aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tap.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-12-07 13:12:39 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-12-07 13:12:39 +0000
commitd12b09b8868be0cf6b8af72c9e6c34921481b08b (patch)
tree0b60cd1a1ca9b2155613aa43bfbc8589fefa2da9 /epan/tap.c
parent56b2184927702fa8bfae70bd63779070869e04bd (diff)
new function fetch_tapped_data()
This function can be called from a dissector to fetch (if any) tapped data from a tap. This can offer an alternative method of passing data between different dissectors much cleaner than the pinfo pollition and private_data design mistake. The SMB2 dissector uses this method to extract vital data such as Account_Name from the ntlmssp dissector (that is 3 leveld down from smb2) svn path=/trunk/; revision=16722
Diffstat (limited to 'epan/tap.c')
-rw-r--r--epan/tap.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/epan/tap.c b/epan/tap.c
index 2b8dd1da20..b692fcd58d 100644
--- a/epan/tap.c
+++ b/epan/tap.c
@@ -245,6 +245,50 @@ tap_push_tapped_queue(epan_dissect_t *edt)
}
}
+
+/* This function can be used by a dissector to fetch any tapped data before
+ * returning.
+ * This can be useful if one wants to extract the data inside dissector BEFORE
+ * it exists as an alternative to the callbacks that are all called AFTER the
+ * dissection has completed.
+ *
+ * Example: SMB2 uses this mechanism to extract the data tapped from NTLMSSP
+ * containing the account and domain names before exiting.
+ * Note that the SMB2 tap listener specifies all three callbacks as NULL.
+ *
+ * Beware: when using this mechanism to extract the tapped data you can not
+ * use "filters" and should specify the "filter" as NULL when registering
+ * the tap listener.
+ */
+void *
+fetch_tapped_data(int tap_id, int idx)
+{
+ tap_packet_t *tp;
+ guint i;
+
+ /* nothing to do, just return */
+ if(!tapping_is_active){
+ return NULL;
+ }
+
+ /* nothing to do, just return */
+ if(!tap_packet_index){
+ return NULL;
+ }
+
+ /* loop over all tapped packets and return the one with index idx */
+ for(i=0;i<tap_packet_index;i++){
+ tp=&tap_packet_array[i];
+ if(tp->tap_id==tap_id){
+ if(!idx--){
+ return tp->tap_specific_data;
+ }
+ }
+ }
+
+ return NULL;
+}
+
/* This function is called when we need to reset all tap listeners, for example
when we open/start a new capture or if we need to rescan the packet list.
*/