2 * Routines for OMA Internal Location Protocol packet dissection
3 * Copyright 2006, e.yimjia <jy.m12.0@gmail.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 * ref OMA-TS-ILP-V2_0_1-20121205-A
24 * http://www.openmobilealliance.org
29 #include <epan/packet.h>
30 #include <epan/prefs.h>
31 #include <epan/asn1.h>
33 #include "packet-per.h"
34 #include "packet-tcp.h"
35 #include "packet-gsm_map.h"
36 #include "packet-e164.h"
37 #include "packet-e212.h"
39 #define PNAME "OMA Internal Location Protocol"
43 void proto_register_ilp(void);
45 static dissector_handle_t rrlp_handle;
46 static dissector_handle_t lpp_handle;
48 /* IANA Registered Ports
49 * oma-ilp 7276/tcp OMA Internal Location
51 static guint gbl_ilp_port = 7276;
53 /* Initialize the protocol and registered fields */
54 static int proto_ilp = -1;
57 #define ILP_HEADER_SIZE 2
59 static gboolean ilp_desegment = TRUE;
61 #include "packet-ilp-hf.c"
62 static int hf_ilp_mobile_directory_number = -1;
64 /* Initialize the subtree pointers */
65 static gint ett_ilp = -1;
66 static gint ett_ilp_setid = -1;
67 #include "packet-ilp-ett.c"
69 /* Include constants */
70 #include "packet-ilp-val.h"
73 #include "packet-ilp-fn.c"
77 get_ilp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
79 /* PDU length = Message length */
80 return tvb_get_ntohs(tvb,offset);
84 dissect_ilp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
86 tcp_dissect_pdus(tvb, pinfo, tree, ilp_desegment, ILP_HEADER_SIZE,
87 get_ilp_pdu_len, dissect_ILP_PDU_PDU, data);
88 return tvb_captured_length(tvb);
91 void proto_reg_handoff_ilp(void);
93 /*--- proto_register_ilp -------------------------------------------*/
94 void proto_register_ilp(void) {
97 static hf_register_info hf[] = {
99 #include "packet-ilp-hfarr.c"
100 { &hf_ilp_mobile_directory_number,
101 { "Mobile Directory Number", "ilp.mobile_directory_number",
102 FT_STRING, BASE_NONE, NULL, 0,
106 /* List of subtrees */
107 static gint *ett[] = {
110 #include "packet-ilp-ettarr.c"
113 module_t *ilp_module;
116 /* Register protocol */
117 proto_ilp = proto_register_protocol(PNAME, PSNAME, PFNAME);
118 register_dissector("ilp", dissect_ilp_tcp, proto_ilp);
120 /* Register fields and subtrees */
121 proto_register_field_array(proto_ilp, hf, array_length(hf));
122 proto_register_subtree_array(ett, array_length(ett));
124 ilp_module = prefs_register_protocol(proto_ilp,proto_reg_handoff_ilp);
126 prefs_register_bool_preference(ilp_module, "desegment_ilp_messages",
127 "Reassemble ILP messages spanning multiple TCP segments",
128 "Whether the ILP dissector should reassemble messages spanning multiple TCP segments."
129 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
132 /* Register a configuration option for port */
133 prefs_register_uint_preference(ilp_module, "tcp.port",
135 "Set the TCP port for ILP messages(IANA registered port is 7276)",
142 /*--- proto_reg_handoff_ilp ---------------------------------------*/
144 proto_reg_handoff_ilp(void)
146 static gboolean initialized = FALSE;
147 static dissector_handle_t ilp_handle;
148 static guint local_ilp_port;
151 ilp_handle = find_dissector("ilp");
152 dissector_add_string("media_type","application/oma-supl-ilp", ilp_handle);
153 rrlp_handle = find_dissector("rrlp");
154 lpp_handle = find_dissector("lpp");
157 dissector_delete_uint("tcp.port", local_ilp_port, ilp_handle);
160 local_ilp_port = gbl_ilp_port;
161 dissector_add_uint("tcp.port", gbl_ilp_port, ilp_handle);