Harald Welte | 2d112ad | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 1 | Index: epan/dissectors/Makefile.common |
| 2 | =================================================================== |
Harald Welte | 63aba29 | 2009-07-04 04:11:21 +0200 | [diff] [blame^] | 3 | --- epan/dissectors/Makefile.common.orig 2009-07-03 22:19:54.000000000 +0200 |
| 4 | +++ epan/dissectors/Makefile.common 2009-07-03 22:20:16.000000000 +0200 |
| 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 | 2d112ad | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 13 | Index: epan/dissectors/packet-rsl.c |
| 14 | =================================================================== |
Harald Welte | 63aba29 | 2009-07-04 04:11:21 +0200 | [diff] [blame^] | 15 | --- epan/dissectors/packet-rsl.c.orig 2009-07-03 22:19:54.000000000 +0200 |
| 16 | +++ epan/dissectors/packet-rsl.c 2009-07-03 22:20:16.000000000 +0200 |
Harald Welte | 2d112ad | 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 | 63aba29 | 2009-07-04 04:11:21 +0200 | [diff] [blame^] | 25 | Index: epan/dissectors/packet-gsm_abis_ip.c |
Harald Welte | 2d112ad | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 26 | =================================================================== |
Harald Welte | d64d2ad | 2009-06-25 20:50:33 +0200 | [diff] [blame] | 27 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
Harald Welte | 63aba29 | 2009-07-04 04:11:21 +0200 | [diff] [blame^] | 28 | +++ epan/dissectors/packet-gsm_abis_ip.c 2009-07-03 22:20:16.000000000 +0200 |
Harald Welte | d64d2ad | 2009-06-25 20:50:33 +0200 | [diff] [blame] | 29 | @@ -0,0 +1,279 @@ |
Harald Welte | 63aba29 | 2009-07-04 04:11:21 +0200 | [diff] [blame^] | 30 | +/* packet-gsm_abis_ip.c |
Harald Welte | 2d112ad | 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 | 63aba29 | 2009-07-04 04:11:21 +0200 | [diff] [blame^] | 125 | +dissect_ipa_attr(tvbuff_t *tvb, int base_offs, proto_tree *tree) |
Harald Welte | 2d112ad | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 126 | +{ |
| 127 | + guint8 len, tag, attr_type; |
| 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); |
| 137 | + tag = tvb_get_guint8(tvb, offset+2); |
| 138 | + proto_tree_add_item(tree, hf_ipaccess_attr_tag, |
| 139 | + tvb, offset+2, 1, FALSE); |
| 140 | + proto_tree_add_item(tree, hf_ipaccess_attr_string, |
| 141 | + tvb, offset+3, len-1, FALSE); |
| 142 | + break; |
| 143 | + case 0x01: /* a single-byte reqest for a certain attr */ |
| 144 | + len = 0; |
| 145 | + proto_tree_add_item(tree, hf_ipaccess_attr_tag, |
| 146 | + tvb, offset+1, 1, FALSE); |
| 147 | + break; |
| 148 | + }; |
| 149 | + offset += len + 2; |
| 150 | + }; |
| 151 | + return offset; |
| 152 | +} |
| 153 | + |
| 154 | +/* Dissect an ip.access specific message */ |
| 155 | +static gint |
| 156 | +dissect_ipaccess(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
| 157 | +{ |
| 158 | + proto_item *ti; |
| 159 | + proto_tree *ipaccess_tree; |
| 160 | + guint8 msg_type; |
| 161 | + |
| 162 | + msg_type = tvb_get_guint8(tvb, 0); |
| 163 | + |
| 164 | + if (check_col(pinfo->cinfo, COL_INFO)) |
| 165 | + col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", |
| 166 | + val_to_str(msg_type, ipaccess_msgtype_vals, |
| 167 | + "unknown 0x%02x")); |
| 168 | + if (tree) { |
| 169 | + ti = proto_tree_add_item(tree, proto_ipaccess, tvb, 0, -1, FALSE); |
| 170 | + ipaccess_tree = proto_item_add_subtree(ti, ett_ipaccess); |
| 171 | + proto_tree_add_item(ipaccess_tree, hf_ipaccess_msgtype, |
| 172 | + tvb, 0, 1, FALSE); |
| 173 | + switch (msg_type) { |
| 174 | + case 4: |
| 175 | + case 5: |
Harald Welte | 63aba29 | 2009-07-04 04:11:21 +0200 | [diff] [blame^] | 176 | + dissect_ipa_attr(tvb, 1, ipaccess_tree); |
Harald Welte | 2d112ad | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 177 | + break; |
| 178 | + } |
| 179 | + } |
| 180 | + |
| 181 | + return 1; |
| 182 | +} |
| 183 | + |
| 184 | + |
| 185 | +/* Code to actually dissect the packets */ |
| 186 | +static void |
| 187 | +dissect_abisip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
| 188 | +{ |
| 189 | + |
| 190 | + int offset = 0; |
| 191 | + |
| 192 | + if (check_col(pinfo->cinfo, COL_PROTOCOL)) |
| 193 | + col_set_str(pinfo->cinfo, COL_PROTOCOL, "Abis/IP"); |
| 194 | + if (check_col(pinfo->cinfo, COL_INFO)) |
| 195 | + col_clear(pinfo->cinfo, COL_INFO); |
| 196 | + |
| 197 | + while (tvb_reported_length_remaining(tvb, offset) != 0) { |
| 198 | + proto_item *ti; |
| 199 | + proto_tree *abisip_tree; |
| 200 | + guint8 len, msg_type; |
| 201 | + tvbuff_t *next_tvb; |
| 202 | + |
| 203 | + len = tvb_get_guint8(tvb, offset+1); |
| 204 | + msg_type = tvb_get_guint8(tvb, offset+2); |
| 205 | + |
| 206 | + if (check_col(pinfo->cinfo, COL_INFO)) |
| 207 | + col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", |
| 208 | + val_to_str(msg_type, abisip_protocol_vals, |
| 209 | + "unknown 0x%02x")); |
| 210 | + |
| 211 | + if (tree) { |
Harald Welte | d64d2ad | 2009-06-25 20:50:33 +0200 | [diff] [blame] | 212 | + ti = proto_tree_add_protocol_format(tree, proto_abisip, |
| 213 | + tvb, offset, len+3, |
| 214 | + "A-bis/IP protocol ip.access, type: %s", |
| 215 | + val_to_str(msg_type, abisip_protocol_vals, |
| 216 | + "unknown 0x%02x")); |
Harald Welte | 2d112ad | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 217 | + abisip_tree = proto_item_add_subtree(ti, ett_abisip); |
| 218 | + proto_tree_add_item(abisip_tree, hf_abisip_data_len, |
| 219 | + tvb, offset+1, 1, FALSE); |
| 220 | + proto_tree_add_item(abisip_tree, hf_abisip_protocol, |
| 221 | + tvb, offset+2, 1, FALSE); |
| 222 | + } |
| 223 | + |
| 224 | + next_tvb = tvb_new_subset(tvb, offset+3, len, len); |
| 225 | + |
| 226 | + switch (msg_type) { |
| 227 | + case ABISIP_RSL: |
| 228 | + /* hand this off to the standard A-bis RSL dissector */ |
| 229 | + call_dissector(sub_handles[SUB_RSL], next_tvb, pinfo, tree); |
| 230 | + break; |
| 231 | + case ABISIP_OML: |
| 232 | + /* hand this off to the standard A-bis OML dissector */ |
Harald Welte | d64d2ad | 2009-06-25 20:50:33 +0200 | [diff] [blame] | 233 | + if (sub_handles[SUB_OML]) |
| 234 | + call_dissector(sub_handles[SUB_OML], next_tvb, |
| 235 | + pinfo, tree); |
Harald Welte | 2d112ad | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 236 | + break; |
| 237 | + case ABISIP_IPACCESS: |
| 238 | + dissect_ipaccess(next_tvb, pinfo, tree); |
| 239 | + break; |
| 240 | + } |
| 241 | + offset += len + 3; |
| 242 | + } |
| 243 | +} |
| 244 | + |
Harald Welte | 63aba29 | 2009-07-04 04:11:21 +0200 | [diff] [blame^] | 245 | +void proto_register_abis_ip(void) |
Harald Welte | 2d112ad | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 246 | +{ |
| 247 | + static hf_register_info hf[] = { |
| 248 | + {&hf_abisip_data_len, |
| 249 | + {"DataLen", "abisip.data_len", |
| 250 | + FT_UINT8, BASE_DEC, NULL, 0x0, |
| 251 | + "The length of the data (in bytes)", HFILL} |
| 252 | + }, |
| 253 | + {&hf_abisip_protocol, |
| 254 | + {"Protocol", "abisip.protocol", |
| 255 | + FT_UINT8, BASE_HEX, VALS(abisip_protocol_vals), 0x0, |
| 256 | + "The A-bis/IP Sub-Protocol", HFILL} |
| 257 | + }, |
| 258 | + }; |
| 259 | + static hf_register_info hf_ipa[] = { |
| 260 | + {&hf_ipaccess_msgtype, |
| 261 | + {"MessageType", "ipaccess.msg_type", |
| 262 | + FT_UINT8, BASE_HEX, VALS(ipaccess_msgtype_vals), 0x0, |
Harald Welte | 63aba29 | 2009-07-04 04:11:21 +0200 | [diff] [blame^] | 263 | + "Type of ip.access messsage", HFILL} |
Harald Welte | 2d112ad | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 264 | + }, |
| 265 | + {&hf_ipaccess_attr_tag, |
| 266 | + {"Tag", "ipaccess.attr_tag", |
| 267 | + FT_UINT8, BASE_HEX, VALS(ipaccess_idtag_vals), 0x0, |
| 268 | + "Attribute Tag", HFILL} |
| 269 | + }, |
| 270 | + {&hf_ipaccess_attr_string, |
| 271 | + {"String", "ipaccess.attr_string", |
| 272 | + FT_STRING, BASE_NONE, NULL, 0x0, |
| 273 | + "String attribute", HFILL} |
| 274 | + }, |
| 275 | + }; |
| 276 | + |
| 277 | + static gint *ett[] = { |
| 278 | + &ett_abisip, |
| 279 | + &ett_ipaccess, |
| 280 | + }; |
| 281 | + |
| 282 | + proto_abisip = |
Harald Welte | 63aba29 | 2009-07-04 04:11:21 +0200 | [diff] [blame^] | 283 | + proto_register_protocol("GSM A-bis/IP protocol as used by ip.access", |
| 284 | + "GSM A-bis/IP", "gsm_abis_ip"); |
Harald Welte | 2d112ad | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 285 | + proto_ipaccess = |
Harald Welte | 63aba29 | 2009-07-04 04:11:21 +0200 | [diff] [blame^] | 286 | + proto_register_protocol("GSM A-bis/IP ip.access CCM sub-protocol", |
Harald Welte | 2d112ad | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 287 | + "IPA", "ipaccess"); |
| 288 | + |
| 289 | + proto_register_field_array(proto_abisip, hf, array_length(hf)); |
| 290 | + proto_register_field_array(proto_ipaccess, hf_ipa, array_length(hf_ipa)); |
| 291 | + proto_register_subtree_array(ett, array_length(ett)); |
Harald Welte | d64d2ad | 2009-06-25 20:50:33 +0200 | [diff] [blame] | 292 | + |
| 293 | + register_dissector("gsm_abis_ip", dissect_abisip, proto_abisip); |
Harald Welte | 2d112ad | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 294 | +} |
| 295 | + |
Harald Welte | 63aba29 | 2009-07-04 04:11:21 +0200 | [diff] [blame^] | 296 | +void proto_reg_handoff_gsm_abis_ip(void) |
Harald Welte | 2d112ad | 2009-06-10 05:42:52 +0800 | [diff] [blame] | 297 | +{ |
| 298 | + dissector_handle_t abisip_handle; |
| 299 | + |
| 300 | + sub_handles[SUB_RSL] = find_dissector("gsm_abis_rsl"); |
| 301 | + sub_handles[SUB_OML] = find_dissector("gsm_abis_oml"); |
| 302 | + |
| 303 | + abisip_handle = create_dissector_handle(dissect_abisip, proto_abisip); |
| 304 | + dissector_add("tcp.port", TCP_PORT_ABISIP_PRIM, abisip_handle); |
| 305 | + dissector_add("tcp.port", TCP_PORT_ABISIP_SEC, abisip_handle); |
| 306 | + dissector_add("tcp.port", TCP_PORT_ABISIP_INST, abisip_handle); |
| 307 | + dissector_add("udp.port", TCP_PORT_ABISIP_INST, abisip_handle); |
| 308 | +} |