How to construct a protocol header using proto buf (proto3) in python3 ?

18 views
Skip to first unread message

Manomugdha Biswas

unread,
Jan 29, 2020, 7:56:58 AM1/29/20
to Protocol Buffers
Hi,
I have following .proto file.

// [START declaration]
syntax = "proto3";
package tutorial;

// [END declaration]

// [START ICMP Echo Req messages]
message ICMP {
    int32 type = 1;
    int32 code = 2;
    int32 chksm = 3;
}

Here type is of 1 byte, code is of 1 byte, chksm is of 2 bytes. if given values are type=8, code=0, chksm=0x1234 then expected output after serialization is {0x08001234}. proto-buf gives '\x08\x01\x10\x02\x18\xb4$'.

Can i get the expected output using proto-buf?

Regards,
Mano
Reply all
Reply to author
Forward
0 new messages