123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- #ifndef PB_DECODE_H_INCLUDED
- #define PB_DECODE_H_INCLUDED
- #include "pb.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- struct pb_istream_s
- {
- #ifdef PB_BUFFER_ONLY
-
- int *callback;
- #else
- bool (*callback)(pb_istream_t *stream, pb_byte_t *buf, size_t count);
- #endif
- void *state;
- size_t bytes_left;
-
- #ifndef PB_NO_ERRMSG
- const char *errmsg;
- #endif
- };
-
- bool pb_decode(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct);
- bool pb_decode_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct);
- bool pb_decode_delimited(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct);
- bool pb_decode_delimited_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct);
- bool pb_decode_nullterminated(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct);
- #ifdef PB_ENABLE_MALLOC
- void pb_release(const pb_field_t fields[], void *dest_struct);
- #endif
- pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t bufsize);
- bool pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count);
- bool pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type, uint32_t *tag, bool *eof);
- bool pb_skip_field(pb_istream_t *stream, pb_wire_type_t wire_type);
- #ifndef PB_WITHOUT_64BIT
- bool pb_decode_varint(pb_istream_t *stream, uint64_t *dest);
- #else
- #define pb_decode_varint pb_decode_varint32
- #endif
- bool pb_decode_varint32(pb_istream_t *stream, uint32_t *dest);
- bool pb_decode_bool(pb_istream_t *stream, bool *dest);
- #ifndef PB_WITHOUT_64BIT
- bool pb_decode_svarint(pb_istream_t *stream, int64_t *dest);
- #else
- bool pb_decode_svarint(pb_istream_t *stream, int32_t *dest);
- #endif
- bool pb_decode_fixed32(pb_istream_t *stream, void *dest);
- #ifndef PB_WITHOUT_64BIT
- bool pb_decode_fixed64(pb_istream_t *stream, void *dest);
- #endif
- bool pb_make_string_substream(pb_istream_t *stream, pb_istream_t *substream);
- bool pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream);
- #ifdef __cplusplus
- }
- #endif
- #endif
|