aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc/impl/codegen/grpc_types.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/grpc/impl/codegen/grpc_types.h')
-rw-r--r--include/grpc/impl/codegen/grpc_types.h42
1 files changed, 30 insertions, 12 deletions
diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h
index 8efd570bad..ee8101aab8 100644
--- a/include/grpc/impl/codegen/grpc_types.h
+++ b/include/grpc/impl/codegen/grpc_types.h
@@ -294,11 +294,9 @@ typedef enum grpc_call_error {
/** A single metadata element */
typedef struct grpc_metadata {
- /* 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;
-
+ const char *key;
+ const char *value;
+ size_t value_length;
uint32_t flags;
/** The following fields are reserved for grpc internal use.
@@ -340,8 +338,10 @@ typedef struct {
} grpc_metadata_array;
typedef struct {
- grpc_slice method;
- grpc_slice host;
+ char *method;
+ size_t method_capacity;
+ char *host;
+ size_t host_capacity;
gpr_timespec deadline;
uint32_t flags;
void *reserved;
@@ -423,10 +423,7 @@ typedef struct grpc_op {
size_t trailing_metadata_count;
grpc_metadata *trailing_metadata;
grpc_status_code status;
- /* 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;
+ const char *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
@@ -447,7 +444,28 @@ typedef struct grpc_op {
value, or reuse it in a future op. */
grpc_metadata_array *trailing_metadata;
grpc_status_code *status;
- grpc_slice *status_details;
+ /** 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;
} recv_status_on_client;
struct {
/** out argument, set to 1 if the call failed in any way (seen as a