Pass source ID through to JSON output.
This commit is contained in:
@@ -33,6 +33,7 @@ static void json_hello(struct buf *buf) {
|
|||||||
|
|
||||||
static void json_add_common(struct packet *packet, json_t *obj) {
|
static void json_add_common(struct packet *packet, json_t *obj) {
|
||||||
json_object_set_new(obj, "type", json_string(packet_type_names[packet->type]));
|
json_object_set_new(obj, "type", json_string(packet_type_names[packet->type]));
|
||||||
|
json_object_set_new(obj, "source_id", json_string(packet->source_id));
|
||||||
if (packet->mlat_timestamp) {
|
if (packet->mlat_timestamp) {
|
||||||
json_object_set_new(obj, "mlat_timestamp", json_integer(packet->mlat_timestamp));
|
json_object_set_new(obj, "mlat_timestamp", json_integer(packet->mlat_timestamp));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#define PACKET_DATA_LEN_MAX 14
|
#define PACKET_DATA_LEN_MAX 14
|
||||||
struct packet {
|
struct packet {
|
||||||
|
char *source_id;
|
||||||
enum {
|
enum {
|
||||||
MODE_S_SHORT,
|
MODE_S_SHORT,
|
||||||
MODE_S_LONG,
|
MODE_S_LONG,
|
||||||
|
|||||||
@@ -79,7 +79,9 @@ static void receive_read(struct peer *peer) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct packet packet = { 0 };
|
struct packet packet = {
|
||||||
|
.source_id = receive->id,
|
||||||
|
};
|
||||||
while (receive->parser_wrapper(receive, &packet)) {
|
while (receive->parser_wrapper(receive, &packet)) {
|
||||||
send_write(&packet);
|
send_write(&packet);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user