diff options
Diffstat (limited to 'include/grpc/impl/codegen/grpc_types.h')
-rw-r--r-- | include/grpc/impl/codegen/grpc_types.h | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index ee8101aab8..8efd570bad 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -294,9 +294,11 @@ typedef enum grpc_call_error { /** A single metadata element */ typedef struct grpc_metadata { - const char *key; - const char *value; - size_t value_length; + /* the key, value values are expected to line up with grpc_mdelem: if changing + them, update metadata.h at the same time. */ + grpc_slice key; + grpc_slice value; + uint32_t flags; /** The following fields are reserved for grpc internal use. @@ -338,10 +340,8 @@ typedef struct { } grpc_metadata_array; typedef struct { - char *method; - size_t method_capacity; - char *host; - size_t host_capacity; + grpc_slice method; + grpc_slice host; gpr_timespec deadline; uint32_t flags; void *reserved; @@ -423,7 +423,10 @@ typedef struct grpc_op { size_t trailing_metadata_count; grpc_metadata *trailing_metadata; grpc_status_code status; - const char *status_details; + /* optional: set to NULL if no details need sending, non-NULL if they do + * pointer will not be retained past the start_batch call + */ + grpc_slice *status_details; } send_status_from_server; /** 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 @@ -444,28 +447,7 @@ typedef struct grpc_op { value, or reuse it in a future op. */ grpc_metadata_array *trailing_metadata; grpc_status_code *status; - /** status_details is a buffer owned by the application before the op - completes and after the op has completed. During the operation - status_details may be reallocated to a size larger than - *status_details_capacity, in which case *status_details_capacity will - be updated with the new array capacity. - - Pre-allocating space: - size_t my_capacity = 8; - char *my_details = gpr_malloc(my_capacity); - x.status_details = &my_details; - x.status_details_capacity = &my_capacity; - - Not pre-allocating space: - size_t my_capacity = 0; - char *my_details = NULL; - x.status_details = &my_details; - x.status_details_capacity = &my_capacity; - - After the call: - gpr_free(my_details); */ - char **status_details; - size_t *status_details_capacity; + grpc_slice *status_details; } recv_status_on_client; struct { /** out argument, set to 1 if the call failed in any way (seen as a |