MOS Source Code
Loading...
Searching...
No Matches
pb_encode.c File Reference
#include "pb.h"
#include "pb_encode.h"
#include "pb_common.h"
+ Include dependency graph for pb_encode.c:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define checkreturn
 
#define pb_int64_t   int64_t
 
#define pb_uint64_t   uint64_t
 

Functions

static bool buf_write (pb_ostream_t *stream, const pb_byte_t *buf, size_t count)
 
static bool encode_array (pb_ostream_t *stream, pb_field_iter_t *field)
 
static bool pb_check_proto3_default_value (const pb_field_iter_t *field)
 
static bool encode_basic_field (pb_ostream_t *stream, const pb_field_iter_t *field)
 
static bool encode_callback_field (pb_ostream_t *stream, const pb_field_iter_t *field)
 
static bool encode_field (pb_ostream_t *stream, pb_field_iter_t *field)
 
static bool encode_extension_field (pb_ostream_t *stream, const pb_field_iter_t *field)
 
static bool default_extension_encoder (pb_ostream_t *stream, const pb_extension_t *extension)
 
static bool pb_encode_varint_32 (pb_ostream_t *stream, uint32_t low, uint32_t high)
 
static bool pb_enc_bool (pb_ostream_t *stream, const pb_field_iter_t *field)
 
static bool pb_enc_varint (pb_ostream_t *stream, const pb_field_iter_t *field)
 
static bool pb_enc_fixed (pb_ostream_t *stream, const pb_field_iter_t *field)
 
static bool pb_enc_bytes (pb_ostream_t *stream, const pb_field_iter_t *field)
 
static bool pb_enc_string (pb_ostream_t *stream, const pb_field_iter_t *field)
 
static bool pb_enc_submessage (pb_ostream_t *stream, const pb_field_iter_t *field)
 
static bool pb_enc_fixed_length_bytes (pb_ostream_t *stream, const pb_field_iter_t *field)
 
pb_ostream_t pb_ostream_from_buffer (pb_byte_t *buf, size_t bufsize)
 
bool pb_write (pb_ostream_t *stream, const pb_byte_t *buf, size_t count)
 
static bool safe_read_bool (const void *pSize)
 
bool pb_encode (pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct)
 
bool pb_encode_ex (pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct, unsigned int flags)
 
bool pb_get_encoded_size (size_t *size, const pb_msgdesc_t *fields, const void *src_struct)
 
bool pb_encode_varint (pb_ostream_t *stream, uint64_t value)
 
bool pb_encode_svarint (pb_ostream_t *stream, int64_t value)
 
bool pb_encode_fixed32 (pb_ostream_t *stream, const void *value)
 
bool pb_encode_fixed64 (pb_ostream_t *stream, const void *value)
 
bool pb_encode_tag (pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number)
 
bool pb_encode_tag_for_field (pb_ostream_t *stream, const pb_field_iter_t *field)
 
bool pb_encode_string (pb_ostream_t *stream, const pb_byte_t *buffer, size_t size)
 
bool pb_encode_submessage (pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct)
 

Macro Definition Documentation

◆ checkreturn

#define checkreturn

Definition at line 18 of file pb_encode.c.

◆ pb_int64_t

#define pb_int64_t   int64_t

Definition at line 45 of file pb_encode.c.

Referenced by pb_enc_varint().

◆ pb_uint64_t

#define pb_uint64_t   uint64_t

Function Documentation

◆ buf_write()

static bool buf_write ( pb_ostream_t * stream,
const pb_byte_t * buf,
size_t count )
static

Definition at line 53 of file pb_encode.c.

Referenced by pb_ostream_from_buffer(), and pb_write().

+ Here is the call graph for this function:

◆ encode_array()

static bool encode_array ( pb_ostream_t * stream,
pb_field_iter_t * field )
static

Definition at line 128 of file pb_encode.c.

Referenced by encode_field().

+ Here is the call graph for this function:

◆ pb_check_proto3_default_value()

static bool pb_check_proto3_default_value ( const pb_field_iter_t * field)
static

Definition at line 244 of file pb_encode.c.

Referenced by encode_field(), and pb_check_proto3_default_value().

+ Here is the call graph for this function:

◆ encode_basic_field()

static bool encode_basic_field ( pb_ostream_t * stream,
const pb_field_iter_t * field )
static

Definition at line 362 of file pb_encode.c.

Referenced by encode_array(), and encode_field().

+ Here is the call graph for this function:

◆ encode_callback_field()

static bool encode_callback_field ( pb_ostream_t * stream,
const pb_field_iter_t * field )
static

Definition at line 407 of file pb_encode.c.

Referenced by encode_field().

◆ encode_field()

static bool encode_field ( pb_ostream_t * stream,
pb_field_iter_t * field )
static

Definition at line 418 of file pb_encode.c.

Referenced by default_extension_encoder(), and pb_encode().

+ Here is the call graph for this function:

◆ encode_extension_field()

static bool encode_extension_field ( pb_ostream_t * stream,
const pb_field_iter_t * field )
static

Definition at line 487 of file pb_encode.c.

Referenced by pb_encode().

+ Here is the call graph for this function:

◆ default_extension_encoder()

static bool default_extension_encoder ( pb_ostream_t * stream,
const pb_extension_t * extension )
static

Definition at line 474 of file pb_encode.c.

Referenced by encode_extension_field().

+ Here is the call graph for this function:

◆ pb_encode_varint_32()

static bool pb_encode_varint_32 ( pb_ostream_t * stream,
uint32_t low,
uint32_t high )
static

Definition at line 573 of file pb_encode.c.

Referenced by pb_enc_varint(), and pb_encode_varint().

+ Here is the call graph for this function:

◆ pb_enc_bool()

static bool pb_enc_bool ( pb_ostream_t * stream,
const pb_field_iter_t * field )
static

Definition at line 776 of file pb_encode.c.

Referenced by encode_basic_field().

+ Here is the call graph for this function:

◆ pb_enc_varint()

static bool pb_enc_varint ( pb_ostream_t * stream,
const pb_field_iter_t * field )
static

Definition at line 783 of file pb_encode.c.

Referenced by encode_array(), encode_basic_field(), and main().

+ Here is the call graph for this function:

◆ pb_enc_fixed()

static bool pb_enc_fixed ( pb_ostream_t * stream,
const pb_field_iter_t * field )
static

Definition at line 831 of file pb_encode.c.

Referenced by encode_array(), encode_basic_field(), and main().

+ Here is the call graph for this function:

◆ pb_enc_bytes()

static bool pb_enc_bytes ( pb_ostream_t * stream,
const pb_field_iter_t * field )
static

Definition at line 856 of file pb_encode.c.

Referenced by encode_basic_field(), and main().

+ Here is the call graph for this function:

◆ pb_enc_string()

static bool pb_enc_string ( pb_ostream_t * stream,
const pb_field_iter_t * field )
static

Definition at line 877 of file pb_encode.c.

Referenced by encode_basic_field(), and main().

+ Here is the call graph for this function:

◆ pb_enc_submessage()

static bool pb_enc_submessage ( pb_ostream_t * stream,
const pb_field_iter_t * field )
static

Definition at line 930 of file pb_encode.c.

Referenced by encode_basic_field().

+ Here is the call graph for this function:

◆ pb_enc_fixed_length_bytes()

static bool pb_enc_fixed_length_bytes ( pb_ostream_t * stream,
const pb_field_iter_t * field )
static

Definition at line 949 of file pb_encode.c.

Referenced by encode_basic_field().

+ Here is the call graph for this function:

◆ pb_ostream_from_buffer()

pb_ostream_t pb_ostream_from_buffer ( pb_byte_t * buf,
size_t bufsize )

◆ pb_write()

bool pb_write ( pb_ostream_t * stream,
const pb_byte_t * buf,
size_t count )

◆ safe_read_bool()

static bool safe_read_bool ( const void * pSize)
static

Definition at line 115 of file pb_encode.c.

Referenced by encode_field(), pb_check_proto3_default_value(), and pb_enc_bool().

◆ pb_encode()

bool pb_encode ( pb_ostream_t * stream,
const pb_msgdesc_t * fields,
const void * src_struct )

◆ pb_encode_ex()

bool pb_encode_ex ( pb_ostream_t * stream,
const pb_msgdesc_t * fields,
const void * src_struct,
unsigned int flags )

Definition at line 536 of file pb_encode.c.

+ Here is the call graph for this function:

◆ pb_get_encoded_size()

bool pb_get_encoded_size ( size_t * size,
const pb_msgdesc_t * fields,
const void * src_struct )

Definition at line 557 of file pb_encode.c.

Referenced by main(), rpc_do_pb_call(), and rpc_write_result_pb().

+ Here is the call graph for this function:

◆ pb_encode_varint()

◆ pb_encode_svarint()

bool pb_encode_svarint ( pb_ostream_t * stream,
int64_t value )

Definition at line 625 of file pb_encode.c.

Referenced by main(), pb_enc_varint(), write_repeated_svarint(), and write_svarint().

+ Here is the call graph for this function:

◆ pb_encode_fixed32()

bool pb_encode_fixed32 ( pb_ostream_t * stream,
const void * value )

Definition at line 637 of file pb_encode.c.

Referenced by encode_fixed32(), pb_enc_fixed(), rand_fill_protobuf(), write_farray2(), write_fixed32(), and write_repeated_fixed32().

+ Here is the call graph for this function:

◆ pb_encode_fixed64()

bool pb_encode_fixed64 ( pb_ostream_t * stream,
const void * value )

Definition at line 654 of file pb_encode.c.

Referenced by encode_fixed64(), pb_enc_fixed(), rand_fill_protobuf(), write_double(), write_fixed64(), write_repeated_double(), and write_repeated_fixed64().

+ Here is the call graph for this function:

◆ pb_encode_tag()

bool pb_encode_tag ( pb_ostream_t * stream,
pb_wire_type_t wiretype,
uint32_t field_number )

◆ pb_encode_tag_for_field()

◆ pb_encode_string()

bool pb_encode_string ( pb_ostream_t * stream,
const pb_byte_t * buffer,
size_t size )

◆ pb_encode_submessage()

bool pb_encode_submessage ( pb_ostream_t * stream,
const pb_msgdesc_t * fields,
const void * src_struct )