summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2012-11-08 13:29:33 +0000
committerLudovic Pouzenc <ludovic@pouzenc.fr>2012-11-08 13:29:33 +0000
commit9edc97da2b75cc3ada86c93ba658d00236b57195 (patch)
tree368283ad2cfd48e9c3cf0cbef9c275f38a079057
parentb046584c3ec7816c9040ff2e4a2a3fc8bf1cdd3b (diff)
download2012-tzsp-9edc97da2b75cc3ada86c93ba658d00236b57195.tar.gz
2012-tzsp-9edc97da2b75cc3ada86c93ba658d00236b57195.tar.bz2
2012-tzsp-9edc97da2b75cc3ada86c93ba658d00236b57195.zip
Ajout option -s <snaplen> dans le usage()
Ajout d'une condition pour compatibilite avec libpcap-0.7 (Debian Etch...) git-svn-id: file:///var/svn/2012-tzsp/trunk@17 147d2d3d-d0bd-48ea-923a-d90ac20f5906
-rw-r--r--pcap2tzsp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pcap2tzsp.c b/pcap2tzsp.c
index 4c1ff03..f508abe 100644
--- a/pcap2tzsp.c
+++ b/pcap2tzsp.c
@@ -79,15 +79,16 @@ static char *opt_snaplen=NULL;
pcap_t *pcap_handle = NULL;
void usage(char progname[]) {
- printf("Usage : %s [--verbose] [--brief] [-i <iface>] [-h <host>] [-p <port>] [custom_pcap_filter]\n", progname);
+ printf("Usage : %s [--verbose] [--brief] [-i <iface>] [-h <host>] [-p <port>] [-s <snaplen>] [custom_pcap_filter]\n", progname);
printf("\t<iface> : Interface name to capture from (Default : first available interface)\n");
printf("\t<host> : Host (or IPv4 address) for sending captured packet headers (Default : '%s')\n", DEFAULT_HOST);
printf("\t<port> : Port for sending captured packet headers (Default '%s')\n", DEFAULT_PORT);
+ printf("\t<snaplen> : Snarf snaplen bytes of data from each packet (Default '%s')\n", DEFAULT_SNAPLEN);
printf("\t<custom_pcap_filter> : libpcap capture filter (Default '%s')\n", DEFAULT_FILTER);
exit(1);
}
-
+#ifndef COMPAT_LIBPCAP_0_7
void sig_handler(int signo) {
static int pcap_break=0;
@@ -103,6 +104,7 @@ void sig_handler(int signo) {
fprintf(stderr, "Catched an unhandled signal : %i\n", signo);
}
}
+#endif
int main(int argc, char *argv[]) {
@@ -203,7 +205,9 @@ int main(int argc, char *argv[]) {
}
#endif
+#ifndef COMPAT_LIBPCAP_0_7
signal(SIGINT, sig_handler);
+#endif
/* Run the capture loop */
start_capture_loop(pcap_filter);