The protobuf module is a simple library for parsing Protocol Buffers messages in the form of bitstrings. It has the following API:
Message = [
[{field_number, FieldNumber}, {field_type, FieldType}, {value, Value}]
, ...].
Message = parse_message(BitString)
BitString = parse_message(Message)
- create a messageencode_signed(Int, 32)
- convert signed int32 to Procol Buffers wire format (ZigZag)encode_signed(Int, 64)
- convert signed int64 to ZigZag formatdecode_signed(Int)
- convert ZigZag number to signed integer
Example code:
BitString = <<16#12, 16#07, 16#74, 16#65, 16#73, 16#74, 16#69, 16#6e, 16#67, 16#08, 16#96, 16#01>>.
Message = protobuf:parse_message(BitString).