diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc/grpc.h | 18 | ||||
-rw-r--r-- | include/grpc/grpc_security.h | 7 | ||||
-rw-r--r-- | include/grpc/support/port_platform.h | 41 |
3 files changed, 50 insertions, 16 deletions
diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 7b33a4d861..6e5f48d7ef 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -44,7 +44,7 @@ extern "C" { #endif -/* Completion Channels enable notification of the completion of asynchronous +/* Completion Queues enable notification of the completion of asynchronous actions. */ typedef struct grpc_completion_queue grpc_completion_queue; @@ -156,7 +156,8 @@ typedef enum grpc_op_error { struct grpc_byte_buffer; typedef struct grpc_byte_buffer grpc_byte_buffer; -/* Sample helpers to obtain byte buffers (these will certainly move place */ +/* Sample helpers to obtain byte buffers (these will certainly move + someplace else) */ grpc_byte_buffer *grpc_byte_buffer_create(gpr_slice *slices, size_t nslices); grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb); size_t grpc_byte_buffer_length(grpc_byte_buffer *bb); @@ -340,12 +341,12 @@ typedef struct grpc_op { /* Initialize the grpc library */ void grpc_init(void); -/* Shutdown the grpc library */ +/* Shut down the grpc library */ void grpc_shutdown(void); grpc_completion_queue *grpc_completion_queue_create(void); -/* Blocks until an event is available, the completion queue is being shutdown, +/* Blocks until an event is available, the completion queue is being shut down, or deadline is reached. Returns NULL on timeout, otherwise the event that occurred. Callers should call grpc_event_finish once they have processed the event. @@ -365,7 +366,7 @@ grpc_event *grpc_completion_queue_next(grpc_completion_queue *cq, grpc_event *grpc_completion_queue_pluck(grpc_completion_queue *cq, void *tag, gpr_timespec deadline); -/* Cleanup any data owned by the event */ +/* Clean up any data owned by the event */ void grpc_event_finish(grpc_event *event); /* Begin destruction of a completion queue. Once all possible events are @@ -548,16 +549,11 @@ grpc_call_error grpc_server_request_call( grpc_server *grpc_server_create(grpc_completion_queue *cq, const grpc_channel_args *args); -/* Add a http2 over tcp listener. +/* Add a HTTP2 over plaintext over tcp listener. Returns bound port number on success, 0 on failure. REQUIRES: server not started */ int grpc_server_add_http2_port(grpc_server *server, const char *addr); -/* Add a secure port to server. - Returns bound port number on success, 0 on failure. - REQUIRES: server not started */ -int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr); - /* Start a server - tells all listeners to start listening */ void grpc_server_start(grpc_server *server); diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index 731959069f..a43d998d02 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -162,6 +162,13 @@ grpc_server *grpc_secure_server_create(grpc_server_credentials *creds, grpc_completion_queue *cq, const grpc_channel_args *args); +/* Add a HTTP2 over an encrypted link over tcp listener. + Server must have been created with grpc_secure_server_create. + Returns bound port number on success, 0 on failure. + REQUIRES: server not started */ +int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr); + + #ifdef __cplusplus } #endif diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 9d4bfbee5e..5b9b3c47a6 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -37,10 +37,6 @@ /* Override this file with one for your platform if you need to redefine things. */ -/* For a common case, assume that the platform has a C99-like stdint.h */ - -#include <stdint.h> - #if !defined(GPR_NO_AUTODETECT_PLATFORM) #if defined(_WIN64) || defined(WIN64) #define GPR_WIN32 1 @@ -70,15 +66,43 @@ #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 #elif defined(__linux__) +#ifndef _BSD_SOURCE +#define _BSD_SOURCE +#endif +#ifndef _DEFAULT_SOURCE +#define _DEFAULT_SOURCE +#endif +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include <features.h> #define GPR_CPU_LINUX 1 #define GPR_GCC_ATOMIC 1 #define GPR_LINUX 1 #define GPR_LINUX_MULTIPOLL_WITH_EPOLL 1 #define GPR_POSIX_WAKEUP_FD 1 -#define GPR_LINUX_EVENTFD 1 #define GPR_POSIX_SOCKET 1 #define GPR_POSIX_SOCKETADDR 1 +#ifdef __GLIBC_PREREQ +#if __GLIBC_PREREQ(2, 9) +#define GPR_LINUX_EVENTFD 1 +#endif +#if __GLIBC_PREREQ(2, 10) +#define GPR_LINUX_SOCKETUTILS 1 +#endif +#if __GLIBC_PREREQ(2, 17) #define GPR_LINUX_ENV 1 +#endif +#endif +#ifndef GPR_LINUX_EVENTFD +#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 +#endif +#ifndef GPR_LINUX_SOCKETUTILS +#define GPR_POSIX_SOCKETUTILS +#endif +#ifndef GPR_LINUX_ENV +#define GPR_POSIX_ENV 1 +#endif #define GPR_POSIX_FILE 1 #define GPR_POSIX_STRING 1 #define GPR_POSIX_SYNC 1 @@ -90,6 +114,9 @@ #define GPR_ARCH_32 1 #endif /* _LP64 */ #elif defined(__APPLE__) +#ifndef _BSD_SOURCE +#define _BSD_SOURCE +#endif #define GPR_CPU_POSIX 1 #define GPR_GCC_ATOMIC 1 #define GPR_POSIX_LOG 1 @@ -115,6 +142,10 @@ #endif #endif /* GPR_NO_AUTODETECT_PLATFORM */ +/* For a common case, assume that the platform has a C99-like stdint.h */ + +#include <stdint.h> + /* Cache line alignment */ #ifndef GPR_CACHELINE_SIZE #if defined(__i386__) || defined(__x86_64__) |