libsignal-protocol-c  master
Utility macros for manipulating structures
Collaboration diagram for Utility macros for manipulating structures:

Macros

#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)
 

Detailed Description

Macros and constants used to manipulate the base "classes" generated by protobuf-c. They also define limits and check correctness.

Macro Definition Documentation

◆ MAX_UINT64_ENCODED_SIZE

#define MAX_UINT64_ENCODED_SIZE   10

The maximum length of a 64-bit integer in varint encoding.

◆ STRUCT_MEMBER

#define STRUCT_MEMBER (   member_type,
  struct_p,
  struct_offset 
)    (*(member_type *) STRUCT_MEMBER_P((struct_p), (struct_offset)))

Return field in a ProtobufCMessage based on offset.

Take a pointer to a ProtobufCMessage and find the field at the offset. Cast it to the passed type.

◆ STRUCT_MEMBER_P

#define STRUCT_MEMBER_P (   struct_p,
  struct_offset 
)    ((void *) ((uint8_t *) (struct_p) + (struct_offset)))

Internal ProtobufCMessage manipulation macro.

Base macro for manipulating a ProtobufCMessage. Used by STRUCT_MEMBER() and STRUCT_MEMBER_PTR().

◆ STRUCT_MEMBER_PTR

#define STRUCT_MEMBER_PTR (   member_type,
  struct_p,
  struct_offset 
)    ((member_type *) STRUCT_MEMBER_P((struct_p), (struct_offset)))

Return field in a ProtobufCMessage based on offset.

Take a pointer to a ProtobufCMessage and find the field at the offset. Cast it to a pointer to the passed type.