diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc/census.h | 11 | ||||
-rw-r--r-- | include/grpc/grpc.h | 16 | ||||
-rw-r--r-- | include/grpc/support/host_port.h | 6 |
3 files changed, 30 insertions, 3 deletions
diff --git a/include/grpc/census.h b/include/grpc/census.h index 3fc07affc8..379783905a 100644 --- a/include/grpc/census.h +++ b/include/grpc/census.h @@ -100,6 +100,17 @@ int census_context_deserialize(const char *buffer, census_context **context); * future census calls will result in undefined behavior. */ void census_context_destroy(census_context *context); +/* A census statistic to be recorded comprises two parts: an ID for the + * particular statistic and the value to be recorded against it. */ +typedef struct { + int id; + double value; +} census_stat; + +/* Record new stats against the given context. */ +void census_record_stat(census_context *context, census_stat *stats, + size_t nstats); + #ifdef __cplusplus } #endif diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 7b2fedad63..3287b090f3 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -433,6 +433,20 @@ grpc_call *grpc_channel_create_registered_call( grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops, size_t nops, void *tag); +/** Returns a newly allocated string representing the endpoint to which this + call is communicating with. The string is in the uri format accepted by + grpc_channel_create. + The returned string should be disposed of with gpr_free(). + + WARNING: this value is never authenticated or subject to any security + related code. It must not be used for any authentication related + functionality. Instead, use grpc_auth_context. */ +char *grpc_call_get_peer(grpc_call *call); + +/** Return a newly allocated string representing the target a channel was + created for. */ +char *grpc_channel_get_target(grpc_channel *channel); + /** Create a client channel to 'target'. Additional channel level configuration MAY be provided by grpc_channel_args, though the expectation is that most clients will want to simply pass NULL. See grpc_channel_args definition for @@ -442,7 +456,7 @@ grpc_channel *grpc_insecure_channel_create(const char *target, const grpc_channel_args *args); /** Create a lame client: this client fails every operation attempted on it. */ -grpc_channel *grpc_lame_client_channel_create(void); +grpc_channel *grpc_lame_client_channel_create(const char *target); /** Close and destroy a grpc channel */ void grpc_channel_destroy(grpc_channel *channel); diff --git a/include/grpc/support/host_port.h b/include/grpc/support/host_port.h index 3cc2f498e8..30267ab1df 100644 --- a/include/grpc/support/host_port.h +++ b/include/grpc/support/host_port.h @@ -52,8 +52,10 @@ int gpr_join_host_port(char **out, const char *host, int port); /* Given a name in the form "host:port" or "[ho:st]:port", split into hostname and port number, into newly allocated strings, which must later be - destroyed using gpr_free(). */ -void gpr_split_host_port(const char *name, char **host, char **port); + destroyed using gpr_free(). + Return 1 on success, 0 on failure. Guarantees *host and *port == NULL on + failure. */ +int gpr_split_host_port(const char *name, char **host, char **port); #ifdef __cplusplus } |