diff options
Diffstat (limited to 'epan/dissectors/asn1/rspro/packet-rspro-template.c')
-rw-r--r-- | epan/dissectors/asn1/rspro/packet-rspro-template.c | 95 |
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); +} |