Note that there are some explanatory texts on larger screens.

plurals
  1. POprotobuf RPC structure (embedded ARM)
    primarykey
    data
    text
    <p>I need to use protobuf in embeded arm system. Need the support of pure C. The project will use a client-server architecture (C server with the java, Python clients). The project requires to consider the possibility of extending the protocol. for example - such requests will be sent to the server:</p> <pre><code>read &lt;address&gt; &lt;type&gt; &lt;count&gt; [&lt;filename&gt;] write &lt;address&gt; &lt;type&gt; &lt;value&gt; ... </code></pre> <p>where address, length, type, value - required; filename - optional. Request must contain one of the commands: write, read ... (but not more than one). I think it should be something like this:</p> <pre><code>message WriteRequest { enum ValueType { INT8 = 0 [(string)="int8"]; INT16 = 1 [(string)="int16"]; INT32 = 2 [(string)="int32"]; INT64 = 3 [(string)="int64"]; FLOAT32 = 4 [(string)="float32"]; FLOAT64 = 5 [(string)="float64"]; BYTEARRAY = 6 [(string)="bytearray"]; } required uint64 address = 1; required ValueType value_type = 2 [default = INT32]; optional int32 value_int8 = 3; optional int32 value_int16 = 4; optional int32 value_int32 = 5; optional int32 value_int64 = 6; optional float value_float32 = 7; optional double value_float64 = 8; optional bytes value_bytearray = 9; } ... message Request { enum RequestType { READ_REQUEST = 1; WRITE_REQUEST = 2; ... } required RequestType request_type = 1; optional ReadRequest read = 3; optional WriteRequest write = 4; ... } </code></pre> <p>I think like the best choice in this case - nanopb (<a href="http://koti.kapsi.fi/jpa/nanopb/" rel="nofollow">http://koti.kapsi.fi/jpa/nanopb/</a>). In my view code nanopb written very well.</p> <p>As I understand it, nanopb not support Self-describing Messages. Or any reflection methods. That's why I chose this structure. <strong>Is this structure optimal for this case? Can be a problem in the future? if will need to extend the protocol for new commands (for example: <code>listStatus &lt;id&gt; &lt;verbose&gt;</code>)?</strong></p> <p><strong>If used as a server nanopb (like this: <a href="http://code.google.com/p/nanopb/source/browse/example/server.c" rel="nofollow">http://code.google.com/p/nanopb/source/browse/example/server.c</a>), will I be able to use as a client? (as I understand, nanopb not support Services in .proto.)</strong>:</p> <pre><code>service MyService { rpc Search (Request) returns (Response); } </code></pre> <p>PS: Is it worth to use protobuf-c?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload