Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

functions.c File Reference

#include <include.h>
#include <src/functions.h>
#include <src/analyse.h>
#include <src/crc-32.h>
#include <src/crt_io.h>
#include <src/conversion.h>
#include <getopt.h>
#include <syslog.h>

Include dependency graph for functions.c:

Go to the source code of this file.

Functions

void HelpAndBye (void)
void Bye (void)
int analyseBeacon (unsigned char *packet, int len)
int analyseProbeReq (unsigned char *packet, int len)
int analyseProbeRep (unsigned char *packet, int len)
int analyseCTS (unsigned char *packet)
int analyseRTS (unsigned char *packet)
int analyseACK (unsigned char *packet)
int analysePSPOLL (unsigned char *packet)
int analyseData (unsigned char *packet, int len)
int analyseMGMT (unsigned char *packet)
void ProcessTagBits (unsigned char *packet, int len, int FrameType)
 Generic analyse og MGMT packets.
UINT8 dataIsCrypted (unsigned char *packet, int len)
char * safe_strncpy (char *dst, const char *src, int size)
int safe_snprintf (char *s, int size, char *fmt,...)
void * memcpy_buff (void *dest, const void *src, size_t n)
void UpdateOtherInformation (char *Buff)
void printfMAC (UINT8 AddMac[WLAN_ADDR_LEN])
int processPacket (unsigned char *packet, int len)
UINT8 FilterESSID (char *ESSID)
void ParseCommandLine (int argc, char **argv, ConfigStruct *config)
void DispConf (ConfigStruct *config)
void ChannelToStr (char *strChannel, UINT8 Channel, UINT8 SChannel)
void InitConfiguration (ConfigStruct *config)

Variables

sockaddr_nl nl_sk_addr
ScanResult_t Res
Statistics_t Stats
WINDOW * Title_WND
WINDOW * Panel_WND
WINDOW * Sum_WND
WINDOW * RealTime_WND
p80211_caphdr_t wlan_header


Function Documentation

void HelpAndBye void   ) 
 

Definition at line 97 of file scanner.c.

References HELPTEXT.

Referenced by ParseCommandLine().

void Bye void   ) 
 

Definition at line 105 of file scanner.c.

Referenced by main(), and ParseCommandLine().

int analyseBeacon unsigned char *  packet,
int  len
 

Definition at line 359 of file functions.c.

References FixedField_t::bcn_int, ScanResult_t::BssId, FixedField_t::cap_info, CLEAR_TYPE_BIT_AP, CLEAR_TYPE_BIT_P2P, debug, ScanResult_t::DestMac, ScanResult_t::hasWep, LogDetectedClient(), LogPutBSSID(), LogPutIsAP(), LogPutIsP2P(), LogPutRate(), LogPutSeqNum(), LogPutSN(), LogPutTimestamp(), ScanResult_t::Noise, ProcessTagBits(), ScanResult_t::Rate, Res, SET_TYPE_BIT_AP, SET_TYPE_BIT_BEACON, SET_TYPE_BIT_P2P, ScanResult_t::Signal, ScanResult_t::SrcMac, FixedField_t::ts, ScanResult_t::TypeOfClient, WLAN_FSTYPE_BEACON, WLAN_GET_MGMT_CAP_INFO_ESS, WLAN_GET_MGMT_CAP_INFO_IBSS, WLAN_GET_MGMT_CAP_INFO_PRIVACY, WLAN_GET_SEQ_FRGNUM, and WLAN_GET_SEQ_SEQNUM.

Referenced by processPacket().

int analyseProbeReq unsigned char *  packet,
int  len
 

Definition at line 425 of file functions.c.

References ScanResult_t::BssId, FixedField_t::cap_info, debug, ScanResult_t::DestMac, ScanResult_t::hasWep, LogDetectedClient(), LogPutBSSID(), LogPutRate(), LogPutSeqNum(), LogPutSN(), ScanResult_t::Noise, ProcessTagBits(), Res, ScanResult_t::Signal, ScanResult_t::SrcMac, WLAN_FSTYPE_PROBEREQ, WLAN_GET_MGMT_CAP_INFO_PRIVACY, WLAN_GET_SEQ_FRGNUM, and WLAN_GET_SEQ_SEQNUM.

Referenced by processPacket().

int analyseProbeRep unsigned char *  packet,
int  len
 

Definition at line 473 of file functions.c.

References FixedField_t::bcn_int, ScanResult_t::BssId, FixedField_t::cap_info, CLEAR_TYPE_BIT_AP, CLEAR_TYPE_BIT_P2P, debug, ScanResult_t::DestMac, ScanResult_t::hasWep, LogDetectedClient(), LogPutBSSID(), LogPutIsAP(), LogPutIsP2P(), LogPutRate(), LogPutSeqNum(), LogPutSN(), LogPutTimestamp(), ScanResult_t::Noise, ProcessTagBits(), ScanResult_t::Rate, Res, SET_TYPE_BIT_AP, SET_TYPE_BIT_P2P, ScanResult_t::Signal, ScanResult_t::SrcMac, FixedField_t::ts, ScanResult_t::TypeOfClient, WLAN_FSTYPE_PROBERESP, WLAN_GET_MGMT_CAP_INFO_ESS, WLAN_GET_MGMT_CAP_INFO_IBSS, WLAN_GET_MGMT_CAP_INFO_PRIVACY, WLAN_GET_SEQ_FRGNUM, and WLAN_GET_SEQ_SEQNUM.

Referenced by processPacket().

int analyseCTS unsigned char *  packet  ) 
 

Definition at line 572 of file functions.c.

References ScanResult_t::BssId, debug, ScanResult_t::DestMac, LogDetectedClient(), Res, ScanResult_t::SrcMac, and WLAN_STR_ADDR_LEN.

Referenced by processPacket().

int analyseRTS unsigned char *  packet  ) 
 

Definition at line 541 of file functions.c.

References ScanResult_t::BssId, debug, ScanResult_t::DestMac, LogDetectedClient(), LogPutRate(), LogPutSN(), ScanResult_t::Rate, Res, ScanResult_t::Signal, ScanResult_t::SrcMac, and WLAN_STR_ADDR_LEN.

Referenced by processPacket().

int analyseACK unsigned char *  packet  ) 
 

Definition at line 597 of file functions.c.

References ScanResult_t::BssId, debug, ScanResult_t::DestMac, LogDetectedClient(), Res, ScanResult_t::SrcMac, and WLAN_STR_ADDR_LEN.

Referenced by processPacket().

int analysePSPOLL unsigned char *  packet  ) 
 

Definition at line 621 of file functions.c.

References ScanResult_t::BssId, debug, ScanResult_t::DestMac, LogDetectedClient(), LogPutRate(), LogPutSeqNum(), LogPutSN(), ScanResult_t::Rate, Res, ScanResult_t::Signal, ScanResult_t::SrcMac, and WLAN_STR_ADDR_LEN.

Referenced by processPacket().

int analyseData unsigned char *  packet,
int  len
 

Definition at line 654 of file functions.c.

References FixedField_t::bcn_int, ScanResult_t::BssId, FixedField_t::cap_info, dataIsCrypted(), debug, ScanResult_t::DestMac, ScanResult_t::hasWep, LogDetectedClient(), LogPutBSSID(), LogPutDS(), LogPutIsAP(), LogPutRate(), LogPutSN(), ScanResult_t::Rate, Res, SET_TYPE_BIT_AP, SET_TYPE_BIT_FROMDS, SET_TYPE_BIT_TODS, ScanResult_t::Signal, ScanResult_t::SrcMac, ScanResult_t::TypeOfClient, WLAN_FSTYPE_NULL, WLAN_GET_FC_FROMDS, WLAN_GET_FC_FSTYPE, WLAN_GET_FC_TODS, WLAN_GET_MGMT_CAP_INFO_PRIVACY, and WLAN_STR_ADDR_LEN.

Referenced by processPacket().

int analyseMGMT unsigned char *  packet  ) 
 

Definition at line 762 of file functions.c.

References ScanResult_t::BssId, debug, ScanResult_t::DestMac, LogDetectedClient(), LogPutRate(), LogPutSeqNum(), LogPutSN(), ScanResult_t::Rate, Res, ScanResult_t::Signal, ScanResult_t::SrcMac, and WLAN_STR_ADDR_LEN.

Referenced by processPacket().

void ProcessTagBits unsigned char *  packet,
int  len,
int  FrameType
 

Generic analyse og MGMT packets.

Definition at line 816 of file functions.c.

References ScanResult_t::Channel, CLEAR_TYPE_BIT_AP, debug, FilterESSID(), LogPutChannel(), LogPutMaxRate(), LogPutOtherInformation(), LogPutSSID(), ScanResult_t::OtherInformation, Res, SET_TYPE_BIT_AP, SET_TYPE_BIT_P2P, ScanResult_t::SSID, ScanResult_t::TypeOfClient, UpdateOtherInformation(), warning(), WLAN_EID_CF_PARMS, WLAN_EID_CHALLENGE, WLAN_EID_DS_PARMS, WLAN_EID_FH_PARMS, WLAN_EID_IBSS_PARMS, WLAN_EID_SSID, WLAN_EID_SUPP_RATES, WLAN_EID_TIM, WLAN_FSTYPE_ASSOCREQ, WLAN_FSTYPE_ASSOCRESP, WLAN_FSTYPE_ATIM, WLAN_FSTYPE_BEACON, WLAN_FSTYPE_PROBEREQ, WLAN_FSTYPE_PROBERESP, WLAN_FSTYPE_REASSOCREQ, and WLAN_FSTYPE_REASSOCRESP.

Referenced by analyseBeacon(), analyseProbeRep(), and analyseProbeReq().

UINT8 dataIsCrypted unsigned char *  packet,
int  len
 

Definition at line 117 of file functions.c.

References FixedField_t::cap_info, Statistics_t::CryptedPackets, Statistics_t::IV, ScanResult_t::IV, Res, Stats, Statistics_t::WeakIV, WLAN_GET_FC_FROMDS, WLAN_GET_FC_TODS, and WLAN_GET_MGMT_CAP_INFO_PRIVACY.

Referenced by analyseData().

char* safe_strncpy char *  dst,
const char *  src,
int  size
 

Definition at line 79 of file functions.c.

int safe_snprintf char *  s,
int  size,
char *  fmt,
  ...
 

Definition at line 85 of file functions.c.

void* memcpy_buff void *  dest,
const void *  src,
size_t  n
 

Definition at line 101 of file functions.c.

References debug, and MAX_BUFFER_SIZE.

Referenced by getPacketATHEROS(), getPacketCISCO(), getPacketHERMES(), getPacketHOSTAP(), getPacketPRISM54g(), and getPacketWLAN().

void UpdateOtherInformation char *  Buff  ) 
 

Definition at line 180 of file functions.c.

References debug, MAXSIZE_OTHERINFORMATION, ScanResult_t::OtherInformation, and Res.

Referenced by ProcessTagBits().

void printfMAC UINT8  AddMac[WLAN_ADDR_LEN]  ) 
 

Definition at line 197 of file functions.c.

int processPacket unsigned char *  packet,
int  len
 

Definition at line 206 of file functions.c.

References analyseACK(), analyseBeacon(), analyseCTS(), analyseData(), analyseMGMT(), analyseProbeRep(), analyseProbeReq(), analysePSPOLL(), analyseRTS(), Statistics_t::Beacon, debug, ScanResult_t::Noise, ScanResult_t::Rate, Res, SET_TYPE_BIT_DATA, ScanResult_t::Signal, Stats, ScanResult_t::TypeOfClient, ScanResult_t::TypeOfPacket, TypeOfPacketToString(), ScanResult_t::TypeSubtype, UINT32, WLAN_FSTYPE_ACK, WLAN_FSTYPE_ASSOCREQ, WLAN_FSTYPE_ASSOCRESP, WLAN_FSTYPE_ATIM, WLAN_FSTYPE_AUTHEN, WLAN_FSTYPE_BEACON, WLAN_FSTYPE_CFACK, WLAN_FSTYPE_CFACK_CFPOLL, WLAN_FSTYPE_CFEND, WLAN_FSTYPE_CFENDCFACK, WLAN_FSTYPE_CFPOLL, WLAN_FSTYPE_CTS, WLAN_FSTYPE_DATA_CFACK, WLAN_FSTYPE_DATA_CFACK_CFPOLL, WLAN_FSTYPE_DATA_CFPOLL, WLAN_FSTYPE_DATAONLY, WLAN_FSTYPE_DEAUTHEN, WLAN_FSTYPE_DISASSOC, WLAN_FSTYPE_NULL, WLAN_FSTYPE_PROBEREQ, WLAN_FSTYPE_PROBERESP, WLAN_FSTYPE_PSPOLL, WLAN_FSTYPE_REASSOCREQ, WLAN_FSTYPE_REASSOCRESP, WLAN_FSTYPE_RTS, WLAN_FTYPE_CTL, WLAN_FTYPE_DATA, WLAN_FTYPE_MGMT, WLAN_GET_FC_FSTYPE, WLAN_GET_FC_FTYPE, wlan_header, and WLAN_SIZEOF_TYPEOFPACKET.

Referenced by main().

UINT8 FilterESSID char *  ESSID  ) 
 

Definition at line 800 of file functions.c.

References FALSE.

Referenced by ProcessTagBits().

void ParseCommandLine int  argc,
char **  argv,
ConfigStruct config
 

Definition at line 1007 of file functions.c.

References ATHEROS_CARD, Bye(), CHANNEL_MAX, CHANNEL_MIN, ConfigStruct::ChannelHop, ConfigStruct::CheckScreenSize, CISCO_CARD, CISCO_CVS_CARD, config, ConfigStruct::DateFormat, debug, ConfigStruct::DebugLevel, ConfigStruct::devname, ConfigStruct::devname2, DEVNAME_LEN, ConfigStruct::DoNotDisplay, FALSE, HelpAndBye(), HOP_MAX, HOP_MIN, HOSTAP_CARD, ConfigStruct::IDS_is_ON, LUCENT_CARD, MAX_DEBUG_LEVEL, ConfigStruct::MaxPacket, ConfigStruct::OutDotFileName, ConfigStruct::OutDumpFileName, ConfigStruct::OutFileName, PRISM54G_CARD, ConfigStruct::SendAlert2Syslog, SET_BIT, ConfigStruct::SingleChannel, ConfigStruct::TimeToSleepBeforeChangeChannel, TRUE, ConfigStruct::TypeOfCard, and WLAN_NG_CARD.

Referenced by main().

void DispConf ConfigStruct config  ) 
 

Definition at line 1302 of file functions.c.

References ConfigStruct::CheckScreenSize, CISCO_CVS_CARD, config, ConfigStruct::DateFormat, ConfigStruct::DebugLevel, ConfigStruct::devname, ConfigStruct::devname2, ConfigStruct::IDS_is_ON, MAX_DEBUG_LEVEL, ConfigStruct::MaxPacket, ConfigStruct::OutDotFileName, ConfigStruct::OutDumpFileName, ConfigStruct::OutFileName, ConfigStruct::SendAlert2Syslog, ConfigStruct::SingleChannel, ConfigStruct::TimeToSleepBeforeChangeChannel, and ConfigStruct::TypeOfCard.

Referenced by main().

void ChannelToStr char *  strChannel,
UINT8  Channel,
UINT8  SChannel
 

Channel to string

Definition at line 1351 of file functions.c.

References debug.

Referenced by main().

void InitConfiguration ConfigStruct config  ) 
 

Definition at line 1364 of file functions.c.

References ConfigStruct::ChannelHop, ConfigStruct::CheckScreenSize, config, ConfigStruct::DateFormat, ConfigStruct::DebugLevel, ConfigStruct::devname, ConfigStruct::DoNotDisplay, FALSE, ConfigStruct::SendAlert2Syslog, ConfigStruct::SingleChannel, ConfigStruct::TimeToSleepBeforeChangeChannel, TRUE, ConfigStruct::TypeOfCard, and WLAN_NG_CARD.

Referenced by main().


Variable Documentation

struct sockaddr_nl nl_sk_addr
 

ScanResult_t Res
 

Definition at line 59 of file scanner.c.

Statistics_t Stats
 

Definition at line 61 of file scanner.c.

WINDOW* Title_WND
 

Definition at line 60 of file scanner.c.

Referenced by InitScreen(), and RefreshAllWND().

WINDOW * Panel_WND
 

Definition at line 60 of file scanner.c.

WINDOW * Sum_WND
 

Definition at line 60 of file scanner.c.

WINDOW * RealTime_WND
 

Definition at line 60 of file scanner.c.

p80211_caphdr_t wlan_header
 

Definition at line 52 of file driver.c.


Generated on Fri Feb 25 12:02:47 2005 for WifiScanner by  doxygen 1.4.1