GRPC Core
9.0.0
|
#include <grpc/support/port_platform.h>
#include <stdbool.h>
#include <grpc/slice_buffer.h>
#include <zlib.h>
#include "src/core/lib/transport/static_metadata.h"
Go to the source code of this file.
Data Structures | |
struct | grpc_stream_compression_context |
struct | grpc_stream_compression_vtable |
Typedefs | |
typedef struct grpc_stream_compression_vtable | grpc_stream_compression_vtable |
typedef struct grpc_stream_compression_context | grpc_stream_compression_context |
typedef enum grpc_stream_compression_method | grpc_stream_compression_method |
typedef enum grpc_stream_compression_flush | grpc_stream_compression_flush |
Functions | |
bool | grpc_stream_compress (grpc_stream_compression_context *ctx, grpc_slice_buffer *in, grpc_slice_buffer *out, size_t *output_size, size_t max_output_size, grpc_stream_compression_flush flush) |
Compress bytes provided in in with a given context, with an optional flush at the end of compression. More... | |
bool | grpc_stream_decompress (grpc_stream_compression_context *ctx, grpc_slice_buffer *in, grpc_slice_buffer *out, size_t *output_size, size_t max_output_size, bool *end_of_context) |
Decompress bytes provided in in with a given context. More... | |
grpc_stream_compression_context * | grpc_stream_compression_context_create (grpc_stream_compression_method method) |
Creates a stream compression context. More... | |
void | grpc_stream_compression_context_destroy (grpc_stream_compression_context *ctx) |
Destroys a stream compression context. More... | |
int | grpc_stream_compression_method_parse (grpc_slice value, bool is_compress, grpc_stream_compression_method *method) |
Parse stream compression method based on algorithm name. More... | |
typedef struct grpc_stream_compression_context grpc_stream_compression_context |
typedef struct grpc_stream_compression_vtable grpc_stream_compression_vtable |
bool grpc_stream_compress | ( | grpc_stream_compression_context * | ctx, |
grpc_slice_buffer * | in, | ||
grpc_slice_buffer * | out, | ||
size_t * | output_size, | ||
size_t | max_output_size, | ||
grpc_stream_compression_flush | flush | ||
) |
Compress bytes provided in in with a given context, with an optional flush at the end of compression.
Emits at most max_output_size compressed bytes into out. If all the bytes in input buffer in are depleted and flush is not GRPC_STREAM_COMPRESSION_FLUSH_NONE, the corresponding flush method is executed. The total number of bytes emitted is outputted in output_size.
A SYNC flush indicates that the entire messages in in can be decompressed from out. A FINISH flush implies a SYNC flush, and that any further compression will not be dependent on the state of the current context and any previous compressed bytes. It allows corresponding decompression context to be dropped when reaching this boundary.
grpc_stream_compression_context* grpc_stream_compression_context_create | ( | grpc_stream_compression_method | method | ) |
Creates a stream compression context.
pending_bytes_buffer is the input buffer for compression/decompression operations. method specifies whether the context is for compression or decompression.
void grpc_stream_compression_context_destroy | ( | grpc_stream_compression_context * | ctx | ) |
Destroys a stream compression context.
int grpc_stream_compression_method_parse | ( | grpc_slice | value, |
bool | is_compress, | ||
grpc_stream_compression_method * | method | ||
) |
Parse stream compression method based on algorithm name.
bool grpc_stream_decompress | ( | grpc_stream_compression_context * | ctx, |
grpc_slice_buffer * | in, | ||
grpc_slice_buffer * | out, | ||
size_t * | output_size, | ||
size_t | max_output_size, | ||
bool * | end_of_context | ||
) |
Decompress bytes provided in in with a given context.
Emits at most max_output_size decompressed bytes into out. If decompression process reached the end of a gzip stream, end_of_context is set to true; otherwise it is set to false. The total number of bytes emitted is outputted in output_size.