aboutsummaryrefslogtreecommitdiffstats
path: root/tethereal.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2002-09-04 09:40:29 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2002-09-04 09:40:29 +0000
commit93a649db6f5db64dbdc80eece52f0891c8a72cfb (patch)
tree90bdf086756c8f41361d49ed02ea7adfa1bbd84a /tethereal.c
parent7876ca4fe0bd8ce1cf1bd16d9e4cbdb8a4a007d3 (diff)
Tap api. tap is a simple api that can be used for arbitrary extensions.
One example extension is rpcstat. Try -Z rpc,rtt,100003,3 as argument to tethereal when reading a capture containing NFSv3 packets. tap-rpcstat.[ch] is intended to demonstrate the api and can be used to base other extensions on. svn path=/trunk/; revision=6175
Diffstat (limited to 'tethereal.c')
-rw-r--r--tethereal.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/tethereal.c b/tethereal.c
index 22d8a50de2..d7be13a6cb 100644
--- a/tethereal.c
+++ b/tethereal.c
@@ -1,6 +1,6 @@
/* tethereal.c
*
- * $Id: tethereal.c,v 1.153 2002/08/28 21:00:41 jmayer Exp $
+ * $Id: tethereal.c,v 1.154 2002/09/04 09:40:24 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -95,6 +95,8 @@
#include "capture_stop_conditions.h"
#include "ringbuffer.h"
#include <epan/epan_dissect.h>
+#include "tap.h"
+#include "tap-rpcstat.h"
#ifdef HAVE_LIBPCAP
#include <wiretap/wtap-capture.h>
@@ -205,6 +207,7 @@ print_usage(gboolean print_ver)
fprintf(stderr, "\t[ -o <preference setting> ] ... [ -r <infile> ] [ -R <read filter> ]\n");
fprintf(stderr, "\t[ -t <time stamp format> ] [ -w <savefile> ] [ -x ]\n");
#endif
+ fprintf(stderr, "\t[ -Z <statistics string> ]\n");
fprintf(stderr, "Valid file type arguments to the \"-F\" flag:\n");
for (i = 0; i < WTAP_NUM_FILE_TYPES; i++) {
if (wtap_dump_can_open(i))
@@ -453,7 +456,7 @@ main(int argc, char *argv[])
#endif
/* Now get our args */
- while ((opt = getopt(argc, argv, "a:b:c:Df:F:hi:lnN:o:pqr:R:s:St:vw:Vx")) != -1) {
+ while ((opt = getopt(argc, argv, "a:b:c:Df:F:hi:lnN:o:pqr:R:s:St:vw:VxZ:")) != -1) {
switch (opt) {
case 'a': /* autostop criteria */
#ifdef HAVE_LIBPCAP
@@ -644,6 +647,25 @@ main(int argc, char *argv[])
case 'x': /* Print packet data in hex (and ASCII) */
print_hex = TRUE;
break;
+ case 'Z':
+ if(!strncmp(optarg,"rpc,",4)){
+ if(!strncmp(optarg,"rpc,rtt,",8)){
+ int rpcprogram, rpcversion;
+ if(sscanf(optarg,"rpc,rtt,%d,%d",&rpcprogram,&rpcversion)==2){
+ rpcstat_init(rpcprogram,rpcversion);
+ } else {
+ fprintf(stderr, "tethereal: invalid \"-Z rpc,rtt,<program>,<version>\" argument\n");
+ exit(1);
+ }
+ } else {
+ fprintf(stderr, "tethereal: invalid -Z argument. Argument must be \"-Z rpc,rtt,...\"\n");
+ exit(1);
+ }
+ } else {
+ fprintf(stderr, "tethereal: invalid -Z argument. Argument must be \"-Z rpc,...\"\n");
+ exit(1);
+ }
+ break;
default:
case '?': /* Bad flag - print usage message */
arg_error = TRUE;
@@ -885,6 +907,7 @@ main(int argc, char *argv[])
#endif
}
+ draw_tap_listeners(TRUE);
epan_cleanup();
return 0;
@@ -1640,7 +1663,11 @@ wtap_dispatch_cb_print(guchar *user, const struct wtap_pkthdr *phdr,
if (cf->rfcode) {
epan_dissect_prime_dfilter(edt, cf->rfcode);
}
+
+ tap_queue_init(pseudo_header, buf, &fdata);
epan_dissect_run(edt, pseudo_header, buf, &fdata, verbose ? NULL : &cf->cinfo);
+ tap_push_tapped_queue();
+
if (cf->rfcode) {
passed = dfilter_apply_edt(cf->rfcode, edt);
}