diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 1998-11-12 06:01:27 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 1998-11-12 06:01:27 +0000 |
commit | c0f191e9e0c2d49564e42a23cfcd6a391569892c (patch) | |
tree | b5635327a52f09fe041a808311d39e8bde8b3def /wiretap/wtap.h | |
parent | fcb4c78a6a01d22f0db9d6de870342511030cb01 (diff) |
I added the LANalzyer file format to wiretap. I cleaned up some code in the
wiretap functions to be more generic and therefore allow an easier integration
of more packet-capture file types. I also put in all the GPL copyrights in the
wiretap code.
svn path=/trunk/; revision=83
Diffstat (limited to 'wiretap/wtap.h')
-rw-r--r-- | wiretap/wtap.h | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/wiretap/wtap.h b/wiretap/wtap.h index 65983722a3..e3ffff4bb7 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -1,9 +1,24 @@ -/* - * wtap.h - * ------ - * Wiretap Library for Packet Capturing and Filtering +/* wtap.h + * + * $Id: wtap.h,v 1.2 1998/11/12 06:01:27 gram Exp $ + * + * Wiretap Library + * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu> * - * Gilbert Ramirez + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * */ /* Encapsulation types */ @@ -30,6 +45,11 @@ #include <pcap.h> #include <buffer.h> +typedef struct { + guint16 pkt_len; + guint32 totpktt; +} lanalyzer_t; + struct wtap_pkthdr { struct timeval ts; guint32 caplen; @@ -39,7 +59,9 @@ struct wtap_pkthdr { typedef void (*wtap_handler)(u_char*, const struct wtap_pkthdr*, const u_char *); -typedef struct _wtap { +struct wtap; +typedef int (*subtype_func)(struct wtap*); +typedef struct wtap { FILE* fh; int file_type; unsigned long frame_number; @@ -47,7 +69,12 @@ typedef struct _wtap { Buffer frame_buffer; struct wtap_pkthdr phdr; - pcap_t *pcap; + union { + pcap_t *pcap; + lanalyzer_t *lanalyzer; + } capture; + + subtype_func subtype_read; char err_str[PCAP_ERRBUF_SIZE]; int encapsulation; } wtap; @@ -62,6 +89,7 @@ int wtap_file_type(wtap *wth); int wtap_encapsulation(wtap *wth); /* per file */ void wtap_close(wtap *wth); + /* Pointer versions of ntohs and ntohl. Given a pointer to a member of a * byte array, returns the value of the two or four bytes at the pointer. * The pletoh[sl] versions return the little-endian representation. |