pcap_file.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int getPacketPCAP (p80211_caphdr_t *wlan_header, UINT8 *pcap_name, int maxlen)
int openPacketPCAP (char *devname)
void closePacketPCAP (void)


Function Documentation

int getPacketPCAP ( p80211_caphdr_t wlan_header,
UINT8 pcap_name,
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 *  devname  ) 

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().

00102 {
00103   pcap_close(ca.pcap);
00104 }


Generated on Fri Jul 25 17:11:21 2008 for WifiScanner by  doxygen 1.5.5