LMS 2012
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
c_wifi.c File Reference
#include "c_wifi.h"

Go to the source code of this file.

Macros

#define MAX_AP_ENTRIES   16
 
#define MAX_AP_STORAGE_ENTRIES   16
 
#define WPA_SUPPLICANT_GLOBAL_SOCKET   "/var/run/wpa_supplicant-global"
 
#define WPA_SUPPLICANT_CONTROL_SOCKET   "/var/run/wpa_supplicant"
 
#define HARDWARE_SEARCH_STRING   "ID 0846:9030 NetGear, Inc."
 
#define WIFI_VENDOR_ID   "0846"
 
#define WIFI_DONGLE_ID   "9030"
 
#define WPA_APPLIKATION_PATH   ""
 

Functions

void cWiFiStartTimer (void)
 
RESULT cWiFiKillUdHcPc (void)
 
void cWiFiStartDongleCheckTimer (void)
 
int cWiFiTimeFromLastDongleCheck (void)
 
int cWiFiCheckTimer (void)
 
void wpa_control_message_callback (char *message, size_t length)
 
int do_wpa_command (struct wpa_ctrl *control, char *command)
 
int cWiFiStartWpaSupplicant (char *ConfigPath, char *IFName)
 
struct wpa_ctrlcWiFiOpenCtrlInterFace (char *CtrlPath, char *InterFace)
 
int cWiFiPopulateKnownApList (void)
 
int cWiFiStoreKnownApList (void)
 
void cWiFiRestoreActualApRecord (int Destination)
 
void cWiFiPreserveActualApRecord (int Index)
 
void cWiFiMoveUpInStoreList (int Index)
 
void cWiFiMoveDownInStoreList (int Index)
 
void cWiFiMoveUpInActualList (int Index)
 
void cWiFiMoveDownInActualList (int Index)
 
void cWiFiMoveUpInList (int Index)
 
RESULT cWiFiRemoveNetwork (void)
 
RESULT cWiFiTcpClose (void)
 
void cWiFiUdpClientClose (void)
 
void cWiFiMoveDownInList (int Index)
 
void cWiFiDeleteInList (int Index)
 
void cWiFiDeleteInStoreList (int Index)
 
void cWifiMoveAllActualDown (int SourcePointer)
 
void cWiFiMoveAllStoreDown (int SourcePointer)
 
void cWiFiCopyStoreToActual (int StoreIndex, int ActualIndex)
 
void cWiFiCopyActualToStore (int ActualIndex, int StoreIndex)
 
RESULT cWiFiCheckAndDelete (int Index)
 
void cWiFiAddToKnownApList (int Index)
 
void cWiFiPreserveStorageApRecord (int Index)
 
void cWiFiRestoreStorageApRecord (int Destination)
 
RESULT cWiFiMergeActualAndKnownTable (void)
 
RESULT cWiFiTerminate (void)
 
RESULT cWiFiAddNetwork (void)
 
RESULT cWiFiSetScanSsidToOne (void)
 
RESULT cWiFiSetSsid (char *Ssid)
 
RESULT cWiFiSetKeyManagToWpa2 (void)
 
RESULT cWiFiSetKeyManagToNone (void)
 
RESULT cWiFiSetPsk (char *Psk)
 
RESULT cWiFiGetApMacAddr (char *MacAddr, int Index)
 
void cWiFiSetEncryptToWpa2 (int Index)
 
void cWiFiSetEncryptToNone (int Index)
 
void cWiFiSetKnown (int Index)
 
void cWiFiDeleteAsKnown (int LocalIndex)
 
RESULT cWiFiAddHidden (char *HiddenApName, char *Security, char *PassWord)
 
RESULT cWiFiGetHiddenMacAddr (char *MacAddr, int Index)
 
RESULT cWiFiGetIpAddr (char *IpAddress)
 
RESULT cWiFiGetMyMacAddr (char *MacAddress)
 
RESULT cWiFiFindMacAddr (void)
 
RESULT cWiFiDeepDongleSearch (void)
 
RESULT cWiFiKnownDongleAttached (void)
 
RESULT cWiFiFindIpAddr (void)
 
RESULT cWiFiRequestIpAdr (char *Interface)
 
RESULT cWiFiSetPairWiseCcmp (void)
 
RESULT cWiFiSetGroupCcmp (void)
 
RESULT cWiFiSetProtoRsn (void)
 
RESULT cWiFiSetEnableNetwork (void)
 
RESULT cWiFiWpaStatus (void)
 
RESULT cWiFiDisconnect (void)
 
RESULT cWiFiReconnect (void)
 
RESULT cWiFiGetName (char *ApName, int Index, char Length)
 
RESULT cWiFiSetName (char *ApName, int Index)
 
unsigned char cWiFiGetFlags (int Index)
 
void cWiFiClearExceptZero ()
 
void cWiFiTcpShutDown (int iSocket)
 
void cWiFiCleanUpOldStuff (void)
 
RESULT cWiFiMakeConnectionToAp (int Index)
 
RESULT cWiFiConnectToAp (int Index)
 
RESULT cWiFiMakePsk (char *ApSsid, char *PassPhrase, int Index)
 
RESULT cWiFiGetIndexFromName (char *Name, UBYTE *Index)
 
int cWiFiIsItAFriend (char *mac_address)
 
void cWiFiSortBySignalLevel ()
 
RESULT cWiFiStoreActualApList ()
 
RESULT cWiFiScanForAPs ()
 
void cWiFiIncApListSize (void)
 
int cWiFiGetApListSize (void)
 
int cWiFiWpaPing (void)
 
RESULT cWiFiGetLogicalName (void)
 
RESULT cWiFiGetStatus (void)
 
RESULT cWiFiTxingBeacons (void)
 
RESULT cWiFiTcpConnected (void)
 
RESULT cWiFiInitTcpServer ()
 
RESULT cWiFiWaitForTcpConnection (void)
 
UWORD cWiFiWriteTcp (UBYTE *Buffer, UWORD Length)
 
RESULT cWiFiResetTcp (void)
 
UWORD cWiFiReadTcp (UBYTE *Buffer, UWORD Length)
 
RESULT cWiFiBeaconAnswer (void)
 
RESULT cWiFiTransmitBeacon (void)
 
RESULT cWiFiInitUdpConnection (void)
 
void cWiFiSetBtSerialNo (void)
 
void cWiFiSetBrickName (void)
 
int cWiFiCheckForLoadedModule (char *NameToCheck)
 
void cWiFiLoadAthHwModules (void)
 
void cWiFiUnLoadAthHwModules (void)
 
void cWiFiControl (void)
 
RESULT cWiFiGetOnStatus (void)
 
RESULT cWiFiTurnOn (void)
 
RESULT cWiFiTurnOff (void)
 
RESULT cWiFiExit (void)
 
RESULT cWiFiInit (void)
 

Variables

struct timeval TimerStartVal TimerCurrentVal
 
struct timeval DongleCheckStartVal DongleCheckCurrentVal
 
unsigned int TimeOut = 0
 
char Buffer [1024]
 
char * BufPtr = Buffer
 
int BufLen = sizeof(Buffer)
 
KNOWN_HW KnownWiFiDongle = HW_NOT_KNOWN
 
UBYTE TcpReadBuffer [1024]
 
uint TcpReadBufPointer = 0
 
int WiFiConnectionState = WIFI_NOT_INITIATED
 
int InitState = NOT_INIT
 
int UdpSocketDescriptor = 0
 
char Server [32]
 
int UdpRxCount
 
int UdpTxCount
 
struct sockaddr_in ServerAddr
 
socklen_t ServerAddrLen = sizeof(ServerAddr)
 
fd_set UdpReadFlags
 
fd_set UdpWriteFlags
 
struct timeval UdpWait
 
int BroadCast = 1
 
BEACON_MODE BeaconTx = NO_TX
 
TCP_STATES TcpState = TCP_DOWN
 
int WiFiStatus = OK
 
RESULT WiFiOnStatus = FAIL
 
int TcpConnectionSocket = 0
 
struct sockaddr_in servaddr client_addr
 
int TCPListenServer = 0
 
UWORD TcpTotalLength = 0
 
UWORD TcpRestLen = 0
 
UBYTE TcpReadState = TCP_IDLE
 

Macro Definition Documentation

#define HARDWARE_SEARCH_STRING   "ID 0846:9030 NetGear, Inc."

Definition at line 82 of file c_wifi.c.

#define MAX_AP_ENTRIES   16

Definition at line 44 of file c_wifi.c.

#define MAX_AP_STORAGE_ENTRIES   16

Definition at line 50 of file c_wifi.c.

#define WIFI_DONGLE_ID   "9030"

Definition at line 85 of file c_wifi.c.

#define WIFI_VENDOR_ID   "0846"

Definition at line 84 of file c_wifi.c.

#define WPA_APPLIKATION_PATH   ""

Definition at line 93 of file c_wifi.c.

#define WPA_SUPPLICANT_CONTROL_SOCKET   "/var/run/wpa_supplicant"

Definition at line 75 of file c_wifi.c.

#define WPA_SUPPLICANT_GLOBAL_SOCKET   "/var/run/wpa_supplicant-global"

Definition at line 74 of file c_wifi.c.

Function Documentation

RESULT cWiFiAddHidden ( char *  HiddenApName,
char *  Security,
char *  PassWord 
)

Definition at line 1119 of file c_wifi.c.

RESULT cWiFiAddNetwork ( void  )

Definition at line 818 of file c_wifi.c.

void cWiFiAddToKnownApList ( int  Index)

Definition at line 687 of file c_wifi.c.

RESULT cWiFiBeaconAnswer ( void  )

Definition at line 3077 of file c_wifi.c.

RESULT cWiFiCheckAndDelete ( int  Index)

Definition at line 664 of file c_wifi.c.

int cWiFiCheckForLoadedModule ( char *  NameToCheck)

Definition at line 3260 of file c_wifi.c.

int cWiFiCheckTimer ( void  )

Definition at line 187 of file c_wifi.c.

void cWiFiCleanUpOldStuff ( void  )

Definition at line 1760 of file c_wifi.c.

void cWiFiClearExceptZero ( )

Definition at line 1731 of file c_wifi.c.

RESULT cWiFiConnectToAp ( int  Index)

Definition at line 2011 of file c_wifi.c.

void cWiFiControl ( void  )

Definition at line 3462 of file c_wifi.c.

void cWiFiCopyActualToStore ( int  ActualIndex,
int  StoreIndex 
)

Definition at line 659 of file c_wifi.c.

void cWiFiCopyStoreToActual ( int  StoreIndex,
int  ActualIndex 
)

Definition at line 654 of file c_wifi.c.

RESULT cWiFiDeepDongleSearch ( void  )

Definition at line 1278 of file c_wifi.c.

void cWiFiDeleteAsKnown ( int  LocalIndex)

Definition at line 1112 of file c_wifi.c.

void cWiFiDeleteInList ( int  Index)

Definition at line 597 of file c_wifi.c.

void cWiFiDeleteInStoreList ( int  Index)

Definition at line 615 of file c_wifi.c.

RESULT cWiFiDisconnect ( void  )

Definition at line 1606 of file c_wifi.c.

RESULT cWiFiExit ( void  )

Definition at line 3998 of file c_wifi.c.

RESULT cWiFiFindIpAddr ( void  )

Definition at line 1350 of file c_wifi.c.

RESULT cWiFiFindMacAddr ( void  )

Definition at line 1221 of file c_wifi.c.

int cWiFiGetApListSize ( void  )

Definition at line 2544 of file c_wifi.c.

RESULT cWiFiGetApMacAddr ( char *  MacAddr,
int  Index 
)

Definition at line 1064 of file c_wifi.c.

unsigned char cWiFiGetFlags ( int  Index)

Definition at line 1726 of file c_wifi.c.

RESULT cWiFiGetHiddenMacAddr ( char *  MacAddr,
int  Index 
)

Definition at line 1156 of file c_wifi.c.

RESULT cWiFiGetIndexFromName ( char *  Name,
UBYTE Index 
)

Definition at line 2152 of file c_wifi.c.

RESULT cWiFiGetIpAddr ( char *  IpAddress)

Definition at line 1197 of file c_wifi.c.

RESULT cWiFiGetLogicalName ( void  )

Definition at line 2574 of file c_wifi.c.

RESULT cWiFiGetMyMacAddr ( char *  MacAddress)

Definition at line 1209 of file c_wifi.c.

RESULT cWiFiGetName ( char *  ApName,
int  Index,
char  Length 
)

Definition at line 1681 of file c_wifi.c.

RESULT cWiFiGetOnStatus ( void  )

Definition at line 3875 of file c_wifi.c.

RESULT cWiFiGetStatus ( void  )

Definition at line 2601 of file c_wifi.c.

void cWiFiIncApListSize ( void  )

Definition at line 2536 of file c_wifi.c.

RESULT cWiFiInit ( void  )

Definition at line 4006 of file c_wifi.c.

RESULT cWiFiInitTcpServer ( )

Definition at line 2627 of file c_wifi.c.

RESULT cWiFiInitUdpConnection ( void  )

Definition at line 3164 of file c_wifi.c.

int cWiFiIsItAFriend ( char *  mac_address)

Definition at line 2205 of file c_wifi.c.

RESULT cWiFiKillUdHcPc ( void  )

Definition at line 140 of file c_wifi.c.

RESULT cWiFiKnownDongleAttached ( void  )

Definition at line 1311 of file c_wifi.c.

void cWiFiLoadAthHwModules ( void  )

Definition at line 3296 of file c_wifi.c.

RESULT cWiFiMakeConnectionToAp ( int  Index)

Definition at line 1776 of file c_wifi.c.

RESULT cWiFiMakePsk ( char *  ApSsid,
char *  PassPhrase,
int  Index 
)

Definition at line 2078 of file c_wifi.c.

RESULT cWiFiMergeActualAndKnownTable ( void  )

Definition at line 722 of file c_wifi.c.

void cWifiMoveAllActualDown ( int  SourcePointer)

Definition at line 630 of file c_wifi.c.

void cWiFiMoveAllStoreDown ( int  SourcePointer)

Definition at line 642 of file c_wifi.c.

void cWiFiMoveDownInActualList ( int  Index)

Definition at line 458 of file c_wifi.c.

void cWiFiMoveDownInList ( int  Index)

Definition at line 586 of file c_wifi.c.

void cWiFiMoveDownInStoreList ( int  Index)

Definition at line 444 of file c_wifi.c.

void cWiFiMoveUpInActualList ( int  Index)

Definition at line 451 of file c_wifi.c.

void cWiFiMoveUpInList ( int  Index)

Definition at line 465 of file c_wifi.c.

void cWiFiMoveUpInStoreList ( int  Index)

Definition at line 437 of file c_wifi.c.

struct wpa_ctrl* cWiFiOpenCtrlInterFace ( char *  CtrlPath,
char *  InterFace 
)

Definition at line 252 of file c_wifi.c.

int cWiFiPopulateKnownApList ( void  )

Definition at line 260 of file c_wifi.c.

void cWiFiPreserveActualApRecord ( int  Index)

Definition at line 432 of file c_wifi.c.

void cWiFiPreserveStorageApRecord ( int  Index)

Definition at line 712 of file c_wifi.c.

UWORD cWiFiReadTcp ( UBYTE Buffer,
UWORD  Length 
)

Definition at line 2824 of file c_wifi.c.

RESULT cWiFiReconnect ( void  )

Definition at line 1642 of file c_wifi.c.

RESULT cWiFiRemoveNetwork ( void  )

Definition at line 477 of file c_wifi.c.

RESULT cWiFiRequestIpAdr ( char *  Interface)

Definition at line 1416 of file c_wifi.c.

RESULT cWiFiResetTcp ( void  )

Definition at line 2810 of file c_wifi.c.

void cWiFiRestoreActualApRecord ( int  Destination)

Definition at line 427 of file c_wifi.c.

void cWiFiRestoreStorageApRecord ( int  Destination)

Definition at line 717 of file c_wifi.c.

RESULT cWiFiScanForAPs ( void  )

Definition at line 2477 of file c_wifi.c.

void cWiFiSetBrickName ( void  )

Definition at line 3247 of file c_wifi.c.

void cWiFiSetBtSerialNo ( void  )

Definition at line 3234 of file c_wifi.c.

RESULT cWiFiSetEnableNetwork ( void  )

Definition at line 1543 of file c_wifi.c.

void cWiFiSetEncryptToNone ( int  Index)

Definition at line 1099 of file c_wifi.c.

void cWiFiSetEncryptToWpa2 ( int  Index)

Definition at line 1076 of file c_wifi.c.

RESULT cWiFiSetGroupCcmp ( void  )

Definition at line 1488 of file c_wifi.c.

RESULT cWiFiSetKeyManagToNone ( void  )

Definition at line 1006 of file c_wifi.c.

RESULT cWiFiSetKeyManagToWpa2 ( void  )

Definition at line 979 of file c_wifi.c.

void cWiFiSetKnown ( int  Index)

Definition at line 1107 of file c_wifi.c.

RESULT cWiFiSetName ( char *  ApName,
int  Index 
)

Definition at line 1699 of file c_wifi.c.

RESULT cWiFiSetPairWiseCcmp ( void  )

Definition at line 1461 of file c_wifi.c.

RESULT cWiFiSetProtoRsn ( void  )

Definition at line 1516 of file c_wifi.c.

RESULT cWiFiSetPsk ( char *  Psk)

Definition at line 1033 of file c_wifi.c.

RESULT cWiFiSetScanSsidToOne ( void  )

Definition at line 878 of file c_wifi.c.

RESULT cWiFiSetSsid ( char *  Ssid)

Definition at line 927 of file c_wifi.c.

void cWiFiSortBySignalLevel ( )

Definition at line 2221 of file c_wifi.c.

void cWiFiStartDongleCheckTimer ( void  )

Definition at line 174 of file c_wifi.c.

void cWiFiStartTimer ( void  )

Definition at line 135 of file c_wifi.c.

int cWiFiStartWpaSupplicant ( char *  ConfigPath,
char *  IFName 
)

Definition at line 232 of file c_wifi.c.

RESULT cWiFiStoreActualApList ( )

Definition at line 2250 of file c_wifi.c.

int cWiFiStoreKnownApList ( void  )

Definition at line 360 of file c_wifi.c.

RESULT cWiFiTcpClose ( void  )

Definition at line 530 of file c_wifi.c.

RESULT cWiFiTcpConnected ( void  )

Definition at line 2619 of file c_wifi.c.

void cWiFiTcpShutDown ( int  iSocket)

Definition at line 1742 of file c_wifi.c.

RESULT cWiFiTerminate ( void  )

Definition at line 785 of file c_wifi.c.

int cWiFiTimeFromLastDongleCheck ( void  )

Definition at line 180 of file c_wifi.c.

RESULT cWiFiTransmitBeacon ( void  )

Definition at line 3121 of file c_wifi.c.

RESULT cWiFiTurnOff ( void  )

Definition at line 3929 of file c_wifi.c.

RESULT cWiFiTurnOn ( void  )

Definition at line 3885 of file c_wifi.c.

RESULT cWiFiTxingBeacons ( void  )

Definition at line 2611 of file c_wifi.c.

void cWiFiUdpClientClose ( void  )

Definition at line 577 of file c_wifi.c.

void cWiFiUnLoadAthHwModules ( void  )

Definition at line 3379 of file c_wifi.c.

RESULT cWiFiWaitForTcpConnection ( void  )

Definition at line 2717 of file c_wifi.c.

int cWiFiWpaPing ( void  )

Definition at line 2549 of file c_wifi.c.

RESULT cWiFiWpaStatus ( void  )

Definition at line 1570 of file c_wifi.c.

UWORD cWiFiWriteTcp ( UBYTE Buffer,
UWORD  Length 
)

Definition at line 2757 of file c_wifi.c.

int do_wpa_command ( struct wpa_ctrl control,
char *  command 
)

Definition at line 204 of file c_wifi.c.

void wpa_control_message_callback ( char *  message,
size_t  length 
)

Definition at line 195 of file c_wifi.c.

Variable Documentation

BEACON_MODE BeaconTx = NO_TX

Definition at line 122 of file c_wifi.c.

int BroadCast = 1

Definition at line 121 of file c_wifi.c.

char Buffer[1024]

Definition at line 102 of file c_wifi.c.

int BufLen = sizeof(Buffer)

Definition at line 104 of file c_wifi.c.

char* BufPtr = Buffer

Definition at line 103 of file c_wifi.c.

struct sockaddr_in servaddr client_addr

Definition at line 127 of file c_wifi.c.

struct timeval DongleCheckStartVal DongleCheckCurrentVal

Definition at line 98 of file c_wifi.c.

int InitState = NOT_INIT

Definition at line 112 of file c_wifi.c.

KNOWN_HW KnownWiFiDongle = HW_NOT_KNOWN

Definition at line 106 of file c_wifi.c.

char Server[32]

Definition at line 115 of file c_wifi.c.

struct sockaddr_in ServerAddr

Definition at line 117 of file c_wifi.c.

socklen_t ServerAddrLen = sizeof(ServerAddr)

Definition at line 118 of file c_wifi.c.

int TcpConnectionSocket = 0

Definition at line 126 of file c_wifi.c.

int TCPListenServer = 0

Definition at line 128 of file c_wifi.c.

UBYTE TcpReadBuffer[1024]

Definition at line 108 of file c_wifi.c.

uint TcpReadBufPointer = 0

Definition at line 109 of file c_wifi.c.

UBYTE TcpReadState = TCP_IDLE

Definition at line 131 of file c_wifi.c.

UWORD TcpRestLen = 0

Definition at line 130 of file c_wifi.c.

TCP_STATES TcpState = TCP_DOWN

Definition at line 123 of file c_wifi.c.

UWORD TcpTotalLength = 0

Definition at line 129 of file c_wifi.c.

unsigned int TimeOut = 0

Definition at line 100 of file c_wifi.c.

struct timeval TimerStartVal TimerCurrentVal

Definition at line 97 of file c_wifi.c.

fd_set UdpReadFlags

Definition at line 119 of file c_wifi.c.

int UdpRxCount

Definition at line 116 of file c_wifi.c.

int UdpSocketDescriptor = 0

Definition at line 114 of file c_wifi.c.

int UdpTxCount

Definition at line 116 of file c_wifi.c.

struct timeval UdpWait

Definition at line 120 of file c_wifi.c.

fd_set UdpWriteFlags

Definition at line 119 of file c_wifi.c.

int WiFiConnectionState = WIFI_NOT_INITIATED

Definition at line 111 of file c_wifi.c.

RESULT WiFiOnStatus = FAIL

Definition at line 125 of file c_wifi.c.

int WiFiStatus = OK

Definition at line 124 of file c_wifi.c.