From 6df3dfdf18115f5a3ce8477749ecef77a66260c0 Mon Sep 17 00:00:00 2001 From: mjm Date: Wed, 27 Nov 2002 22:34:42 +0000 Subject: added cardmode and sniffer --- (limited to 'noncore/net/wellenreiter/libwellenreiter/source/sniff.hh') diff --git a/noncore/net/wellenreiter/libwellenreiter/source/sniff.hh b/noncore/net/wellenreiter/libwellenreiter/source/sniff.hh new file mode 100644 index 0000000..fa8519b --- a/dev/null +++ b/noncore/net/wellenreiter/libwellenreiter/source/sniff.hh @@ -0,0 +1,64 @@ +/* $Id$ */ + +#ifndef SNIFF_HH +#define SNIFF_HH + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define NONBROADCASTING "non-broadcasting" + +/* holds all the interresting data */ +struct packetinfo +{ + int isvalid; + int pktlen; + int fctype; + int fcsubtype; + int fc_wep; + int cap_WEP; + int cap_IBSS; + int cap_ESS; + int channel; + char bssid[sizeof("00:00:00:00:00:00")]; + char desthwaddr[sizeof("00:00:00:00:00:00")]; + char sndhwaddr[sizeof("00:00:00:00:00:00")]; + char *ssid; + int ssid_len; +}; + +void process_packets(const struct pcap_pkthdr* pkthdr,const u_char* packet); +int decode_80211b_hdr(const u_char *p,struct packetinfo *ppinfo); +void etheraddr_string(register const u_char *ep,char * text); +int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo); + +int GetHeaderLength(u_int16_t fc); + +/* + * True if "l" bytes of "var" were captured. + * + * The "snapend - (l) <= snapend" checks to make sure "l" isn't so large + * that "snapend - (l)" underflows. + * + * The check is for <= rather than < because "l" might be 0. + */ +#define TTEST2(var, l) (snapend - (l) <= snapend && \ + (const u_char *)&(var) <= snapend - (l)) + +/* True if "var" was captured */ +#define TTEST(var) TTEST2(var, sizeof(var)) + +/* Bail if "l" bytes of "var" were not captured */ +#define TCHECK2(var, l) if (!TTEST2(var, l)) goto trunc + +/* Bail if "var" was not captured */ +#define TCHECK(var) TCHECK2(var, sizeof(var)) + +#endif /* SNIFF_HH */ -- cgit v0.9.0.2