GRPC C++  1.62.0
Data Structures | Macros | Typedefs | Enumerations
grpc_types.h File Reference
#include <grpc/support/port_platform.h>
#include <stddef.h>
#include <grpc/impl/channel_arg_names.h>
#include <grpc/impl/compression_types.h>
#include <grpc/slice.h>
#include <grpc/status.h>
#include <grpc/support/time.h>

Go to the source code of this file.

Data Structures

struct  grpc_byte_buffer
 
union  grpc_byte_buffer::grpc_byte_buffer_data
 
struct  grpc_byte_buffer::grpc_byte_buffer_data::grpc_compressed_buffer
 
struct  grpc_arg_pointer_vtable
 
struct  grpc_arg
 A single argument... More...
 
union  grpc_arg::grpc_arg_value
 
struct  grpc_arg::grpc_arg_value::grpc_arg_pointer
 
struct  grpc_channel_args
 An array of arguments that can be passed around. More...
 
struct  grpc_metadata
 A single metadata element. More...
 
struct  grpc_event
 The result of an operation. More...
 
struct  grpc_metadata_array
 
struct  grpc_call_details
 
struct  grpc_op
 Operation data: one field for each op type (except SEND_CLOSE_FROM_CLIENT which has no arguments) More...
 
union  grpc_op::grpc_op_data
 
struct  grpc_op::grpc_op_data::grpc_op_send_initial_metadata
 
struct  grpc_op::grpc_op_data::grpc_op_send_initial_metadata::grpc_op_send_initial_metadata_maybe_compression_level
 If is_set, compression_level will be used for the call. More...
 
struct  grpc_op::grpc_op_data::grpc_op_send_message
 
struct  grpc_op::grpc_op_data::grpc_op_send_status_from_server
 
struct  grpc_op::grpc_op_data::grpc_op_recv_initial_metadata
 ownership of the array is with the caller, but ownership of the elements stays with the call object (ie key, value members are owned by the call object, recv_initial_metadata->array is owned by the caller). More...
 
struct  grpc_op::grpc_op_data::grpc_op_recv_message
 ownership of the byte buffer is moved to the caller; the caller must call grpc_byte_buffer_destroy on this value, or reuse it in a future op. More...
 
struct  grpc_op::grpc_op_data::grpc_op_recv_status_on_client
 
struct  grpc_op::grpc_op_data::grpc_op_recv_close_on_server
 
struct  grpc_channel_info
 Information requested from the channel. More...
 
struct  grpc_completion_queue_functor
 Specifies an interface class to be used as a tag for callback-based completion queues. More...
 
struct  grpc_completion_queue_attributes
 

Macros

#define GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH   (-1)
 Default send/receive message size limits in bytes. More...
 
#define GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH   (4 * 1024 * 1024)
 
#define GRPC_WRITE_BUFFER_HINT   (0x00000001u)
 Write Flags: More...
 
#define GRPC_WRITE_NO_COMPRESS   (0x00000002u)
 Force compression to be disabled for a particular write (start_write/add_metadata). More...
 
#define GRPC_WRITE_THROUGH   (0x00000004u)
 Force this message to be written to the socket before completing it. More...
 
#define GRPC_WRITE_USED_MASK   (GRPC_WRITE_BUFFER_HINT | GRPC_WRITE_NO_COMPRESS | GRPC_WRITE_THROUGH)
 Mask of all valid flags. More...
 
#define GRPC_INITIAL_METADATA_WAIT_FOR_READY   (0x00000020u)
 Initial metadata flags. More...
 
#define GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET   (0x00000080u)
 Signal that GRPC_INITIAL_METADATA_WAIT_FOR_READY was explicitly set by the calling application. More...
 
#define GRPC_INITIAL_METADATA_USED_MASK
 Mask of all valid flags. More...
 
#define GRPC_CQ_CURRENT_VERSION   2
 
#define GRPC_CQ_VERSION_MINIMUM_FOR_CALLBACKABLE   2
 

Typedefs

typedef struct grpc_byte_buffer grpc_byte_buffer
 
typedef struct grpc_completion_queue grpc_completion_queue
 Completion Queues enable notification of the completion of asynchronous actions. More...
 
typedef struct grpc_channel grpc_channel
 The Channel interface allows creation of Call objects. More...
 
typedef struct grpc_server grpc_server
 A server listens to some port and responds to request calls. More...
 
typedef struct grpc_call grpc_call
 A Call represents an RPC. More...
 
typedef struct grpc_socket_mutator grpc_socket_mutator
 The Socket Mutator interface allows changes on socket options. More...
 
typedef struct grpc_socket_factory grpc_socket_factory
 The Socket Factory interface creates and binds sockets. More...
 
typedef struct grpc_arg_pointer_vtable grpc_arg_pointer_vtable
 
typedef enum grpc_call_error grpc_call_error
 Result of a grpc call. More...
 
typedef struct grpc_metadata grpc_metadata
 A single metadata element. More...
 
typedef enum grpc_completion_type grpc_completion_type
 The type of completion (for grpc_event) More...
 
typedef struct grpc_event grpc_event
 The result of an operation. More...
 
typedef struct grpc_op grpc_op
 Operation data: one field for each op type (except SEND_CLOSE_FROM_CLIENT which has no arguments) More...
 
typedef struct grpc_resource_quota grpc_resource_quota
 
typedef struct grpc_completion_queue_functor grpc_completion_queue_functor
 Specifies an interface class to be used as a tag for callback-based completion queues. More...
 
typedef struct grpc_completion_queue_attributes grpc_completion_queue_attributes
 
typedef struct grpc_completion_queue_factory grpc_completion_queue_factory
 The completion queue factory structure is opaque to the callers of grpc. More...
 

Enumerations

enum  grpc_byte_buffer_type { GRPC_BB_RAW }
 
enum  grpc_arg_type { GRPC_ARG_STRING, GRPC_ARG_INTEGER, GRPC_ARG_POINTER }
 Type specifier for grpc_arg. More...
 
enum  grpc_call_error {
  GRPC_CALL_OK = 0, GRPC_CALL_ERROR, GRPC_CALL_ERROR_NOT_ON_SERVER, GRPC_CALL_ERROR_NOT_ON_CLIENT,
  GRPC_CALL_ERROR_ALREADY_ACCEPTED, GRPC_CALL_ERROR_ALREADY_INVOKED, GRPC_CALL_ERROR_NOT_INVOKED, GRPC_CALL_ERROR_ALREADY_FINISHED,
  GRPC_CALL_ERROR_TOO_MANY_OPERATIONS, GRPC_CALL_ERROR_INVALID_FLAGS, GRPC_CALL_ERROR_INVALID_METADATA, GRPC_CALL_ERROR_INVALID_MESSAGE,
  GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE, GRPC_CALL_ERROR_BATCH_TOO_BIG, GRPC_CALL_ERROR_PAYLOAD_TYPE_MISMATCH, GRPC_CALL_ERROR_COMPLETION_QUEUE_SHUTDOWN
}
 Result of a grpc call. More...
 
enum  grpc_completion_type { GRPC_QUEUE_SHUTDOWN, GRPC_QUEUE_TIMEOUT, GRPC_OP_COMPLETE }
 The type of completion (for grpc_event) More...
 
enum  grpc_op_type {
  GRPC_OP_SEND_INITIAL_METADATA = 0, GRPC_OP_SEND_MESSAGE, GRPC_OP_SEND_CLOSE_FROM_CLIENT, GRPC_OP_SEND_STATUS_FROM_SERVER,
  GRPC_OP_RECV_INITIAL_METADATA, GRPC_OP_RECV_MESSAGE, GRPC_OP_RECV_STATUS_ON_CLIENT, GRPC_OP_RECV_CLOSE_ON_SERVER
}
 
enum  grpc_cq_polling_type { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING }
 Completion queues internally MAY maintain a set of file descriptors in a structure called 'pollset'. More...
 
enum  grpc_cq_completion_type { GRPC_CQ_NEXT, GRPC_CQ_PLUCK, GRPC_CQ_CALLBACK }
 Specifies the type of APIs to use to pop events from the completion queue. More...
 

Macro Definition Documentation

◆ GRPC_CQ_CURRENT_VERSION

#define GRPC_CQ_CURRENT_VERSION   2

◆ GRPC_CQ_VERSION_MINIMUM_FOR_CALLBACKABLE

#define GRPC_CQ_VERSION_MINIMUM_FOR_CALLBACKABLE   2

◆ GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH

#define GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH   (4 * 1024 * 1024)

◆ GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH

#define GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH   (-1)

Default send/receive message size limits in bytes.

-1 for unlimited. TODO(roth) Make this match the default receive limit after next release

◆ GRPC_INITIAL_METADATA_USED_MASK

#define GRPC_INITIAL_METADATA_USED_MASK
Value:
GRPC_INITIAL_METADATA_WAIT_FOR_READY | GRPC_WRITE_THROUGH)

Mask of all valid flags.

◆ GRPC_INITIAL_METADATA_WAIT_FOR_READY

#define GRPC_INITIAL_METADATA_WAIT_FOR_READY   (0x00000020u)

Initial metadata flags.

These flags are to be passed to the grpc_op::flags field Signal that the call should not return UNAVAILABLE before it has started

◆ GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET

#define GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET   (0x00000080u)

Signal that GRPC_INITIAL_METADATA_WAIT_FOR_READY was explicitly set by the calling application.

◆ GRPC_WRITE_BUFFER_HINT

#define GRPC_WRITE_BUFFER_HINT   (0x00000001u)

Write Flags:

Hint that the write may be buffered and need not go out on the wire immediately. GRPC is free to buffer the message until the next non-buffered write, or until writes_done, but it need not buffer completely or at all.

◆ GRPC_WRITE_NO_COMPRESS

#define GRPC_WRITE_NO_COMPRESS   (0x00000002u)

Force compression to be disabled for a particular write (start_write/add_metadata).

Illegal on invoke/accept.

◆ GRPC_WRITE_THROUGH

#define GRPC_WRITE_THROUGH   (0x00000004u)

Force this message to be written to the socket before completing it.

◆ GRPC_WRITE_USED_MASK

#define GRPC_WRITE_USED_MASK   (GRPC_WRITE_BUFFER_HINT | GRPC_WRITE_NO_COMPRESS | GRPC_WRITE_THROUGH)

Mask of all valid flags.

Typedef Documentation

◆ grpc_arg_pointer_vtable

◆ grpc_byte_buffer

◆ grpc_call

typedef struct grpc_call grpc_call

A Call represents an RPC.

When created, it is in a configuration state allowing properties to be set until it is invoked. After invoke, the Call can have messages written to it and read from it.

◆ grpc_call_error

Result of a grpc call.

If the caller satisfies the prerequisites of a particular operation, the grpc_call_error returned will be GRPC_CALL_OK. Receiving any other value listed here is an indication of a bug in the caller.

◆ grpc_channel

typedef struct grpc_channel grpc_channel

The Channel interface allows creation of Call objects.

◆ grpc_completion_queue

Completion Queues enable notification of the completion of asynchronous actions.

◆ grpc_completion_queue_attributes

◆ grpc_completion_queue_factory

The completion queue factory structure is opaque to the callers of grpc.

◆ grpc_completion_queue_functor

Specifies an interface class to be used as a tag for callback-based completion queues.

This can be used directly, as the first element of a struct in C, or as a base class in C++. Its "run" value should be assigned to some non-member function, such as a static method.

◆ grpc_completion_type

The type of completion (for grpc_event)

◆ grpc_event

typedef struct grpc_event grpc_event

The result of an operation.

Returned by a completion queue when the operation started with tag.

◆ grpc_metadata

typedef struct grpc_metadata grpc_metadata

A single metadata element.

◆ grpc_op

typedef struct grpc_op grpc_op

Operation data: one field for each op type (except SEND_CLOSE_FROM_CLIENT which has no arguments)

◆ grpc_resource_quota

◆ grpc_server

typedef struct grpc_server grpc_server

A server listens to some port and responds to request calls.

◆ grpc_socket_factory

The Socket Factory interface creates and binds sockets.

◆ grpc_socket_mutator

The Socket Mutator interface allows changes on socket options.

Enumeration Type Documentation

◆ grpc_arg_type

Type specifier for grpc_arg.

Enumerator
GRPC_ARG_STRING 
GRPC_ARG_INTEGER 
GRPC_ARG_POINTER 

◆ grpc_byte_buffer_type

Enumerator
GRPC_BB_RAW 

Future types may include GRPC_BB_PROTOBUF, etc.

◆ grpc_call_error

Result of a grpc call.

If the caller satisfies the prerequisites of a particular operation, the grpc_call_error returned will be GRPC_CALL_OK. Receiving any other value listed here is an indication of a bug in the caller.

Enumerator
GRPC_CALL_OK 

everything went ok

GRPC_CALL_ERROR 

something failed, we don't know what

GRPC_CALL_ERROR_NOT_ON_SERVER 

this method is not available on the server

GRPC_CALL_ERROR_NOT_ON_CLIENT 

this method is not available on the client

GRPC_CALL_ERROR_ALREADY_ACCEPTED 

this method must be called before server_accept

GRPC_CALL_ERROR_ALREADY_INVOKED 

this method must be called before invoke

GRPC_CALL_ERROR_NOT_INVOKED 

this method must be called after invoke

GRPC_CALL_ERROR_ALREADY_FINISHED 

this call is already finished (writes_done or write_status has already been called)

GRPC_CALL_ERROR_TOO_MANY_OPERATIONS 

there is already an outstanding read/write operation on the call

GRPC_CALL_ERROR_INVALID_FLAGS 

the flags value was illegal for this call

GRPC_CALL_ERROR_INVALID_METADATA 

invalid metadata was passed to this call

GRPC_CALL_ERROR_INVALID_MESSAGE 

invalid message was passed to this call

GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE 

completion queue for notification has not been registered with the server

GRPC_CALL_ERROR_BATCH_TOO_BIG 

this batch of operations leads to more operations than allowed

GRPC_CALL_ERROR_PAYLOAD_TYPE_MISMATCH 

payload type requested is not the type registered

GRPC_CALL_ERROR_COMPLETION_QUEUE_SHUTDOWN 

completion queue has been shutdown

◆ grpc_completion_type

The type of completion (for grpc_event)

Enumerator
GRPC_QUEUE_SHUTDOWN 

Shutting down.

GRPC_QUEUE_TIMEOUT 

No event before timeout.

GRPC_OP_COMPLETE 

Operation completion.

◆ grpc_cq_completion_type

Specifies the type of APIs to use to pop events from the completion queue.

Enumerator
GRPC_CQ_NEXT 

Events are popped out by calling grpc_completion_queue_next() API ONLY.

GRPC_CQ_PLUCK 

Events are popped out by calling grpc_completion_queue_pluck() API ONLY.

GRPC_CQ_CALLBACK 

Events trigger a callback specified as the tag.

◆ grpc_cq_polling_type

Completion queues internally MAY maintain a set of file descriptors in a structure called 'pollset'.

This enum specifies if a completion queue has an associated pollset and any restrictions on the type of file descriptors that can be present in the pollset.

I/O progress can only be made when grpc_completion_queue_next() or grpc_completion_queue_pluck() are called on the completion queue (unless the grpc_cq_polling_type is GRPC_CQ_NON_POLLING) and hence it is very important to actively call these APIs

Enumerator
GRPC_CQ_DEFAULT_POLLING 

The completion queue will have an associated pollset and there is no restriction on the type of file descriptors the pollset may contain.

GRPC_CQ_NON_LISTENING 

Similar to GRPC_CQ_DEFAULT_POLLING except that the completion queues will not contain any 'listening file descriptors' (i.e file descriptors used to listen to incoming channels)

GRPC_CQ_NON_POLLING 

The completion queue will not have an associated pollset.

Note that grpc_completion_queue_next() or grpc_completion_queue_pluck() MUST still be called to pop events from the completion queue; it is not required to call them actively to make I/O progress

◆ grpc_op_type

Enumerator
GRPC_OP_SEND_INITIAL_METADATA 

Send initial metadata: one and only one instance MUST be sent for each call, unless the call was cancelled - in which case this can be skipped.

This op completes after all bytes of metadata have been accepted by outgoing flow control.

GRPC_OP_SEND_MESSAGE 

Send a message: 0 or more of these operations can occur for each call.

This op completes after all bytes for the message have been accepted by outgoing flow control.

GRPC_OP_SEND_CLOSE_FROM_CLIENT 

Send a close from the client: one and only one instance MUST be sent from the client, unless the call was cancelled - in which case this can be skipped.

This op completes after all bytes for the call (including the close) have passed outgoing flow control.

GRPC_OP_SEND_STATUS_FROM_SERVER 

Send status from the server: one and only one instance MUST be sent from the server unless the call was cancelled - in which case this can be skipped.

This op completes after all bytes for the call (including the status) have passed outgoing flow control.

GRPC_OP_RECV_INITIAL_METADATA 

Receive initial metadata: one and only one MUST be made on the client, must not be made on the server.

This op completes after all initial metadata has been read from the peer.

GRPC_OP_RECV_MESSAGE 

Receive a message: 0 or more of these operations can occur for each call.

This op completes after all bytes of the received message have been read, or after a half-close has been received on this call.

GRPC_OP_RECV_STATUS_ON_CLIENT 

Receive status on the client: one and only one must be made on the client.

This operation always succeeds, meaning ops paired with this operation will also appear to succeed, even though they may not have. In that case the status will indicate some failure. This op completes after all activity on the call has completed.

GRPC_OP_RECV_CLOSE_ON_SERVER 

Receive close on the server: one and only one must be made on the server.

This op completes after the close has been received by the server. This operation always succeeds, meaning ops paired with this operation will also appear to succeed, even though they may not have.

GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET
#define GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET
Signal that GRPC_INITIAL_METADATA_WAIT_FOR_READY was explicitly set by the calling application.
Definition: grpc_types.h:203
GRPC_WRITE_THROUGH
#define GRPC_WRITE_THROUGH
Force this message to be written to the socket before completing it.
Definition: grpc_types.h:192