|
luasandbox
1.4.0
Generic Lua sandbox for dynamic data analysis
|
Generic protobuf utility functions. More...

Go to the source code of this file.
Macros | |
| #define | LSB_MAX_VARINT_BYTES 10 |
Enumerations | |
| enum | lsb_pb_wire_types { LSB_PB_WT_VARINT = 0, LSB_PB_WT_FIXED64 = 1, LSB_PB_WT_LENGTH = 2, LSB_PB_WT_SGROUP = 3, LSB_PB_WT_EGROUP = 4, LSB_PB_WT_FIXED32 = 5 } |
Functions | |
| LSB_UTIL_EXPORT const char * | lsb_pb_read_key (const char *p, int *tag, int *wiretype) |
| Extract the tag and wiretype from a protobuf key. More... | |
| LSB_UTIL_EXPORT lsb_err_value | lsb_pb_write_key (lsb_output_buffer *ob, unsigned char tag, unsigned char wiretype) |
| Writes a field key (tag id/wire type) to the output buffer. More... | |
| LSB_UTIL_EXPORT const char * | lsb_pb_read_varint (const char *p, const char *e, long long *vi) |
| Reads the varint into the provided variable. More... | |
| LSB_UTIL_EXPORT int | lsb_pb_output_varint (char *buf, unsigned long long i) |
| Outputs the varint to an existing buffer. More... | |
| LSB_UTIL_EXPORT lsb_err_value | lsb_pb_write_varint (lsb_output_buffer *ob, unsigned long long i) |
| Writes a varint encoded number to the output buffer. More... | |
| LSB_UTIL_EXPORT lsb_err_value | lsb_pb_write_bool (lsb_output_buffer *ob, int i) |
| Writes a bool to the output buffer. More... | |
| LSB_UTIL_EXPORT lsb_err_value | lsb_pb_write_double (lsb_output_buffer *ob, double i) |
| Writes a double to the output buffer. More... | |
| LSB_UTIL_EXPORT lsb_err_value | lsb_pb_write_string (lsb_output_buffer *ob, char tag, const char *s, size_t len) |
| Writes a string to the output buffer. More... | |
| LSB_UTIL_EXPORT lsb_err_value | lsb_pb_update_field_length (lsb_output_buffer *ob, size_t len_pos) |
| Updates the field length in the output buffer once the size is known, this allows for single pass encoding. More... | |
Generic protobuf utility functions.
Definition in file protobuf.h.
| #define LSB_MAX_VARINT_BYTES 10 |
Definition at line 18 of file protobuf.h.
| enum lsb_pb_wire_types |
| Enumerator | |
|---|---|
| LSB_PB_WT_VARINT | |
| LSB_PB_WT_FIXED64 | |
| LSB_PB_WT_LENGTH | |
| LSB_PB_WT_SGROUP | |
| LSB_PB_WT_EGROUP | |
| LSB_PB_WT_FIXED32 | |
Definition at line 20 of file protobuf.h.
| LSB_UTIL_EXPORT int lsb_pb_output_varint | ( | char * | buf, |
| unsigned long long | i | ||
| ) |
Outputs the varint to an existing buffer.
| buf | Pointer to buffer with at least LSB_MAX_VARINT_BYTES available, |
| i | Number to be encoded. |
| LSB_UTIL_EXPORT const char* lsb_pb_read_key | ( | const char * | p, |
| int * | tag, | ||
| int * | wiretype | ||
| ) |
Extract the tag and wiretype from a protobuf key.
| p | Key |
| tag | Tag Id |
| wiretype | Wiretype Id |
| LSB_UTIL_EXPORT const char* lsb_pb_read_varint | ( | const char * | p, |
| const char * | e, | ||
| long long * | vi | ||
| ) |
Reads the varint into the provided variable.
| p | Start of buffer |
| e | End of buffer |
| vi | Varint value |
| LSB_UTIL_EXPORT lsb_err_value lsb_pb_update_field_length | ( | lsb_output_buffer * | ob, |
| size_t | len_pos | ||
| ) |
Updates the field length in the output buffer once the size is known, this allows for single pass encoding.
| ob | Pointer to the output data buffer. |
| len_pos | Position in the output buffer where the length should be written. |
| LSB_UTIL_EXPORT lsb_err_value lsb_pb_write_bool | ( | lsb_output_buffer * | ob, |
| int | i | ||
| ) |
Writes a bool to the output buffer.
| ob | Pointer to the output data buffer. |
| i | Number to be encoded. |
| LSB_UTIL_EXPORT lsb_err_value lsb_pb_write_double | ( | lsb_output_buffer * | ob, |
| double | i | ||
| ) |
Writes a double to the output buffer.
| ob | Pointer to the output data buffer. |
| i | Double to be encoded. |
| LSB_UTIL_EXPORT lsb_err_value lsb_pb_write_key | ( | lsb_output_buffer * | ob, |
| unsigned char | tag, | ||
| unsigned char | wiretype | ||
| ) |
Writes a field key (tag id/wire type) to the output buffer.
| ob | Pointer to the output data buffer. |
| tag | Field identifier. |
| wiretype | Field wire type. |
| LSB_UTIL_EXPORT lsb_err_value lsb_pb_write_string | ( | lsb_output_buffer * | ob, |
| char | tag, | ||
| const char * | s, | ||
| size_t | len | ||
| ) |
Writes a string to the output buffer.
| ob | Pointer to the output data buffer. |
| tag | Field identifier. |
| s | String to output. |
| len | Length of s. |
| LSB_UTIL_EXPORT lsb_err_value lsb_pb_write_varint | ( | lsb_output_buffer * | ob, |
| unsigned long long | i | ||
| ) |
Writes a varint encoded number to the output buffer.
| ob | Pointer to the output data buffer. |
| i | Number to be encoded. |
1.8.11