#include <nitroWiFi/cps.h>
#define CPS_DONOTUSE_DHCP 0x0001
typedef struct {
u32 mode;
void *(*alloc)(u32);
void (*free)(void *);
void (*dhcp_callback)(void);
BOOL (*link_is_on)(void);
unsigned long long random_seed;
u8 *lan_buf;
u32 lan_buflen;
u32 mymss;
CPSInAddr requested_ip;
u32 yield_wait;
} CPSConfig;
A structure that defines the configuration data to be passed to CPS_Startup()
.
mode |
Sets the desired operating mode using bits. If the CPS_DONOTUSE_DHCP bit is enabled, DHCP is not used. |
alloc |
Required. Sets the called functions when memory allocation is needed inside the CPS library. |
free |
Required. Sets the called functions when memory release is needed inside the CPS library. |
dhcp_callback |
If configured not to use DHCP, this callback is immediately called after the physical link is established. If configured to use DHCP, this callback is called if the DHCP server cannot be found. In dhcp_callback , CPSMyIp , CPSNetMask , CPSGatewayIp , CPSDnsIp , etc. are set. If NULL, a function that does nothing is set. |
link_is_on |
Sets a function that returns the physical link state (a non-zero value when the link is ON). If NULL is specified, sets a function that always returns TRUE. The function generally should be set as follows:
|
random_seed |
Sets the seed for random numbers. If 0 is specified, the value of OS_GetTick() is used. Because the initial value of the temporary port is set based on this value, it is recommended to set the most random value possible based on a user action. |
lan_buf |
Required. Sets the ring buffer address used for wireless LAN reception. |
lan_buflen |
Required. Sets the ring buffer length used for wireless LAN reception. If the length that is set is too small, the packet may be dropped; therefore, a setting that ranges from 8K to 16K or more is recommended. |
mymss |
Sets the maximum segment size for TCP reception. Set to 1460 if 0 is specified. |
requested_ip |
If using DHCP, this sets the IP address you want to be assigned. The DHCP server attempts to assign this IP address if possible. 0 indicates that there is no IP address you want to be assigned. Some access points do not save the MAC and IP address pairs when the network disconnects and reconnects. Therefore, an IP address needs to be specified in this member so that the IP address from the previous connection is assigned by priority if necessary. |
yield_wait |
Specifies the OS wait feature to use to poll received packets in the CPS library. If 0, OS_YieldThread() is used. In this case, passing control to applications with a lower priority than the CPS library is difficult. If the value is non-zero, OS_Sleep() that uses this value as a parameter is used. Control is passed to low-priority applications, but network response may be slightly slower. |
Note: Exclusive control is required for functions set to alloc and free members.
CPS_Startup
, CPS Library Types
, CPS Library Global Variables
10/24/2005 Initial version.