10#include "unionproto.pb.h"
33 return iter.submsg_desc;
46 pb_istream_t substream;
51 status =
pb_decode(&substream, messagetype, dest_struct);
66 if (type == MsgType1_fields)
70 printf(
"Got MsgType1: %d\n", msg.value);
72 else if (type == MsgType2_fields)
76 printf(
"Got MsgType2: %s\n", msg.value ?
"true" :
"false");
78 else if (type == MsgType3_fields)
82 printf(
"Got MsgType3: %d %d\n", msg.value1, msg.value2);
bool decode_unionmessage_contents(pb_istream_t *stream, const pb_msgdesc_t *messagetype, void *dest_struct)
const pb_msgdesc_t * decode_unionmessage_type(pb_istream_t *stream)
size_t fread(void *__restrict ptr, size_t size, size_t nmemb, FILE *__restrict stream)
#define PB_GET_ERROR(stream)
bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message)
bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag)
bool pb_decode(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_struct)
bool pb_make_string_substream(pb_istream_t *stream, pb_istream_t *substream)
pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t msglen)
bool pb_skip_field(pb_istream_t *stream, pb_wire_type_t wire_type)
bool pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream)
bool pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type, uint32_t *tag, bool *eof)