aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2017-03-27 18:50:04 +0200
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2017-03-27 18:50:04 +0200
commit8e0684b5d4b69670797d9d297a317aacd7236548 (patch)
tree9eaafb090247ce9b08015c90ac1062f4a10acca9 /include
parentb02dd01584e21565ebea173ceee7568404d23f2b (diff)
parentc4478a103b68100b86f506061cedcb0ce70016ba (diff)
Merge branch 'master' of https://github.com/grpc/grpc into cpp_bazelness
Diffstat (limited to 'include')
-rw-r--r--include/grpc/grpc.h65
-rw-r--r--include/grpc/impl/codegen/grpc_types.h5
-rw-r--r--include/grpc/impl/codegen/port_platform.h8
3 files changed, 78 insertions, 0 deletions
diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h
index 1b33d48c02..e088435d6c 100644
--- a/include/grpc/grpc.h
+++ b/include/grpc/grpc.h
@@ -93,6 +93,71 @@ GRPCAPI const char *grpc_version_string(void);
/** Return a string specifying what the 'g' in gRPC stands for */
GRPCAPI const char *grpc_g_stands_for(void);
+/** Specifies the type of APIs to use to pop events from the completion queue */
+typedef enum {
+ /* Events are popped out by calling grpc_completion_queue_next() API ONLY */
+ GRPC_CQ_NEXT = 1,
+
+ /* Events are popped out by calling grpc_completion_queue_pluck() API ONLY */
+ GRPC_CQ_PLUCK
+} grpc_cq_completion_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 */
+typedef enum {
+ /** 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_DEFAULT_POLLING,
+
+ /* 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_LISTENING,
+
+ /* 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_CQ_NON_POLLING
+} grpc_cq_polling_type;
+
+#define GRPC_CQ_CURRENT_VERSION 1
+typedef struct grpc_completion_queue_attributes {
+ /* The version number of this structure. More fields might be added to this
+ structure in future. */
+ int version; /* Set to GRPC_CQ_CURRENT_VERSION */
+
+ grpc_cq_completion_type cq_completion_type;
+
+ grpc_cq_polling_type cq_polling_type;
+} grpc_completion_queue_attributes;
+
+/** The completion queue factory structure is opaque to the callers of grpc */
+typedef struct grpc_completion_queue_factory grpc_completion_queue_factory;
+
+/** Returns the completion queue factory based on the attributes. MAY return a
+ NULL if no factory can be found */
+GRPCAPI const grpc_completion_queue_factory *
+grpc_completion_queue_factory_lookup(
+ const grpc_completion_queue_attributes *attributes);
+
+/** Helper function to create a completion queue with grpc_cq_completion_type
+ of GRPC_CQ_NEXT and grpc_cq_polling_type of GRPC_CQ_DEFAULT_POLLING */
+GRPCAPI grpc_completion_queue *grpc_completion_queue_create_for_next(
+ void *reserved);
+
+/** Helper function to create a completion queue with grpc_cq_completion_type
+ of GRPC_CQ_PLUCK and grpc_cq_polling_type of GRPC_CQ_DEFAULT_POLLING */
+GRPCAPI grpc_completion_queue *grpc_completion_queue_create_for_pluck(
+ void *reserved);
+
/** Create a completion queue */
GRPCAPI grpc_completion_queue *grpc_completion_queue_create(void *reserved);
diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h
index e5c731304c..887c176f1a 100644
--- a/include/grpc/impl/codegen/grpc_types.h
+++ b/include/grpc/impl/codegen/grpc_types.h
@@ -87,6 +87,9 @@ typedef struct grpc_call grpc_call;
/** The Socket Mutator interface allows changes on socket options */
typedef struct grpc_socket_mutator grpc_socket_mutator;
+/** The Socket Factory interface creates and binds sockets */
+typedef struct grpc_socket_factory grpc_socket_factory;
+
/** Type specifier for grpc_arg */
typedef enum {
GRPC_ARG_STRING,
@@ -240,6 +243,8 @@ typedef struct {
#define GRPC_ARG_LB_POLICY_NAME "grpc.lb_policy_name"
/** The grpc_socket_mutator instance that set the socket options. A pointer. */
#define GRPC_ARG_SOCKET_MUTATOR "grpc.socket_mutator"
+/** The grpc_socket_factory instance to create and bind sockets. A pointer. */
+#define GRPC_ARG_SOCKET_FACTORY "grpc.socket_factory"
/** If non-zero, Cronet transport will coalesce packets to fewer frames when
* possible. */
#define GRPC_ARG_USE_CRONET_PACKET_COALESCING \
diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h
index e565cd31d7..086394648f 100644
--- a/include/grpc/impl/codegen/port_platform.h
+++ b/include/grpc/impl/codegen/port_platform.h
@@ -364,6 +364,14 @@ typedef unsigned __int64 uint64_t;
power of two */
#define GPR_MAX_ALIGNMENT 16
+#ifndef GRPC_ARES
+#ifdef GPR_WINDOWS
+#define GRPC_ARES 0
+#else
+#define GRPC_ARES 1
+#endif
+#endif
+
#ifndef GRPC_MUST_USE_RESULT
#if defined(__GNUC__) && !defined(__MINGW32__)
#define GRPC_MUST_USE_RESULT __attribute__((warn_unused_result))