regenerated with new asn2eth
[obnox/wireshark/wip.git] / asn1 / ulp / packet-ulp-template.c
1 /* packet-ulp.c
2  * Routines for OMA UserPlane Location Protocol packet dissection
3  * Copyright 2006, Anders Broman <anders.broman@ericsson.com>
4  *
5  * $Id$
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
9  * Copyright 1998 Gerald Combs
10  *
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.
15  *
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.
20  *
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.
24  *
25  * ref OMA-TS-ULP-V1_0-20060127-C
26  * http://www.openmobilealliance.org
27  */
28
29 #ifdef HAVE_CONFIG_H
30 # include "config.h"
31 #endif
32
33 #include <glib.h>
34 #include <epan/packet.h>
35 #include <epan/conversation.h>
36 #include <epan/prefs.h>
37
38 #include <stdio.h>
39 #include <string.h>
40
41 #include "packet-ulp.h"
42
43 #include "packet-ber.h"
44 #include "packet-per.h"
45
46 #define PNAME  "OMA UserPlane Location Protocol"
47 #define PSNAME "ULP"
48 #define PFNAME "ulp"
49
50 static dissector_handle_t ulp_handle=NULL;
51
52 /* IANA Registered Ports  
53  * oma-ulp         7275/tcp    OMA UserPlane Location
54  * oma-ulp         7275/udp    OMA UserPlane Location
55  */
56 guint gbl_ulp_port = 7275;
57
58 /* Initialize the protocol and registered fields */
59 static int proto_ulp = -1;
60
61
62 #include "packet-ulp-hf.c"
63
64 /* Initialize the subtree pointers */
65 static gint ett_ulp = -1;
66 #include "packet-ulp-ett.c"
67
68 /* Include constants */
69 #include "packet-ulp-val.h"
70
71 #include "packet-ulp-fn.c"
72
73 /*--- proto_reg_handoff_ulp ---------------------------------------*/
74 void
75 proto_reg_handoff_ulp(void)
76 {
77
78         ulp_handle = create_dissector_handle(dissect_ULP_PDU_PDU, proto_ulp);
79
80         dissector_add("tcp.port", gbl_ulp_port, ulp_handle);
81
82         /* application/oma-supl-ulp */
83         dissector_add_string("media_type","application/oma-supl-ulp", ulp_handle);
84
85 }
86
87
88 /*--- proto_register_ulp -------------------------------------------*/
89 void proto_register_ulp(void) {
90
91   /* List of fields */
92   static hf_register_info hf[] = {
93
94 #include "packet-ulp-hfarr.c"
95   };
96
97   /* List of subtrees */
98   static gint *ett[] = {
99           &ett_ulp,
100 #include "packet-ulp-ettarr.c"
101   };
102
103   module_t *ulp_module;
104
105
106   /* Register protocol */
107   proto_ulp = proto_register_protocol(PNAME, PSNAME, PFNAME);
108   /* Register fields and subtrees */
109   proto_register_field_array(proto_ulp, hf, array_length(hf));
110   proto_register_subtree_array(ett, array_length(ett));
111
112
113   /* Register a configuration option for port */
114   ulp_module = prefs_register_protocol(proto_ulp,proto_reg_handoff_ulp);
115   prefs_register_uint_preference(ulp_module, "tcp.port",
116                                                                    "ULP TCP Port",
117                                                                    "Set the TCP port for Ulp messages(IANA registerd port is 7275)",
118                                                                    10,
119                                                                    &gbl_ulp_port);
120  
121 }
122
123
124
125