aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/rspro/packet-rspro-template.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2019-11-22 11:18:37 +0100
committerHarald Welte <laforge@osmocom.org>2020-09-11 23:26:34 +0200
commit46ee8ccc9834bf91e7f00cfdbf058b1d5c5a25fe (patch)
treedb8c7afd7b019fd6cf1e06a0d7d1c51c368a8857 /epan/dissectors/asn1/rspro/packet-rspro-template.c
parent105fa402841f6e83b13f2e558e73dee2d4a2a713 (diff)
WIP: Osmocom RSPRO dissector support
The Osmocom RSPRO protocol is a protocol for remote SIM card access, i.e. extending the SIM card interface between phone/mdoem (UE) and a remote SIM card reader. The primary user of this protocol is osmo-remsim software suite, which can be found at https://osmocom.org/projects/osmo-remsim/wiki RSPRO is specified in ASN.1 using BER and runs on top of the IPA multiplex (protocol-gsm_ipa.c). Change-Id: Ibcdb2c92281d05c36e3973de4d7ec4aa0cd9b207
Diffstat (limited to 'epan/dissectors/asn1/rspro/packet-rspro-template.c')
-rw-r--r--epan/dissectors/asn1/rspro/packet-rspro-template.c95
1 files changed, 95 insertions, 0 deletions
diff --git a/epan/dissectors/asn1/rspro/packet-rspro-template.c b/epan/dissectors/asn1/rspro/packet-rspro-template.c
new file mode 100644
index 0000000000..24e655e181
--- /dev/null
+++ b/epan/dissectors/asn1/rspro/packet-rspro-template.c
@@ -0,0 +1,95 @@
+/* packet-rspro.c
+ * Routines for RSPRO (Remote SIM Protocol) packet dissection
+ * (C) 2019 by Harald Welte <laforge@gnumonks.org>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <glib.h>
+#include <epan/packet.h>
+#include <epan/conversation.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#include "packet-ber.h"
+#include "packet-rspro.h"
+
+#define PNAME "Remote SIM Protocol"
+#define PSNAME "RSPRO"
+#define PFNAME "rspro"
+#define IPAC_PROTO_EXT_RSPRO 0x07
+static dissector_handle_t rspro_handle=NULL;
+
+void proto_reg_handoff_rspro(void);
+void proto_register_rspro(void);
+
+/* Initialize the protocol and registered fields */
+static int proto_rspro = -1;
+
+#include "packet-rspro-hf.c"
+
+/* Initialize the subtree pointers */
+static int ett_rspro = -1;
+
+#include "packet-rspro-ett.c"
+
+#include "packet-rspro-fn.c"
+
+
+static int
+dissect_rspro(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+{
+ proto_item *rspro_item = NULL;
+ proto_tree *rspro_tree = NULL;
+
+ /* make entry in the Protocol column on summary display */
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, PNAME);
+
+ /* create the rspro protocol tree */
+ if (tree) {
+ rspro_item = proto_tree_add_item(tree, proto_rspro, tvb, 0, -1, FALSE);
+ rspro_tree = proto_item_add_subtree(rspro_item, ett_rspro);
+
+ dissect_RsproPDU_PDU(tvb, pinfo, rspro_tree, data);
+ }
+
+ return tvb_captured_length(tvb);
+}
+
+/*--- proto_register_rspro -------------------------------------------*/
+void proto_register_rspro(void) {
+ /* List of fields */
+ static hf_register_info hf[] = {
+#include "packet-rspro-hfarr.c"
+ };
+
+ /* List of subtrees */
+ static gint *ett[] = {
+ &ett_rspro,
+#include "packet-rspro-ettarr.c"
+ };
+
+ /* Register protocol */
+ proto_rspro = proto_register_protocol(PNAME, PSNAME, PFNAME);
+ /* Register fields and subtrees */
+ proto_register_field_array(proto_rspro, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+}
+
+
+/*--- proto_reg_handoff_rspro ---------------------------------------*/
+void
+proto_reg_handoff_rspro(void)
+{
+ rspro_handle = create_dissector_handle(dissect_rspro, proto_rspro);
+ dissector_add_uint_with_preference("ipa.osmo.protocol", IPAC_PROTO_EXT_RSPRO, rspro_handle);
+}