Kévin Redon has uploaded this change for review. ( 
https://gerrit.osmocom.org/10204


Change subject: sniff: send ATR over GSMTAP
......................................................................

sniff: send ATR over GSMTAP

Change-Id: Id35129883f08002a4a796b56954a128e2b533245
---
M host/simtrace2-sniff.c
1 file changed, 14 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/04/10204/1

diff --git a/host/simtrace2-sniff.c b/host/simtrace2-sniff.c
index 776253a..6d5766f 100644
--- a/host/simtrace2-sniff.c
+++ b/host/simtrace2-sniff.c
@@ -65,7 +65,7 @@
 /* global GSMTAP instance */
 static struct gsmtap_inst *g_gti;

-static int gsmtap_send_sim(const uint8_t *apdu, unsigned int len)
+static int gsmtap_send_sim(uint8_t sub_type, const uint8_t *data, unsigned int 
len)
 {
        struct gsmtap_hdr *gh;
        unsigned int gross_len = len + sizeof(*gh);
@@ -80,8 +80,9 @@
        gh->version = GSMTAP_VERSION;
        gh->hdr_len = sizeof(*gh)/4;
        gh->type = GSMTAP_TYPE_SIM;
+       gh->sub_type = sub_type;

-       memcpy(buf + sizeof(*gh), apdu, len);
+       memcpy(buf + sizeof(*gh), data, len);

        rc = write(gsmtap_inst_fd(g_gti), buf, gross_len);
        if (rc < 0) {
@@ -235,9 +236,17 @@
        }
        printf("\n");

-       if (SIMTRACE_MSGT_SNIFF_TPDU == type) {
-               /* send TPDU (now considered as APDU) to GSMTAP */
-               gsmtap_send_sim(data->data, data->length);
+       /* Send message as GSNTAP */
+       switch (type) {
+       case SIMTRACE_MSGT_SNIFF_ATR:
+               gsmtap_send_sim(GSMTAP_SIM_ATR, data->data, data->length);
+               break;
+       case SIMTRACE_MSGT_SNIFF_TPDU:
+               /* TPDU is now considered as APDU since SIMtrace sends complete 
TPDU */
+               gsmtap_send_sim(GSMTAP_SIM_APDU, data->data, data->length);
+               break;
+       default:
+               break;
        }

        return 0;

--
To view, visit https://gerrit.osmocom.org/10204
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id35129883f08002a4a796b56954a128e2b533245
Gerrit-Change-Number: 10204
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon <kre...@sysmocom.de>

Reply via email to