diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2014-03-13 14:46:42 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-03-13 15:19:11 +0000 |
commit | b1a05d5517d5da0e84f21c72c78c77a5e735bb86 (patch) | |
tree | 085d8bad3f51a7309fa60e2be4de5200c20506ad | |
parent | 73618c8d1c82ad64a6f6e885fbc72367082d1b26 (diff) |
ULP: add UDP transport
and fix indent (use 2 spaces)
Change-Id: I558616e3030a55a845cd4ba31ac32f08bdf8376d
Reviewed-on: https://code.wireshark.org/review/634
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | asn1/ulp/packet-ulp-template.c | 70 | ||||
-rw-r--r-- | epan/dissectors/packet-ulp.c | 82 |
2 files changed, 86 insertions, 66 deletions
diff --git a/asn1/ulp/packet-ulp-template.c b/asn1/ulp/packet-ulp-template.c index 40d9d751af..56fb0b930a 100644 --- a/asn1/ulp/packet-ulp-template.c +++ b/asn1/ulp/packet-ulp-template.c @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * ref OMA-TS-ULP-V1_0-20060127-C + * ref OMA-TS-ULP-V2_0-20100806-D * http://www.openmobilealliance.org */ @@ -48,7 +48,8 @@ static dissector_handle_t lpp_handle; * oma-ulp 7275/tcp OMA UserPlane Location * oma-ulp 7275/udp OMA UserPlane Location */ -static guint gbl_ulp_port = 7275; +static guint gbl_ulp_tcp_port = 7275; +static guint gbl_ulp_udp_port = 7275; /* Initialize the protocol and registered fields */ static int proto_ulp = -1; @@ -74,16 +75,16 @@ static gint ett_ulp = -1; static guint get_ulp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) { - /* PDU length = Message length */ - return tvb_get_ntohs(tvb,offset); + /* PDU length = Message length */ + return tvb_get_ntohs(tvb,offset); } static int dissect_ulp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { - tcp_dissect_pdus(tvb, pinfo, tree, ulp_desegment, ULP_HEADER_SIZE, - get_ulp_pdu_len, dissect_ULP_PDU_PDU, data); - return tvb_length(tvb); + tcp_dissect_pdus(tvb, pinfo, tree, ulp_desegment, ULP_HEADER_SIZE, + get_ulp_pdu_len, dissect_ULP_PDU_PDU, data); + return tvb_length(tvb); } void proto_reg_handoff_ulp(void); @@ -99,7 +100,7 @@ void proto_register_ulp(void) { /* List of subtrees */ static gint *ett[] = { - &ett_ulp, + &ett_ulp, #include "packet-ulp-ettarr.c" }; @@ -117,17 +118,22 @@ void proto_register_ulp(void) { ulp_module = prefs_register_protocol(proto_ulp,proto_reg_handoff_ulp); prefs_register_bool_preference(ulp_module, "desegment_ulp_messages", - "Reassemble ULP messages spanning multiple TCP segments", - "Whether the ULP dissector should reassemble messages spanning multiple TCP segments." - " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", - &ulp_desegment); + "Reassemble ULP messages spanning multiple TCP segments", + "Whether the ULP dissector should reassemble messages spanning multiple TCP segments." + " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", + &ulp_desegment); /* Register a configuration option for port */ prefs_register_uint_preference(ulp_module, "tcp.port", "ULP TCP Port", - "Set the TCP port for ULP messages(IANA registered port is 7275)", + "Set the TCP port for ULP messages (IANA registered port is 7275)", 10, - &gbl_ulp_port); + &gbl_ulp_tcp_port); + prefs_register_uint_preference(ulp_module, "udp.port", + "ULP UDP Port", + "Set the UDP port for ULP messages (IANA registered port is 7275)", + 10, + &gbl_ulp_udp_port); } @@ -136,21 +142,25 @@ void proto_register_ulp(void) { void proto_reg_handoff_ulp(void) { - static gboolean initialized = FALSE; - static dissector_handle_t ulp_handle; - static guint local_ulp_port; - - if (!initialized) { - ulp_handle = find_dissector("ulp"); - dissector_add_string("media_type","application/oma-supl-ulp", ulp_handle); - rrlp_handle = find_dissector("rrlp"); - lpp_handle = find_dissector("lpp"); - initialized = TRUE; - } else { - dissector_delete_uint("tcp.port", local_ulp_port, ulp_handle); - } - - local_ulp_port = gbl_ulp_port; - dissector_add_uint("tcp.port", gbl_ulp_port, ulp_handle); + static gboolean initialized = FALSE; + static dissector_handle_t ulp_tcp_handle, ulp_udp_handle; + static guint local_ulp_tcp_port, local_ulp_udp_port; + + if (!initialized) { + ulp_tcp_handle = find_dissector("ulp"); + dissector_add_string("media_type","application/oma-supl-ulp", ulp_tcp_handle); + ulp_udp_handle = new_create_dissector_handle(dissect_ULP_PDU_PDU, proto_ulp); + rrlp_handle = find_dissector("rrlp"); + lpp_handle = find_dissector("lpp"); + initialized = TRUE; + } else { + dissector_delete_uint("tcp.port", local_ulp_tcp_port, ulp_tcp_handle); + dissector_delete_uint("udp.port", local_ulp_udp_port, ulp_udp_handle); + } + + local_ulp_tcp_port = gbl_ulp_tcp_port; + dissector_add_uint("tcp.port", gbl_ulp_tcp_port, ulp_tcp_handle); + local_ulp_udp_port = gbl_ulp_udp_port; + dissector_add_uint("udp.port", gbl_ulp_udp_port, ulp_udp_handle); } diff --git a/epan/dissectors/packet-ulp.c b/epan/dissectors/packet-ulp.c index 9ccce2773e..4ef45623ac 100644 --- a/epan/dissectors/packet-ulp.c +++ b/epan/dissectors/packet-ulp.c @@ -28,7 +28,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * ref OMA-TS-ULP-V1_0-20060127-C + * ref OMA-TS-ULP-V2_0-20100806-D * http://www.openmobilealliance.org */ @@ -56,7 +56,8 @@ static dissector_handle_t lpp_handle; * oma-ulp 7275/tcp OMA UserPlane Location * oma-ulp 7275/udp OMA UserPlane Location */ -static guint gbl_ulp_port = 7275; +static guint gbl_ulp_tcp_port = 7275; +static guint gbl_ulp_udp_port = 7275; /* Initialize the protocol and registered fields */ static int proto_ulp = -1; @@ -668,7 +669,7 @@ static int hf_ulp_GANSSSignals_signal7 = -1; static int hf_ulp_GANSSSignals_signal8 = -1; /*--- End of included file: packet-ulp-hf.c ---*/ -#line 62 "../../asn1/ulp/packet-ulp-template.c" +#line 63 "../../asn1/ulp/packet-ulp-template.c" /* Initialize the subtree pointers */ static gint ett_ulp = -1; @@ -885,7 +886,7 @@ static gint ett_ulp_PolygonArea = -1; static gint ett_ulp_PolygonDescription = -1; /*--- End of included file: packet-ulp-ett.c ---*/ -#line 66 "../../asn1/ulp/packet-ulp-template.c" +#line 67 "../../asn1/ulp/packet-ulp-template.c" /* Include constants */ @@ -908,7 +909,7 @@ static gint ett_ulp_PolygonDescription = -1; #define maxWimaxBSMeas 32 /*--- End of included file: packet-ulp-val.h ---*/ -#line 69 "../../asn1/ulp/packet-ulp-template.c" +#line 70 "../../asn1/ulp/packet-ulp-template.c" @@ -6277,22 +6278,22 @@ static int dissect_ULP_PDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_ /*--- End of included file: packet-ulp-fn.c ---*/ -#line 72 "../../asn1/ulp/packet-ulp-template.c" +#line 73 "../../asn1/ulp/packet-ulp-template.c" static guint get_ulp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) { - /* PDU length = Message length */ - return tvb_get_ntohs(tvb,offset); + /* PDU length = Message length */ + return tvb_get_ntohs(tvb,offset); } static int dissect_ulp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { - tcp_dissect_pdus(tvb, pinfo, tree, ulp_desegment, ULP_HEADER_SIZE, - get_ulp_pdu_len, dissect_ULP_PDU_PDU, data); - return tvb_length(tvb); + tcp_dissect_pdus(tvb, pinfo, tree, ulp_desegment, ULP_HEADER_SIZE, + get_ulp_pdu_len, dissect_ULP_PDU_PDU, data); + return tvb_length(tvb); } void proto_reg_handoff_ulp(void); @@ -8692,12 +8693,12 @@ void proto_register_ulp(void) { NULL, HFILL }}, /*--- End of included file: packet-ulp-hfarr.c ---*/ -#line 98 "../../asn1/ulp/packet-ulp-template.c" +#line 99 "../../asn1/ulp/packet-ulp-template.c" }; /* List of subtrees */ static gint *ett[] = { - &ett_ulp, + &ett_ulp, /*--- Included file: packet-ulp-ettarr.c ---*/ #line 1 "../../asn1/ulp/packet-ulp-ettarr.c" @@ -8911,7 +8912,7 @@ void proto_register_ulp(void) { &ett_ulp_PolygonDescription, /*--- End of included file: packet-ulp-ettarr.c ---*/ -#line 104 "../../asn1/ulp/packet-ulp-template.c" +#line 105 "../../asn1/ulp/packet-ulp-template.c" }; module_t *ulp_module; @@ -8928,17 +8929,22 @@ void proto_register_ulp(void) { ulp_module = prefs_register_protocol(proto_ulp,proto_reg_handoff_ulp); prefs_register_bool_preference(ulp_module, "desegment_ulp_messages", - "Reassemble ULP messages spanning multiple TCP segments", - "Whether the ULP dissector should reassemble messages spanning multiple TCP segments." - " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", - &ulp_desegment); + "Reassemble ULP messages spanning multiple TCP segments", + "Whether the ULP dissector should reassemble messages spanning multiple TCP segments." + " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", + &ulp_desegment); /* Register a configuration option for port */ prefs_register_uint_preference(ulp_module, "tcp.port", "ULP TCP Port", - "Set the TCP port for ULP messages(IANA registered port is 7275)", + "Set the TCP port for ULP messages (IANA registered port is 7275)", 10, - &gbl_ulp_port); + &gbl_ulp_tcp_port); + prefs_register_uint_preference(ulp_module, "udp.port", + "ULP UDP Port", + "Set the UDP port for ULP messages (IANA registered port is 7275)", + 10, + &gbl_ulp_udp_port); } @@ -8947,21 +8953,25 @@ void proto_register_ulp(void) { void proto_reg_handoff_ulp(void) { - static gboolean initialized = FALSE; - static dissector_handle_t ulp_handle; - static guint local_ulp_port; - - if (!initialized) { - ulp_handle = find_dissector("ulp"); - dissector_add_string("media_type","application/oma-supl-ulp", ulp_handle); - rrlp_handle = find_dissector("rrlp"); - lpp_handle = find_dissector("lpp"); - initialized = TRUE; - } else { - dissector_delete_uint("tcp.port", local_ulp_port, ulp_handle); - } - - local_ulp_port = gbl_ulp_port; - dissector_add_uint("tcp.port", gbl_ulp_port, ulp_handle); + static gboolean initialized = FALSE; + static dissector_handle_t ulp_tcp_handle, ulp_udp_handle; + static guint local_ulp_tcp_port, local_ulp_udp_port; + + if (!initialized) { + ulp_tcp_handle = find_dissector("ulp"); + dissector_add_string("media_type","application/oma-supl-ulp", ulp_tcp_handle); + ulp_udp_handle = new_create_dissector_handle(dissect_ULP_PDU_PDU, proto_ulp); + rrlp_handle = find_dissector("rrlp"); + lpp_handle = find_dissector("lpp"); + initialized = TRUE; + } else { + dissector_delete_uint("tcp.port", local_ulp_tcp_port, ulp_tcp_handle); + dissector_delete_uint("udp.port", local_ulp_udp_port, ulp_udp_handle); + } + + local_ulp_tcp_port = gbl_ulp_tcp_port; + dissector_add_uint("tcp.port", gbl_ulp_tcp_port, ulp_tcp_handle); + local_ulp_udp_port = gbl_ulp_udp_port; + dissector_add_uint("udp.port", gbl_ulp_udp_port, ulp_udp_handle); } |