aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-lapd.c
diff options
context:
space:
mode:
authorclairvoyant <joserubiovidales@gmail.com>2016-06-23 16:33:50 +0200
committerJaap Keuter <jaap.keuter@xs4all.nl>2016-06-29 19:20:53 +0000
commit272ec20c56612559bfc7b480cda754f97432f5c7 (patch)
treef9c609f589de357f24d123197cc01a77592328c2 /epan/dissectors/packet-lapd.c
parentbe12a252dd0bfeddc4b82da4690bcd582aa94d4a (diff)
LAPD. SCTP can carry LAPD information.
* LAPD can be configured in "Decode As" using port and protocol identifier. * Add default sctp ppi (the number is not assigned by IANA). Change-Id: Iaa4797e844f6480881605ad4e6b408d7d5f60cad Reviewed-on: https://code.wireshark.org/review/16107 Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Diffstat (limited to 'epan/dissectors/packet-lapd.c')
-rw-r--r--epan/dissectors/packet-lapd.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/epan/dissectors/packet-lapd.c b/epan/dissectors/packet-lapd.c
index cfb5f8cd5f..672e3a8f9e 100644
--- a/epan/dissectors/packet-lapd.c
+++ b/epan/dissectors/packet-lapd.c
@@ -82,6 +82,7 @@ static gint ett_lapd_address = -1;
static gint ett_lapd_control = -1;
static gint ett_lapd_checksum = -1;
static gint pref_lapd_rtp_payload_type = 0;
+static guint pref_lapd_sctp_payload_protocol_identifier = 0;
static expert_field ei_lapd_abort = EI_INIT;
static expert_field ei_lapd_checksum_bad = EI_INIT;
@@ -746,6 +747,13 @@ proto_register_lapd(void)
"RTP payload type for embedded LAPD. It must be one of the dynamic types "
"from 96 to 127. Set it to 0 to disable.",
10, &pref_lapd_rtp_payload_type);
+ prefs_register_uint_preference(lapd_module, "sctp_payload_protocol_identifier",
+ "SCTP Payload protocol Identifier for LAPD",
+ "SCTP Payload protocol Identifier for LAPD. Its a "
+ "32 bits value from 0 to 4294967295. Set it to 0 to disable.",
+ 10, &pref_lapd_sctp_payload_protocol_identifier);
+
+
}
void
@@ -754,16 +762,21 @@ proto_reg_handoff_lapd(void)
static gboolean init = FALSE;
static dissector_handle_t lapd_bitstream_handle;
static gint lapd_rtp_payload_type;
+ static guint lapd_sctp_payload_protocol_identifier;
+
+ dissector_handle_t lapd_handle;
+ lapd_handle = find_dissector("lapd");
if (!init) {
- dissector_handle_t lapd_handle;
- lapd_handle = find_dissector("lapd");
dissector_add_uint("wtap_encap", WTAP_ENCAP_LINUX_LAPD, lapd_handle);
dissector_add_uint("wtap_encap", WTAP_ENCAP_LAPD, lapd_handle);
dissector_add_uint("l2tp.pw_type", L2TPv3_PROTOCOL_LAPD, lapd_handle);
heur_dissector_add("udp", dissect_udp_lapd, "LAPD over UDP", "lapd_udp", proto_lapd, HEURISTIC_ENABLE);
+ dissector_add_for_decode_as("sctp.ppi", lapd_handle);
+ dissector_add_for_decode_as("sctp.port", lapd_handle);
+
register_dissector("lapd-bitstream", dissect_lapd_bitstream, proto_lapd);
lapd_bitstream_handle = find_dissector("lapd-bitstream");
@@ -771,11 +784,20 @@ proto_reg_handoff_lapd(void)
} else {
if ((lapd_rtp_payload_type > 95) && (lapd_rtp_payload_type < 128))
dissector_delete_uint("rtp.pt", lapd_rtp_payload_type, lapd_bitstream_handle);
+
+ /* If "previous" value is a valid protocol id, then clean up the dissector preference mapping. */
+ if (lapd_sctp_payload_protocol_identifier != 0)
+ dissector_delete_uint("sctp.ppi", lapd_sctp_payload_protocol_identifier, lapd_handle);
}
lapd_rtp_payload_type = pref_lapd_rtp_payload_type;
if ((lapd_rtp_payload_type > 95) && (lapd_rtp_payload_type < 128))
dissector_add_uint("rtp.pt", lapd_rtp_payload_type, lapd_bitstream_handle);
+
+ /* Only update the protocol identifier preference if there is a valid identifier (value > 0). */
+ lapd_sctp_payload_protocol_identifier = pref_lapd_sctp_payload_protocol_identifier;
+ if ( lapd_sctp_payload_protocol_identifier > 0)
+ dissector_add_uint("sctp.ppi", lapd_sctp_payload_protocol_identifier, lapd_handle);
}
/*