aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-catapult-dct2000.c
diff options
context:
space:
mode:
authormartinm <martinm@f5534014-38df-0310-8fa8-9805f1628bb7>2009-04-18 08:03:09 +0000
committermartinm <martinm@f5534014-38df-0310-8fa8-9805f1628bb7>2009-04-18 08:03:09 +0000
commitbe94a5780eef3bed8d771e6416ddc51061b64883 (patch)
treea27e3895b9fda8b3157462b351f27b7c84379b1e /epan/dissectors/packet-catapult-dct2000.c
parent5de3bf1feadfa0388c76ec59f40829d33c18eaef (diff)
Try to speed up lookup of LTE mac/rlc/pdcp dissectors
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@28085 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-catapult-dct2000.c')
-rw-r--r--epan/dissectors/packet-catapult-dct2000.c60
1 files changed, 37 insertions, 23 deletions
diff --git a/epan/dissectors/packet-catapult-dct2000.c b/epan/dissectors/packet-catapult-dct2000.c
index 97e7d0802f..c326cf3adf 100644
--- a/epan/dissectors/packet-catapult-dct2000.c
+++ b/epan/dissectors/packet-catapult-dct2000.c
@@ -185,6 +185,10 @@ extern int proto_mac_lte;
extern int proto_rlc_lte;
extern int proto_pdcp_lte;
+static dissector_handle_t mac_lte_handle;
+static dissector_handle_t rlc_lte_handle;
+static dissector_handle_t pdcp_lte_handle;
+
void proto_register_catapult_dct2000(void);
static dissector_handle_t look_for_dissector(char *protocol_name);
@@ -814,7 +818,6 @@ void dissect_pdcp_lte(tvbuff_t *tvb _U_, gint offset _U_,
LogicalChannelType logicalChannelType;
guint8 bcch_transport = 0;
struct pdcp_lte_info *p_pdcp_lte_info = NULL;
- dissector_handle_t protocol_handle = 0;
tvbuff_t *pdcp_lte_tvb;
/* Top-level opcode */
@@ -964,9 +967,8 @@ void dissect_pdcp_lte(tvbuff_t *tvb _U_, gint offset _U_,
}
/* Call PDCP LTE dissector */
- protocol_handle = find_dissector("pdcp-lte");
pdcp_lte_tvb = tvb_new_subset(tvb, offset, -1, tvb_length_remaining(tvb, offset));
- call_dissector_only(protocol_handle, pdcp_lte_tvb, pinfo, tree);
+ call_dissector_only(pdcp_lte_handle, pdcp_lte_tvb, pinfo, tree);
break;
@@ -1727,46 +1729,48 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
- /* Work with generic XML protocol.
- This is a bit of a hack, but xml isn't really a proper
- encapsulation type... */
- if (strcmp(protocol_name, "xml") == 0)
+ /**************************************************************************/
+ /* These protocols have no encapsulation type, just look them up directly */
+ if (strcmp(protocol_name, "mac_r8_lte") == 0)
{
- protocol_handle = find_dissector("xml");
+ protocol_handle = mac_lte_handle;
}
- else
- /* Attempt to show tty messages as raw text */
- if (strcmp(protocol_name, "tty") == 0)
+ else
+ if (strcmp(protocol_name, "rlc_r8_lte") == 0)
{
- dissect_tty_lines(tvb, pinfo, dct2000_tree, offset);
- return;
+ protocol_handle = rlc_lte_handle;
}
else
- if (strcmp(protocol_name, "sipprim") == 0)
+ if (strcmp(protocol_name, "pdcp_r8_lte") == 0)
{
- protocol_handle = find_dissector("sipprim");
+ /* Dissect proprietary header, then pass remainder to PDCP */
+ dissect_pdcp_lte(tvb, offset, pinfo, tree);
+ return;
}
+
+ /* Work with generic XML protocol. */
else
- if (strcmp(protocol_name, "mac_r8_lte") == 0)
+ if (strcmp(protocol_name, "xml") == 0)
{
- protocol_handle = find_dissector("mac-lte");
+ protocol_handle = find_dissector("xml");
}
+
+ /* Attempt to show tty messages as raw text */
else
- if (strcmp(protocol_name, "rlc_r8_lte") == 0)
+ if (strcmp(protocol_name, "tty") == 0)
{
- protocol_handle = find_dissector("rlc-lte");
+ dissect_tty_lines(tvb, pinfo, dct2000_tree, offset);
+ return;
}
else
- if (strcmp(protocol_name, "pdcp_r8_lte") == 0)
+ if (strcmp(protocol_name, "sipprim") == 0)
{
- /* Dissect proprietary header, then pass remainder to PDCP */
- dissect_pdcp_lte(tvb, offset, pinfo, tree);
- return;
+ protocol_handle = find_dissector("sipprim");
}
else
@@ -2125,9 +2129,19 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/******************************************************************************/
void proto_reg_handoff_catapult_dct2000(void)
{
+ static gboolean have_cached_handles = FALSE;
dissector_handle_t catapult_dct2000_handle = find_dissector("dct2000");
dissector_add("wtap_encap", WTAP_ENCAP_CATAPULT_DCT2000,
catapult_dct2000_handle);
+
+ /* Cache some protocol handles that we don't want to keep looking up */
+ if (!have_cached_handles) {
+ mac_lte_handle = find_dissector("mac-lte");
+ rlc_lte_handle = find_dissector("rlc-lte");
+ pdcp_lte_handle = find_dissector("pdcp-lte");
+
+ have_cached_handles = TRUE;
+ }
}
/****************************************/