libsignal-protocol-c  master
protobuf-c.c File Reference
#include <stdlib.h>
#include <string.h>
#include "protobuf-c.h"
Include dependency graph for protobuf-c.c:

Classes

struct  _ScannedMember
 

Macros

#define TRUE   1
 
#define FALSE   0
 
#define PROTOBUF_C__ASSERT_NOT_REACHED()   assert(0)
 
#define MAX_UINT64_ENCODED_SIZE   10
 
#define PROTOBUF_C_UNPACK_ERROR(...)
 
#define STRUCT_MEMBER_P(struct_p, struct_offset)   ((void *) ((uint8_t *) (struct_p) + (struct_offset)))
 
#define STRUCT_MEMBER(member_type, struct_p, struct_offset)   (*(member_type *) STRUCT_MEMBER_P((struct_p), (struct_offset)))
 
#define STRUCT_MEMBER_PTR(member_type, struct_p, struct_offset)   ((member_type *) STRUCT_MEMBER_P((struct_p), (struct_offset)))
 
#define ASSERT_IS_ENUM_DESCRIPTOR(desc)   assert((desc)->magic == PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC)
 
#define ASSERT_IS_MESSAGE_DESCRIPTOR(desc)   assert((desc)->magic == PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC)
 
#define ASSERT_IS_MESSAGE(message)   ASSERT_IS_MESSAGE_DESCRIPTOR((message)->descriptor)
 
#define ASSERT_IS_SERVICE_DESCRIPTOR(desc)   assert((desc)->magic == PROTOBUF_C__SERVICE_DESCRIPTOR_MAGIC)
 
#define BOUND_SIZEOF_SCANNED_MEMBER_LOG2   5
 
#define FIRST_SCANNED_MEMBER_SLAB_SIZE_LOG2   4
 
#define MAX_SCANNED_MEMBER_SLAB
 
#define REQUIRED_FIELD_BITMAP_SET(index)   (required_fields_bitmap[(index)/8] |= (1<<((index)%8)))
 
#define REQUIRED_FIELD_BITMAP_IS_SET(index)   (required_fields_bitmap[(index)/8] & (1<<((index)%8)))
 
#define CLEAR_REMAINING_N_PTRS()
 

Typedefs

typedef struct _ScannedMember ScannedMember
 
typedef void(* GenericHandler) (void *service, const ProtobufCMessage *input, ProtobufCClosure closure, void *closure_data)
 

Functions

const char * protobuf_c_version (void)
 
uint32_t protobuf_c_version_number (void)
 
void protobuf_c_buffer_simple_append (ProtobufCBuffer *buffer, size_t len, const uint8_t *data)
 
size_t protobuf_c_message_get_packed_size (const ProtobufCMessage *message)
 
size_t protobuf_c_message_pack (const ProtobufCMessage *message, uint8_t *out)
 
size_t protobuf_c_message_pack_to_buffer (const ProtobufCMessage *message, ProtobufCBuffer *buffer)
 
ProtobufCMessageprotobuf_c_message_unpack (const ProtobufCMessageDescriptor *desc, ProtobufCAllocator *allocator, size_t len, const uint8_t *data)
 
void protobuf_c_message_free_unpacked (ProtobufCMessage *message, ProtobufCAllocator *allocator)
 
void protobuf_c_message_init (const ProtobufCMessageDescriptor *descriptor, void *message)
 
protobuf_c_boolean protobuf_c_message_check (const ProtobufCMessage *message)
 
void protobuf_c_service_invoke_internal (ProtobufCService *service, unsigned method_index, const ProtobufCMessage *input, ProtobufCClosure closure, void *closure_data)
 
void protobuf_c_service_generated_init (ProtobufCService *service, const ProtobufCServiceDescriptor *descriptor, ProtobufCServiceDestroy destroy)
 
void protobuf_c_service_destroy (ProtobufCService *service)
 
const ProtobufCEnumValueprotobuf_c_enum_descriptor_get_value_by_name (const ProtobufCEnumDescriptor *desc, const char *name)
 
const ProtobufCEnumValueprotobuf_c_enum_descriptor_get_value (const ProtobufCEnumDescriptor *desc, int value)
 
const ProtobufCFieldDescriptorprotobuf_c_message_descriptor_get_field_by_name (const ProtobufCMessageDescriptor *desc, const char *name)
 
const ProtobufCFieldDescriptorprotobuf_c_message_descriptor_get_field (const ProtobufCMessageDescriptor *desc, unsigned value)
 
const ProtobufCMethodDescriptorprotobuf_c_service_descriptor_get_method_by_name (const ProtobufCServiceDescriptor *desc, const char *name)
 

Detailed Description

Support library for protoc-c generated code.

This file implements the public API used by the code generated by protoc-c.

Authors
Dave Benson and the protobuf-c authors

Macro Definition Documentation

◆ CLEAR_REMAINING_N_PTRS

#define CLEAR_REMAINING_N_PTRS ( )
Value:
for(f++;f < desc->n_fields; f++) \
{ \
field = desc->fields + f; \
if (field->label == PROTOBUF_C_LABEL_REPEATED) \
STRUCT_MEMBER (size_t, rv, field->quantifier_offset) = 0; \
}
Definition: protobuf-c.h:286

◆ MAX_SCANNED_MEMBER_SLAB

#define MAX_SCANNED_MEMBER_SLAB
Value:
(sizeof(unsigned int)*8 - 1 \
- BOUND_SIZEOF_SCANNED_MEMBER_LOG2 \
- FIRST_SCANNED_MEMBER_SLAB_SIZE_LOG2)

◆ TRUE

#define TRUE   1
Todo:
64-BIT OPTIMIZATION: certain implementations use 32-bit math even on 64-bit platforms (uint64_size, uint64_pack, parse_uint64).
Todo:
Use size_t consistently.