Create a message descriptor type.
This replaces the sentinel at the end of the pb_field_t array for each message type. git-svn-id: https://svn.kapsi.fi/jpa/nanopb-dev@1007 e3a754e5-d11d-0410-8d38-ebb782a927b9
This commit is contained in:
committed by
Petteri Aimonen
parent
dcf43a6416
commit
43b8e20744
13
pb.h
13
pb.h
@@ -112,6 +112,19 @@ typedef struct {
|
||||
uint8_t bytes[1];
|
||||
} pb_bytes_array_t;
|
||||
|
||||
/* This macro is define the type of a structure for a message with N
|
||||
* fields.
|
||||
*/
|
||||
#define PB_MSG_STRUCT(N) struct { \
|
||||
unsigned int field_count; \
|
||||
pb_field_t fields[N]; \
|
||||
}
|
||||
|
||||
/* This is the visible type for generated message structures.
|
||||
* The actual number of fields at the end will vary by message type.
|
||||
*/
|
||||
typedef PB_MSG_STRUCT(1) pb_message_t;
|
||||
|
||||
/* This structure is used for giving the callback function.
|
||||
* It is stored in the message structure and filled in by the method that
|
||||
* calls pb_decode.
|
||||
|
||||
Reference in New Issue
Block a user