diff options
author | Alistair Veitch <aveitch@google.com> | 2016-01-13 09:08:38 -0800 |
---|---|---|
committer | Alistair Veitch <aveitch@google.com> | 2016-01-13 09:08:38 -0800 |
commit | 0f690721bdc977b5d506e575f5e13be6d09c57fd (patch) | |
tree | d0401e5aa29da92303263f7b89d394c1c88b8487 /include | |
parent | f190601e606fb89158f671bea1676e4083bc9bb4 (diff) |
Move encode/decode API into census.h
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc/census.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/include/grpc/census.h b/include/grpc/census.h index 908bcc96e2..2a62f4daca 100644 --- a/include/grpc/census.h +++ b/include/grpc/census.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -339,7 +339,7 @@ typedef struct { const char *key; const char *value; size_t value_len; - gpr_uint8 flags; + uint8_t flags; } census_tag; /* Tag flags. */ @@ -386,6 +386,22 @@ int census_tag_set_get_tag_by_index(const census_tag_set *tags, int index, int census_tag_set_get_tag_by_key(const census_tag_set *tags, const char *key, census_tag *tag); +/* Encode to-be-propagated non-binary tags from a tag set into a memory + buffer. The total number of bytes used in the buffer is returned. If the + buffer is too small to contain the encoded tag set, then 0 is returned. */ +size_t census_tag_set_encode_propagated(const census_tag_set *tags, + char *buffer, size_t buf_size); + +/* Encode to-be-propagated binary tags from a tag set into a memory + buffer. The total number of bytes used in the buffer is returned. If the + buffer is too small to contain the encoded tag set, then 0 is returned. */ +size_t census_tag_set_encode_propagated_binary(const census_tag_set *tags, + char *buffer, size_t buf_size); + +/* Decode tag set buffers encoded with census_tag_set_encode_*(). */ +census_tag_set *census_tag_set_decode(const char *buffer, size_t size, + const char *bin_buffer, size_t bin_size); + /* Get a contexts tag set. */ census_tag_set *census_context_tag_set(census_context *context); |