diff options
Diffstat (limited to 'other/3wahas/sniff.h')
| -rw-r--r-- | other/3wahas/sniff.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/other/3wahas/sniff.h b/other/3wahas/sniff.h new file mode 100644 index 0000000..af8fc77 --- /dev/null +++ b/other/3wahas/sniff.h | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /* snifflib | ||
| 2 | * | ||
| 3 | * by scut | ||
| 4 | * | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifndef Z_SNIFF_H | ||
| 8 | #define Z_SNIFF_H | ||
| 9 | |||
| 10 | #include <pcap.h> | ||
| 11 | #include "packet.h" | ||
| 12 | |||
| 13 | #define SNAPLEN 65535 | ||
| 14 | #define PROMISC 1 | ||
| 15 | #define READ_TIMEOUT 0 | ||
| 16 | |||
| 17 | typedef struct s_dev { | ||
| 18 | int error; /* error flag */ | ||
| 19 | |||
| 20 | pcap_t *pd; /* packet capture descriptor */ | ||
| 21 | char *interface; /* interface name */ | ||
| 22 | int linktype; /* link layer type */ | ||
| 23 | unsigned long int linkhdrlen; /* length of the link layer frame header */ | ||
| 24 | bpf_u_int32 localnet; /* local network address */ | ||
| 25 | bpf_u_int32 netmask; /* netmask of local network */ | ||
| 26 | |||
| 27 | } s_dev; | ||
| 28 | |||
| 29 | typedef struct sniff_info { | ||
| 30 | s_dev *device; /* device structure of the sniffing device */ | ||
| 31 | struct in_addr ip_dst; | ||
| 32 | } sniff_info; | ||
| 33 | |||
| 34 | void sniff_new (char *interface, char *ip_dst); | ||
| 35 | void *sniff_handle (sniff_info *sinfo); | ||
| 36 | s_dev *sniff_open (char *devname); | ||
| 37 | pcap_t *sniff_pcap_open (char *device); | ||
| 38 | void sniff_dev_free (s_dev *device); | ||
| 39 | |||
| 40 | #endif | ||
| 41 | |||
