Questions tagged [protobuf-c]

Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data

in this context, protobuf-c is strong related to c because the automatically generated code is C headers and implementation.

From the official site:

Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages.

205 questions
0
votes
0 answers

What is the bootstrap option in protobuf compiler?

In generator.cc file in protobuf compiler there is an option enabled from command line for "bootstrap", but the concept itself is not explained anywhere. It can be seen on this line. What is this boostrap option?
just an
  • 33
  • 5
0
votes
0 answers

How to erase repeated_field of protobuf::mutable pointer?

I have a protobuf::mutable pointer, auto del_list = message_my.mutable_del_list() I want to delete its repeated_field.h which times below 10, so I use the function below: for (auto del_item = del_list->begin(); del_item != del_list->end();) { …
0
votes
1 answer

Set elements from array pointer into protobuf in C++

I have a pointer to an array called array which is defined as uint16_t *array. I have another variable called size that shows how many elements there is. I have a field in a protobuf message defined as: required bytes array = 1; How can I use the…
Baiqing
  • 1,223
  • 2
  • 9
  • 21
0
votes
1 answer

Protobuf packed (de)serialization

Since protobuf does not support the uint16_t datatype, I have a field below describing what I have in place. uint32_t fingerprints = 1 [packed=true]; To save space, I have a C++ program that packs together two uint16_t values and add them that way,…
Baiqing
  • 1,223
  • 2
  • 9
  • 21
0
votes
1 answer

C++ protobuf BuildFile with imports/dependencies not loaded

Given the following dmp.proto file... syntax = "proto3"; import "google/protobuf/any.proto"; import "google/protobuf/descriptor.proto"; message Engine1Specific { bool enabled = 1; double field1 = 2; double field2 = 3; double…
0
votes
1 answer

nanopb - how to specify encoding of integer in proto file

How do I set a int32 to use a fixed size for encoding? In the API, it says PB_LTYPE_FIXED32 0x04 32-bit integer or floating point. But what option do I set in the .proto file to encode a int32 as a PB_LTYPE_FIXED32 as opposed to a…
Bob
  • 4,576
  • 7
  • 39
  • 107
0
votes
1 answer

nanopb/protobuf - how to force max size serialization/encoding

Documentation for pb_ostream_from_buffer says After writing, you can check stream.bytes_written to find out how much valid data there is in the buffer. This should be passed as the message length on decoding side. So ideally, when I send the…
Bob
  • 4,576
  • 7
  • 39
  • 107
0
votes
1 answer

nanopb, google-protobuf - can I set the length of the message as part of the serialized data itself?

I have a message message Msg { uint32 a; uint32 b; bool c; } When I write a message using pb_encode I notice that the amount of stream.bytes_written depends on how many of the Msg fields were changed from their default. I really do not want to send…
Bob
  • 4,576
  • 7
  • 39
  • 107
0
votes
1 answer

nanopb pb_istream_from_buffer - what is value of bufsize?

pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t bufsize); buf - Pointer to byte array to read from. bufsize Size of the byte array. What is the argument for bufsize? Is it the macro in the .pb.h file under the heading /*…
Bob
  • 4,576
  • 7
  • 39
  • 107
0
votes
0 answers

ProtocolBuffer C++ Visual Studio 2019

I am trying to build Protocolbuffer for Visual Studio 2019 x86, I followed the steps in this page https://github.com/protocolbuffers/protobuf/blob/main/cmake/README.md for release I tried: cmake -G "NMake Makefiles" ^ -DCMAKE_BUILD_TYPE=Release ^ …
0
votes
1 answer

When I'm trying to compile the Protobuf in golang, It's showing '"int" is not defined.'

While compiling the proto file, I'm getting '"int" is not defined'. 'test.proto' file syntax = "proto3"; package test; option go_package = "/;test"; message User { string FirstName = 1; string LastName = 2; string Address = 3; int…
0
votes
0 answers

How to solve "plugin failed code 127" compiling with nanopb

I am trying to compile a c++ code in an conan enviroment, here are details: Ubuntu 18.04 WSL x86-64 Windowns 10 x64 python 3.7.5 protoc 3.19.4 The project is located at /mnt/c/project The build directory is located at /mnt/c/build The build occurs…
0
votes
1 answer

How To Export Compiled Protobuf to Static Library C++

I want to make a static library containing .cc and .h files that are generated from protoc compiler to link with it from other project, I'm using C++
0
votes
0 answers

Find point of difference in two Google protobufs

I'm comparing two very large protobufs to figure out if there is a difference and if there is the point of divergence. I'm using MessageDifferencer which points out that there are differences between the two protobufs. I've been eye-balling the…
Amir
  • 421
  • 1
  • 4
  • 14
0
votes
1 answer

Generate pb.c/pb.h files using protobuf-c without anonymous members in structs

I am trying to generate some pb.c and pb.h files using protobuf-c. I have earlier use nanopb to generate the same files but need to move to protobuf-c for a new project. When generating the structure for a OneOf field, I see a difference in the…