Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 1 | Index: epan/dissectors/Makefile.common |
| 2 | =================================================================== |
Harald Welte | f6f96d4 | 2009-07-10 19:41:50 +0200 | [diff] [blame] | 3 | --- epan/dissectors/Makefile.common.orig |
| 4 | +++ epan/dissectors/Makefile.common |
Harald Welte | 8f19a27 | 2009-07-04 04:11:21 +0200 | [diff] [blame] | 5 | @@ -471,6 +471,7 @@ |
| 6 | packet-gsm_a_gm.c \ |
| 7 | packet-gsm_a_rp.c \ |
| 8 | packet-gsm_a_rr.c \ |
| 9 | + packet-gsm_abis_ip.c \ |
| 10 | packet-gsm_bsslap.c \ |
| 11 | packet-gsm_bssmap_le.c \ |
| 12 | packet-gsm_sms.c \ |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 13 | Index: epan/dissectors/packet-rsl.c |
| 14 | =================================================================== |
Harald Welte | f6f96d4 | 2009-07-10 19:41:50 +0200 | [diff] [blame] | 15 | --- epan/dissectors/packet-rsl.c.orig |
| 16 | +++ epan/dissectors/packet-rsl.c |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 17 | @@ -3950,6 +3950,7 @@ |
| 18 | proto_register_field_array(proto_rsl, hf, array_length(hf)); |
| 19 | proto_register_subtree_array(ett, array_length(ett)); |
| 20 | |
| 21 | + register_dissector("gsm_abis_rsl", dissect_rsl, proto_rsl); |
| 22 | |
| 23 | } |
| 24 | |
Harald Welte | 8f19a27 | 2009-07-04 04:11:21 +0200 | [diff] [blame] | 25 | Index: epan/dissectors/packet-gsm_abis_ip.c |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 26 | =================================================================== |
Harald Welte | f6f96d4 | 2009-07-10 19:41:50 +0200 | [diff] [blame] | 27 | --- /dev/null |
| 28 | +++ epan/dissectors/packet-gsm_abis_ip.c |
| 29 | @@ -0,0 +1,284 @@ |
Harald Welte | 8f19a27 | 2009-07-04 04:11:21 +0200 | [diff] [blame] | 30 | +/* packet-gsm_abis_ip.c |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 31 | + * Routines for packet dissection of ip.access A-bis over IP |
| 32 | + * Copyright 2009 by Harald Welte <laforge@gnumonks.org> |
| 33 | + * |
| 34 | + * $Id$ |
| 35 | + * |
| 36 | + * Wireshark - Network traffic analyzer |
| 37 | + * By Gerald Combs <gerald@wireshark.org> |
| 38 | + * Copyright 1998 Gerald Combs |
| 39 | + * |
| 40 | + * This program is free software; you can redistribute it and/or |
| 41 | + * modify it under the terms of the GNU General Public License |
| 42 | + * as published by the Free Software Foundation; either version 2 |
| 43 | + * of the License, or (at your option) any later version. |
| 44 | + * |
| 45 | + * This program is distributed in the hope that it will be useful, |
| 46 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 47 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 48 | + * GNU General Public License for more details. |
| 49 | + * |
| 50 | + * You should have received a copy of the GNU General Public License |
| 51 | + * along with this program; if not, write to the Free Software |
| 52 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 53 | + */ |
| 54 | + |
| 55 | +#ifdef HAVE_CONFIG_H |
| 56 | +# include "config.h" |
| 57 | +#endif |
| 58 | + |
| 59 | +#include <glib.h> |
| 60 | + |
| 61 | +#include <epan/packet.h> |
| 62 | +#include <epan/emem.h> |
| 63 | + |
| 64 | +/* Initialize the protocol and registered fields */ |
| 65 | +static int proto_abisip = -1; |
| 66 | +static int proto_ipaccess = -1; |
| 67 | + |
| 68 | +static int hf_abisip_data_len = -1; |
| 69 | +static int hf_abisip_protocol = -1; |
| 70 | + |
| 71 | +static int hf_ipaccess_msgtype = -1; |
| 72 | +static int hf_ipaccess_attr_tag = -1; |
| 73 | +static int hf_ipaccess_attr_string = -1; |
| 74 | + |
| 75 | +/* Initialize the subtree pointers */ |
| 76 | +static gint ett_abisip = -1; |
| 77 | +static gint ett_ipaccess = -1; |
| 78 | + |
| 79 | +enum { |
| 80 | + SUB_OML, |
| 81 | + SUB_RSL, |
| 82 | + SUB_IPACCESS, |
| 83 | + |
| 84 | + SUB_MAX |
| 85 | +}; |
| 86 | + |
| 87 | +static dissector_handle_t sub_handles[SUB_MAX]; |
| 88 | + |
| 89 | +#define TCP_PORT_ABISIP_PRIM 3002 |
| 90 | +#define TCP_PORT_ABISIP_SEC 3003 |
| 91 | +#define TCP_PORT_ABISIP_INST 3006 |
| 92 | + |
| 93 | +#define ABISIP_RSL 0x00 |
| 94 | +#define ABISIP_IPACCESS 0xfe |
| 95 | +#define ABISIP_OML 0xff |
| 96 | + |
| 97 | +static const value_string abisip_protocol_vals[] = { |
| 98 | + { 0x00, "RSL" }, |
| 99 | + { 0xfe, "IPA" }, |
| 100 | + { 0xff, "OML" }, |
| 101 | + { 0, NULL } |
| 102 | +}; |
| 103 | + |
| 104 | +static const value_string ipaccess_msgtype_vals[] = { |
| 105 | + { 0x00, "PING?" }, |
| 106 | + { 0x01, "PONG!" }, |
| 107 | + { 0x04, "IDENTITY REQUEST" }, |
| 108 | + { 0x05, "IDENTITY RESPONSE" }, |
| 109 | + { 0x06, "IDENTITY CONF" }, |
| 110 | + { 0, NULL } |
| 111 | +}; |
| 112 | + |
| 113 | +static const value_string ipaccess_idtag_vals[] = { |
| 114 | + { 0x00, "Serial Number" }, |
| 115 | + { 0x01, "Unit Name" }, |
| 116 | + { 0x02, "Location" }, |
| 117 | + { 0x04, "Equipment Version" }, |
| 118 | + { 0x05, "Software Version" }, |
| 119 | + { 0x06, "IP Address" }, |
| 120 | + { 0x07, "MAC Address" }, |
| 121 | + { 0x08, "Unit ID" }, |
| 122 | +}; |
| 123 | + |
| 124 | +static gint |
Harald Welte | 8f19a27 | 2009-07-04 04:11:21 +0200 | [diff] [blame] | 125 | +dissect_ipa_attr(tvbuff_t *tvb, int base_offs, proto_tree *tree) |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 126 | +{ |
Harald Welte | f6f96d4 | 2009-07-10 19:41:50 +0200 | [diff] [blame] | 127 | + guint8 len, attr_type; |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 128 | + |
| 129 | + int offset = base_offs; |
| 130 | + |
| 131 | + while (tvb_reported_length_remaining(tvb, offset) != 0) { |
| 132 | + attr_type = tvb_get_guint8(tvb, offset); |
| 133 | + |
| 134 | + switch (attr_type) { |
| 135 | + case 0x00: /* a string prefixed by its length */ |
| 136 | + len = tvb_get_guint8(tvb, offset+1); |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 137 | + proto_tree_add_item(tree, hf_ipaccess_attr_tag, |
| 138 | + tvb, offset+2, 1, FALSE); |
| 139 | + proto_tree_add_item(tree, hf_ipaccess_attr_string, |
| 140 | + tvb, offset+3, len-1, FALSE); |
| 141 | + break; |
| 142 | + case 0x01: /* a single-byte reqest for a certain attr */ |
| 143 | + len = 0; |
| 144 | + proto_tree_add_item(tree, hf_ipaccess_attr_tag, |
| 145 | + tvb, offset+1, 1, FALSE); |
| 146 | + break; |
Harald Welte | f6f96d4 | 2009-07-10 19:41:50 +0200 | [diff] [blame] | 147 | + default: |
| 148 | + len = 0; |
| 149 | + proto_tree_add_text(tree, tvb, offset+1, 1, |
| 150 | + "unknonw attribute type 0x%02x", |
| 151 | + attr_type); |
| 152 | + break; |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 153 | + }; |
| 154 | + offset += len + 2; |
| 155 | + }; |
| 156 | + return offset; |
| 157 | +} |
| 158 | + |
| 159 | +/* Dissect an ip.access specific message */ |
| 160 | +static gint |
| 161 | +dissect_ipaccess(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
| 162 | +{ |
| 163 | + proto_item *ti; |
| 164 | + proto_tree *ipaccess_tree; |
| 165 | + guint8 msg_type; |
| 166 | + |
| 167 | + msg_type = tvb_get_guint8(tvb, 0); |
| 168 | + |
| 169 | + if (check_col(pinfo->cinfo, COL_INFO)) |
| 170 | + col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", |
| 171 | + val_to_str(msg_type, ipaccess_msgtype_vals, |
| 172 | + "unknown 0x%02x")); |
| 173 | + if (tree) { |
| 174 | + ti = proto_tree_add_item(tree, proto_ipaccess, tvb, 0, -1, FALSE); |
| 175 | + ipaccess_tree = proto_item_add_subtree(ti, ett_ipaccess); |
| 176 | + proto_tree_add_item(ipaccess_tree, hf_ipaccess_msgtype, |
| 177 | + tvb, 0, 1, FALSE); |
| 178 | + switch (msg_type) { |
| 179 | + case 4: |
| 180 | + case 5: |
Harald Welte | 8f19a27 | 2009-07-04 04:11:21 +0200 | [diff] [blame] | 181 | + dissect_ipa_attr(tvb, 1, ipaccess_tree); |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 182 | + break; |
| 183 | + } |
| 184 | + } |
| 185 | + |
| 186 | + return 1; |
| 187 | +} |
| 188 | + |
| 189 | + |
| 190 | +/* Code to actually dissect the packets */ |
| 191 | +static void |
| 192 | +dissect_abisip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
| 193 | +{ |
| 194 | + |
| 195 | + int offset = 0; |
| 196 | + |
| 197 | + if (check_col(pinfo->cinfo, COL_PROTOCOL)) |
| 198 | + col_set_str(pinfo->cinfo, COL_PROTOCOL, "Abis/IP"); |
| 199 | + if (check_col(pinfo->cinfo, COL_INFO)) |
| 200 | + col_clear(pinfo->cinfo, COL_INFO); |
| 201 | + |
| 202 | + while (tvb_reported_length_remaining(tvb, offset) != 0) { |
| 203 | + proto_item *ti; |
| 204 | + proto_tree *abisip_tree; |
| 205 | + guint8 len, msg_type; |
| 206 | + tvbuff_t *next_tvb; |
| 207 | + |
| 208 | + len = tvb_get_guint8(tvb, offset+1); |
| 209 | + msg_type = tvb_get_guint8(tvb, offset+2); |
| 210 | + |
| 211 | + if (check_col(pinfo->cinfo, COL_INFO)) |
| 212 | + col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", |
| 213 | + val_to_str(msg_type, abisip_protocol_vals, |
| 214 | + "unknown 0x%02x")); |
| 215 | + |
| 216 | + if (tree) { |
Harald Welte | dfe6619 | 2009-06-25 20:50:33 +0200 | [diff] [blame] | 217 | + ti = proto_tree_add_protocol_format(tree, proto_abisip, |
| 218 | + tvb, offset, len+3, |
| 219 | + "A-bis/IP protocol ip.access, type: %s", |
| 220 | + val_to_str(msg_type, abisip_protocol_vals, |
| 221 | + "unknown 0x%02x")); |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 222 | + abisip_tree = proto_item_add_subtree(ti, ett_abisip); |
| 223 | + proto_tree_add_item(abisip_tree, hf_abisip_data_len, |
| 224 | + tvb, offset+1, 1, FALSE); |
| 225 | + proto_tree_add_item(abisip_tree, hf_abisip_protocol, |
| 226 | + tvb, offset+2, 1, FALSE); |
| 227 | + } |
| 228 | + |
| 229 | + next_tvb = tvb_new_subset(tvb, offset+3, len, len); |
| 230 | + |
| 231 | + switch (msg_type) { |
| 232 | + case ABISIP_RSL: |
| 233 | + /* hand this off to the standard A-bis RSL dissector */ |
| 234 | + call_dissector(sub_handles[SUB_RSL], next_tvb, pinfo, tree); |
| 235 | + break; |
| 236 | + case ABISIP_OML: |
| 237 | + /* hand this off to the standard A-bis OML dissector */ |
Harald Welte | dfe6619 | 2009-06-25 20:50:33 +0200 | [diff] [blame] | 238 | + if (sub_handles[SUB_OML]) |
| 239 | + call_dissector(sub_handles[SUB_OML], next_tvb, |
| 240 | + pinfo, tree); |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 241 | + break; |
| 242 | + case ABISIP_IPACCESS: |
| 243 | + dissect_ipaccess(next_tvb, pinfo, tree); |
| 244 | + break; |
| 245 | + } |
| 246 | + offset += len + 3; |
| 247 | + } |
| 248 | +} |
| 249 | + |
Harald Welte | 8f19a27 | 2009-07-04 04:11:21 +0200 | [diff] [blame] | 250 | +void proto_register_abis_ip(void) |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 251 | +{ |
| 252 | + static hf_register_info hf[] = { |
| 253 | + {&hf_abisip_data_len, |
| 254 | + {"DataLen", "abisip.data_len", |
| 255 | + FT_UINT8, BASE_DEC, NULL, 0x0, |
| 256 | + "The length of the data (in bytes)", HFILL} |
| 257 | + }, |
| 258 | + {&hf_abisip_protocol, |
| 259 | + {"Protocol", "abisip.protocol", |
| 260 | + FT_UINT8, BASE_HEX, VALS(abisip_protocol_vals), 0x0, |
| 261 | + "The A-bis/IP Sub-Protocol", HFILL} |
| 262 | + }, |
| 263 | + }; |
| 264 | + static hf_register_info hf_ipa[] = { |
| 265 | + {&hf_ipaccess_msgtype, |
| 266 | + {"MessageType", "ipaccess.msg_type", |
| 267 | + FT_UINT8, BASE_HEX, VALS(ipaccess_msgtype_vals), 0x0, |
Harald Welte | 8f19a27 | 2009-07-04 04:11:21 +0200 | [diff] [blame] | 268 | + "Type of ip.access messsage", HFILL} |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 269 | + }, |
| 270 | + {&hf_ipaccess_attr_tag, |
| 271 | + {"Tag", "ipaccess.attr_tag", |
| 272 | + FT_UINT8, BASE_HEX, VALS(ipaccess_idtag_vals), 0x0, |
| 273 | + "Attribute Tag", HFILL} |
| 274 | + }, |
| 275 | + {&hf_ipaccess_attr_string, |
| 276 | + {"String", "ipaccess.attr_string", |
| 277 | + FT_STRING, BASE_NONE, NULL, 0x0, |
| 278 | + "String attribute", HFILL} |
| 279 | + }, |
| 280 | + }; |
| 281 | + |
| 282 | + static gint *ett[] = { |
| 283 | + &ett_abisip, |
| 284 | + &ett_ipaccess, |
| 285 | + }; |
| 286 | + |
| 287 | + proto_abisip = |
Harald Welte | 8f19a27 | 2009-07-04 04:11:21 +0200 | [diff] [blame] | 288 | + proto_register_protocol("GSM A-bis/IP protocol as used by ip.access", |
| 289 | + "GSM A-bis/IP", "gsm_abis_ip"); |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 290 | + proto_ipaccess = |
Harald Welte | 8f19a27 | 2009-07-04 04:11:21 +0200 | [diff] [blame] | 291 | + proto_register_protocol("GSM A-bis/IP ip.access CCM sub-protocol", |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 292 | + "IPA", "ipaccess"); |
| 293 | + |
| 294 | + proto_register_field_array(proto_abisip, hf, array_length(hf)); |
| 295 | + proto_register_field_array(proto_ipaccess, hf_ipa, array_length(hf_ipa)); |
| 296 | + proto_register_subtree_array(ett, array_length(ett)); |
Harald Welte | dfe6619 | 2009-06-25 20:50:33 +0200 | [diff] [blame] | 297 | + |
| 298 | + register_dissector("gsm_abis_ip", dissect_abisip, proto_abisip); |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 299 | +} |
| 300 | + |
Harald Welte | 8f19a27 | 2009-07-04 04:11:21 +0200 | [diff] [blame] | 301 | +void proto_reg_handoff_gsm_abis_ip(void) |
Harald Welte | 022d767 | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 302 | +{ |
| 303 | + dissector_handle_t abisip_handle; |
| 304 | + |
| 305 | + sub_handles[SUB_RSL] = find_dissector("gsm_abis_rsl"); |
| 306 | + sub_handles[SUB_OML] = find_dissector("gsm_abis_oml"); |
| 307 | + |
| 308 | + abisip_handle = create_dissector_handle(dissect_abisip, proto_abisip); |
| 309 | + dissector_add("tcp.port", TCP_PORT_ABISIP_PRIM, abisip_handle); |
| 310 | + dissector_add("tcp.port", TCP_PORT_ABISIP_SEC, abisip_handle); |
| 311 | + dissector_add("tcp.port", TCP_PORT_ABISIP_INST, abisip_handle); |
| 312 | + dissector_add("udp.port", TCP_PORT_ABISIP_INST, abisip_handle); |
| 313 | +} |