Change in simtrace2[master]: sniff: send ATR over GSMTAP

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Kévin Redon gerrit-no-reply at lists.osmocom.org
Fri Jul 27 18:19:07 UTC 2018


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 <kredon at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180727/96c6f17a/attachment.htm>


More information about the gerrit-log mailing list