SOCConfig

C Specification

#include <nitroWiFi/soc.h>
#define SOC_VENDOR_NINTENDO  0x0000      // Nintendo TCP/IP stack
#define SOC_VERSION          0x0100      // Version 1.0

// Name for SOCConfig.alloc() and SOCConfig.free()
#define SOC_MEM_TCP_INFO         0
#define SOC_MEM_TCP_SENDBUF      1
#define SOC_MEM_TCP_RECVBUF      2
#define SOC_MEM_UDP_INFO         3
#define SOC_MEM_UDP_RECVBUF      4
#define SOC_MEM_TIMEWAITBUF      5
#define SOC_MEM_REASSEMBLYBUF    6

// Flags for SOCConfig{}.flag
#define SOC_FLAG_DHCP            0x0001  // Use DHCP
#define SOC_FLAG_PPPoE           0x0002  // Use PPPoE
typedef struct SOCConfig
{
    u16         vendor;             // SOC_VENDOR_NINTENDO
    u16         version;            // SOC_VERSION

    //
    // vendor specific section
    //
    void*    (* alloc )(u32 name, s32 size);
    void     (* free ) (u32 name, void* ptr, s32 size);

    u32          flag;              // ORed SOC_FLAG_*
    SOCInAddr    addr;
    SOCInAddr    netmask;
    SOCInAddr    router;
    SOCInAddr    dns1;
    SOCInAddr    dns2;

    s32         timeWaitBuffer;     // time wait buffer size
    s32         reassemblyBuffer;   // reassembly buffer size
    s32         mtu;                // maximum transmission unit size

    // TCP
    s32         rwin;               // default TCP receive window size (default 2 x MSS)
    SOCTime     r2;                 // default TCP total retransmit timeout value

    // PPP
    const char* peerid;
    const char* passwd;

    // PPPoE
    const char* serviceName;        // UTF-8 string

    // DHCP
    const char* hostName;           // DHCP host name
    s32         rdhcp;              // DHCP retransmit times

    // UDP
    s32         udpSendBuff;        // default UDP send buffer size
    s32         udpRecvBuff;        // defualt UDP receive buffer size
} SOCConfig;

Description

SOC_VENDOR_NINTENDO implementation:

When the socket layer requests a new memory block, the alloc function is called. The name argument is one of SOC_MEM_* that indicates the memory block type used. The alloc function must allocate a memory block of size bytes and return a pointer to the allocated memory block. If the stack layer can free the allocated memory block, the free function is called. The free function must release the memory block pointed to by the ptr argument. The other arguments (name and size) are the same as those in the alloc function. Mutual exclusion between threads must be implemented in the alloc and free functions. alloc functions and free functions are not called directly from callback functions, so a thread-level synchronous primitive such as OS_LockMutex() can be used.

Member Description
vendor Assigns the vender name. This member is included for compatibility issues, but it is ignored in actual use of the function.
version Assigns the version. This member is included for compatibility issues, but it is ignored in actual use of the function.
alloc This function allocates memory for use inside the project.
free This function deallocates memory used inside the project.
flags Assigns the host configuration method.
SOC_FLAG_DHCP The host is configured using DHCP.
If SOC_FLAG_DHCP is FALSE, the structure members addr, netmask, and router are used in the host configuration.
dns1 Assigns a DNS server address to a structure member.
This structure member is used by SOC_GetHostByAddr() and SOC_GetHostByName().
dns2 Assigns a DNS server address to a structure member.
This structure members is used by SOC_GetHostByAddr() and SOC_GetHostByName().
timeWaitBuffer Assigns the size of the time wait buffer.
This member is included for compatibility but is actually ignored.
reassemblyBuffer Assigns the size of the fragment packet reassembly buffer.
This member is included for compatibility but is actually ignored.
mtu Assigns the default interface MTU size.
If a 0 is designated here, the default interface MTU size is set.
Also, when the host is configured with DHCP, the host will communicate with the DHCP server to adjust the MTU size.
In this case, an MTU size that is smaller than the specified size could be used. The actual MTU size can be found with SOC_GetMtu().
rwin Assigns the size of the default TCP reception window. If 0 is specified, it will be set to 2x MSS (the maximum segment size).
r2 Assigns the default total retransfer timeout time after the TCP connection is established.
This member is included for compatibility but is actually ignored.
serviceName Assigns the service name to be used when connecting with PPPoE.
This member is included for compatibility but is actually ignored.
hostName Assigns the host name of the client to be used when connecting with DHCP.
This member is included for compatibility but is actually ignored.
rdhcp Configures the number of times to resend a DHCP packet.
This member is included for compatibility but is actually ignored.
udpSendBuff Assigns the default UDP send buffer size.
This member is included for compatibility but is actually ignored.
udpRecvBuff Assigns the default UDP receive buffer size.
This member is included for compatibility but is actually ignored.

See Also

SOC_GetHostByAddr, SOC_GetHostByName, SOC_GetMtu, SOC_Startup, SOCInAddr

Revision History

2005/09/13 Initial version.


CONFIDENTIAL