Home
last modified time | relevance | path

Searched refs:stream (Results 1 – 25 of 89) sorted by relevance

1234

/nanopb-2.7.6/tests/fuzztest/
Dflakystream.c4 bool flakystream_callback(pb_istream_t *stream, pb_byte_t *buf, size_t count) in flakystream_callback() argument
6 flakystream_t *state = stream->state; in flakystream_callback()
10 stream->bytes_left = 0; in flakystream_callback()
15 PB_RETURN_ERROR(stream, "flaky error"); in flakystream_callback()
23 void flakystream_init(flakystream_t *stream, const uint8_t *buffer, size_t msglen, size_t fail_afte… in flakystream_init() argument
25 memset(stream, 0, sizeof(*stream)); in flakystream_init()
26 stream->stream.callback = flakystream_callback; in flakystream_init()
27 stream->stream.bytes_left = SIZE_MAX; in flakystream_init()
28 stream->stream.state = stream; in flakystream_init()
29 stream->buffer = buffer; in flakystream_init()
[all …]
/nanopb-2.7.6/tests/alltypes_proto3_callback/
Dencode_alltypes_callback.c13 static bool write_varint(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) in write_varint() argument
15 return pb_encode_tag_for_field(stream, field) && in write_varint()
16 pb_encode_varint(stream, (intptr_t)*arg); in write_varint()
19 static bool write_svarint(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) in write_svarint() argument
21 return pb_encode_tag_for_field(stream, field) && in write_svarint()
22 pb_encode_svarint(stream, (intptr_t)*arg); in write_svarint()
25 static bool write_fixed32(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) in write_fixed32() argument
27 return pb_encode_tag_for_field(stream, field) && in write_fixed32()
28 pb_encode_fixed32(stream, *arg); in write_fixed32()
31 static bool write_fixed64(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) in write_fixed64() argument
[all …]
/nanopb-2.7.6/tests/alltypes_callback/
Dencode_alltypes_callback.c13 static bool write_varint(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) in write_varint() argument
15 return pb_encode_tag_for_field(stream, field) && in write_varint()
16 pb_encode_varint(stream, (intptr_t)*arg); in write_varint()
19 static bool write_svarint(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) in write_svarint() argument
21 return pb_encode_tag_for_field(stream, field) && in write_svarint()
22 pb_encode_svarint(stream, (intptr_t)*arg); in write_svarint()
25 static bool write_fixed32(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) in write_fixed32() argument
27 return pb_encode_tag_for_field(stream, field) && in write_fixed32()
28 pb_encode_fixed32(stream, *arg); in write_fixed32()
31 static bool write_fixed64(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) in write_fixed64() argument
[all …]
/nanopb-2.7.6/tests/msgid/
Dencode_msgid.c14 bool write_prefix(pb_ostream_t *stream, int msgid) in write_prefix() argument
17 return pb_write(stream, &prefix, 1); in write_prefix()
25 bool encode_MyMessage1(pb_ostream_t *stream) in encode_MyMessage1() argument
29 return write_prefix(stream, MyMessage1_msgid) in encode_MyMessage1()
30 && pb_encode(stream, MyMessage1_fields, &msg); in encode_MyMessage1()
33 bool encode_MyMessage2(pb_ostream_t *stream) in encode_MyMessage2() argument
38 return write_prefix(stream, MyMessage2_msgid) in encode_MyMessage2()
39 && pb_encode(stream, MyMessage2_fields, &msg); in encode_MyMessage2()
42 bool encode_MyMessage3(pb_ostream_t *stream) in encode_MyMessage3() argument
46 return write_prefix(stream, MyMessage3_msgid) in encode_MyMessage3()
[all …]
Ddecode_msgid.c10 bool read_prefix(pb_istream_t *stream, int *msgid) in read_prefix() argument
14 if (!pb_read(stream, &prefix, 1)) in read_prefix()
23 bool handle_MyMessage1(pb_istream_t *stream) in handle_MyMessage1() argument
27 if (!pb_decode(stream, MyMessage1_fields, &msg)) in handle_MyMessage1()
34 bool handle_MyMessage2(pb_istream_t *stream) in handle_MyMessage2() argument
38 if (!pb_decode(stream, MyMessage2_fields, &msg)) in handle_MyMessage2()
46 bool handle_MyMessage3(pb_istream_t *stream) in handle_MyMessage3() argument
50 if (!pb_decode(stream, MyMessage3_fields, &msg)) in handle_MyMessage3()
60 pb_istream_t stream; in main() local
75 stream = pb_istream_from_buffer(buffer, count); in main()
[all …]
/nanopb-2.7.6/tests/io_errors/
Dio_errors.c17 bool read_callback(pb_istream_t *stream, uint8_t *buf, size_t count) in read_callback() argument
19 faulty_stream_t *state = stream->state; in read_callback()
24 PB_RETURN_ERROR(stream, "simulated"); in read_callback()
31 bool write_callback(pb_ostream_t *stream, const uint8_t *buf, size_t count) in write_callback() argument
33 faulty_stream_t *state = stream->state; in write_callback()
38 PB_RETURN_ERROR(stream, "simulated"); in write_callback()
59 pb_istream_t stream = {&read_callback, NULL, SIZE_MAX}; in main() local
65 stream.bytes_left = msglen; in main()
66 stream.state = &fs; in main()
70 status = pb_decode(&stream, AllTypes_fields, &msg); in main()
[all …]
/nanopb-2.7.6/
Dpb_encode.c23 static bool checkreturn buf_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count);
24 static bool checkreturn encode_array(pb_ostream_t *stream, pb_field_iter_t *field);
26 static bool checkreturn encode_basic_field(pb_ostream_t *stream, const pb_field_iter_t *field);
27 static bool checkreturn encode_callback_field(pb_ostream_t *stream, const pb_field_iter_t *field);
28 static bool checkreturn encode_field(pb_ostream_t *stream, pb_field_iter_t *field);
29 static bool checkreturn encode_extension_field(pb_ostream_t *stream, const pb_field_iter_t *field);
30 static bool checkreturn default_extension_encoder(pb_ostream_t *stream, const pb_extension_t *exten…
31 static bool checkreturn pb_encode_varint_32(pb_ostream_t *stream, uint32_t low, uint32_t high);
32 static bool checkreturn pb_enc_bool(pb_ostream_t *stream, const pb_field_iter_t *field);
33 static bool checkreturn pb_enc_varint(pb_ostream_t *stream, const pb_field_iter_t *field);
[all …]
Dpb_decode.c24 static bool checkreturn buf_read(pb_istream_t *stream, pb_byte_t *buf, size_t count);
25 static bool checkreturn pb_decode_varint32_eof(pb_istream_t *stream, uint32_t *dest, bool *eof);
26 static bool checkreturn read_raw_value(pb_istream_t *stream, pb_wire_type_t wire_type, pb_byte_t *b…
27 static bool checkreturn decode_basic_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field…
28 static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_fiel…
29 static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_fie…
30 static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_fi…
31 static bool checkreturn decode_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_…
32 static bool checkreturn default_extension_decoder(pb_istream_t *stream, pb_extension_t *extension, …
33 static bool checkreturn decode_extension(pb_istream_t *stream, uint32_t tag, pb_wire_type_t wire_ty…
[all …]
Dpb_encode.h38 bool (*callback)(pb_ostream_t *stream, const pb_byte_t *buf, size_t count);
67 bool pb_encode(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct);
83 bool pb_encode_ex(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct, unsigne…
124 bool pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count);
133 bool pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_iter_t *field);
137 bool pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number);
142 bool pb_encode_varint(pb_ostream_t *stream, uint64_t value);
144 bool pb_encode_varint(pb_ostream_t *stream, uint32_t value);
150 bool pb_encode_svarint(pb_ostream_t *stream, int64_t value);
152 bool pb_encode_svarint(pb_ostream_t *stream, int32_t value);
[all …]
Dpb_decode.h37 bool (*callback)(pb_istream_t *stream, pb_byte_t *buf, size_t count);
74 bool pb_decode(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_struct);
102 bool pb_decode_ex(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_struct, unsigned int…
139 bool pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count);
148 bool pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type, uint32_t *tag, bool *eof);
151 bool pb_skip_field(pb_istream_t *stream, pb_wire_type_t wire_type);
156 bool pb_decode_varint(pb_istream_t *stream, uint64_t *dest);
163 bool pb_decode_varint32(pb_istream_t *stream, uint32_t *dest);
166 bool pb_decode_bool(pb_istream_t *stream, bool *dest);
171 bool pb_decode_svarint(pb_istream_t *stream, int64_t *dest);
[all …]
/nanopb-2.7.6/tests/callbacks/
Dencode_callbacks.c9 bool encode_string(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) in encode_string() argument
13 if (!pb_encode_tag_for_field(stream, field)) in encode_string()
16 return pb_encode_string(stream, (uint8_t*)str, strlen(str)); in encode_string()
19 bool encode_int32(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) in encode_int32() argument
21 if (!pb_encode_tag_for_field(stream, field)) in encode_int32()
24 return pb_encode_varint(stream, 42); in encode_int32()
27 bool encode_fixed32(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) in encode_fixed32() argument
31 if (!pb_encode_tag_for_field(stream, field)) in encode_fixed32()
34 return pb_encode_fixed32(stream, &value); in encode_fixed32()
37 bool encode_fixed64(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) in encode_fixed64() argument
[all …]
Ddecode_callbacks.c10 bool print_string(pb_istream_t *stream, const pb_field_t *field, void **arg) in print_string() argument
15 if (stream->bytes_left > sizeof(buffer) - 1) in print_string()
18 if (!pb_read(stream, buffer, stream->bytes_left)) in print_string()
28 bool print_int32(pb_istream_t *stream, const pb_field_t *field, void **arg) in print_int32() argument
31 if (!pb_decode_varint(stream, &value)) in print_int32()
38 bool print_fixed32(pb_istream_t *stream, const pb_field_t *field, void **arg) in print_fixed32() argument
41 if (!pb_decode_fixed32(stream, &value)) in print_fixed32()
48 bool print_fixed64(pb_istream_t *stream, const pb_field_t *field, void **arg) in print_fixed64() argument
51 if (!pb_decode_fixed64(stream, &value)) in print_fixed64()
62 pb_istream_t stream; in main() local
[all …]
/nanopb-2.7.6/spm_headers/nanopb/
Dpb_encode.h38 bool (*callback)(pb_ostream_t *stream, const pb_byte_t *buf, size_t count);
67 bool pb_encode(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct);
83 bool pb_encode_ex(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct, unsigne…
124 bool pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count);
133 bool pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_iter_t *field);
137 bool pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number);
142 bool pb_encode_varint(pb_ostream_t *stream, uint64_t value);
144 bool pb_encode_varint(pb_ostream_t *stream, uint32_t value);
150 bool pb_encode_svarint(pb_ostream_t *stream, int64_t value);
152 bool pb_encode_svarint(pb_ostream_t *stream, int32_t value);
[all …]
Dpb_decode.h37 bool (*callback)(pb_istream_t *stream, pb_byte_t *buf, size_t count);
74 bool pb_decode(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_struct);
102 bool pb_decode_ex(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_struct, unsigned int…
139 bool pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count);
148 bool pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type, uint32_t *tag, bool *eof);
151 bool pb_skip_field(pb_istream_t *stream, pb_wire_type_t wire_type);
156 bool pb_decode_varint(pb_istream_t *stream, uint64_t *dest);
163 bool pb_decode_varint32(pb_istream_t *stream, uint32_t *dest);
166 bool pb_decode_bool(pb_istream_t *stream, bool *dest);
171 bool pb_decode_svarint(pb_istream_t *stream, int64_t *dest);
[all …]
/nanopb-2.7.6/tests/missing_fields/
Dmissing_fields.c16 pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); in main() local
18 if (!pb_encode(&stream, MissingField_fields, &msg)) in main()
24 size = stream.bytes_written; in main()
30 pb_istream_t stream = pb_istream_from_buffer(buffer, size); in main() local
32 if (!pb_decode(&stream, MissingField_fields, &msg)) in main()
34 printf("Decode failed: %s\n", PB_GET_ERROR(&stream)); in main()
42 pb_istream_t stream = pb_istream_from_buffer(buffer, size); in main() local
44 if (pb_decode(&stream, AllFields_fields, &msg)) in main()
/nanopb-2.7.6/examples/network_server/
Dcommon.c11 static bool write_callback(pb_ostream_t *stream, const uint8_t *buf, size_t count) in write_callback() argument
13 int fd = (intptr_t)stream->state; in write_callback()
17 static bool read_callback(pb_istream_t *stream, uint8_t *buf, size_t count) in read_callback() argument
19 int fd = (intptr_t)stream->state; in read_callback()
28 stream->bytes_left = 0; /* EOF */ in read_callback()
35 pb_ostream_t stream = {&write_callback, (void*)(intptr_t)fd, SIZE_MAX, 0}; in pb_ostream_from_socket() local
36 return stream; in pb_ostream_from_socket()
41 pb_istream_t stream = {&read_callback, (void*)(intptr_t)fd, SIZE_MAX}; in pb_istream_from_socket() local
42 return stream; in pb_istream_from_socket()
/nanopb-2.7.6/tests/raw_decode/
Draw_decode.c17 bool callback(pb_istream_t *stream, uint8_t *buf, size_t count) in callback() argument
19 FILE *file = (FILE*)stream->state; in callback()
40 stream->bytes_left = 0; in callback()
62 bool raw_decode(pb_istream_t *stream, const char *indent) in raw_decode() argument
66 while (stream->bytes_left) in raw_decode()
73 if (!pb_decode_tag(stream, &wire_type, &tag, &eof)) in raw_decode()
81 printf("ERROR: Failed to parse tag: %s\n", PB_GET_ERROR(stream)); in raw_decode()
100 if (!pb_decode_varint(stream, &value)) in raw_decode()
102 printf("\n%sERROR: Failed to parse varint: %s\n", indent, PB_GET_ERROR(stream)); in raw_decode()
114 if (!pb_decode_fixed64(stream, &value)) in raw_decode()
[all …]
/nanopb-2.7.6/examples/using_union_messages/
Ddecode.c18 const pb_msgdesc_t* decode_unionmessage_type(pb_istream_t *stream) in decode_unionmessage_type() argument
24 while (pb_decode_tag(stream, &wire_type, &tag, &eof)) in decode_unionmessage_type()
38 pb_skip_field(stream, wire_type); in decode_unionmessage_type()
44 bool decode_unionmessage_contents(pb_istream_t *stream, const pb_msgdesc_t *messagetype, void *dest… in decode_unionmessage_contents() argument
48 if (!pb_make_string_substream(stream, &substream)) in decode_unionmessage_contents()
52 pb_close_string_substream(stream, &substream); in decode_unionmessage_contents()
61 pb_istream_t stream = pb_istream_from_buffer(buffer, count); in main() local
63 const pb_msgdesc_t *type = decode_unionmessage_type(&stream); in main()
69 status = decode_unionmessage_contents(&stream, MsgType1_fields, &msg); in main()
75 status = decode_unionmessage_contents(&stream, MsgType2_fields, &msg); in main()
[all …]
/nanopb-2.7.6/tests/regression/issue_249/
Dtest.c6 static bool write_array(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) in write_array() argument
11 if (!pb_encode_tag_for_field(stream, field)) in write_array()
13 if (!pb_encode_varint(stream, 1000 + i)) in write_array()
20 static bool read_array(pb_istream_t *stream, const pb_field_t *field, void **arg) in read_array() argument
25 if (!pb_decode_varint32(stream, &i)) in read_array()
41 pb_ostream_t stream = pb_ostream_from_buffer(buf, sizeof(buf)); in main() local
43 TEST(pb_encode(&stream, MainMessage_fields, &msg)); in main()
44 msglen = stream.bytes_written; in main()
49 pb_istream_t stream = pb_istream_from_buffer(buf, msglen); in main() local
53 TEST(pb_decode(&stream, MainMessage_fields, &msg)); in main()
/nanopb-2.7.6/examples/cmake_simple/
Dsimple.c25 pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); in main() local
31 status = pb_encode(&stream, SimpleMessage_fields, &message); in main()
32 message_length = stream.bytes_written; in main()
37 printf("Encoding failed: %s\n", PB_GET_ERROR(&stream)); in main()
53 pb_istream_t stream = pb_istream_from_buffer(buffer, message_length); in main() local
56 status = pb_decode(&stream, SimpleMessage_fields, &message); in main()
61 printf("Decoding failed: %s\n", PB_GET_ERROR(&stream)); in main()
/nanopb-2.7.6/examples/simple/
Dsimple.c25 pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); in main() local
31 status = pb_encode(&stream, SimpleMessage_fields, &message); in main()
32 message_length = stream.bytes_written; in main()
37 printf("Encoding failed: %s\n", PB_GET_ERROR(&stream)); in main()
53 pb_istream_t stream = pb_istream_from_buffer(buffer, message_length); in main() local
56 status = pb_decode(&stream, SimpleMessage_fields, &message); in main()
61 printf("Decoding failed: %s\n", PB_GET_ERROR(&stream)); in main()
/nanopb-2.7.6/tests/regression/GHSA-gcx3-7m76-287p/
Dtest.c8 bool stream_callback(pb_istream_t *stream, uint8_t *buf, size_t count) in stream_callback() argument
10 FILE *file = (FILE*)stream->state; in stream_callback()
19 stream->bytes_left = 0; in stream_callback()
26 pb_istream_t stream = {&stream_callback, NULL, SIZE_MAX}; in main() local
29 stream.state = stdin; in main()
34 status = pb_decode(&stream, MyMessage_fields, &msg); in main()
36 assert(strcmp(stream.errmsg, "realloc failed") == 0); in main()
/nanopb-2.7.6/tests/any_type/
Dencode_any.c14 pb_ostream_t stream; in main() local
27 stream = pb_ostream_from_buffer(msg.details.value.bytes, sizeof(msg.details.value.bytes)); in main()
28 status = pb_encode(&stream, google_protobuf_Duration_fields, &duration); in main()
30 msg.details.value.size = stream.bytes_written; in main()
33 stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); in main()
34 if (pb_encode(&stream, BaseMessage_fields, &msg)) in main()
38 fwrite(buffer, 1, stream.bytes_written, stdout); in main()
43 fprintf(stderr, "Encoding failed: %s\n", PB_GET_ERROR(&stream)); in main()
/nanopb-2.7.6/tests/basic_stream/
Ddecode_stream.c12 bool print_person(pb_istream_t *stream) in print_person() argument
17 if (!pb_decode(stream, Person_fields, &person)) in print_person()
58 bool callback(pb_istream_t *stream, uint8_t *buf, size_t count) in callback() argument
60 FILE *file = (FILE*)stream->state; in callback()
69 stream->bytes_left = 0; in callback()
76 pb_istream_t stream = {&callback, NULL, SIZE_MAX}; in main() local
77 stream.state = stdin; in main()
80 if (!print_person(&stream)) in main()
82 printf("Parsing failed: %s\n", PB_GET_ERROR(&stream)); in main()
/nanopb-2.7.6/examples/cmake_relpath/
Dsimple.c25 pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); in main() local
32 status = pb_encode(&stream, SimpleMessage_fields, &message); in main()
33 message_length = stream.bytes_written; in main()
38 printf("Encoding failed: %s\n", PB_GET_ERROR(&stream)); in main()
54 pb_istream_t stream = pb_istream_from_buffer(buffer, message_length); in main() local
57 status = pb_decode(&stream, SimpleMessage_fields, &message); in main()
62 printf("Decoding failed: %s\n", PB_GET_ERROR(&stream)); in main()

1234