// Code generated by protoc-gen-go-grpc. DO NOT EDIT.

package api

import (
	context "context"
	api "github.com/bio-routing/bio-rd/route/api"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

// BgpServiceClient is the client API for BgpService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type BgpServiceClient interface {
	ListSessions(ctx context.Context, in *ListSessionsRequest, opts ...grpc.CallOption) (*ListSessionsResponse, error)
	DumpRIBIn(ctx context.Context, in *DumpRIBRequest, opts ...grpc.CallOption) (BgpService_DumpRIBInClient, error)
	DumpRIBOut(ctx context.Context, in *DumpRIBRequest, opts ...grpc.CallOption) (BgpService_DumpRIBOutClient, error)
}

type bgpServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewBgpServiceClient(cc grpc.ClientConnInterface) BgpServiceClient {
	return &bgpServiceClient{cc}
}

func (c *bgpServiceClient) ListSessions(ctx context.Context, in *ListSessionsRequest, opts ...grpc.CallOption) (*ListSessionsResponse, error) {
	out := new(ListSessionsResponse)
	err := c.cc.Invoke(ctx, "/bio.bgp.BgpService/ListSessions", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *bgpServiceClient) DumpRIBIn(ctx context.Context, in *DumpRIBRequest, opts ...grpc.CallOption) (BgpService_DumpRIBInClient, error) {
	stream, err := c.cc.NewStream(ctx, &BgpService_ServiceDesc.Streams[0], "/bio.bgp.BgpService/DumpRIBIn", opts...)
	if err != nil {
		return nil, err
	}
	x := &bgpServiceDumpRIBInClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type BgpService_DumpRIBInClient interface {
	Recv() (*api.Route, error)
	grpc.ClientStream
}

type bgpServiceDumpRIBInClient struct {
	grpc.ClientStream
}

func (x *bgpServiceDumpRIBInClient) Recv() (*api.Route, error) {
	m := new(api.Route)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *bgpServiceClient) DumpRIBOut(ctx context.Context, in *DumpRIBRequest, opts ...grpc.CallOption) (BgpService_DumpRIBOutClient, error) {
	stream, err := c.cc.NewStream(ctx, &BgpService_ServiceDesc.Streams[1], "/bio.bgp.BgpService/DumpRIBOut", opts...)
	if err != nil {
		return nil, err
	}
	x := &bgpServiceDumpRIBOutClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type BgpService_DumpRIBOutClient interface {
	Recv() (*api.Route, error)
	grpc.ClientStream
}

type bgpServiceDumpRIBOutClient struct {
	grpc.ClientStream
}

func (x *bgpServiceDumpRIBOutClient) Recv() (*api.Route, error) {
	m := new(api.Route)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// BgpServiceServer is the server API for BgpService service.
// All implementations must embed UnimplementedBgpServiceServer
// for forward compatibility
type BgpServiceServer interface {
	ListSessions(context.Context, *ListSessionsRequest) (*ListSessionsResponse, error)
	DumpRIBIn(*DumpRIBRequest, BgpService_DumpRIBInServer) error
	DumpRIBOut(*DumpRIBRequest, BgpService_DumpRIBOutServer) error
	mustEmbedUnimplementedBgpServiceServer()
}

// UnimplementedBgpServiceServer must be embedded to have forward compatible implementations.
type UnimplementedBgpServiceServer struct {
}

func (UnimplementedBgpServiceServer) ListSessions(context.Context, *ListSessionsRequest) (*ListSessionsResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ListSessions not implemented")
}
func (UnimplementedBgpServiceServer) DumpRIBIn(*DumpRIBRequest, BgpService_DumpRIBInServer) error {
	return status.Errorf(codes.Unimplemented, "method DumpRIBIn not implemented")
}
func (UnimplementedBgpServiceServer) DumpRIBOut(*DumpRIBRequest, BgpService_DumpRIBOutServer) error {
	return status.Errorf(codes.Unimplemented, "method DumpRIBOut not implemented")
}
func (UnimplementedBgpServiceServer) mustEmbedUnimplementedBgpServiceServer() {}

// UnsafeBgpServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to BgpServiceServer will
// result in compilation errors.
type UnsafeBgpServiceServer interface {
	mustEmbedUnimplementedBgpServiceServer()
}

func RegisterBgpServiceServer(s grpc.ServiceRegistrar, srv BgpServiceServer) {
	s.RegisterService(&BgpService_ServiceDesc, srv)
}

func _BgpService_ListSessions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ListSessionsRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(BgpServiceServer).ListSessions(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/bio.bgp.BgpService/ListSessions",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(BgpServiceServer).ListSessions(ctx, req.(*ListSessionsRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _BgpService_DumpRIBIn_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(DumpRIBRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(BgpServiceServer).DumpRIBIn(m, &bgpServiceDumpRIBInServer{stream})
}

type BgpService_DumpRIBInServer interface {
	Send(*api.Route) error
	grpc.ServerStream
}

type bgpServiceDumpRIBInServer struct {
	grpc.ServerStream
}

func (x *bgpServiceDumpRIBInServer) Send(m *api.Route) error {
	return x.ServerStream.SendMsg(m)
}

func _BgpService_DumpRIBOut_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(DumpRIBRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(BgpServiceServer).DumpRIBOut(m, &bgpServiceDumpRIBOutServer{stream})
}

type BgpService_DumpRIBOutServer interface {
	Send(*api.Route) error
	grpc.ServerStream
}

type bgpServiceDumpRIBOutServer struct {
	grpc.ServerStream
}

func (x *bgpServiceDumpRIBOutServer) Send(m *api.Route) error {
	return x.ServerStream.SendMsg(m)
}

// BgpService_ServiceDesc is the grpc.ServiceDesc for BgpService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var BgpService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "bio.bgp.BgpService",
	HandlerType: (*BgpServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ListSessions",
			Handler:    _BgpService_ListSessions_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "DumpRIBIn",
			Handler:       _BgpService_DumpRIBIn_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "DumpRIBOut",
			Handler:       _BgpService_DumpRIBOut_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "protocols/bgp/api/bgp.proto",
}
