/* Generated by the protocol buffer compiler.  DO NOT EDIT! */
/* Generated from: orderer/ab.proto */

#ifndef PROTOBUF_C_orderer_2fab_2eproto__INCLUDED
#define PROTOBUF_C_orderer_2fab_2eproto__INCLUDED

#include <protobuf-c/protobuf-c.h>

PROTOBUF_C__BEGIN_DECLS

#if PROTOBUF_C_VERSION_NUMBER < 1000000
# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
#elif 1002001 < PROTOBUF_C_MIN_COMPILER_VERSION
# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
#endif

#include "common/common.pb-c.h"

typedef struct _Orderer__BroadcastResponse Orderer__BroadcastResponse;
typedef struct _Orderer__SeekNewest Orderer__SeekNewest;
typedef struct _Orderer__SeekOldest Orderer__SeekOldest;
typedef struct _Orderer__SeekSpecified Orderer__SeekSpecified;
typedef struct _Orderer__SeekPosition Orderer__SeekPosition;
typedef struct _Orderer__SeekInfo Orderer__SeekInfo;
typedef struct _Orderer__DeliverResponse Orderer__DeliverResponse;


/* --- enums --- */

typedef enum _Orderer__SeekInfo__SeekBehavior {
  ORDERER__SEEK_INFO__SEEK_BEHAVIOR__BLOCK_UNTIL_READY = 0,
  ORDERER__SEEK_INFO__SEEK_BEHAVIOR__FAIL_IF_NOT_READY = 1
    PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(ORDERER__SEEK_INFO__SEEK_BEHAVIOR)
} Orderer__SeekInfo__SeekBehavior;

/* --- messages --- */

struct  _Orderer__BroadcastResponse
{
  ProtobufCMessage base;
  /*
   * Status code, which may be used to programatically respond to success/failure
   */
  protobuf_c_boolean has_status;
  Common__Status status;
  /*
   * Info string which may contain additional information about the status returned
   */
  char *info;
};
#define ORDERER__BROADCAST_RESPONSE__INIT \
 { PROTOBUF_C_MESSAGE_INIT (&orderer__broadcast_response__descriptor) \
    , 0,0, NULL }


struct  _Orderer__SeekNewest
{
  ProtobufCMessage base;
};
#define ORDERER__SEEK_NEWEST__INIT \
 { PROTOBUF_C_MESSAGE_INIT (&orderer__seek_newest__descriptor) \
     }


struct  _Orderer__SeekOldest
{
  ProtobufCMessage base;
};
#define ORDERER__SEEK_OLDEST__INIT \
 { PROTOBUF_C_MESSAGE_INIT (&orderer__seek_oldest__descriptor) \
     }


struct  _Orderer__SeekSpecified
{
  ProtobufCMessage base;
  protobuf_c_boolean has_number;
  uint64_t number;
};
#define ORDERER__SEEK_SPECIFIED__INIT \
 { PROTOBUF_C_MESSAGE_INIT (&orderer__seek_specified__descriptor) \
    , 0,0 }


typedef enum {
  ORDERER__SEEK_POSITION__TYPE__NOT_SET = 0,
  ORDERER__SEEK_POSITION__TYPE_NEWEST = 1,
  ORDERER__SEEK_POSITION__TYPE_OLDEST = 2,
  ORDERER__SEEK_POSITION__TYPE_SPECIFIED = 3,
} Orderer__SeekPosition__TypeCase;

struct  _Orderer__SeekPosition
{
  ProtobufCMessage base;
  Orderer__SeekPosition__TypeCase type_case;
  union {
    Orderer__SeekNewest *newest;
    Orderer__SeekOldest *oldest;
    Orderer__SeekSpecified *specified;
  };
};
#define ORDERER__SEEK_POSITION__INIT \
 { PROTOBUF_C_MESSAGE_INIT (&orderer__seek_position__descriptor) \
    , ORDERER__SEEK_POSITION__TYPE__NOT_SET, {0} }


/*
 * SeekInfo specifies the range of requested blocks to return
 * If the start position is not found, an error is immediately returned
 * Otherwise, blocks are returned until a missing block is encountered, then behavior is dictated
 * by the SeekBehavior specified.  If BLOCK_UNTIL_READY is specified, the reply will block until
 * the requested blocks are available, if FAIL_IF_NOT_READY is specified, the reply will return an
 * error indicating that the block is not found.  To request that all blocks be returned indefinitely
 * as they are created, behavior should be set to BLOCK_UNTIL_READY and the stop should be set to
 * specified with a number of MAX_UINT64
 */
struct  _Orderer__SeekInfo
{
  ProtobufCMessage base;
  /*
   * The position to start the deliver from
   */
  Orderer__SeekPosition *start;
  /*
   * The position to stop the deliver
   */
  Orderer__SeekPosition *stop;
  /*
   * The behavior when a missing block is encountered
   */
  protobuf_c_boolean has_behavior;
  Orderer__SeekInfo__SeekBehavior behavior;
};
#define ORDERER__SEEK_INFO__INIT \
 { PROTOBUF_C_MESSAGE_INIT (&orderer__seek_info__descriptor) \
    , NULL, NULL, 0,0 }


typedef enum {
  ORDERER__DELIVER_RESPONSE__TYPE__NOT_SET = 0,
  ORDERER__DELIVER_RESPONSE__TYPE_STATUS = 1,
  ORDERER__DELIVER_RESPONSE__TYPE_BLOCK = 2,
} Orderer__DeliverResponse__TypeCase;

struct  _Orderer__DeliverResponse
{
  ProtobufCMessage base;
  Orderer__DeliverResponse__TypeCase type_case;
  union {
    Common__Status status;
    Common__Block *block;
  };
};
#define ORDERER__DELIVER_RESPONSE__INIT \
 { PROTOBUF_C_MESSAGE_INIT (&orderer__deliver_response__descriptor) \
    , ORDERER__DELIVER_RESPONSE__TYPE__NOT_SET, {0} }


/* Orderer__BroadcastResponse methods */
void   orderer__broadcast_response__init
                     (Orderer__BroadcastResponse         *message);
size_t orderer__broadcast_response__get_packed_size
                     (const Orderer__BroadcastResponse   *message);
size_t orderer__broadcast_response__pack
                     (const Orderer__BroadcastResponse   *message,
                      uint8_t             *out);
size_t orderer__broadcast_response__pack_to_buffer
                     (const Orderer__BroadcastResponse   *message,
                      ProtobufCBuffer     *buffer);
Orderer__BroadcastResponse *
       orderer__broadcast_response__unpack
                     (ProtobufCAllocator  *allocator,
                      size_t               len,
                      const uint8_t       *data);
void   orderer__broadcast_response__free_unpacked
                     (Orderer__BroadcastResponse *message,
                      ProtobufCAllocator *allocator);
/* Orderer__SeekNewest methods */
void   orderer__seek_newest__init
                     (Orderer__SeekNewest         *message);
size_t orderer__seek_newest__get_packed_size
                     (const Orderer__SeekNewest   *message);
size_t orderer__seek_newest__pack
                     (const Orderer__SeekNewest   *message,
                      uint8_t             *out);
size_t orderer__seek_newest__pack_to_buffer
                     (const Orderer__SeekNewest   *message,
                      ProtobufCBuffer     *buffer);
Orderer__SeekNewest *
       orderer__seek_newest__unpack
                     (ProtobufCAllocator  *allocator,
                      size_t               len,
                      const uint8_t       *data);
void   orderer__seek_newest__free_unpacked
                     (Orderer__SeekNewest *message,
                      ProtobufCAllocator *allocator);
/* Orderer__SeekOldest methods */
void   orderer__seek_oldest__init
                     (Orderer__SeekOldest         *message);
size_t orderer__seek_oldest__get_packed_size
                     (const Orderer__SeekOldest   *message);
size_t orderer__seek_oldest__pack
                     (const Orderer__SeekOldest   *message,
                      uint8_t             *out);
size_t orderer__seek_oldest__pack_to_buffer
                     (const Orderer__SeekOldest   *message,
                      ProtobufCBuffer     *buffer);
Orderer__SeekOldest *
       orderer__seek_oldest__unpack
                     (ProtobufCAllocator  *allocator,
                      size_t               len,
                      const uint8_t       *data);
void   orderer__seek_oldest__free_unpacked
                     (Orderer__SeekOldest *message,
                      ProtobufCAllocator *allocator);
/* Orderer__SeekSpecified methods */
void   orderer__seek_specified__init
                     (Orderer__SeekSpecified         *message);
size_t orderer__seek_specified__get_packed_size
                     (const Orderer__SeekSpecified   *message);
size_t orderer__seek_specified__pack
                     (const Orderer__SeekSpecified   *message,
                      uint8_t             *out);
size_t orderer__seek_specified__pack_to_buffer
                     (const Orderer__SeekSpecified   *message,
                      ProtobufCBuffer     *buffer);
Orderer__SeekSpecified *
       orderer__seek_specified__unpack
                     (ProtobufCAllocator  *allocator,
                      size_t               len,
                      const uint8_t       *data);
void   orderer__seek_specified__free_unpacked
                     (Orderer__SeekSpecified *message,
                      ProtobufCAllocator *allocator);
/* Orderer__SeekPosition methods */
void   orderer__seek_position__init
                     (Orderer__SeekPosition         *message);
size_t orderer__seek_position__get_packed_size
                     (const Orderer__SeekPosition   *message);
size_t orderer__seek_position__pack
                     (const Orderer__SeekPosition   *message,
                      uint8_t             *out);
size_t orderer__seek_position__pack_to_buffer
                     (const Orderer__SeekPosition   *message,
                      ProtobufCBuffer     *buffer);
Orderer__SeekPosition *
       orderer__seek_position__unpack
                     (ProtobufCAllocator  *allocator,
                      size_t               len,
                      const uint8_t       *data);
void   orderer__seek_position__free_unpacked
                     (Orderer__SeekPosition *message,
                      ProtobufCAllocator *allocator);
/* Orderer__SeekInfo methods */
void   orderer__seek_info__init
                     (Orderer__SeekInfo         *message);
size_t orderer__seek_info__get_packed_size
                     (const Orderer__SeekInfo   *message);
size_t orderer__seek_info__pack
                     (const Orderer__SeekInfo   *message,
                      uint8_t             *out);
size_t orderer__seek_info__pack_to_buffer
                     (const Orderer__SeekInfo   *message,
                      ProtobufCBuffer     *buffer);
Orderer__SeekInfo *
       orderer__seek_info__unpack
                     (ProtobufCAllocator  *allocator,
                      size_t               len,
                      const uint8_t       *data);
void   orderer__seek_info__free_unpacked
                     (Orderer__SeekInfo *message,
                      ProtobufCAllocator *allocator);
/* Orderer__DeliverResponse methods */
void   orderer__deliver_response__init
                     (Orderer__DeliverResponse         *message);
size_t orderer__deliver_response__get_packed_size
                     (const Orderer__DeliverResponse   *message);
size_t orderer__deliver_response__pack
                     (const Orderer__DeliverResponse   *message,
                      uint8_t             *out);
size_t orderer__deliver_response__pack_to_buffer
                     (const Orderer__DeliverResponse   *message,
                      ProtobufCBuffer     *buffer);
Orderer__DeliverResponse *
       orderer__deliver_response__unpack
                     (ProtobufCAllocator  *allocator,
                      size_t               len,
                      const uint8_t       *data);
void   orderer__deliver_response__free_unpacked
                     (Orderer__DeliverResponse *message,
                      ProtobufCAllocator *allocator);
/* --- per-message closures --- */

typedef void (*Orderer__BroadcastResponse_Closure)
                 (const Orderer__BroadcastResponse *message,
                  void *closure_data);
typedef void (*Orderer__SeekNewest_Closure)
                 (const Orderer__SeekNewest *message,
                  void *closure_data);
typedef void (*Orderer__SeekOldest_Closure)
                 (const Orderer__SeekOldest *message,
                  void *closure_data);
typedef void (*Orderer__SeekSpecified_Closure)
                 (const Orderer__SeekSpecified *message,
                  void *closure_data);
typedef void (*Orderer__SeekPosition_Closure)
                 (const Orderer__SeekPosition *message,
                  void *closure_data);
typedef void (*Orderer__SeekInfo_Closure)
                 (const Orderer__SeekInfo *message,
                  void *closure_data);
typedef void (*Orderer__DeliverResponse_Closure)
                 (const Orderer__DeliverResponse *message,
                  void *closure_data);

/* --- services --- */

typedef struct _Orderer__AtomicBroadcast_Service Orderer__AtomicBroadcast_Service;
struct _Orderer__AtomicBroadcast_Service
{
  ProtobufCService base;
  void (*broadcast)(Orderer__AtomicBroadcast_Service *service,
                    const Common__Envelope *input,
                    Orderer__BroadcastResponse_Closure closure,
                    void *closure_data);
  void (*deliver)(Orderer__AtomicBroadcast_Service *service,
                  const Common__Envelope *input,
                  Orderer__DeliverResponse_Closure closure,
                  void *closure_data);
};
typedef void (*Orderer__AtomicBroadcast_ServiceDestroy)(Orderer__AtomicBroadcast_Service *);
void orderer__atomic_broadcast__init (Orderer__AtomicBroadcast_Service *service,
                                      Orderer__AtomicBroadcast_ServiceDestroy destroy);
#define ORDERER__ATOMIC_BROADCAST__BASE_INIT \
    { &orderer__atomic_broadcast__descriptor, protobuf_c_service_invoke_internal, NULL }
#define ORDERER__ATOMIC_BROADCAST__INIT(function_prefix__) \
    { ORDERER__ATOMIC_BROADCAST__BASE_INIT,\
      function_prefix__ ## broadcast,\
      function_prefix__ ## deliver  }
void orderer__atomic_broadcast__broadcast(ProtobufCService *service,
                                          const Common__Envelope *input,
                                          Orderer__BroadcastResponse_Closure closure,
                                          void *closure_data);
void orderer__atomic_broadcast__deliver(ProtobufCService *service,
                                        const Common__Envelope *input,
                                        Orderer__DeliverResponse_Closure closure,
                                        void *closure_data);

/* --- descriptors --- */

extern const ProtobufCMessageDescriptor orderer__broadcast_response__descriptor;
extern const ProtobufCMessageDescriptor orderer__seek_newest__descriptor;
extern const ProtobufCMessageDescriptor orderer__seek_oldest__descriptor;
extern const ProtobufCMessageDescriptor orderer__seek_specified__descriptor;
extern const ProtobufCMessageDescriptor orderer__seek_position__descriptor;
extern const ProtobufCMessageDescriptor orderer__seek_info__descriptor;
extern const ProtobufCEnumDescriptor    orderer__seek_info__seek_behavior__descriptor;
extern const ProtobufCMessageDescriptor orderer__deliver_response__descriptor;
extern const ProtobufCServiceDescriptor orderer__atomic_broadcast__descriptor;

PROTOBUF_C__END_DECLS


#endif  /* PROTOBUF_C_orderer_2fab_2eproto__INCLUDED */
