32#define protobuf_field_type_VALUE_STRING_LIST(XXX) \
33 XXX(PROTOBUF_TYPE_NONE, 0, "") \
34 XXX(PROTOBUF_TYPE_DOUBLE, 1, "double") \
35 XXX(PROTOBUF_TYPE_FLOAT, 2, "float") \
36 XXX(PROTOBUF_TYPE_INT64, 3, "int64") \
37 XXX(PROTOBUF_TYPE_UINT64, 4, "uint64") \
38 XXX(PROTOBUF_TYPE_INT32, 5, "int32") \
39 XXX(PROTOBUF_TYPE_FIXED64, 6, "fixed64") \
40 XXX(PROTOBUF_TYPE_FIXED32, 7, "fixed32") \
41 XXX(PROTOBUF_TYPE_BOOL, 8, "bool") \
42 XXX(PROTOBUF_TYPE_STRING, 9, "string") \
43 XXX(PROTOBUF_TYPE_GROUP, 10, "group") \
44 XXX(PROTOBUF_TYPE_MESSAGE, 11, "message") \
45 XXX(PROTOBUF_TYPE_BYTES, 12, "bytes") \
46 XXX(PROTOBUF_TYPE_UINT32, 13, "uint32") \
47 XXX(PROTOBUF_TYPE_ENUM, 14, "enum") \
48 XXX(PROTOBUF_TYPE_SFIXED32, 15, "sfixed32") \
49 XXX(PROTOBUF_TYPE_SFIXED64, 16, "sfixed64") \
50 XXX(PROTOBUF_TYPE_SINT32, 17, "sint32") \
51 XXX(PROTOBUF_TYPE_SINT64, 18, "sint64")
53#define PROTOBUF_MAX_FIELD_TYPE 18
55VALUE_STRING_ENUM(protobuf_field_type);
56VALUE_STRING_ARRAY_GLOBAL_DCL(protobuf_field_type);
59typedef struct PbwDescriptorPool PbwDescriptorPool;
61typedef struct PbwMethodDescriptor PbwMethodDescriptor;
63typedef struct PbwDescriptor PbwDescriptor;
65typedef struct PbwFieldDescriptor PbwFieldDescriptor;
67typedef struct PbwEnumDescriptor PbwEnumDescriptor;
69typedef struct PbwEnumValueDescriptor PbwEnumValueDescriptor;
71typedef void(*pbw_report_error_cb_t)(
const char *msg_format, ...);
100const PbwMethodDescriptor*
192const PbwFieldDescriptor*
203const PbwFieldDescriptor*
214const PbwFieldDescriptor*
305const PbwEnumDescriptor*
417const PbwEnumValueDescriptor*
458const PbwEnumValueDescriptor*
469const PbwEnumValueDescriptor*
480const PbwEnumValueDescriptor*
522pbw_foreach_message(
const PbwDescriptorPool* pool,
void (*cb)(
const PbwDescriptor* message,
void* userdata),
void* userdata);
const char * pbw_EnumValueDescriptor_full_name(const PbwEnumValueDescriptor *enumValue)
Get the full name of an enum value descriptor.
Definition protobuf-helper.c:284
int pbw_FieldDescriptor_number(const PbwFieldDescriptor *field)
Retrieves the number associated with a Protocol Buffers field descriptor.
Definition protobuf-helper.c:134
int pbw_Descriptor_field_count(const PbwDescriptor *message)
Get the count of fields in a Protocol Buffers descriptor.
Definition protobuf-helper.c:98
const char * pbw_EnumDescriptor_name(const PbwEnumDescriptor *anEnum)
Get the name of an enum descriptor.
Definition protobuf-helper.c:242
const PbwMethodDescriptor * pbw_DescriptorPool_FindMethodByName(const PbwDescriptorPool *pool, const char *name)
Finds a method descriptor by name in a descriptor pool.
Definition protobuf-helper.c:50
const char * pbw_FieldDescriptor_full_name(const PbwFieldDescriptor *field)
Get the full name of a field descriptor.
Definition protobuf-helper.c:122
bool pbw_FieldDescriptor_default_value_bool(const PbwFieldDescriptor *field)
Get the default value of a boolean field descriptor.
Definition protobuf-helper.c:224
double pbw_FieldDescriptor_default_value_double(const PbwFieldDescriptor *field)
Retrieves the default value of a double field descriptor.
Definition protobuf-helper.c:218
const char * pbw_EnumDescriptor_full_name(const PbwEnumDescriptor *anEnum)
Get the full name of an enum descriptor.
Definition protobuf-helper.c:248
const char * pbw_EnumValueDescriptor_name(const PbwEnumValueDescriptor *enumValue)
Get the name of an EnumValueDescriptor.
Definition protobuf-helper.c:278
const PbwFieldDescriptor * pbw_Descriptor_FindFieldByNumber(const PbwDescriptor *message, int number)
Finds a field descriptor by its number in a message descriptor.
Definition protobuf-helper.c:110
const PbwDescriptor * pbw_MethodDescriptor_input_type(const PbwMethodDescriptor *method)
Retrieves the input type descriptor for a method.
Definition protobuf-helper.c:68
const char * pbw_Descriptor_name(const PbwDescriptor *message)
Retrieves the name of a Protocol Buffers descriptor.
Definition protobuf-helper.c:92
bool pbw_FieldDescriptor_has_default_value(const PbwFieldDescriptor *field)
Check if a field descriptor has a default value.
Definition protobuf-helper.c:182
const char * pbw_FieldDescriptor_default_value_string(const PbwFieldDescriptor *field, int *size)
Get the default value string of a protobuf field descriptor.
Definition protobuf-helper.c:230
int32_t pbw_FieldDescriptor_default_value_int32(const PbwFieldDescriptor *field)
Retrieves the default value for an int32 field descriptor.
Definition protobuf-helper.c:188
const char * pbw_MethodDescriptor_name(const PbwMethodDescriptor *method)
Get the name of a Protocol Buffers method descriptor.
Definition protobuf-helper.c:56
const PbwEnumValueDescriptor * pbw_EnumDescriptor_FindValueByNumber(const PbwEnumDescriptor *anEnum, int number)
Finds an enum value descriptor by its number.
Definition protobuf-helper.c:266
int pbw_FieldDescriptor_is_repeated(const PbwFieldDescriptor *field)
Check if a field descriptor is repeated.
Definition protobuf-helper.c:146
bool pbw_FieldDescriptor_is_required(const PbwFieldDescriptor *field)
Check if a field descriptor is required.
Definition protobuf-helper.c:176
const PbwDescriptor * pbw_MethodDescriptor_output_type(const PbwMethodDescriptor *method)
Retrieves the output type of a method descriptor.
Definition protobuf-helper.c:74
int64_t pbw_FieldDescriptor_default_value_int64(const PbwFieldDescriptor *field)
Retrieves the default value for a field descriptor as an int64.
Definition protobuf-helper.c:194
float pbw_FieldDescriptor_default_value_float(const PbwFieldDescriptor *field)
Retrieves the default value of a float field descriptor.
Definition protobuf-helper.c:212
void pbw_foreach_message(const PbwDescriptorPool *pool, void(*cb)(const PbwDescriptor *message, void *userdata), void *userdata)
Iterates over all messages in a descriptor pool and applies a callback function to each.
Definition protobuf-helper.c:296
const char * pbw_FieldDescriptor_name(const PbwFieldDescriptor *field)
Retrieves the name of a Protocol Buffers field descriptor.
Definition protobuf-helper.c:128
int pbw_FieldDescriptor_type(const PbwFieldDescriptor *field)
Get the type of a Protocol Buffers field descriptor.
Definition protobuf-helper.c:140
int pbw_load_proto_file(PbwDescriptorPool *pool, const char *filename)
Loads a Protocol Buffers file into the descriptor pool.
Definition protobuf-helper.c:40
int pbw_EnumDescriptor_value_count(const PbwEnumDescriptor *anEnum)
Get the count of values in an enum descriptor.
Definition protobuf-helper.c:254
uint64_t pbw_FieldDescriptor_default_value_uint64(const PbwFieldDescriptor *field)
Get the default value for a uint64 field descriptor.
Definition protobuf-helper.c:206
const PbwEnumValueDescriptor * pbw_EnumDescriptor_value(const PbwEnumDescriptor *anEnum, int value_index)
Retrieves a PbwEnumValueDescriptor by its index.
Definition protobuf-helper.c:260
const char * pbw_Descriptor_full_name(const PbwDescriptor *message)
Get the full name of a Protocol Buffers descriptor.
Definition protobuf-helper.c:86
const char * pbw_MethodDescriptor_full_name(const PbwMethodDescriptor *method)
Get the full name of a method descriptor.
Definition protobuf-helper.c:62
const PbwFieldDescriptor * pbw_Descriptor_field(const PbwDescriptor *message, int field_index)
Retrieves a field descriptor by index from a message descriptor.
Definition protobuf-helper.c:104
uint32_t pbw_FieldDescriptor_default_value_uint32(const PbwFieldDescriptor *field)
Retrieves the default value for a uint32 field descriptor.
Definition protobuf-helper.c:200
const PbwEnumValueDescriptor * pbw_FieldDescriptor_default_value_enum(const PbwFieldDescriptor *field)
Get the default value of an enum field descriptor.
Definition protobuf-helper.c:236
int pbw_FieldDescriptor_is_packed(const PbwFieldDescriptor *field)
Checks if the given field descriptor is packed.
Definition protobuf-helper.c:152
const PbwDescriptor * pbw_FieldDescriptor_message_type(const PbwFieldDescriptor *field)
Retrieves the message type associated with a Protocol Buffers field descriptor.
Definition protobuf-helper.c:164
int pbw_EnumValueDescriptor_number(const PbwEnumValueDescriptor *enumValue)
Get the number associated with a Protocol Buffers enum value descriptor.
Definition protobuf-helper.c:290
const char * pbw_FieldDescriptor_typeName(wmem_allocator_t *scope, int field_type)
Retrieves the type name for a given field type.
Definition protobuf-helper.c:158
void pbw_reinit_DescriptorPool(PbwDescriptorPool **pool, const char **directories, pbw_report_error_cb_t error_cb)
Definition protobuf-helper.c:33
const PbwDescriptor * pbw_DescriptorPool_FindMessageTypeByName(const PbwDescriptorPool *pool, const char *name)
Finds a message type by its name in a descriptor pool.
Definition protobuf-helper.c:80
const PbwFieldDescriptor * pbw_Descriptor_FindFieldByName(const PbwDescriptor *message, const char *name)
Finds a field descriptor by name in a message descriptor.
Definition protobuf-helper.c:116
const PbwEnumDescriptor * pbw_FieldDescriptor_enum_type(const PbwFieldDescriptor *field)
Get the enum type of a field descriptor.
Definition protobuf-helper.c:170
const PbwEnumValueDescriptor * pbw_EnumDescriptor_FindValueByName(const PbwEnumDescriptor *anEnum, const char *name)
Finds a value descriptor by name in an enum descriptor.
Definition protobuf-helper.c:272
Internal memory allocator interface used by the wmem subsystem.
Definition wmem_allocator.h:34