#include <include.h>
#include <src/pcap_file.h>
#include <src/wlan-ng.h>
#include <src/functions.h>
#include <src/crt_io.h>
Go to the source code of this file.
Defines | |
#define | STR_MAX 80 |
Functions | |
int | getPacketPCAP (p80211_caphdr_t *wlan_header, UINT8 *buf, int maxlen) |
int | openPacketPCAP (char *pcap_name) |
void | closePacketPCAP (void) |
Variables | |
static char * | ID = "$Id: pcap.c,v 1.3 2005/11/03 15:28:53 poggij Exp $" |
ConfigStruct | config |
p80211_caphdr_t | wlan_header |
WINDOW * | Sum_WND |
WINDOW * | RealTime_WND |
static CaptureArg | ca |
static char | errbuf [PCAP_ERRBUF_SIZE] |
#define STR_MAX 80 |
Definition at line 43 of file pcap_file.c.
int getPacketPCAP | ( | p80211_caphdr_t * | wlan_header, | |
UINT8 * | buf, | |||
int | maxlen | |||
) |
Definition at line 48 of file pcap_file.c.
References p80211_caphdr::antenna, p80211_caphdr::channel, p80211_caphdr::datarate, DumpHexPaquets(), p80211_caphdr::encoding, p80211_caphdr::hosttime, p80211_caphdr::length, p80211_caphdr::mactime, memcpy_buff(), CaptureArg_t::offset, CaptureArg_t::pcap, p80211_caphdr::phytype, p80211_caphdr::preamble, p80211_caphdr::priority, RealTime_WND, p80211_caphdr::ssi_noise, p80211_caphdr::ssi_signal, p80211_caphdr::ssi_type, p80211_caphdr::version, and warning().
Referenced by getPacket().
00049 { 00050 struct pcap_pkthdr pktHdr; 00051 u_char *ret; 00052 fd_set rs; 00053 00054 FD_ZERO(&rs); 00055 FD_SET(0, &rs); 00056 00057 warning("before\n"); 00058 ret = (u_char *) pcap_next(ca.pcap, &pktHdr); 00059 warning("after\n"); 00060 00061 // If no problem and packet is enought big (with data) 00062 if ((ret) && (pktHdr.len >= 1)) { 00063 #if 1 00064 // Function to dump in hexa the message send or sent to the driver 00065 DumpHexPaquets(RealTime_WND, ret, 0x40); 00066 #endif 00067 memcpy_buff(buf, ret + ca.offset, pktHdr.len + 0x00); 00068 // Fill Header 00069 // TODO : find this information in any maner ?! 00070 wlan_header->version = 0; // It's a reduced capture frame format 00071 wlan_header->length = 0; // Not used for now 00072 wlan_header->mactime = 0; 00073 wlan_header->hosttime = 0; 00074 wlan_header->phytype = 0; // Not used for now 00075 wlan_header->channel = 0; 00076 wlan_header->datarate = 0; // datarate is in units of 100kbps. 00077 wlan_header->antenna = 0; // Not used for now 00078 wlan_header->priority = 0; // Not used for now 00079 wlan_header->ssi_type = 0; // Not used for now 00080 wlan_header->ssi_signal = 0; 00081 wlan_header->ssi_noise = 0; 00082 wlan_header->preamble = 0; // Not used for now 00083 wlan_header->encoding = 0; // Not used for now 00084 return pktHdr.len; 00085 } else { 00086 return (0); // Noting to read 00087 } 00088 }
int openPacketPCAP | ( | char * | pcap_name | ) |
Definition at line 90 of file pcap_file.c.
References CalculateOffset(), CaptureArg_t::DataLink, errbuf, ERROR_CANT_OPEN_PCAP, NO_ERROR, CaptureArg_t::offset, and CaptureArg_t::pcap.
Referenced by openPacket().
00091 { 00092 ca.pcap = pcap_open_offline(pcap_name, errbuf); 00093 if (ca.pcap) { 00094 ca.DataLink = pcap_datalink(ca.pcap); 00095 ca.offset = CalculateOffset(ca.DataLink); 00096 return NO_ERROR; 00097 } 00098 return ERROR_CANT_OPEN_PCAP; 00099 }
void closePacketPCAP | ( | void | ) |
Definition at line 101 of file pcap_file.c.
References CaptureArg_t::pcap.
Referenced by closePacket().
char* ID = "$Id: pcap.c,v 1.3 2005/11/03 15:28:53 poggij Exp $" [static] |
Definition at line 30 of file pcap_file.c.
Referenced by main().
WINDOW * RealTime_WND |
CaptureArg ca [static] |
Definition at line 40 of file pcap_file.c.
char errbuf[PCAP_ERRBUF_SIZE] [static] |
Definition at line 41 of file pcap_file.c.