2 * Routines for SMRSE Short Message Relay Service packet dissection
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #include <epan/packet.h>
32 #include <epan/asn1.h>
37 #include "packet-ber.h"
38 #include "packet-smrse.h"
40 #define PNAME "Short Message Relaying Service"
41 #define PSNAME "SMRSE"
42 #define PFNAME "smrse"
44 #define TCP_PORT_SMRSE 4321
46 /* Initialize the protocol and registered fields */
48 static int hf_smrse_reserved = -1;
49 static int hf_smrse_tag = -1;
50 static int hf_smrse_length = -1;
51 static int hf_smrse_Octet_Format = -1;
52 #include "packet-smrse-hf.c"
54 /* Initialize the subtree pointers */
55 static gint ett_smrse = -1;
56 #include "packet-smrse-ett.c"
59 #include "packet-smrse-fn.c"
61 static const value_string tag_vals[] = {
63 { 2, "AliveTestRsp" },
77 dissect_smrse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
79 proto_item *item = NULL;
80 proto_tree *tree = NULL;
85 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
87 reserved=tvb_get_guint8(tvb, 0);
88 length=tvb_get_ntohs(tvb,1);
89 tag=tvb_get_guint8(tvb, 3);
93 if( (tag<1)||(tag>11) )
97 item = proto_tree_add_item(parent_tree, proto_smrse, tvb, 0, -1, FALSE);
98 tree = proto_item_add_subtree(item, ett_smrse);
101 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMRSE");
102 if (check_col(pinfo->cinfo, COL_INFO))
103 col_set_str(pinfo->cinfo, COL_INFO, val_to_str(tag, tag_vals,"Unknown Tag:0x%02x"));
105 proto_tree_add_item(tree, hf_smrse_reserved, tvb, 0, 1, FALSE);
106 proto_tree_add_item(tree, hf_smrse_length, tvb, 1, 2, FALSE);
107 proto_tree_add_item(tree, hf_smrse_tag, tvb, 3, 1, FALSE);
115 offset=dissect_smrse_SMR_Bind(FALSE, tvb, 4, &asn1_ctx, tree, -1);
118 offset=dissect_smrse_SMR_Bind_Confirm(FALSE, tvb, 4, &asn1_ctx, tree, -1);
121 offset=dissect_smrse_SMR_Bind_Failure(FALSE, tvb, 4, &asn1_ctx, tree, -1);
124 offset=dissect_smrse_SMR_Unbind(FALSE, tvb, 4, &asn1_ctx, tree, -1);
127 offset=dissect_smrse_RPDataMT(FALSE, tvb, 4, &asn1_ctx, tree, -1);
130 offset=dissect_smrse_RPDataMO(FALSE, tvb, 4, &asn1_ctx, tree, -1);
133 offset=dissect_smrse_RPAck(FALSE, tvb, 4, &asn1_ctx, tree, -1);
136 offset=dissect_smrse_RPError(FALSE, tvb, 4, &asn1_ctx, tree, -1);
139 offset=dissect_smrse_RPAlertSC(FALSE, tvb, 4, &asn1_ctx, tree, -1);
146 /*--- proto_register_smrse ----------------------------------------------*/
147 void proto_register_smrse(void) {
150 static hf_register_info hf[] = {
151 { &hf_smrse_reserved, {
152 "Reserved", "smrse.reserved", FT_UINT8, BASE_DEC,
153 NULL, 0, "Reserved byte, must be 126", HFILL }},
155 "Tag", "smrse.tag", FT_UINT8, BASE_DEC,
156 VALS(tag_vals), 0, NULL, HFILL }},
157 { &hf_smrse_length, {
158 "Length", "smrse.length", FT_UINT16, BASE_DEC,
159 NULL, 0, "Length of SMRSE PDU", HFILL }},
160 { &hf_smrse_Octet_Format,
161 { "octet-Format", "smrse.octet_Format",
162 FT_STRING, BASE_NONE, NULL, 0,
163 "SMS-Address/address-value/octet-format", HFILL }},
165 #include "packet-smrse-hfarr.c"
168 /* List of subtrees */
169 static gint *ett[] = {
171 #include "packet-smrse-ettarr.c"
174 /* Register protocol */
175 proto_smrse = proto_register_protocol(PNAME, PSNAME, PFNAME);
177 /* Register fields and subtrees */
178 proto_register_field_array(proto_smrse, hf, array_length(hf));
179 proto_register_subtree_array(ett, array_length(ett));
184 /*--- proto_reg_handoff_smrse -------------------------------------------*/
185 void proto_reg_handoff_smrse(void) {
186 dissector_handle_t smrse_handle;
188 smrse_handle = new_create_dissector_handle(dissect_smrse, proto_smrse);
189 dissector_add("tcp.port",TCP_PORT_SMRSE, smrse_handle);