Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1 | /* |
| 2 | * |
Craig Tiller | 0605995 | 2015-02-18 08:34:56 -0800 | [diff] [blame^] | 3 | * Copyright 2015, Google Inc. |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 4 | * All rights reserved. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions are |
| 8 | * met: |
| 9 | * |
| 10 | * * Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * * Redistributions in binary form must reproduce the above |
| 13 | * copyright notice, this list of conditions and the following disclaimer |
| 14 | * in the documentation and/or other materials provided with the |
| 15 | * distribution. |
| 16 | * * Neither the name of Google Inc. nor the names of its |
| 17 | * contributors may be used to endorse or promote products derived from |
| 18 | * this software without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | * |
| 32 | */ |
| 33 | |
| 34 | #ifndef __GRPC_GRPC_H__ |
| 35 | #define __GRPC_GRPC_H__ |
| 36 | |
| 37 | #include <grpc/status.h> |
| 38 | |
| 39 | #include <stddef.h> |
| 40 | #include <grpc/support/slice.h> |
| 41 | #include <grpc/support/time.h> |
| 42 | |
| 43 | #ifdef __cplusplus |
| 44 | extern "C" { |
| 45 | #endif |
| 46 | |
Nathaniel Manista | 6d41a05 | 2015-02-16 02:12:48 +0000 | [diff] [blame] | 47 | /* Completion Queues enable notification of the completion of asynchronous |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 48 | actions. */ |
| 49 | typedef struct grpc_completion_queue grpc_completion_queue; |
| 50 | |
| 51 | /* The Channel interface allows creation of Call objects. */ |
| 52 | typedef struct grpc_channel grpc_channel; |
| 53 | |
| 54 | /* A server listens to some port and responds to request calls */ |
| 55 | typedef struct grpc_server grpc_server; |
| 56 | |
| 57 | /* A Call represents an RPC. When created, it is in a configuration state |
| 58 | allowing properties to be set until it is invoked. After invoke, the Call |
| 59 | can have messages written to it and read from it. */ |
| 60 | typedef struct grpc_call grpc_call; |
| 61 | |
| 62 | /* Type specifier for grpc_arg */ |
| 63 | typedef enum { |
| 64 | GRPC_ARG_STRING, |
| 65 | GRPC_ARG_INTEGER, |
| 66 | GRPC_ARG_POINTER |
| 67 | } grpc_arg_type; |
| 68 | |
| 69 | /* A single argument... each argument has a key and a value |
| 70 | |
| 71 | A note on naming keys: |
| 72 | Keys are namespaced into groups, usually grouped by library, and are |
| 73 | keys for module XYZ are named XYZ.key1, XYZ.key2, etc. Module names must |
| 74 | be restricted to the regex [A-Za-z][_A-Za-z0-9]{,15}. |
| 75 | Key names must be restricted to the regex [A-Za-z][_A-Za-z0-9]{,47}. |
| 76 | |
| 77 | GRPC core library keys are prefixed by grpc. |
| 78 | |
| 79 | Library authors are strongly encouraged to #define symbolic constants for |
| 80 | their keys so that it's possible to change them in the future. */ |
| 81 | typedef struct { |
| 82 | grpc_arg_type type; |
| 83 | char *key; |
| 84 | union { |
| 85 | char *string; |
| 86 | int integer; |
| 87 | struct { |
| 88 | void *p; |
| 89 | void *(*copy)(void *p); |
| 90 | void (*destroy)(void *p); |
| 91 | } pointer; |
| 92 | } value; |
| 93 | } grpc_arg; |
| 94 | |
Craig Tiller | 29f2b21 | 2015-02-17 17:01:24 -0800 | [diff] [blame] | 95 | /* An array of arguments that can be passed around. |
| 96 | Used to set optional channel-level configuration. |
| 97 | These configuration options are modelled as key-value pairs as defined |
| 98 | by grpc_arg; keys are strings to allow easy backwards-compatible extension |
| 99 | by arbitrary parties. |
| 100 | All evaluation is performed at channel creation time. */ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 101 | typedef struct { |
| 102 | size_t num_args; |
| 103 | grpc_arg *args; |
| 104 | } grpc_channel_args; |
| 105 | |
| 106 | /* Channel argument keys: */ |
| 107 | /* Enable census for tracing and stats collection */ |
| 108 | #define GRPC_ARG_ENABLE_CENSUS "grpc.census" |
| 109 | /* Maximum number of concurrent incoming streams to allow on a http2 |
| 110 | connection */ |
| 111 | #define GRPC_ARG_MAX_CONCURRENT_STREAMS "grpc.max_concurrent_streams" |
| 112 | /* Maximum message length that the channel can receive */ |
| 113 | #define GRPC_ARG_MAX_MESSAGE_LENGTH "grpc.max_message_length" |
| 114 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 115 | /* Result of a grpc call. If the caller satisfies the prerequisites of a |
| 116 | particular operation, the grpc_call_error returned will be GRPC_CALL_OK. |
| 117 | Receiving any other value listed here is an indication of a bug in the |
| 118 | caller. */ |
| 119 | typedef enum grpc_call_error { |
| 120 | /* everything went ok */ |
| 121 | GRPC_CALL_OK = 0, |
| 122 | /* something failed, we don't know what */ |
| 123 | GRPC_CALL_ERROR, |
| 124 | /* this method is not available on the server */ |
| 125 | GRPC_CALL_ERROR_NOT_ON_SERVER, |
| 126 | /* this method is not available on the client */ |
| 127 | GRPC_CALL_ERROR_NOT_ON_CLIENT, |
nnoble | 0c475f0 | 2014-12-05 15:37:39 -0800 | [diff] [blame] | 128 | /* this method must be called before server_accept */ |
| 129 | GRPC_CALL_ERROR_ALREADY_ACCEPTED, |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 130 | /* this method must be called before invoke */ |
| 131 | GRPC_CALL_ERROR_ALREADY_INVOKED, |
| 132 | /* this method must be called after invoke */ |
| 133 | GRPC_CALL_ERROR_NOT_INVOKED, |
| 134 | /* this call is already finished |
| 135 | (writes_done or write_status has already been called) */ |
| 136 | GRPC_CALL_ERROR_ALREADY_FINISHED, |
| 137 | /* there is already an outstanding read/write operation on the call */ |
| 138 | GRPC_CALL_ERROR_TOO_MANY_OPERATIONS, |
| 139 | /* the flags value was illegal for this call */ |
| 140 | GRPC_CALL_ERROR_INVALID_FLAGS |
| 141 | } grpc_call_error; |
| 142 | |
| 143 | /* Result of a grpc operation */ |
| 144 | typedef enum grpc_op_error { |
| 145 | /* everything went ok */ |
| 146 | GRPC_OP_OK = 0, |
| 147 | /* something failed, we don't know what */ |
| 148 | GRPC_OP_ERROR |
| 149 | } grpc_op_error; |
| 150 | |
| 151 | /* Write Flags: */ |
| 152 | /* Hint that the write may be buffered and need not go out on the wire |
| 153 | immediately. GRPC is free to buffer the message until the next non-buffered |
| 154 | write, or until writes_done, but it need not buffer completely or at all. */ |
| 155 | #define GRPC_WRITE_BUFFER_HINT (0x00000001u) |
| 156 | /* Force compression to be disabled for a particular write |
| 157 | (start_write/add_metadata). Illegal on invoke/accept. */ |
| 158 | #define GRPC_WRITE_NO_COMPRESS (0x00000002u) |
| 159 | |
| 160 | /* A buffer of bytes */ |
| 161 | struct grpc_byte_buffer; |
| 162 | typedef struct grpc_byte_buffer grpc_byte_buffer; |
| 163 | |
Nathaniel Manista | 6d41a05 | 2015-02-16 02:12:48 +0000 | [diff] [blame] | 164 | /* Sample helpers to obtain byte buffers (these will certainly move |
| 165 | someplace else) */ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 166 | grpc_byte_buffer *grpc_byte_buffer_create(gpr_slice *slices, size_t nslices); |
Craig Tiller | 80fa15c | 2015-01-13 16:10:49 -0800 | [diff] [blame] | 167 | grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 168 | size_t grpc_byte_buffer_length(grpc_byte_buffer *bb); |
| 169 | void grpc_byte_buffer_destroy(grpc_byte_buffer *byte_buffer); |
| 170 | |
| 171 | /* Reader for byte buffers. Iterates over slices in the byte buffer */ |
| 172 | struct grpc_byte_buffer_reader; |
| 173 | typedef struct grpc_byte_buffer_reader grpc_byte_buffer_reader; |
| 174 | |
| 175 | grpc_byte_buffer_reader *grpc_byte_buffer_reader_create( |
| 176 | grpc_byte_buffer *buffer); |
| 177 | /* At the end of the stream, returns 0. Otherwise, returns 1 and sets slice to |
| 178 | be the returned slice. Caller is responsible for calling gpr_slice_unref on |
| 179 | the result. */ |
| 180 | int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader, |
| 181 | gpr_slice *slice); |
| 182 | void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader); |
| 183 | |
| 184 | /* A single metadata element */ |
| 185 | typedef struct grpc_metadata { |
Craig Tiller | 4f97273 | 2015-02-05 12:40:20 -0800 | [diff] [blame] | 186 | const char *key; |
| 187 | const char *value; |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 188 | size_t value_length; |
| 189 | } grpc_metadata; |
| 190 | |
| 191 | typedef enum grpc_completion_type { |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 192 | GRPC_QUEUE_SHUTDOWN, /* Shutting down */ |
Craig Tiller | fb189f8 | 2015-02-03 12:07:07 -0800 | [diff] [blame] | 193 | GRPC_OP_COMPLETE, /* operation completion */ |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 194 | GRPC_READ, /* A read has completed */ |
| 195 | GRPC_WRITE_ACCEPTED, /* A write has been accepted by |
| 196 | flow control */ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 197 | GRPC_FINISH_ACCEPTED, /* writes_done or write_status has been accepted */ |
| 198 | GRPC_CLIENT_METADATA_READ, /* The metadata array sent by server received at |
| 199 | client */ |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 200 | GRPC_FINISHED, /* An RPC has finished. The event contains status. |
| 201 | On the server this will be OK or Cancelled. */ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 202 | GRPC_SERVER_RPC_NEW, /* A new RPC has arrived at the server */ |
Craig Tiller | 4ffdcd5 | 2015-01-16 11:34:55 -0800 | [diff] [blame] | 203 | GRPC_SERVER_SHUTDOWN, /* The server has finished shutting down */ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 204 | GRPC_COMPLETION_DO_NOT_USE /* must be last, forces users to include |
| 205 | a default: case */ |
| 206 | } grpc_completion_type; |
| 207 | |
| 208 | typedef struct grpc_event { |
| 209 | grpc_completion_type type; |
| 210 | void *tag; |
| 211 | grpc_call *call; |
| 212 | /* Data associated with the completion type. Field names match the type of |
| 213 | completion as listed in grpc_completion_type. */ |
| 214 | union { |
| 215 | /* Contains a pointer to the buffer that was read, or NULL at the end of a |
| 216 | stream. */ |
| 217 | grpc_byte_buffer *read; |
| 218 | grpc_op_error write_accepted; |
| 219 | grpc_op_error finish_accepted; |
| 220 | grpc_op_error invoke_accepted; |
Craig Tiller | fb189f8 | 2015-02-03 12:07:07 -0800 | [diff] [blame] | 221 | grpc_op_error op_complete; |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 222 | struct { |
| 223 | size_t count; |
| 224 | grpc_metadata *elements; |
| 225 | } client_metadata_read; |
ctiller | 2845cad | 2014-12-15 15:14:12 -0800 | [diff] [blame] | 226 | struct { |
| 227 | grpc_status_code status; |
| 228 | const char *details; |
| 229 | size_t metadata_count; |
| 230 | grpc_metadata *metadata_elements; |
| 231 | } finished; |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 232 | struct { |
| 233 | const char *method; |
| 234 | const char *host; |
| 235 | gpr_timespec deadline; |
| 236 | size_t metadata_count; |
| 237 | grpc_metadata *metadata_elements; |
| 238 | } server_rpc_new; |
| 239 | } data; |
| 240 | } grpc_event; |
| 241 | |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 242 | typedef struct { |
| 243 | size_t count; |
| 244 | size_t capacity; |
| 245 | grpc_metadata *metadata; |
| 246 | } grpc_metadata_array; |
| 247 | |
Craig Tiller | ea61b07 | 2015-02-03 19:19:27 -0800 | [diff] [blame] | 248 | void grpc_metadata_array_init(grpc_metadata_array *array); |
| 249 | void grpc_metadata_array_destroy(grpc_metadata_array *array); |
| 250 | |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 251 | typedef struct { |
Craig Tiller | ea61b07 | 2015-02-03 19:19:27 -0800 | [diff] [blame] | 252 | char *method; |
Craig Tiller | 034929c | 2015-02-02 16:56:15 -0800 | [diff] [blame] | 253 | size_t method_capacity; |
Craig Tiller | ea61b07 | 2015-02-03 19:19:27 -0800 | [diff] [blame] | 254 | char *host; |
Craig Tiller | 034929c | 2015-02-02 16:56:15 -0800 | [diff] [blame] | 255 | size_t host_capacity; |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 256 | gpr_timespec deadline; |
| 257 | } grpc_call_details; |
| 258 | |
Craig Tiller | ea61b07 | 2015-02-03 19:19:27 -0800 | [diff] [blame] | 259 | void grpc_call_details_init(grpc_call_details *details); |
| 260 | void grpc_call_details_destroy(grpc_call_details *details); |
| 261 | |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 262 | typedef enum { |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 263 | /* Send initial metadata: one and only one instance MUST be sent for each |
| 264 | call, |
Craig Tiller | b7800c1 | 2015-02-04 18:25:38 -0800 | [diff] [blame] | 265 | unless the call was cancelled - in which case this can be skipped */ |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 266 | GRPC_OP_SEND_INITIAL_METADATA = 0, |
Craig Tiller | b7800c1 | 2015-02-04 18:25:38 -0800 | [diff] [blame] | 267 | /* Send a message: 0 or more of these operations can occur for each call */ |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 268 | GRPC_OP_SEND_MESSAGE, |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 269 | /* Send a close from the server: one and only one instance MUST be sent from |
| 270 | the client, |
Craig Tiller | b7800c1 | 2015-02-04 18:25:38 -0800 | [diff] [blame] | 271 | unless the call was cancelled - in which case this can be skipped */ |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 272 | GRPC_OP_SEND_CLOSE_FROM_CLIENT, |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 273 | /* Send status from the server: one and only one instance MUST be sent from |
| 274 | the server |
Craig Tiller | b7800c1 | 2015-02-04 18:25:38 -0800 | [diff] [blame] | 275 | unless the call was cancelled - in which case this can be skipped */ |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 276 | GRPC_OP_SEND_STATUS_FROM_SERVER, |
Craig Tiller | b7800c1 | 2015-02-04 18:25:38 -0800 | [diff] [blame] | 277 | /* Receive initial metadata: one and only one MUST be made on the client, must |
| 278 | not be made on the server */ |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 279 | GRPC_OP_RECV_INITIAL_METADATA, |
Craig Tiller | b7800c1 | 2015-02-04 18:25:38 -0800 | [diff] [blame] | 280 | /* Receive a message: 0 or more of these operations can occur for each call */ |
Craig Tiller | fb189f8 | 2015-02-03 12:07:07 -0800 | [diff] [blame] | 281 | GRPC_OP_RECV_MESSAGE, |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 282 | /* Receive status on the client: one and only one must be made on the client |
| 283 | */ |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 284 | GRPC_OP_RECV_STATUS_ON_CLIENT, |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 285 | /* Receive status on the server: one and only one must be made on the server |
| 286 | */ |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 287 | GRPC_OP_RECV_CLOSE_ON_SERVER |
| 288 | } grpc_op_type; |
| 289 | |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 290 | /* Operation data: one field for each op type (except SEND_CLOSE_FROM_CLIENT |
| 291 | which has |
Craig Tiller | b7800c1 | 2015-02-04 18:25:38 -0800 | [diff] [blame] | 292 | no arguments) */ |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 293 | typedef struct grpc_op { |
| 294 | grpc_op_type op; |
| 295 | union { |
| 296 | struct { |
| 297 | size_t count; |
| 298 | const grpc_metadata *metadata; |
| 299 | } send_initial_metadata; |
| 300 | grpc_byte_buffer *send_message; |
| 301 | struct { |
| 302 | size_t trailing_metadata_count; |
| 303 | grpc_metadata *trailing_metadata; |
| 304 | grpc_status_code status; |
| 305 | const char *status_details; |
| 306 | } send_status_from_server; |
Craig Tiller | 4f97273 | 2015-02-05 12:40:20 -0800 | [diff] [blame] | 307 | /* ownership of the array is with the caller, but ownership of the elements |
Craig Tiller | c56b2cb | 2015-02-05 16:35:38 -0800 | [diff] [blame] | 308 | stays with the call object (ie key, value members are owned by the call |
| 309 | object, recv_initial_metadata->array is owned by the caller). |
| 310 | After the operation completes, call grpc_metadata_array_destroy on this |
| 311 | value, or reuse it in a future op. */ |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 312 | grpc_metadata_array *recv_initial_metadata; |
| 313 | grpc_byte_buffer **recv_message; |
| 314 | struct { |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 315 | /* ownership of the array is with the caller, but ownership of the |
| 316 | elements |
Craig Tiller | c56b2cb | 2015-02-05 16:35:38 -0800 | [diff] [blame] | 317 | stays with the call object (ie key, value members are owned by the call |
| 318 | object, trailing_metadata->array is owned by the caller). |
| 319 | After the operation completes, call grpc_metadata_array_destroy on this |
| 320 | value, or reuse it in a future op. */ |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 321 | grpc_metadata_array *trailing_metadata; |
| 322 | grpc_status_code *status; |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 323 | /* status_details is a buffer owned by the application before the op |
| 324 | completes |
| 325 | and after the op has completed. During the operation status_details may |
| 326 | be |
| 327 | reallocated to a size larger than *status_details_capacity, in which |
| 328 | case |
Craig Tiller | c56b2cb | 2015-02-05 16:35:38 -0800 | [diff] [blame] | 329 | *status_details_capacity will be updated with the new array capacity. |
| 330 | |
| 331 | Pre-allocating space: |
| 332 | size_t my_capacity = 8; |
| 333 | char *my_details = gpr_malloc(my_capacity); |
| 334 | x.status_details = &my_details; |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 335 | x.status_details_capacity = &my_capacity; |
Craig Tiller | c56b2cb | 2015-02-05 16:35:38 -0800 | [diff] [blame] | 336 | |
| 337 | Not pre-allocating space: |
| 338 | size_t my_capacity = 0; |
| 339 | char *my_details = NULL; |
| 340 | x.status_details = &my_details; |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 341 | x.status_details_capacity = &my_capacity; |
Craig Tiller | c56b2cb | 2015-02-05 16:35:38 -0800 | [diff] [blame] | 342 | |
| 343 | After the call: |
| 344 | gpr_free(my_details); */ |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 345 | char **status_details; |
| 346 | size_t *status_details_capacity; |
| 347 | } recv_status_on_client; |
| 348 | struct { |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 349 | /* out argument, set to 1 if the call failed in any way (seen as a |
| 350 | cancellation |
Craig Tiller | 0a5bcbc | 2015-02-09 21:39:04 -0800 | [diff] [blame] | 351 | on the server), or 0 if the call succeeded */ |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 352 | int *cancelled; |
| 353 | } recv_close_on_server; |
| 354 | } data; |
| 355 | } grpc_op; |
| 356 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 357 | /* Initialize the grpc library */ |
Craig Tiller | 32946d3 | 2015-01-15 11:37:30 -0800 | [diff] [blame] | 358 | void grpc_init(void); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 359 | |
Nathaniel Manista | 6d41a05 | 2015-02-16 02:12:48 +0000 | [diff] [blame] | 360 | /* Shut down the grpc library */ |
Craig Tiller | 32946d3 | 2015-01-15 11:37:30 -0800 | [diff] [blame] | 361 | void grpc_shutdown(void); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 362 | |
Craig Tiller | 32946d3 | 2015-01-15 11:37:30 -0800 | [diff] [blame] | 363 | grpc_completion_queue *grpc_completion_queue_create(void); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 364 | |
Nathaniel Manista | 6d41a05 | 2015-02-16 02:12:48 +0000 | [diff] [blame] | 365 | /* Blocks until an event is available, the completion queue is being shut down, |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 366 | or deadline is reached. Returns NULL on timeout, otherwise the event that |
| 367 | occurred. Callers should call grpc_event_finish once they have processed |
| 368 | the event. |
| 369 | |
| 370 | Callers must not call grpc_completion_queue_next and |
| 371 | grpc_completion_queue_pluck simultaneously on the same completion queue. */ |
| 372 | grpc_event *grpc_completion_queue_next(grpc_completion_queue *cq, |
| 373 | gpr_timespec deadline); |
| 374 | |
| 375 | /* Blocks until an event with tag 'tag' is available, the completion queue is |
| 376 | being shutdown or deadline is reached. Returns NULL on timeout, or a pointer |
| 377 | to the event that occurred. Callers should call grpc_event_finish once they |
| 378 | have processed the event. |
| 379 | |
| 380 | Callers must not call grpc_completion_queue_next and |
| 381 | grpc_completion_queue_pluck simultaneously on the same completion queue. */ |
| 382 | grpc_event *grpc_completion_queue_pluck(grpc_completion_queue *cq, void *tag, |
| 383 | gpr_timespec deadline); |
| 384 | |
Nathaniel Manista | 6d41a05 | 2015-02-16 02:12:48 +0000 | [diff] [blame] | 385 | /* Clean up any data owned by the event */ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 386 | void grpc_event_finish(grpc_event *event); |
| 387 | |
| 388 | /* Begin destruction of a completion queue. Once all possible events are |
| 389 | drained it's safe to call grpc_completion_queue_destroy. */ |
| 390 | void grpc_completion_queue_shutdown(grpc_completion_queue *cq); |
| 391 | |
| 392 | /* Destroy a completion queue. The caller must ensure that the queue is |
| 393 | drained and no threads are executing grpc_completion_queue_next */ |
| 394 | void grpc_completion_queue_destroy(grpc_completion_queue *cq); |
| 395 | |
| 396 | /* Create a call given a grpc_channel, in order to call 'method'. The request |
| 397 | is not sent until grpc_call_invoke is called. All completions are sent to |
| 398 | 'completion_queue'. */ |
Craig Tiller | c4f0ebe | 2015-02-02 10:16:30 -0800 | [diff] [blame] | 399 | grpc_call *grpc_channel_create_call_old(grpc_channel *channel, |
| 400 | const char *method, const char *host, |
| 401 | gpr_timespec deadline); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 402 | |
Craig Tiller | 034929c | 2015-02-02 16:56:15 -0800 | [diff] [blame] | 403 | /* Create a call given a grpc_channel, in order to call 'method'. The request |
| 404 | is not sent until grpc_call_invoke is called. All completions are sent to |
| 405 | 'completion_queue'. */ |
Craig Tiller | fb189f8 | 2015-02-03 12:07:07 -0800 | [diff] [blame] | 406 | grpc_call *grpc_channel_create_call(grpc_channel *channel, |
| 407 | grpc_completion_queue *completion_queue, |
| 408 | const char *method, const char *host, |
| 409 | gpr_timespec deadline); |
Craig Tiller | 034929c | 2015-02-02 16:56:15 -0800 | [diff] [blame] | 410 | |
| 411 | /* Start a batch of operations defined in the array ops; when complete, post a |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 412 | completion of type 'tag' to the completion queue bound to the call. |
Craig Tiller | b7800c1 | 2015-02-04 18:25:38 -0800 | [diff] [blame] | 413 | The order of ops specified in the batch has no significance. |
| 414 | Only one operation of each type can be active at once in any given |
| 415 | batch. */ |
Craig Tiller | fef7669 | 2015-02-02 16:44:26 -0800 | [diff] [blame] | 416 | grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops, |
| 417 | size_t nops, void *tag); |
| 418 | |
Craig Tiller | 29f2b21 | 2015-02-17 17:01:24 -0800 | [diff] [blame] | 419 | /* Create a client channel to 'target'. Additional channel level configuration |
| 420 | MAY be provided by grpc_channel_args, though the expectation is that most |
| 421 | clients will want to simply pass NULL. See grpc_channel_args definition |
| 422 | for more on this. */ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 423 | grpc_channel *grpc_channel_create(const char *target, |
| 424 | const grpc_channel_args *args); |
| 425 | |
| 426 | /* Close and destroy a grpc channel */ |
| 427 | void grpc_channel_destroy(grpc_channel *channel); |
| 428 | |
| 429 | /* THREAD-SAFETY for grpc_call |
| 430 | The following functions are thread-compatible for any given call: |
| 431 | grpc_call_add_metadata |
| 432 | grpc_call_invoke |
| 433 | grpc_call_start_write |
| 434 | grpc_call_writes_done |
| 435 | grpc_call_start_read |
| 436 | grpc_call_destroy |
| 437 | The function grpc_call_cancel is thread-safe, and can be called at any |
| 438 | point before grpc_call_destroy is called. */ |
| 439 | |
| 440 | /* Error handling for grpc_call |
| 441 | Most grpc_call functions return a grpc_error. If the error is not GRPC_OK |
| 442 | then the operation failed due to some unsatisfied precondition. |
| 443 | If a grpc_call fails, it's guaranteed that no change to the call state |
| 444 | has been made. */ |
| 445 | |
| 446 | /* Add a single metadata element to the call, to be sent upon invocation. |
| 447 | flags is a bit-field combination of the write flags defined above. |
yangg | fb3aa26 | 2014-12-16 15:29:57 -0800 | [diff] [blame] | 448 | REQUIRES: grpc_call_start_invoke/grpc_call_server_end_initial_metadata have |
| 449 | not been called on this call. |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 450 | Produces no events. */ |
Craig Tiller | c4f0ebe | 2015-02-02 10:16:30 -0800 | [diff] [blame] | 451 | grpc_call_error grpc_call_add_metadata_old(grpc_call *call, |
| 452 | grpc_metadata *metadata, |
| 453 | gpr_uint32 flags); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 454 | |
| 455 | /* Invoke the RPC. Starts sending metadata and request headers on the wire. |
| 456 | flags is a bit-field combination of the write flags defined above. |
| 457 | REQUIRES: Can be called at most once per call. |
| 458 | Can only be called on the client. |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 459 | Produces a GRPC_CLIENT_METADATA_READ event with metadata_read_tag when |
| 460 | the servers initial metadata has been read. |
| 461 | Produces a GRPC_FINISHED event with finished_tag when the call has been |
| 462 | completed (there may be other events for the call pending at this |
| 463 | time) */ |
Craig Tiller | c4f0ebe | 2015-02-02 10:16:30 -0800 | [diff] [blame] | 464 | grpc_call_error grpc_call_invoke_old(grpc_call *call, grpc_completion_queue *cq, |
| 465 | void *metadata_read_tag, |
| 466 | void *finished_tag, gpr_uint32 flags); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 467 | |
nnoble | 0c475f0 | 2014-12-05 15:37:39 -0800 | [diff] [blame] | 468 | /* Accept an incoming RPC, binding a completion queue to it. |
| 469 | To be called before sending or receiving messages. |
nnoble | 0c475f0 | 2014-12-05 15:37:39 -0800 | [diff] [blame] | 470 | REQUIRES: Can be called at most once per call. |
| 471 | Can only be called on the server. |
| 472 | Produces a GRPC_FINISHED event with finished_tag when the call has been |
| 473 | completed (there may be other events for the call pending at this |
| 474 | time) */ |
Craig Tiller | c4f0ebe | 2015-02-02 10:16:30 -0800 | [diff] [blame] | 475 | grpc_call_error grpc_call_server_accept_old(grpc_call *call, |
| 476 | grpc_completion_queue *cq, |
| 477 | void *finished_tag); |
nnoble | 0c475f0 | 2014-12-05 15:37:39 -0800 | [diff] [blame] | 478 | |
yangg | fb3aa26 | 2014-12-16 15:29:57 -0800 | [diff] [blame] | 479 | /* Start sending metadata. |
nnoble | 0c475f0 | 2014-12-05 15:37:39 -0800 | [diff] [blame] | 480 | To be called before sending messages. |
| 481 | flags is a bit-field combination of the write flags defined above. |
| 482 | REQUIRES: Can be called at most once per call. |
| 483 | Can only be called on the server. |
| 484 | Must be called after grpc_call_server_accept */ |
Craig Tiller | c4f0ebe | 2015-02-02 10:16:30 -0800 | [diff] [blame] | 485 | grpc_call_error grpc_call_server_end_initial_metadata_old(grpc_call *call, |
| 486 | gpr_uint32 flags); |
nnoble | 0c475f0 | 2014-12-05 15:37:39 -0800 | [diff] [blame] | 487 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 488 | /* Called by clients to cancel an RPC on the server. |
| 489 | Can be called multiple times, from any thread. */ |
| 490 | grpc_call_error grpc_call_cancel(grpc_call *call); |
| 491 | |
Craig Tiller | d248c24 | 2015-01-14 11:49:12 -0800 | [diff] [blame] | 492 | /* Called by clients to cancel an RPC on the server. |
Craig Tiller | 6046dc3 | 2015-01-14 12:55:45 -0800 | [diff] [blame] | 493 | Can be called multiple times, from any thread. |
Craig Tiller | d248c24 | 2015-01-14 11:49:12 -0800 | [diff] [blame] | 494 | If a status has not been received for the call, set it to the status code |
Craig Tiller | 6046dc3 | 2015-01-14 12:55:45 -0800 | [diff] [blame] | 495 | and description passed in. |
Craig Tiller | d248c24 | 2015-01-14 11:49:12 -0800 | [diff] [blame] | 496 | Importantly, this function does not send status nor description to the |
| 497 | remote endpoint. */ |
Craig Tiller | 6046dc3 | 2015-01-14 12:55:45 -0800 | [diff] [blame] | 498 | grpc_call_error grpc_call_cancel_with_status(grpc_call *call, |
| 499 | grpc_status_code status, |
| 500 | const char *description); |
Craig Tiller | d248c24 | 2015-01-14 11:49:12 -0800 | [diff] [blame] | 501 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 502 | /* Queue a byte buffer for writing. |
| 503 | flags is a bit-field combination of the write flags defined above. |
| 504 | A write with byte_buffer null is allowed, and will not send any bytes on the |
| 505 | wire. If this is performed without GRPC_WRITE_BUFFER_HINT flag it provides |
| 506 | a mechanism to flush any previously buffered writes to outgoing flow control. |
| 507 | REQUIRES: No other writes are pending on the call. It is only safe to |
| 508 | start the next write after the corresponding write_accepted event |
| 509 | is received. |
| 510 | GRPC_INVOKE_ACCEPTED must have been received by the application |
| 511 | prior to calling this on the client. On the server, |
nnoble | 0c475f0 | 2014-12-05 15:37:39 -0800 | [diff] [blame] | 512 | grpc_call_server_end_of_initial_metadata must have been called |
| 513 | successfully. |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 514 | Produces a GRPC_WRITE_ACCEPTED event. */ |
Craig Tiller | c4f0ebe | 2015-02-02 10:16:30 -0800 | [diff] [blame] | 515 | grpc_call_error grpc_call_start_write_old(grpc_call *call, |
| 516 | grpc_byte_buffer *byte_buffer, |
| 517 | void *tag, gpr_uint32 flags); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 518 | |
| 519 | /* Queue a status for writing. |
| 520 | REQUIRES: No other writes are pending on the call. |
yangg | fb3aa26 | 2014-12-16 15:29:57 -0800 | [diff] [blame] | 521 | grpc_call_server_end_initial_metadata must have been called on the |
| 522 | call prior to calling this. |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 523 | Only callable on the server. |
| 524 | Produces a GRPC_FINISH_ACCEPTED event when the status is sent. */ |
Craig Tiller | c4f0ebe | 2015-02-02 10:16:30 -0800 | [diff] [blame] | 525 | grpc_call_error grpc_call_start_write_status_old(grpc_call *call, |
| 526 | grpc_status_code status_code, |
| 527 | const char *status_message, |
| 528 | void *tag); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 529 | |
| 530 | /* No more messages to send. |
| 531 | REQUIRES: No other writes are pending on the call. |
| 532 | Only callable on the client. |
| 533 | Produces a GRPC_FINISH_ACCEPTED event when all bytes for the call have passed |
| 534 | outgoing flow control. */ |
Craig Tiller | c4f0ebe | 2015-02-02 10:16:30 -0800 | [diff] [blame] | 535 | grpc_call_error grpc_call_writes_done_old(grpc_call *call, void *tag); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 536 | |
| 537 | /* Initiate a read on a call. Output event contains a byte buffer with the |
| 538 | result of the read. |
| 539 | REQUIRES: No other reads are pending on the call. It is only safe to start |
| 540 | the next read after the corresponding read event is received. |
nnoble | 0c475f0 | 2014-12-05 15:37:39 -0800 | [diff] [blame] | 541 | On the client: |
| 542 | GRPC_INVOKE_ACCEPTED must have been received by the application |
| 543 | prior to calling this. |
| 544 | On the server: |
| 545 | grpc_call_server_accept must be called before calling this. |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 546 | Produces a single GRPC_READ event. */ |
Craig Tiller | c4f0ebe | 2015-02-02 10:16:30 -0800 | [diff] [blame] | 547 | grpc_call_error grpc_call_start_read_old(grpc_call *call, void *tag); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 548 | |
| 549 | /* Destroy a call. */ |
| 550 | void grpc_call_destroy(grpc_call *call); |
| 551 | |
| 552 | /* Request a call on a server. |
| 553 | Allows the server to create a single GRPC_SERVER_RPC_NEW event, with tag |
| 554 | tag_new. |
| 555 | If the call is subsequently cancelled, the cancellation will occur with tag |
| 556 | tag_cancel. |
| 557 | REQUIRES: Server must not have been shutdown. |
| 558 | NOTE: calling this is the only way to obtain GRPC_SERVER_RPC_NEW events. */ |
Craig Tiller | c4f0ebe | 2015-02-02 10:16:30 -0800 | [diff] [blame] | 559 | grpc_call_error grpc_server_request_call_old(grpc_server *server, |
| 560 | void *tag_new); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 561 | |
Craig Tiller | fada7d4 | 2015-02-11 23:03:55 -0800 | [diff] [blame] | 562 | /* Request notification of a new call */ |
Craig Tiller | fb189f8 | 2015-02-03 12:07:07 -0800 | [diff] [blame] | 563 | grpc_call_error grpc_server_request_call( |
Craig Tiller | ea61b07 | 2015-02-03 19:19:27 -0800 | [diff] [blame] | 564 | grpc_server *server, grpc_call **call, grpc_call_details *details, |
Craig Tiller | fb189f8 | 2015-02-03 12:07:07 -0800 | [diff] [blame] | 565 | grpc_metadata_array *request_metadata, |
Craig Tiller | 0605995 | 2015-02-18 08:34:56 -0800 | [diff] [blame^] | 566 | grpc_completion_queue *cq_bound_to_call, |
Craig Tiller | 8e8fd89 | 2015-02-10 17:02:08 -0800 | [diff] [blame] | 567 | void *tag_new); |
Craig Tiller | 034929c | 2015-02-02 16:56:15 -0800 | [diff] [blame] | 568 | |
Craig Tiller | fada7d4 | 2015-02-11 23:03:55 -0800 | [diff] [blame] | 569 | /* Registers a method in the server. |
| 570 | Methods to this (host, method) pair will not be reported by |
Craig Tiller | 0605995 | 2015-02-18 08:34:56 -0800 | [diff] [blame^] | 571 | grpc_server_request_call, but instead be reported by |
Craig Tiller | fada7d4 | 2015-02-11 23:03:55 -0800 | [diff] [blame] | 572 | grpc_server_request_registered_call when passed the appropriate |
| 573 | registered_method (as returned by this function). |
| 574 | Must be called before grpc_server_start. |
| 575 | Returns NULL on failure. */ |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 576 | void *grpc_server_register_method(grpc_server *server, const char *method, |
Craig Tiller | 0605995 | 2015-02-18 08:34:56 -0800 | [diff] [blame^] | 577 | const char *host, |
Craig Tiller | 20bc56d | 2015-02-12 09:02:56 -0800 | [diff] [blame] | 578 | grpc_completion_queue *new_call_cq); |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 579 | |
Craig Tiller | fada7d4 | 2015-02-11 23:03:55 -0800 | [diff] [blame] | 580 | /* Request notification of a new pre-registered call */ |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 581 | grpc_call_error grpc_server_request_registered_call( |
| 582 | grpc_server *server, void *registered_method, grpc_call **call, |
| 583 | gpr_timespec *deadline, grpc_metadata_array *request_metadata, |
| 584 | grpc_byte_buffer **optional_payload, |
Craig Tiller | 8e8fd89 | 2015-02-10 17:02:08 -0800 | [diff] [blame] | 585 | grpc_completion_queue *cq_bound_to_call, void *tag_new); |
Craig Tiller | 24be0f7 | 2015-02-10 14:04:22 -0800 | [diff] [blame] | 586 | |
Craig Tiller | 29f2b21 | 2015-02-17 17:01:24 -0800 | [diff] [blame] | 587 | /* Create a server. Additional configuration for each incoming channel can |
Craig Tiller | e7163ab | 2015-02-17 20:46:08 -0800 | [diff] [blame] | 588 | be specified with args. If no additional configuration is needed, args can |
| 589 | be NULL. See grpc_channel_args for more. */ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 590 | grpc_server *grpc_server_create(grpc_completion_queue *cq, |
| 591 | const grpc_channel_args *args); |
| 592 | |
Craig Tiller | d251ab9 | 2015-02-17 17:22:14 -0800 | [diff] [blame] | 593 | /* Add a HTTP2 over plaintext over tcp listener. |
ctiller | 570d1f4 | 2015-01-12 16:29:52 -0800 | [diff] [blame] | 594 | Returns bound port number on success, 0 on failure. |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 595 | REQUIRES: server not started */ |
| 596 | int grpc_server_add_http2_port(grpc_server *server, const char *addr); |
| 597 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 598 | /* Start a server - tells all listeners to start listening */ |
| 599 | void grpc_server_start(grpc_server *server); |
| 600 | |
ctiller | 9a58df0 | 2014-12-11 16:26:49 -0800 | [diff] [blame] | 601 | /* Begin shutting down a server. |
| 602 | After completion, no new calls or connections will be admitted. |
Craig Tiller | aea2fc0 | 2015-02-17 16:54:53 -0800 | [diff] [blame] | 603 | Existing calls will be allowed to complete. |
| 604 | Shutdown is idempotent. */ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 605 | void grpc_server_shutdown(grpc_server *server); |
| 606 | |
Craig Tiller | 4ffdcd5 | 2015-01-16 11:34:55 -0800 | [diff] [blame] | 607 | /* As per grpc_server_shutdown, but send a GRPC_SERVER_SHUTDOWN event when |
Craig Tiller | aea2fc0 | 2015-02-17 16:54:53 -0800 | [diff] [blame] | 608 | there are no more calls being serviced. |
| 609 | Shutdown is idempotent, and all tags will be notified at once if multiple |
| 610 | grpc_server_shutdown_and_notify calls are made. */ |
Craig Tiller | 4ffdcd5 | 2015-01-16 11:34:55 -0800 | [diff] [blame] | 611 | void grpc_server_shutdown_and_notify(grpc_server *server, void *tag); |
| 612 | |
ctiller | 9a58df0 | 2014-12-11 16:26:49 -0800 | [diff] [blame] | 613 | /* Destroy a server. |
Craig Tiller | aea2fc0 | 2015-02-17 16:54:53 -0800 | [diff] [blame] | 614 | Forcefully cancels all existing calls. |
| 615 | Implies grpc_server_shutdown() if one was not previously performed. */ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 616 | void grpc_server_destroy(grpc_server *server); |
| 617 | |
| 618 | #ifdef __cplusplus |
| 619 | } |
| 620 | #endif |
| 621 | |
Craig Tiller | 0605995 | 2015-02-18 08:34:56 -0800 | [diff] [blame^] | 622 | #endif /* __GRPC_GRPC_H__ */ |