Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions
protobuf_lang_tree.h File Reference
#include <wireshark.h>
#include <stdio.h>
#include <stdarg.h>

Go to the source code of this file.

Classes

struct  pbl_descriptor_pool_t
 
struct  pbl_file_descriptor_t
 
struct  pbl_node_t
 
struct  pbl_method_descriptor_t
 
struct  pbl_message_descriptor_t
 
struct  pbl_enum_value_descriptor_t
 
struct  pbl_field_descriptor_t
 Describes a field in a Protocol Buffer message, similar to google::protobuf::FieldDescriptor. More...
 
struct  pbl_enum_descriptor_t
 
struct  pbl_option_descriptor_t
 
struct  _protobuf_lang_token_t
 
struct  _protobuf_lang_state_t
 

Macros

#define PBL_DEFAULT_PACKAGE_NAME   ""
 

Typedefs

typedef void(* pbl_report_error_cb_t) (const char *msg_format,...)
 
typedef struct pbl_node_t pbl_node_t
 
typedef struct _protobuf_lang_token_t protobuf_lang_token_t
 
typedef struct _protobuf_lang_state_t protobuf_lang_state_t
 

Enumerations

enum  pbl_node_type_t {
  PBL_UNKNOWN = 0 , PBL_PACKAGE , PBL_MESSAGE , PBL_FIELD ,
  PBL_ONEOF , PBL_MAP_FIELD , PBL_ENUM , PBL_ENUM_VALUE ,
  PBL_SERVICE , PBL_METHOD , PBL_OPTIONS , PBL_OPTION
}
 

Functions

void pbl_reinit_descriptor_pool (pbl_descriptor_pool_t **ppool, const char **directories, pbl_report_error_cb_t error_cb)
 
void pbl_free_pool (pbl_descriptor_pool_t *pool)
 Free a descriptor pool and its associated resources.
 
bool pbl_add_proto_file_to_be_parsed (pbl_descriptor_pool_t *pool, const char *filepath)
 Adds a Protocol Buffers file to be parsed.
 
int run_pbl_parser (pbl_descriptor_pool_t *pool)
 Runs the Protocol Buffers Language parser.
 
const pbl_method_descriptor_tpbl_message_descriptor_pool_FindMethodByName (const pbl_descriptor_pool_t *pool, const char *name)
 Finds a method descriptor by its name in a message descriptor pool.
 
const char * pbl_method_descriptor_name (const pbl_method_descriptor_t *method)
 Retrieves the name of a method descriptor.
 
const char * pbl_method_descriptor_full_name (const pbl_method_descriptor_t *method)
 Retrieves the full name of a method descriptor.
 
const pbl_message_descriptor_tpbl_method_descriptor_input_type (const pbl_method_descriptor_t *method)
 Retrieves the input message descriptor type for a method.
 
const pbl_message_descriptor_tpbl_method_descriptor_output_type (const pbl_method_descriptor_t *method)
 Retrieves the output type of a method descriptor.
 
const pbl_message_descriptor_tpbl_message_descriptor_pool_FindMessageTypeByName (const pbl_descriptor_pool_t *pool, const char *name)
 Finds a message descriptor by its name in a descriptor pool.
 
const char * pbl_message_descriptor_name (const pbl_message_descriptor_t *message)
 Retrieves the name of a message descriptor.
 
const char * pbl_message_descriptor_full_name (const pbl_message_descriptor_t *message)
 Retrieves the full name of a message descriptor.
 
int pbl_message_descriptor_field_count (const pbl_message_descriptor_t *message)
 Get the count of fields in a message descriptor.
 
const pbl_field_descriptor_tpbl_message_descriptor_field (const pbl_message_descriptor_t *message, int field_index)
 Retrieves a field descriptor from a message descriptor by index.
 
const pbl_field_descriptor_tpbl_message_descriptor_FindFieldByNumber (const pbl_message_descriptor_t *message, int number)
 Finds a field descriptor by its number in a message descriptor.
 
const pbl_field_descriptor_tpbl_message_descriptor_FindFieldByName (const pbl_message_descriptor_t *message, const char *name)
 Finds a field descriptor by name in a message descriptor.
 
const char * pbl_field_descriptor_full_name (const pbl_field_descriptor_t *field)
 Retrieves the full name of a field descriptor.
 
const char * pbl_field_descriptor_name (const pbl_field_descriptor_t *field)
 Retrieves the name of a field descriptor.
 
int pbl_field_descriptor_number (const pbl_field_descriptor_t *field)
 Retrieves the number associated with a field descriptor.
 
int pbl_field_descriptor_type (const pbl_field_descriptor_t *field)
 Get the type of a field descriptor.
 
int pbl_field_descriptor_is_repeated (const pbl_field_descriptor_t *field)
 Checks if a field descriptor is repeated.
 
int pbl_field_descriptor_is_packed (const pbl_field_descriptor_t *field)
 Checks if a field descriptor is packed.
 
const char * pbl_field_descriptor_TypeName (wmem_allocator_t *scope, int field_type)
 Retrieves the type name for a given field type.
 
const pbl_message_descriptor_tpbl_field_descriptor_message_type (const pbl_field_descriptor_t *field)
 Retrieves the message type descriptor for a field.
 
const pbl_enum_descriptor_tpbl_field_descriptor_enum_type (const pbl_field_descriptor_t *field)
 Get the enum descriptor for a field.
 
bool pbl_field_descriptor_is_required (const pbl_field_descriptor_t *field)
 Checks if a field descriptor is required.
 
bool pbl_field_descriptor_has_default_value (const pbl_field_descriptor_t *field)
 Checks if a field descriptor has a default value.
 
int32_t pbl_field_descriptor_default_value_int32 (const pbl_field_descriptor_t *field)
 Retrieves the default value for an int32 field descriptor.
 
int64_t pbl_field_descriptor_default_value_int64 (const pbl_field_descriptor_t *field)
 Retrieves the default value of a field descriptor as an int64.
 
uint32_t pbl_field_descriptor_default_value_uint32 (const pbl_field_descriptor_t *field)
 Retrieves the default value of a field descriptor as a uint32.
 
uint64_t pbl_field_descriptor_default_value_uint64 (const pbl_field_descriptor_t *field)
 Retrieves the default value of a field descriptor as a 64-bit unsigned integer.
 
float pbl_field_descriptor_default_value_float (const pbl_field_descriptor_t *field)
 Retrieves the default value of a float field descriptor.
 
double pbl_field_descriptor_default_value_double (const pbl_field_descriptor_t *field)
 Retrieves the default value of a double field descriptor.
 
bool pbl_field_descriptor_default_value_bool (const pbl_field_descriptor_t *field)
 Retrieves the default value of a boolean field descriptor.
 
const char * pbl_field_descriptor_default_value_string (const pbl_field_descriptor_t *field, int *size)
 Get the default value string of a Protocol Buffers field descriptor.
 
const pbl_enum_value_descriptor_tpbl_field_descriptor_default_value_enum (const pbl_field_descriptor_t *field)
 Retrieves the default value enum for a field descriptor.
 
const char * pbl_enum_descriptor_name (const pbl_enum_descriptor_t *anEnum)
 Get the name of an enum descriptor.
 
const char * pbl_enum_descriptor_full_name (const pbl_enum_descriptor_t *anEnum)
 Get the full name of an enum descriptor.
 
int pbl_enum_descriptor_value_count (const pbl_enum_descriptor_t *anEnum)
 Get the count of values in an enum descriptor.
 
const pbl_enum_value_descriptor_tpbl_enum_descriptor_value (const pbl_enum_descriptor_t *anEnum, int value_index)
 Retrieves an enum value descriptor by its index.
 
const pbl_enum_value_descriptor_tpbl_enum_descriptor_FindValueByNumber (const pbl_enum_descriptor_t *anEnum, int number)
 Finds an enumeration value descriptor by its number.
 
const pbl_enum_value_descriptor_tpbl_enum_descriptor_FindValueByName (const pbl_enum_descriptor_t *anEnum, const char *name)
 Finds an enumeration value descriptor by name within a given enumeration descriptor.
 
const char * pbl_enum_value_descriptor_name (const pbl_enum_value_descriptor_t *enumValue)
 Retrieves the name of an enum value descriptor.
 
const char * pbl_enum_value_descriptor_full_name (const pbl_enum_value_descriptor_t *enumValue)
 Get the full name of an enum value descriptor.
 
int pbl_enum_value_descriptor_number (const pbl_enum_value_descriptor_t *enumValue)
 Retrieves the number associated with an enum value descriptor.
 
void pbl_foreach_message (const pbl_descriptor_pool_t *pool, void(*cb)(const pbl_message_descriptor_t *, void *), void *userdata)
 Iterates over all message descriptors in a descriptor pool.
 
pbl_node_tpbl_create_node (pbl_file_descriptor_t *file, int lineno, pbl_node_type_t nodetype, const char *name)
 Creates a new node in the Protocol Buffers language tree.
 
pbl_node_tpbl_set_node_name (pbl_node_t *node, int lineno, const char *newname)
 Set the name of a node.
 
const char * pbl_get_node_full_name (pbl_node_t *node)
 Get the full name of a node.
 
pbl_node_tpbl_add_child (pbl_node_t *parent, pbl_node_t *child)
 Adds a child node to a parent node.
 
pbl_node_tpbl_create_enum_value_node (pbl_file_descriptor_t *file, int lineno, const char *name, int number)
 Create a new enum value node.
 
pbl_node_tpbl_merge_children (pbl_node_t *to, pbl_node_t *from)
 Merges children from one node to another.
 
pbl_node_tpbl_create_field_node (pbl_file_descriptor_t *file, int lineno, const char *label, const char *type_name, const char *name, int number, pbl_node_t *options)
 Create a field node for a Protocol Buffers message.
 
pbl_node_tpbl_create_map_field_node (pbl_file_descriptor_t *file, int lineno, const char *name, int number, pbl_node_t *options)
 Create a map field node in the Protocol Buffers language tree.
 
pbl_node_tpbl_create_method_node (pbl_file_descriptor_t *file, int lineno, const char *name, const char *in_msg_type, bool in_is_stream, const char *out_msg_type, bool out_is_stream)
 Create a method node for Protocol Buffers.
 
pbl_node_tpbl_create_option_node (pbl_file_descriptor_t *file, int lineno, const char *name, const char *value)
 Creates a new option node for Protocol Buffers Language Tree.
 
void pbl_free_node (void *anode)
 Frees a protocol buffer language tree node.
 

Detailed Description

Routines of building and reading Protocol Buffers Language grammar tree. Copyright 2019, Huang Qiangxiong qiang.nosp@m.xion.nosp@m.g.hua.nosp@m.ng@q.nosp@m.q.com

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

Function Documentation

◆ pbl_add_child()

pbl_node_t * pbl_add_child ( pbl_node_t parent,
pbl_node_t child 
)

Adds a child node to a parent node.

Parameters
parentThe parent node to which the child will be added.
childThe child node to add.
Returns
pbl_node_t* The updated parent node with the child added, or NULL if an error occurred.

◆ pbl_add_proto_file_to_be_parsed()

bool pbl_add_proto_file_to_be_parsed ( pbl_descriptor_pool_t pool,
const char *  filepath 
)

Adds a Protocol Buffers file to be parsed.

Parameters
poolThe descriptor pool to which the file will be added.
filepathThe path to the Protocol Buffers file.

◆ pbl_create_enum_value_node()

pbl_node_t * pbl_create_enum_value_node ( pbl_file_descriptor_t file,
int  lineno,
const char *  name,
int  number 
)

Create a new enum value node.

Parameters
fileThe file descriptor associated with this node.
linenoThe line number in the source code where this node is created.
nameThe name of the enum value.
numberThe numeric value of the enum.
Returns
pbl_node_t* A pointer to the newly created enum value node.

◆ pbl_create_field_node()

pbl_node_t * pbl_create_field_node ( pbl_file_descriptor_t file,
int  lineno,
const char *  label,
const char *  type_name,
const char *  name,
int  number,
pbl_node_t options 
)

Create a field node for a Protocol Buffers message.

Parameters
fileThe file descriptor associated with the message.
linenoThe line number in the source code where this function is called.
labelThe label of the field, indicating if it's required, repeated, or optional.
type_nameThe name of the data type of the field.
nameThe name of the field.
numberThe unique identifier for the field within the message.
optionsA node containing additional options for the field.
Returns
pbl_node_t* A pointer to the created field node.

◆ pbl_create_map_field_node()

pbl_node_t * pbl_create_map_field_node ( pbl_file_descriptor_t file,
int  lineno,
const char *  name,
int  number,
pbl_node_t options 
)

Create a map field node in the Protocol Buffers language tree.

Parameters
filePointer to the file descriptor.
linenoLine number where this node is defined.
nameName of the map field.
numberField number.
optionsOptions for the map field.
Returns
pbl_node_t* Pointer to the created map field node.

◆ pbl_create_method_node()

pbl_node_t * pbl_create_method_node ( pbl_file_descriptor_t file,
int  lineno,
const char *  name,
const char *  in_msg_type,
bool  in_is_stream,
const char *  out_msg_type,
bool  out_is_stream 
)

Create a method node for Protocol Buffers.

Parameters
filePointer to the file descriptor.
linenoLine number in the source code.
nameName of the method.
in_msg_typeType of the input message.
in_is_streamIndicates if the input is a stream.
out_msg_typeType of the output message.
out_is_streamIndicates if the output is a stream.
Returns
Pointer to the created method node.

◆ pbl_create_node()

pbl_node_t * pbl_create_node ( pbl_file_descriptor_t file,
int  lineno,
pbl_node_type_t  nodetype,
const char *  name 
)

Creates a new node in the Protocol Buffers language tree.

Parameters
fileThe file descriptor associated with the node.
linenoThe line number where the node is defined.
nodetypeThe type of the node to create.
nameThe name of the node.
Returns
pbl_node_t* A pointer to the newly created node, or NULL if an invalid node type is provided.

◆ pbl_create_option_node()

pbl_node_t * pbl_create_option_node ( pbl_file_descriptor_t file,
int  lineno,
const char *  name,
const char *  value 
)

Creates a new option node for Protocol Buffers Language Tree.

Parameters
filePointer to the file descriptor.
linenoLine number where the node is created.
nameName of the option.
valueValue of the option, can be NULL.
Returns
pbl_node_t* Pointer to the newly created option node.

◆ pbl_enum_descriptor_FindValueByName()

const pbl_enum_value_descriptor_t * pbl_enum_descriptor_FindValueByName ( const pbl_enum_descriptor_t anEnum,
const char *  name 
)

Finds an enumeration value descriptor by name within a given enumeration descriptor.

Parameters
anEnumPointer to the enumeration descriptor.
nameThe name of the enumeration value descriptor to find.
Returns
const char* Pointer to the found enumeration value descriptor, or NULL if not found.

◆ pbl_enum_descriptor_FindValueByNumber()

const pbl_enum_value_descriptor_t * pbl_enum_descriptor_FindValueByNumber ( const pbl_enum_descriptor_t anEnum,
int  number 
)

Finds an enumeration value descriptor by its number.

Parameters
anEnumPointer to the enumeration descriptor.
numberThe number of the enumeration value to find.
Returns
const pbl_enum_value_descriptor_t* Pointer to the found enumeration value descriptor, or NULL if not found.

◆ pbl_enum_descriptor_full_name()

const char * pbl_enum_descriptor_full_name ( const pbl_enum_descriptor_t anEnum)

Get the full name of an enum descriptor.

Parameters
anEnumPointer to the enum descriptor.
Returns
const char* Full name of the enum descriptor.

◆ pbl_enum_descriptor_name()

const char * pbl_enum_descriptor_name ( const pbl_enum_descriptor_t anEnum)

Get the name of an enum descriptor.

Parameters
anEnumPointer to the enum descriptor.
Returns
const char* The name of the enum descriptor.

◆ pbl_enum_descriptor_value()

const pbl_enum_value_descriptor_t * pbl_enum_descriptor_value ( const pbl_enum_descriptor_t anEnum,
int  value_index 
)

Retrieves an enum value descriptor by its index.

Parameters
anEnumPointer to the enum descriptor.
value_indexIndex of the enum value descriptor to retrieve.
Returns
const pbl_enum_value_descriptor_t* Pointer to the enum value descriptor, or NULL if not found.

◆ pbl_enum_descriptor_value_count()

int pbl_enum_descriptor_value_count ( const pbl_enum_descriptor_t anEnum)

Get the count of values in an enum descriptor.

Parameters
anEnumPointer to the enum descriptor.
Returns
int The number of values in the enum descriptor.

◆ pbl_enum_value_descriptor_full_name()

const char * pbl_enum_value_descriptor_full_name ( const pbl_enum_value_descriptor_t enumValue)

Get the full name of an enum value descriptor.

Parameters
enumValuePointer to the enum value descriptor.
Returns
const char* The full name of the enum value descriptor.

◆ pbl_enum_value_descriptor_name()

const char * pbl_enum_value_descriptor_name ( const pbl_enum_value_descriptor_t enumValue)

Retrieves the name of an enum value descriptor.

Parameters
enumValuePointer to the enum value descriptor.
Returns
const char* The name of the enum value descriptor.

◆ pbl_enum_value_descriptor_number()

int pbl_enum_value_descriptor_number ( const pbl_enum_value_descriptor_t enumValue)

Retrieves the number associated with an enum value descriptor.

Parameters
enumValuePointer to the enum value descriptor.
Returns
The number of the enum value.

◆ pbl_field_descriptor_default_value_bool()

bool pbl_field_descriptor_default_value_bool ( const pbl_field_descriptor_t field)

Retrieves the default value of a boolean field descriptor.

Parameters
fieldPointer to the field descriptor.
Returns
The default value as a boolean.

◆ pbl_field_descriptor_default_value_double()

double pbl_field_descriptor_default_value_double ( const pbl_field_descriptor_t field)

Retrieves the default value of a double field descriptor.

Parameters
fieldPointer to the field descriptor.
Returns
The default value of the double field.

◆ pbl_field_descriptor_default_value_enum()

const pbl_enum_value_descriptor_t * pbl_field_descriptor_default_value_enum ( const pbl_field_descriptor_t field)

Retrieves the default value enum for a field descriptor.

Parameters
fieldThe field descriptor to query.
Returns
const pbl_enum_value_descriptor_t* The default value enum, or NULL if not applicable.

◆ pbl_field_descriptor_default_value_float()

float pbl_field_descriptor_default_value_float ( const pbl_field_descriptor_t field)

Retrieves the default value of a float field descriptor.

Parameters
fieldPointer to the pbl_field_descriptor_t structure.
Returns
The default value as a float.

◆ pbl_field_descriptor_default_value_int32()

int32_t pbl_field_descriptor_default_value_int32 ( const pbl_field_descriptor_t field)

Retrieves the default value for an int32 field descriptor.

Parameters
fieldPointer to the pbl_field_descriptor_t structure.
Returns
The default value of the int32 field.

◆ pbl_field_descriptor_default_value_int64()

int64_t pbl_field_descriptor_default_value_int64 ( const pbl_field_descriptor_t field)

Retrieves the default value of a field descriptor as an int64.

Parameters
fieldPointer to the pbl_field_descriptor_t structure.
Returns
The default value of the field as an int64.

◆ pbl_field_descriptor_default_value_string()

const char * pbl_field_descriptor_default_value_string ( const pbl_field_descriptor_t field,
int *  size 
)

Get the default value string of a Protocol Buffers field descriptor.

Parameters
fieldPointer to the Protocol Buffers field descriptor.
sizePointer to an integer where the length of the default value string will be stored.
Returns
const char* The default value string.

◆ pbl_field_descriptor_default_value_uint32()

uint32_t pbl_field_descriptor_default_value_uint32 ( const pbl_field_descriptor_t field)

Retrieves the default value of a field descriptor as a uint32.

Parameters
fieldThe field descriptor from which to retrieve the default value.
Returns
The default value of the field as a uint32.

◆ pbl_field_descriptor_default_value_uint64()

uint64_t pbl_field_descriptor_default_value_uint64 ( const pbl_field_descriptor_t field)

Retrieves the default value of a field descriptor as a 64-bit unsigned integer.

Parameters
fieldPointer to the field descriptor.
Returns
The default value of the field as a 64-bit unsigned integer.

◆ pbl_field_descriptor_enum_type()

const pbl_enum_descriptor_t * pbl_field_descriptor_enum_type ( const pbl_field_descriptor_t field)

Get the enum descriptor for a field.

Parameters
fieldThe field descriptor to query.
Returns
const pbl_enum_descriptor_t* The enum descriptor if the field is of type ENUM, otherwise NULL.

◆ pbl_field_descriptor_full_name()

const char * pbl_field_descriptor_full_name ( const pbl_field_descriptor_t field)

Retrieves the full name of a field descriptor.

Parameters
fieldPointer to the field descriptor.
Returns
const char* The full name of the field.

◆ pbl_field_descriptor_has_default_value()

bool pbl_field_descriptor_has_default_value ( const pbl_field_descriptor_t field)

Checks if a field descriptor has a default value.

Parameters
fieldThe field descriptor to check.
Returns
int 1 if the field has a default value, 0 otherwise.

◆ pbl_field_descriptor_is_packed()

int pbl_field_descriptor_is_packed ( const pbl_field_descriptor_t field)

Checks if a field descriptor is packed.

Parameters
fieldThe field descriptor to check.
Returns
true If the field is packed, false otherwise.

◆ pbl_field_descriptor_is_repeated()

int pbl_field_descriptor_is_repeated ( const pbl_field_descriptor_t field)

Checks if a field descriptor is repeated.

Parameters
fieldPointer to the field descriptor.
Returns
1 if the field is repeated, 0 otherwise.

◆ pbl_field_descriptor_is_required()

bool pbl_field_descriptor_is_required ( const pbl_field_descriptor_t field)

Checks if a field descriptor is required.

Parameters
fieldThe field descriptor to check.
Returns
true if the field is required, false otherwise.

◆ pbl_field_descriptor_message_type()

const pbl_message_descriptor_t * pbl_field_descriptor_message_type ( const pbl_field_descriptor_t field)

Retrieves the message type descriptor for a field.

Parameters
fieldThe field descriptor to query.
Returns
const pbl_message_descriptor_t* Pointer to the message type descriptor, or NULL if not applicable.

◆ pbl_field_descriptor_name()

const char * pbl_field_descriptor_name ( const pbl_field_descriptor_t field)

Retrieves the name of a field descriptor.

Parameters
fieldPointer to the field descriptor.
Returns
The name of the field descriptor.

◆ pbl_field_descriptor_number()

int pbl_field_descriptor_number ( const pbl_field_descriptor_t field)

Retrieves the number associated with a field descriptor.

Parameters
fieldPointer to the field descriptor structure.
Returns
The number of the field descriptor.

◆ pbl_field_descriptor_type()

int pbl_field_descriptor_type ( const pbl_field_descriptor_t field)

Get the type of a field descriptor.

Parameters
fieldThe field descriptor to query.
Returns
The type of the field descriptor.

◆ pbl_field_descriptor_TypeName()

const char * pbl_field_descriptor_TypeName ( wmem_allocator_t scope,
int  field_type 
)

Retrieves the type name for a given field type.

Parameters
scopeMemory allocator scope.
field_typeThe field type to retrieve the type name for.
Returns
const char* The type name of the field type, or "UNKNOWN_FIELD_TYPE(%d)" if not found.

◆ pbl_foreach_message()

void pbl_foreach_message ( const pbl_descriptor_pool_t pool,
void(*)(const pbl_message_descriptor_t *, void *)  cb,
void *  userdata 
)

Iterates over all message descriptors in a descriptor pool.

Parameters
poolThe descriptor pool to iterate over.
cbCallback function to call for each message descriptor.
userdataUser data to pass to the callback function.

◆ pbl_free_node()

void pbl_free_node ( void *  anode)

Frees a protocol buffer language tree node.

This function releases all resources associated with a given protocol buffer language tree node and sets it to NULL.

Parameters
anodePointer to the node to be freed.

◆ pbl_free_pool()

void pbl_free_pool ( pbl_descriptor_pool_t pool)

Free a descriptor pool and its associated resources.

Parameters
poolThe descriptor pool to free.

◆ pbl_get_node_full_name()

const char * pbl_get_node_full_name ( pbl_node_t node)

Get the full name of a node.

Parameters
nodeThe node to get the full name for.
Returns
const char* The full name of the node, or NULL if not available.

◆ pbl_merge_children()

pbl_node_t * pbl_merge_children ( pbl_node_t to,
pbl_node_t from 
)

Merges children from one node to another.

This function merges all children from the 'from' node into the 'to' node. It then frees the resources associated with the 'from' node's children.

Parameters
toThe target node to which children will be added.
fromThe source node from which children will be taken.
Returns
pbl_node_t* The target node after merging.

◆ pbl_message_descriptor_field()

const pbl_field_descriptor_t * pbl_message_descriptor_field ( const pbl_message_descriptor_t message,
int  field_index 
)

Retrieves a field descriptor from a message descriptor by index.

Parameters
messageThe message descriptor to search.
field_indexThe index of the field descriptor to retrieve.
Returns
const pbl_field_descriptor_t* A pointer to the field descriptor, or NULL if not found.

◆ pbl_message_descriptor_field_count()

int pbl_message_descriptor_field_count ( const pbl_message_descriptor_t message)

Get the count of fields in a message descriptor.

Parameters
messagePointer to the message descriptor.
Returns
int The number of fields in the message descriptor.

◆ pbl_message_descriptor_FindFieldByName()

const pbl_field_descriptor_t * pbl_message_descriptor_FindFieldByName ( const pbl_message_descriptor_t message,
const char *  name 
)

Finds a field descriptor by name in a message descriptor.

Parameters
messageThe message descriptor to search within.
nameThe name of the field descriptor to find.
Returns
const char* A pointer to the found field descriptor, or NULL if not found.

◆ pbl_message_descriptor_FindFieldByNumber()

const pbl_field_descriptor_t * pbl_message_descriptor_FindFieldByNumber ( const pbl_message_descriptor_t message,
int  number 
)

Finds a field descriptor by its number in a message descriptor.

Parameters
messageThe message descriptor to search within.
numberThe number of the field descriptor to find.
Returns
const pbl_field_descriptor_t* A pointer to the found field descriptor, or NULL if not found.

◆ pbl_message_descriptor_full_name()

const char * pbl_message_descriptor_full_name ( const pbl_message_descriptor_t message)

Retrieves the full name of a message descriptor.

Parameters
messagePointer to the message descriptor.
Returns
const char* The full name of the message descriptor.

◆ pbl_message_descriptor_name()

const char * pbl_message_descriptor_name ( const pbl_message_descriptor_t message)

Retrieves the name of a message descriptor.

Parameters
messagePointer to the message descriptor.
Returns
const char* The full name of the message descriptor.

◆ pbl_message_descriptor_pool_FindMessageTypeByName()

const pbl_message_descriptor_t * pbl_message_descriptor_pool_FindMessageTypeByName ( const pbl_descriptor_pool_t pool,
const char *  name 
)

Finds a message descriptor by its name in a descriptor pool.

Parameters
poolThe descriptor pool to search within.
nameThe name of the message descriptor to find.
Returns
const pbl_message_descriptor_t* A pointer to the found message descriptor, or NULL if not found.

◆ pbl_message_descriptor_pool_FindMethodByName()

const pbl_method_descriptor_t * pbl_message_descriptor_pool_FindMethodByName ( const pbl_descriptor_pool_t pool,
const char *  name 
)

Finds a method descriptor by its name in a message descriptor pool.

Parameters
poolThe message descriptor pool to search within.
nameThe name of the method descriptor to find.
Returns
A pointer to the found method descriptor, or NULL if not found.

◆ pbl_method_descriptor_full_name()

const char * pbl_method_descriptor_full_name ( const pbl_method_descriptor_t method)

Retrieves the full name of a method descriptor.

Parameters
methodPointer to the method descriptor.
Returns
The full name of the method descriptor as a string.

◆ pbl_method_descriptor_input_type()

const pbl_message_descriptor_t * pbl_method_descriptor_input_type ( const pbl_method_descriptor_t method)

Retrieves the input message descriptor type for a method.

Parameters
methodPointer to the method descriptor.
Returns
const pbl_message_descriptor_t* Pointer to the input message descriptor, or NULL if not found.

◆ pbl_method_descriptor_name()

const char * pbl_method_descriptor_name ( const pbl_method_descriptor_t method)

Retrieves the name of a method descriptor.

Parameters
methodPointer to the method descriptor.
Returns
The name of the method descriptor.

◆ pbl_method_descriptor_output_type()

const pbl_message_descriptor_t * pbl_method_descriptor_output_type ( const pbl_method_descriptor_t method)

Retrieves the output type of a method descriptor.

Parameters
methodThe method descriptor to query.
Returns
const pbl_message_descriptor_t* A pointer to the message descriptor if found, otherwise NULL.

◆ pbl_reinit_descriptor_pool()

void pbl_reinit_descriptor_pool ( pbl_descriptor_pool_t **  ppool,
const char **  directories,
pbl_report_error_cb_t  error_cb 
)

Reinitialize the protocol buffers pool according to proto files directories.

Parameters
ppoolThe output descriptor_pool will be created. If *pool is not NULL, it will free it first.
directoriesThe root directories containing proto files. Must end with NULL element.
error_cbThe error reporter callback function.

◆ pbl_set_node_name()

pbl_node_t * pbl_set_node_name ( pbl_node_t node,
int  lineno,
const char *  newname 
)

Set the name of a node.

Parameters
nodePointer to the node whose name is to be set.
linenoLine number where this function was called (for debugging purposes).
newnameNew name for the node.
Returns
pbl_node_t* Pointer to the modified node.

◆ run_pbl_parser()

int run_pbl_parser ( pbl_descriptor_pool_t pool)

Runs the Protocol Buffers Language parser.

Parameters
poolThe descriptor pool to parse.
Returns
0 on success, non-zero on failure.