2 * Routines for OMA UserPlane Location Protocol packet dissection
3 * Copyright 2006, Anders Broman <anders.broman@ericsson.com>
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.
25 * ref OMA-TS-ULP-V1_0-20060127-C
26 * http://www.openmobilealliance.org
34 #include <epan/packet.h>
35 #include <epan/conversation.h>
36 #include <epan/prefs.h>
41 #include "packet-ulp.h"
43 #include "packet-ber.h"
44 #include "packet-per.h"
45 #include <epan/emem.h>
46 #include "packet-tcp.h"
48 #define PNAME "OMA UserPlane Location Protocol"
52 static dissector_handle_t ulp_handle=NULL;
53 static dissector_handle_t rrlp_handle;
55 /* IANA Registered Ports
56 * oma-ulp 7275/tcp OMA UserPlane Location
57 * oma-ulp 7275/udp OMA UserPlane Location
59 guint gbl_ulp_port = 7275;
61 /* Initialize the protocol and registered fields */
62 static int proto_ulp = -1;
65 #define ULP_HEADER_SIZE 2
67 gboolean ulp_desegment = TRUE;
69 #include "packet-ulp-hf.c"
71 /* Initialize the subtree pointers */
72 static gint ett_ulp = -1;
73 #include "packet-ulp-ett.c"
75 /* Include constants */
76 #include "packet-ulp-val.h"
79 #include "packet-ulp-fn.c"
83 get_ulp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
85 /* PDU length = Message length */
86 return tvb_get_ntohs(tvb,offset);
90 dissect_ulp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
92 tcp_dissect_pdus(tvb, pinfo, tree, ulp_desegment, ULP_HEADER_SIZE,
93 get_ulp_pdu_len, dissect_ULP_PDU_PDU);
95 /*--- proto_reg_handoff_ulp ---------------------------------------*/
97 proto_reg_handoff_ulp(void)
100 ulp_handle = create_dissector_handle(dissect_ulp_tcp, proto_ulp);
102 dissector_add("tcp.port", gbl_ulp_port, ulp_handle);
104 /* application/oma-supl-ulp */
105 dissector_add_string("media_type","application/oma-supl-ulp", ulp_handle);
107 rrlp_handle = find_dissector("rrlp");
112 /*--- proto_register_ulp -------------------------------------------*/
113 void proto_register_ulp(void) {
116 static hf_register_info hf[] = {
118 #include "packet-ulp-hfarr.c"
121 /* List of subtrees */
122 static gint *ett[] = {
124 #include "packet-ulp-ettarr.c"
127 module_t *ulp_module;
130 /* Register protocol */
131 proto_ulp = proto_register_protocol(PNAME, PSNAME, PFNAME);
132 /* Register fields and subtrees */
133 proto_register_field_array(proto_ulp, hf, array_length(hf));
134 proto_register_subtree_array(ett, array_length(ett));
136 ulp_module = prefs_register_protocol(proto_ulp,proto_reg_handoff_ulp);
138 prefs_register_bool_preference(ulp_module, "desegment_ulp_messages",
139 "Reassemble ULP messages spanning multiple TCP segments",
140 "Whether the ULP dissector should reassemble messages spanning multiple TCP segments."
141 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
144 /* Register a configuration option for port */
145 prefs_register_uint_preference(ulp_module, "tcp.port",
147 "Set the TCP port for Ulp messages(IANA registerd port is 7275)",