add ability to hexdump all received and transmitted messages
diff --git a/src/diag_io.c b/src/diag_io.c
index b4313bb..087eecf 100644
--- a/src/diag_io.c
+++ b/src/diag_io.c
@@ -41,6 +41,9 @@
struct diag_send_desc_type send;
struct diag_hdlc_dest_type enc = { NULL, NULL, 0 };
+ if (di->flags & DIAG_INST_F_HEXDUMP)
+ printf("Tx: %s\n", msgb_hexdump(msg));
+
send.state = DIAG_STATE_START;
send.pkt = msgb_data(msg);
send.last = msgb_data(msg) + msgb_length(msg) - 1;
@@ -128,6 +131,10 @@
msgb_free(msg);
return NULL;
}
+
+ if (di->flags & DIAG_INST_F_HEXDUMP)
+ printf("Rx: %s\n", msgb_hexdump(msg));
+
return msg;
}
diff --git a/src/diag_io.h b/src/diag_io.h
index 953a089..1dffa15 100644
--- a/src/diag_io.h
+++ b/src/diag_io.h
@@ -4,6 +4,8 @@
#include <osmocom/core/msgb.h>
#include <osmocom/core/gsmtap_util.h>
+#define DIAG_INST_F_HEXDUMP 0x00000001
+
struct diag_instance {
int fd;
struct {
@@ -12,6 +14,7 @@
struct {
} tx;
struct gsmtap_inst *gsmtap;
+ uint32_t flags;
};
struct msgb *msgb_alloc_diag(void);