Add hop limit to json and proto formats.

This commit is contained in:
Ian Gulliver
2016-03-03 22:00:02 -08:00
parent 455bee2676
commit 45abe06467
10 changed files with 78 additions and 19 deletions

View File

@@ -43,6 +43,7 @@ static void proto_wrap_to_buf(Adsb *msg, struct buf *buf) {
static void proto_serialize_packet(struct packet *packet, AdsbPacket *out, size_t len) {
out->source_id = (char *) packet->source_id;
out->hops = packet->hops;
if (packet->mlat_timestamp) {
out->mlat_timestamp = packet->mlat_timestamp;
out->has_mlat_timestamp = true;
@@ -165,7 +166,9 @@ static bool proto_parse_packet(AdsbPacket *in, struct packet *packet, struct pro
if (!packet_validate_id((const uint8_t *) in->source_id)) {
return false;
}
packet->source_id = (uint8_t *) in->source_id;
packet->hops = (uint16_t) in->hops;
memcpy(packet->payload, in->payload.data, len);
if (in->has_mlat_timestamp) {