DSWifi
Loading...
Searching...
No Matches
Macros | Typedefs | Enumerations | Functions
dswifi9.h File Reference

ARM9 header of DSWifi. More...

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <nds/ndstypes.h>
#include <dswifi_common.h>
#include <dswifi_version.h>

Macros

#define INIT_ONLY   false
 Init library only, don't try to connect to AP. Used by Wifi_InitDefault().
 
#define WFC_CONNECT   true
 Init library and try to connect to firmware AP. Used by Wifi_InitDefault().
 

Typedefs

typedef void(* WifiFromClientPacketHandler) (Wifi_MPPacketType, int, int, int)
 Handler of WiFI packets received on the host from a client.
 
typedef void(* WifiFromHostPacketHandler) (Wifi_MPPacketType, int, int)
 Handler of WiFI packets received on a client from the host.
 
typedef void(* WifiPacketHandler) (int, int)
 Handler of RAW packets received in this console.
 
typedef void(* WifiSyncHandler) (void)
 Wifi Sync Handler function.
 

Enumerations

enum  WIFI_ASSOCSTATUS {
  ASSOCSTATUS_DISCONNECTED ,
  ASSOCSTATUS_SEARCHING ,
  ASSOCSTATUS_AUTHENTICATING ,
  ASSOCSTATUS_ASSOCIATING ,
  ASSOCSTATUS_ACQUIRINGDHCP ,
  ASSOCSTATUS_ASSOCIATED ,
  ASSOCSTATUS_CANNOTCONNECT
}
 Returned by Wifi_AssocStatus() after calling Wifi_ConnectAP() More...
 
enum  Wifi_MPPacketType {
  WIFI_MPTYPE_INVALID = -1 ,
  WIFI_MPTYPE_CMD = 0 ,
  WIFI_MPTYPE_REPLY = 1 ,
  WIFI_MPTYPE_DATA = 2
}
 Possible types of packets received by multiplayer handlers. More...
 
enum  WIFI_RETURN {
  WIFI_RETURN_OK = 0 ,
  WIFI_RETURN_LOCKFAILED = 1 ,
  WIFI_RETURN_ERROR = 2 ,
  WIFI_RETURN_PARAMERROR = 3
}
 Error codes for Wifi_GetAPData() More...
 
enum  WIFIGETDATA {
  WIFIGETDATA_MACADDRESS ,
  WIFIGETDATA_NUMWFCAPS ,
  WIFIGETDATA_RSSI ,
  MAX_WIFIGETDATA
}
 User code uses members of the WIFIGETDATA structure in calling Wifi_GetData() to retreive miscellaneous odd information. More...
 

Functions

int Wifi_AssocStatus (void)
 Returns information about the status of connection to an AP.
 
void Wifi_AutoConnect (void)
 Connect to an Access Point specified by the WFC data in the firmware.
 
int Wifi_BeaconStart (const char *ssid, u32 game_id)
 Sends a beacon frame to the ARM7 to be used in multiplayer host mode.
 
int Wifi_CheckInit (void)
 Verifies when the ARM7 has been successfully initialized.
 
int Wifi_ConnectAP (Wifi_AccessPoint *apdata, int wepmode, int wepkeyid, unsigned char *wepkey)
 Connect to an Access Point.
 
int Wifi_ConnectOpenAP (Wifi_AccessPoint *apdata)
 Connect to an AP without encryption (and NDS multiplayer hosts).
 
void Wifi_DisableWifi (void)
 Instructs the ARM7 to disengage wireless and stop receiving or transmitting.
 
int Wifi_DisconnectAP (void)
 Disassociate from the Access Point.
 
void Wifi_EnableWifi (void)
 Instructs the ARM7 to go into a basic "active" mode.
 
int Wifi_FindMatchingAP (int numaps, Wifi_AccessPoint *apdata, Wifi_AccessPoint *match_dest)
 Determines whether various APs exist in the local area.
 
int Wifi_GetAPData (int apnum, Wifi_AccessPoint *apdata)
 Grabs data from internal structures for user code (always succeeds).
 
int Wifi_GetData (int datatype, int bufferlen, unsigned char *buffer)
 Retrieve an arbitrary or misc. piece of data from the WiFi hardware.
 
u32 Wifi_GetIP (void)
 It returns the current IP address of the DS.
 
struct in_addr Wifi_GetIPInfo (struct in_addr *pGateway, struct in_addr *pSnmask, struct in_addr *pDns1, struct in_addr *pDns2)
 Returns IP information.
 
int Wifi_GetNumAP (void)
 Returns the current number of APs that are known and tracked internally.
 
u32 Wifi_GetStats (int statnum)
 Retreive an element of the WiFi statistics gathered.
 
void Wifi_IdleMode (void)
 Sets the WiFI hardware in "active" mode.
 
u32 Wifi_Init (int initflags)
 Initializes the WiFi library (ARM9 side) and the sgIP library.
 
bool Wifi_InitDefault (bool useFirmwareSettings)
 Initializes WiFi library.
 
void Wifi_InternetMode (void)
 Sets the WiFI hardware in Internet mode.
 
bool Wifi_LibraryModeReady (void)
 Checks whether a library mode change has finished or not.
 
void Wifi_MultiplayerAllowNewClients (bool allow)
 Allows or disallows new clients to connect to this console acting as host.
 
int Wifi_MultiplayerClientMode (size_t client_packet_size)
 Sets the WiFI hardware in mulitplayer client mode.
 
int Wifi_MultiplayerClientReplyTxFrame (const void *data, u16 datalen)
 Prepares a multiplayer client reply frame to be sent.
 
int Wifi_MultiplayerClientToHostDataTxFrame (const void *data, u16 datalen)
 Sends a data frame to the host.
 
void Wifi_MultiplayerFromClientSetPacketHandler (WifiFromClientPacketHandler func)
 Set a handler on a host console for packets received from clients.
 
void Wifi_MultiplayerFromHostSetPacketHandler (WifiFromHostPacketHandler func)
 Set a handler on a client console for packets received from the host.
 
u16 Wifi_MultiplayerGetClientMask (void)
 Returns a mask where each bit represents an connected client.
 
int Wifi_MultiplayerGetClients (int max_clients, Wifi_ConnectedClient *client_data)
 Get information of clients connected to a multiplayer host.
 
int Wifi_MultiplayerGetNumClients (void)
 Get the number of clients connected to this DS acting as a multiplayer host.
 
int Wifi_MultiplayerHostCmdTxFrame (const void *data, u16 datalen)
 Sends a multiplayer host frame.
 
int Wifi_MultiplayerHostMode (int max_clients, size_t host_packet_size, size_t client_packet_size)
 Sets the WiFI hardware in mulitplayer host mode.
 
void Wifi_MultiplayerHostName (const void *buffer, u8 len)
 Set the name and name length fields in beacon packets.
 
int Wifi_MultiplayerHostToClientDataTxFrame (int aid, const void *data, u16 datalen)
 Sends a data frame to the client with the specified association ID.
 
void Wifi_MultiplayerKickClientByAID (int association_id)
 Kick the client with the provided AID from the host.
 
void Wifi_RawSetPacketHandler (WifiPacketHandler wphfunc)
 Set a handler to process all raw incoming packets.
 
int Wifi_RawTxFrame (u16 datalen, u16 rate, const void *src)
 Send a raw 802.11 frame at a specified rate.
 
void Wifi_RxRawReadPacket (u32 base, u32 size_bytes, void *dst)
 Allows user code to read a packet from within the WifiPacketHandler function.
 
void Wifi_ScanMode (void)
 Makes the ARM7 go into scan mode and list Internet APs.
 
void Wifi_ScanModeFilter (Wifi_APScanFlags flags)
 Makes the ARM7 go into scan mode, filterint out the requested device types.
 
void Wifi_SetChannel (int channel)
 If the WiFi system is not connected or connecting to an access point, instruct the chipset to change channel.
 
void Wifi_SetIP (u32 IPaddr, u32 gateway, u32 subnetmask, u32 dns1, u32 dns2)
 Set the DS's IP address and other IP configuration information.
 
void Wifi_SetPromiscuousMode (int enable)
 Allows the DS to enter or leave a "promsicuous" mode.
 
void Wifi_SetSyncHandler (WifiSyncHandler sh)
 Call this function to request notification of when the ARM7-side Wifi_Sync() function should be called.
 
void Wifi_Sync (void)
 Call this function when requested to sync by the ARM7 side of the WiFi lib.
 
void Wifi_Timer (int num_ms)
 This function should be called in a periodic interrupt.
 
void Wifi_Update (void)
 Checks for new data from the ARM7 and initiates routing if data is available.
 

Detailed Description

ARM9 header of DSWifi.