aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ncp2222.inc
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2010-11-01 18:38:13 +0000
committerBill Meier <wmeier@newsguy.com>2010-11-01 18:38:13 +0000
commit2f8ab638582a8ecbcabb50362cd559a02be0ffba (patch)
tree43a0cecce979fa59468295f87900179665f792b2 /epan/dissectors/packet-ncp2222.inc
parent5227ad988a17c3400caa02a60944428b750a994d (diff)
Compile (over 100) dfilters only if needed rather than at every Wireshark startup;
Also: Minor whitespace cleanup. svn path=/trunk/; revision=34747
Diffstat (limited to 'epan/dissectors/packet-ncp2222.inc')
-rw-r--r--epan/dissectors/packet-ncp2222.inc28
1 files changed, 27 insertions, 1 deletions
diff --git a/epan/dissectors/packet-ncp2222.inc b/epan/dissectors/packet-ncp2222.inc
index 93a9ffa0ab..e575b9ed77 100644
--- a/epan/dissectors/packet-ncp2222.inc
+++ b/epan/dissectors/packet-ncp2222.inc
@@ -7512,12 +7512,29 @@ nds_defrag(tvbuff_t *tvb, packet_info *pinfo, guint32 nw_connection, guint8 sequ
}
}
else
- {
+ {
dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
}
}
}
+static gboolean ncp2222_dfilters_compiled = FALSE;
+
+static void
+ncp2222_compile_dfilters(void)
+{
+ int i;
+
+ for (i = 0; i < NUM_REQ_CONDS; i++) {
+ if (!dfilter_compile((const gchar*)req_conds[i].dfilter_text,
+ &req_conds[i].dfilter)) {
+ g_message("NCP dissector failed to compile dfilter: %s\n",
+ req_conds[i].dfilter_text);
+ g_assert_not_reached();
+ }
+ }
+}
+
void
dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
guint32 nw_connection, guint8 sequence,
@@ -7540,6 +7557,15 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
const char *volatile message;
+ /* We're dissecting an ncp2222 request; Compile the dfilters (if not yet done). */
+ /* XXX: We do this here rather than at "post-registration" (as previouly done) */
+ /* so compiling over 100 dfilters is done only if needed (thus avoiding */
+ /* compiling the dfilters each time Wireshark is started. */
+ if (! ncp2222_dfilters_compiled) {
+ ncp2222_compile_dfilters();
+ ncp2222_dfilters_compiled = TRUE;
+ }
+
/* Determine which ncp_record to use. */
switch (type) {
case NCP_ALLOCATE_SLOT: