background image

Memory Allocation Support

 

2-14

Allocate Bulk Memory Block

mmBulkAlloc

Syntax

void  *mmBulkAlloc( INT32 Size );

Return Value

Pointer to allocated memory or NULL on error

Description

Allocates a memory block of at least size bytes in length. The function returns
a pointer to the new memory block, or NULL if memory is not available. The
size of the allocation is not restricted.

Free Bulk Memory Block

mmBulkFree

Syntax

void   mmBulkFree( void *pv );

Return Value

nothing

Description

Frees a previously allocated memory block by supplying the pointer that
mmBulkAlloc() originally returned.

Reallocate Bulk Memory Block

mmBulkRealloc

Syntax

void *mmBulkRealloc( void *pv, INT32 Size );

Return Value

Pointer to reallocated memory or NULL on error or when Size is zero

Description

Reallocate a previously allocated memory block by supplying the pointer that
mmBulkAlloc() originally returned. If Size is zero, the block is simply freed and
this function returns NULL. Otherwise, a NULL return indicates that the block
could not be reallocated and the original memory pointer (pv) is still valid. On
success, this function returns a pointer to the new memory block.

Copy Memory

mmCopy

Syntax

void  mmCopy( void *pDst, void *pSrc, uint size );

Return Value

nothing

Description

Called to copy size bytes of data memory from the data buffer pSrc to the data
buffer pDst.

Zero Memory

mmZeroInit

Syntax

void  mmZeroInit( void *pDst, uint size );

Return Value

nothing

Description

Called to initialize size bytes of data memory in the data buffer pDst to NULL.

Summary of Contents for TMS320C6000

Page 1: ...TMS320C6000 TCP IP Network Developer s Kit NDK Programmer s Reference Guide Literature Number SPRU524A October 2001 Printed on Recycled Paper ...

Page 2: ...nt that any license either express or implied is granted under any TI patent right copyright mask work right or other TI intellectual property right relating to any combination machine or process in which TI products or services are used Information published by TI regarding third party products or services does not constitute a license from TI to use such products or services or a warranty or end...

Page 3: ...rious API sets described in the NDK documentation Chapter 2 Operating System Abstraction API describes the API used by the adaptation layer to access the operating system Chapter 3 Sockets and Stream IO API describes the file and sockets API functions Chapter 4 Initialization and Configuration describes the TCP IP stack initialization and configuration including the Configuration Manager API and t...

Page 4: ...ice through the web server Related Documentation From Texas Instruments The following reference is provided for further information TMS320C6000 TCP IP Network Developer s Kit NDK User s Guide literature number SPRU523 TMS320C6000 TCP IP Network Developer s Kit NDK Porting Guide literature number SPRU030 TMS320C6000 TCP IP Network Developer s Kit NDK Technical Data Quick Reference Guide literature ...

Page 5: ...ogramming Interfaces 3 12 3 4 Full Duplex Pipes Programming Interface 3 34 4 Initialization and Configuration 4 1 4 1 Configuration Overview 4 2 4 2 Configuration Manager 4 3 4 3 Network Control Initialization Procedure NETCTRL 4 19 4 4 Configuration Specification 4 23 5 Network Tools Library Support Functions 5 1 5 1 Generic Support Calls 5 2 5 2 DNS Support Calls 5 7 5 3 TFTP Support Calls 5 10 ...

Page 6: ...g Stack Statistics A 59 B Network Address Translation B 1 B 1 NAT Operation B 2 B 2 NAT Port Mapping B 16 B 3 NAT Proxy Filters B 20 C Point to Point Protocol C 1 C 1 Low Level PPP Support C 2 C 2 Serial HDLC Client and Server Support C 14 C 3 PPPoE Client and Server Support C 20 C 4 Creating PPP Sever User Accounts C 25 D Hardware Abstraction Layer HAL D 1 D 1 Overview D 2 D 2 Low Level Timer Dri...

Page 7: ...gment Objects A 6 A 2 FRAG Object Properties A 15 B 1 Basic Home Network Configuration B 2 B 2 Public Servers on the Home Network B 7 C 1 Standard PPP Frame Over Serial Line C 2 C 2 PPP Frame Processed by PPP API C 2 C 3 Serial Interface SI Abstraction C 3 ...

Page 8: ...duction This chapter serves as an introduction to the programming API reference for the TMS320C6000 TCP IP Network Developer s Kit NDK Topic Page 1 1 This Document 1 2 1 2 Additional Documentation 1 3 Chapter 1 ...

Page 9: ... make these use of these function calls Appendix B Network Address Translation The stack library includes Network Address Translation module This ap pendix describes the operational theory of NAT and how to use the NAT functions included in the library Appendix C Point to Point Protocol The stack library has internal device sections for both traditional Ethernet and PPP The PPP module can act as P...

Page 10: ...CP IP NDK User s Guide contains the following information about the TCP IP NDK TCP IP NDK Installation and Test Running the Example Applications TCP IP Stack Library Overview Network Application Development 1 2 2 TMS320C6000 TCP IP NDK Porting Guide The NDK Porting Guide describes the inner workings of the individual stack layers The TCP IP stack is designed to be executed in different operating m...

Page 11: ...t of these functions will map directly to a native OS counterpart Applications programmers that program to this API are assured that their ap plications will execute on any system to which this abstraction is ported Topic Page 2 1 Operating System Configuration 2 2 2 2 Task Support 2 5 2 3 Semaphore Support 2 10 2 4 Memory Allocation Report 2 13 2 5 Print and Debug Support 2 15 2 6 File I O Suppor...

Page 12: ...initialization is cov ered later in this document The _oscfg structure of type OSENVCFG which is defined as follows Configuration Structure typedef struct _osenvcfg uint DbgPrintLevel Debug message print threshold uint DbgAbortLevel Debug message sys abort threshold int TaskPriLow Lowest priority for stack task int TaskPriNorm Normal priority for stack task int TaskPriHigh High priority for stack ...

Page 13: ...sk threads are set Task threads that are created by the system or services will usually run at this level Priority Level for High Priority for Stack Task _oscfg TaskPriHigh Default Value 7 Description This is the priority at which high priority stack task threads are set Setting a thread at a higher priority than this may disrupt the system and cause unpre dictable behavior if the thread calls any...

Page 14: ...skStkNorm Default Value 4096 Description This is the stack size used for a network task with an average network band width using TCP It is used for the majority of network tasks in the network tools library that use TCP High Volume Task Stack Size _oscfg TaskStkHigh Default Value 5120 Description This is the stack size used to network tasks that require a high network band width using TCP It is al...

Page 15: ...me priority TaskSleep Block a task thread for a period of time TaskBlock Block a task thread TaskSetPri Set task thread priority level TaskGetPri Get task thread priority level TaskSetEnv Assign one of three private environment handles to task thread TaskGetEnv Retrieve one of three private environment handles 2 2 3 Task API Functions Block Task From Execution TaskBlock Syntax void TaskBlock HANDL...

Page 16: ...f 0 to 15 is recom mended 0 is the lowest priority and should be reserved for an idle task If the specified priority is negative the task is blocked The task stack size specified by StackSize is not examined or adjusted by the create function The size should be made compatible with the native environ ment a multiple of 4 bytes should be sufficient Arg1 through Arg3 are optional arguments that can ...

Page 17: ...task entry point function is about to return but it may be called from anywhere Get Task Environment Handle TaskGetEnv Syntax HANDLE TaskGetEnv HANDLE hTask int Slot Parameter s hTask Handle to target task Slot Environment slot to use 1 3 Return Value Private environment handle or NULL Description NOTE This function is currently not available under DSP BIOS Returns a private environment handle for...

Page 18: ...o result if Task functions are called before the operating system is initialized Set Task Environment Handle TaskSetEnv Syntax void TaskSetEnv HANDLE hTask int Slot HANDLE hEnv Parameter s hTask Handle to target task Slot Environment slot to use 1 3 hEnv Private environment handle Return Value nothing Description NOTE This function is currently not available under DSP BIOS Sets and stores a privat...

Page 19: ...s blocked Calling this function may cause a task switch Sleep Task for Period of Time TaskSleep Syntax void TaskSleep UINT32 Delay Parameter s Delay Time in milliseconds of sleep Return Value nothing Description Sleeps the calling task for a period of time as supplied in Delay The sleep time can not be zero Calling this function may cause a task switch Yield Execution to Another Task Thread TaskYi...

Page 20: ... optionally for a period of time SemCount Get the current semaphore count SemPost Release semaphore increment count SemReset Reset semaphore and set new count 2 3 3 Semaphore API Functions Create New Semaphore SemCreate Syntax HANDLE SemCreate int Count Parameter s Count Initial semaphore count Return Value Handle to semaphore or NULL on error Description Creates a new semaphore object with an ini...

Page 21: ...t Description This function is used to wait on a semaphore If the semaphore count is greater than 0 the semaphore count is decrement and this function immediately returns If the semaphore count is zero the task is placed on a waiting list for the sema phore and blocked If the semaphore becomes available in the time period specified in Timeout the function returns However the function returns re ga...

Page 22: ...em int Count Parameter s hSem Handle to Semaphore Count Initial semaphore count Return Value nothing Description This function resets the semaphore first setting an initial semaphore count and then unblocking all tasks that are pending on the semaphore This function should be used with care Tasks that are pending on the sema phore may exhibit unexpected behavior since all tasks pending on the sema...

Page 23: ...are as follows mmAlloc Allocate Small Memory Block mmFree Free mmAlloc Memory Block mmBulkAlloc Allocate Unrestricted Memory Block mmBulkRealloc Reallocate mmBulkAlloc Memory Block mmBulkFree Free mmBulkAlloc Memory Block 2 4 3 Memory Allocation API Functions Allocate Memory Block mmAlloc Syntax void mmAlloc uint size Return Value Pointer to allocated memory or NULL on error Description Allocates ...

Page 24: ... INT32 Size Return Value Pointer to reallocated memory or NULL on error or when Size is zero Description Reallocate a previously allocated memory block by supplying the pointer that mmBulkAlloc originally returned If Size is zero the block is simply freed and this function returns NULL Otherwise a NULL return indicates that the block could not be reallocated and the original memory pointer pv is s...

Page 25: ...ror causes a system shutdown 2 5 2 Standard Print Functions The standard set of printf functions is supported int printf const char format int sprintf char s const char format int vprintf const char format va_list arg int vsprintf char s const char format va_list arg 2 5 3 Debug API Functions Print a Debug Message to the Debug Log DbgPrintf Syntax void DbgPrintf int ErrLevel char Format Parameter ...

Page 26: ...e message is printed and additionally if the message results in a system shutdown Both thresholds can be modified through the OS configuration The definition of the severity levels are as fol lows define DBG_INFO 1 define DBG_WARN 2 define DBG_ERROR 3 define DBG_NONE 4 ...

Page 27: ...bstraction Currently only the HTTP Server service makes use of this API The API described here was taken from the Unix standard The names of the functions have been prefixed with the designation efs_ which stands for em bedded file system This was done so that the functions would not conflict with any existing file system The EFS API is a very simple RAM based file system A couple of new functions...

Page 28: ...ilename is copied so it does not need to be static A static buffer based system is more efficient for embedded systems since the data must already be present in RAM or ROM However the efs_createfile function could easily be altered to use allocated buffers which are later freed when efs_destroyfile is called These create and destroy functions are only called by the sample application code and thus...

Page 29: ...the length in bytes of the indicated file The file must al ready have been opened via a call to efs_fopen Load Executable File and Return Entrypoint efs_loadfunction Syntax EFSFUN efs_loadfunction char name Parameter s name Filename max length of EFS_FILENAME_MAX Return Value Pointer to executable function Description This function loads an executable file and returns a pointer to the entrypoint f...

Page 30: ...ription This function tests to see is the file position has reached the end of the file It is functionally equivalent to feof Open File efs_fopen Syntax EFS_FILE efs_fopen char name char mode Parameter s name Name of file to open mode Desired mode of open file Return Value Returns a stream pointer or NULL on error Description This function performs a logical open on the named file and returns a st...

Page 31: ... efs_fseek EFS_FILE stream INT32 offset int origin Parameter s stream Pointer to open stream file offset Offset of desired new position origin Base reference point for offset Return Value Returns non zero on error Description This function sets the file position of the indicated stream to that specified by offset from a base reference point specified by origin It is functionally equiva lent to fse...

Page 32: ...am from the array ptr up to nobj ob jects of a length specified by size It returns the number of objects written this may be less than the number of objects requested on an error It is functionally equivalent to fwrite Nothing in the stack package requires write capability thus this function al ways returns zero Reset File Position to Start of File efs_rewind Syntax void efs_rewind EFS_FILE stream...

Page 33: ...ndard file descriptor environment and a Berkeley compatible sockets API This layer is built on top of DSP BIOS and designed to not conflict with any pre existing file support The resulting file and sockets API functions are described in this section Topic Page 3 1 File Descriptor Environment 3 2 3 2 File Descriptor Programming Interface 3 5 3 3 Sockets Programming Interface 3 12 3 4 Full Duplex Pi...

Page 34: ...tion to the native operating environment It is this layer that implements the standard sockets and file IO functions The stack works by associating a file descriptor table with each caller s thread or in our ter minology task In this system each task has its own file descriptor table The file descriptor index passed to a file function is used to lookup the actual file handle contained in the task ...

Page 35: ...k to also open the file descriptor session Note that the parent task must guarantee that the child task s file session is open before the child task has had a chance to exe cute This can be done via task priority but it can be messy Thus it is not a very common approach A third more common option is to allow a child task to open its own file session but where a parent task monitors its children an...

Page 36: ...owing Parent Task Functions void create_child_task Create System Tasks Create a child task hChildTask TaskCreate child_socket_task void destroy_child_task First close the child s file session This will close all open files fdSessionClose hChildTask Then destroy the task TaskDestroy hChildTask ...

Page 37: ...the vast majority of cases it will be in the form of a local file descriptor The following functions can operate on file descriptors fdOpenSession Open file descriptor support session fdCloseSession Close file descriptor support session fdSelect Wait on one or more file events same as stan dard select fdClose Flush stream and close file descriptor same as standard close fdError Return last error v...

Page 38: ...Task Task Thread Handle Return Value 1 on success or 0 on memory allocation error Description This function opens a file descriptor session on a task thread so that the task can begin using file descriptor and other stream IO functions A task thread normally calls fdOpenSession when it is first created and fdCloseSession before it exits Use of these functions was described in more detail in the pr...

Page 39: ...allows the task to instruct the stack to wait for any one of multiple events to occur and to wake up the process only when one of more of these events occurs or when a specified amount of time has passed The definition of the timeval structure is struct timeval INT32 tv_sec INT32 tv_usec Passing in a NULL pointer for timeout specifies an infinite wait period Passing a valid pointer to a timeval st...

Page 40: ... about the current thread The return value from the fdSelect called on the target thread is still valid most likely an empty descriptor set Convert a File Descriptor Index to a File Handle fdGetFileHandle Syntax HANDLE fdGetFileHandle int fd Parameter s fd File descriptor to convert Return Value Non zero handle on success or NULL on error When an error occurs the error type can be obtained by call...

Page 41: ...s been recently created In a parent child relationship it is safer for the child to call fdTransfer and then signal the parent if necessary to allow it to terminate A better alternative for transferring a file descriptor from one task to another is for the source task to call fdGetFileHandle and pass the re sulting global handle to the second task The second task can then call FileHandleGetFd on t...

Page 42: ...her file or socket calls This function converts a file handle to a file descriptor Note that after this call the file handle should no longer be used 3 2 5 File Descriptor Set fd_set Macros Add a File Descriptor to a File Descriptor Set FD_SET Syntax void FD_SET int fd fd_set pFdSet Parameter s fd File descriptor to add pFdSet Pointer to fd_set data type Return Value Should be treated as a void fu...

Page 43: ...s TRUE if the supplied file descriptor is contained in the in dicated file descriptor set This function is typically called after a call to fdSe lect to determine on what file descriptors select has detected activity Copy a File Descriptor Set FD_COPY Syntax void FD_COPY fd_set pFdSetSRC fd_set pFdSetDST Parameter s pFdSetSRC Pointer to fd_set to copy pFdSetDST Pointer to fd_set to write copied da...

Page 44: ...o the system via a call to recvncfree By default TCP uses both a send and receive buffer The send buffer is used since the TCP protocol can require reshaping or retransmission of data due to window sizes lost packets etc On receive the standard TCP socket also has a receive buffer This is used to coalesce TCP data received from packet buffers Coalescing data is important for protocols that transmi...

Page 45: ...rd socket access functions are as follows accept Accept a connection on a socket bind Bind a name to a socket connect Initiate a connection on a socket getpeername Return name address of connected peer getsockname Return the local name address of the socket getsockopt Get the value of a socket option listen Listen for connection requests on a socket recv Receive data from a socket recvfrom Receive...

Page 46: ...ion request on the queue of pending connections creates a new socket with the same properties of socket s and allocates a new file descriptor for the socket If no pending connections are present on the queue and the socket is not marked as non blocking ac cept blocks the caller until a connection is present If the socket is marked non blocking and no pending connections are present on the queue ac...

Page 47: ...ocket When a socket is created with socket it exists in a name space address family but has no name assigned The bind function requests that name be assigned to the socket The argument s is a socket that has been created with the socket function The argument pName is a structure of type sockaddr that contains the desired local address The len parameter contains the size of pName which is si zeof s...

Page 48: ...the socket function The argument pName is a structure of type sockaddr that contains the desired foreign address The len parameter contains the size of pName which is si zeof struct sockaddr Stream sockets may connect only once while datagram sockets may re con nect multiple times to change their association The connection may be dis solved by attempting to connect to an illegal address say NULL I...

Page 49: ...ointer to size of pName Return Value If it succeeds the function returns 0 Otherwise a value of 1 is returned and the function fdError can be called to determine the error EBADF The file descriptor socket is invalid ENOTSOCK The file descriptor does not reference a socket EINVAL Name arguments are invalid Description The getsockname function returns the local name address of the socket The argumen...

Page 50: ...ze identify a buffer in which the value for the requested option s are to be returned pbufsize is a value result parameter initially containing the size of the buffer pointed to by pbuf and modified on re turn to indicate the actual size of the value returned Most socket level options utilize an int parameter for pbuf SO_LINGER uses a struct linger parameter defined in INC SOCKET H which specifies...

Page 51: ...s on the socket Broadcast was a privileged operation in earlier versions of the system SO_OOBINLINE With protocols that support out of band data this option requests that out of band data be placed in the normal data input queue as received it will then be accessible with recv or read calls without the MSG_OOB flag Some protocols always behave as if this option is set SO_SNDBUF Buffer size for out...

Page 52: ...EWOULD BLOCK if no data were sent In the current imple mentation this timer is restarted each time addition al data are delivered to the protocol implying that the limit applies to output portions ranging in size from the low water mark to the high water mark for output SO_RCVTIMEO Is an option to set a timeout value for input opera tions It accepts a struct timeval parameter with the number of se...

Page 53: ...ing setsockopt This option pro vides the same functionality as calling the Unix function Fcntl with the O_NONBLOCK flag The following options are recognized at the IPPROTO_IP level IP_OPTIONS Specifies the IP options to be including in any out going IP packet sent via this socket maximum length is 20 bytes IP_HDRINCL Indicates to IP that the socket application is supply ing the IP header as well a...

Page 54: ...tion is called to specify a willingness to accept incoming connections and a queue limit for incoming New connections are accepted by calling the accept function The listen function applies only to sockets of type SOCK_STREAM The maxcon parameter defines the maximum length the queue of pending connections may grow to If a connection request arrives with the queue full the client receives an error ...

Page 55: ...ed amount rather than waiting for receipt of the full amount requested this behavior is affected by the options specified in flags as well as the socket level options SO_RCVLOWAT and SO_RCVTIMEO de scribed in getsockopt The select call fdSelect may be used to determine when more data arrives The flags argument to a recv call is formed by combining one or more of the following flags MSG_DONTWAIT re...

Page 56: ...ified by pbuf up to a maximum length specified by size The options in flags can be used to change the default behavior of the operation The name address of the sender is written to pName The argument pName is a result parameter that is filled in with the address of the sending entity as known to the communications layer The domain in which the communication is occurring determines the exact format...

Page 57: ...g of the receive queue without removing that data from the queue Thus a subsequent re ceive call will return the same data MSG_WAITALL requests that the operation block until the full re quest is satisfied However the call may still return less data than requested if an error or disconnect occurs or the next data to be received is of a differ ent type than that returned Receive Data from a Socket ...

Page 58: ... longer needs the data buffer it is returned to the system by calling recvncfree Repeated failure to free buffers will eventually cause the stack to stop receiving data This function can not be used with sockets of type SOCK_STREAM When used with sockets of type SOCK_STREAMNC out of band data marks are cleared The select call fdSelect may be used to determine when more data arrives The flags argum...

Page 59: ...r is returned in phBuffer Both of these pointers must be valid The options in flags can be used to change the default behavior of the operation The name address of the sender is written to pName The argument pName is a result parameter that is filled in with the address of the sending entity as known to the communications layer The domain in which the communication is occurring determines the exac...

Page 60: ...n flags Return Value If it succeeds the function returns the number of bytes sent Otherwise a value of 1 is returned and the function fdError can be called to determine the error EBADF The file descriptor socket is invalid ENOTSOCK The file descriptor does not reference a socket ENOTCONN The socket is connection oriented and not con nected EWOULDBLOCK The socket is specified as non blocking or the...

Page 61: ...record mark for protocols that support the concept MSG_EOF requests that the sender side of a socket be shut down and that an appropriate indication be sent at the end of the specified data this flag is only im plemented for SOCK_STREAM sockets in the PF_INET protocol family and is used to implement Transaction TCP MSG_DONTROUTE specifies that the packet should not be routed but sent only using th...

Page 62: ...ontain the size of name which is sizeof struct sockaddr The functions returns the length of the data transmitted on successful comple tion For a datagram type socket the send operation always copies one packet s worth of data If the buffer is too long to hold the entire packet an error code of EMSGSIZE is returned The select call fdSelect may be used to determine when the socket is able to write T...

Page 63: ...he uppermost socket level When manipulating socket options the level at which the option resides and the name of the option must be specified To manipulate options at the socket level level is specified as SOL_SOCKET To manipulate options at any other level the protocol number of the appropriate protocol controlling the option is supplied In this implementation only SOL_SOCKET IPPROTO_IP and IPROT...

Page 64: ...yntax int socket int domain int type int protocol Parameter s domain Socket domain PF_INET type Socket type SOCK_DGRAM SOCK_STREAM SOCK_RAW protocol Socket protocol Normally IPPROTO_TCP or IPPROTO_UDP but can be anything when type is set to SOCK_RAW Return Value If it succeeds the function returns a file descriptor representing the socket Otherwise a value of 1 is returned and the function fdError...

Page 65: ...v socket function is used but has the potential of tying up multiple data packets It should only be used when the socket is to receive data in large bursts Out of band data is supported but only when the tradi tional recv socket calls are used SOCK_DGRAM supports datagrams connectionless unreliable messages of a fixed typically small maximum length SOCK_RAW similar to SOCK_DGRAM only allows the us...

Page 66: ...GetFileHandle function Communications is performed using the standard file and sockets API func tions All the file descriptor functions are supported with pipes fdSelect fdClose fdError and fdGetFileHandle Also socket functions send and recv are used to write and read data through the pipe Both functions also support the following standard sockets message flags when using pipes MSG_PEEK Examine da...

Page 67: ... File descriptor to second end of pipe Return Value File descriptor or 1 on error A more detailed error code can be found by call ing fdError Description Creates a pre connected full duplex pipe The returned file descriptors can be used with all the fd file descriptor functions as well as the send and recv socket functions Pipes are connection oriented so like TCP a read or write call can return E...

Page 68: ... Manager API used to maintain system configurations the Network Control module that uses the configuration to initialize the network and the specification of the individual configuration components available Topic Page 4 1 Configuration Overview 4 2 4 2 Configuration Manager 4 3 4 3 Network Control Initialization Procedure NETCTRL 4 19 4 4 Configuration Specification 4 23 Chapter 4 ...

Page 69: ... done for the programmer and the programmer must usually develop custom boot code as well The TCP IP stack is supplied with three things that make the configuration and boot process a little easier for the programmer First there is a programming API for creating walking and editing a system configurations Secondly initiali zation software is provided with source code that boots the system using a ...

Page 70: ... values in the configura tion Configurations can be set active or inactive When a configuration is active any change to the configuration results in a change in the system When a con figuration is inactive it behaves like a standard database Part of the main init ialization sequence is the make the system configuration active and then inac tive when shutting down Both the configurations and config...

Page 71: ...ar memory buffer CfgSetExecuteOrder Set the Tag Initialization and Shutdown Order on Execute CfgExecute Make the configuration active or inactive CfgSetService Sets service callback function for a particular tag CfgAddEntry Add a configuration entry to a configuration CfgRemoveEntry Remove entry from configuration CfgGetEntryCnt Get the number of item instances for a tag item pair CfgGetEntry Get ...

Page 72: ...ura tion error The possible configuration errors are CFGERROR_BADHANDLE Invalid hCfg handle CFGERROR_BADPARAM Invalid function parameter CFGERROR_RESOURCES Memory allocation error while adding entry Returns less than or equal to CFGERROR_SERVICE when the service call back function returns an error Service errors are specific to the service call back functions installed and are thus implementation ...

Page 73: ...does not allow for fully du plicate entries Entries are full duplicates if there exists another entry with the same Tag and Item key values and an exact duplicate data section size and content When a full duplicate entry is detected the new duplicate entry is not created The user has some options in how the entry is added to the configuration This is done with flags that can be set in the Mode par...

Page 74: ...tion are not reflected by changes to the system Executing the configuration setting fExecute to 1 causes all current entries in the configuration to be loaded and any further changes in the configuration to be immediately reflecting in the system Disabling execution of the configuration setting fExecute to 0 causes all con figuration entries to be unloaded from the system note they are not removed...

Page 75: ...dex Instance index to get 1 to n phCfgEntry Pointer to where to write configuration entry handle Return Value Returns 1 if a matching entry was found Returns 0 if a matching entry was not found Returns less than 0 on error The possible configuration errors are CFGERROR_BADHANDLE Invalid hCfg handle CFGERROR_BADPARAM Invalid function parameter Description This function searches the configuration fo...

Page 76: ...ate every entry for a Tag Item pair start with index 1 and then use CfgGetNextEntry to get additional entries Get the Number of Entry Instances for the Supplied Tag Item Pair CfgGetEntryCnt Syntax int CfgGetEntryCnt HANDLE hCfg uint Tag uint Item Parameter s hCfg Handle to configuration Tag Tag value of query Item Item value of query Return Value Returns 0 or greater on success number if instances...

Page 77: ... following reasons a supplied parameter is incorrect the item was not found the supplied buffer size specified by Size was not large enough to hold the data Get the Next Entry Instance Matching the Supplied Entry Handle CfgGetNextEntry Syntax int CfgGetNextEntry HANDLE hCfg HANDLE hCfgEntry HANDLE phCfgEntryNext Parameter s hCfg Handle to configurationh CfgEntry Handle to last configuration entry ...

Page 78: ...g Handle to configuration Size Size of memory block to load pData Pointer to memory block to load Return Value Returns the number of bytes loaded or less than 0 on an error The possible errors are CFGERROR_BADHANDLE Invalid hCfg handle CFGERROR_BADPARAM Invalid function parameter Description One of the features of the configuration system is the ability for the manager to convert a configuration d...

Page 79: ...cess or less than 0 on error The possible errors are CFGERROR_BADHANDLE Invalid hCfg handle CFGERROR_BADPARAM Invalid function parameter Note The handle hCfgEntry is not dereferenced on the event of an error Description This function removes a configuration entry from a configuration If the execution state of the configuration is active see CfgExecute then the removal of the configuration entry is...

Page 80: ...s zero pSize can not itself be NULL the function does not attempt to save the configuration but rather calculates the size required and writes this value to the location specified by pSize In fact any time the value at pSize is less than the size required to store the configura tion the function returns 0 and the value at pSize is set to the size required to store the data The pData parameter poin...

Page 81: ...rvice function for a particular configuration tag Ser vice function pointers default to NULL and when they are NULL no service is performed for the configuration entry it becomes information data only When invoked the service callback function is passed back information about the affected entry The callback function is defined as int CbSrv HANDLE hCfg uint Tag uint Item uint Op HANDLE hCfgEntry hC...

Page 82: ...wn specified in pCloseOder Both arrays must be provided even if they are identical pointers The number of elements in each array is specified by the Tags parameter This must exactly match the max number of tags in the system defined by CFGTAG_MAX An entry of 0 in either order array is used as a placeholder for tags that have not yet been defined 4 2 4 Configuration Entry API Functions Remove a Ref...

Page 83: ...d to hold the entry data this function returns 0 and the number of bytes required to hold the data is stored at pSize The pData parameter points to the data buffer to receive the configuration entry data This pointer can be null if pSize is zero Get Information on a Configuration Entry CfgEntryInfo Syntax int CfgEntryInfo HANDLE hCfgEntry int pSize UINT8 ppData Parameter s hCfgEntry Handle to conf...

Page 84: ...iguration entry handle beyond the scope of the function which obtained it from the con figuration This normally occurs when one user function calls another and passes it a handle The handle should be dereferenced when no longer needed Configuration entry handles are dereferenced by the calling one of the following CfgEntryDeRef Stop using the entry CfgRemoveEntry Stop using entry and remove it fro...

Page 85: ...e size of the new buffer must exactly match the old size This function should be used for configuration entries that are for information purposes only Note that if a service provider callback is associated with the Tag value of this entry the processing function is not called as a result of this data update This function only updates the data stored for this configuration entry ...

Page 86: ... function must always be called first before any other TCP IP stack related function 2 Create a new configuration via CfgNew 3 Build the new configuration via configuration API calls or load a previous configuration from non volatile memory using CfgLoad 4 Boot the stack with the configuration by calling NC_NetStart hCfg pfnStart pfnStop pfnNetIP with a handle to the configuration plus point ers t...

Page 87: ...reboot command When the system is ready for a final shutdown the following actions are per formed 8 When NC_NetStart returns and the session is over call the CfgFree function to free the configuration handle created with CfgNew 9 After all resources have been freed call the NC_SystemClose function to complete the system shutdown 4 3 3 Function Overview The system initialization access functions in...

Page 88: ...figuration handle supplied in hCfg is the default configuration handle for the system The execution thread on which NetStartCb is called is not critical to event scheduling but it should return eventually I e the application should not take control of the thread If system shutdown is initiated before this callback function returns some resources may not be freed Excluding critical errors NC_NetSta...

Page 89: ...s function is called to shutdown a network initiated with NC_NetStart The return value supplied in the StopCode parameter becomes the return value for NC_NetStart See the description of NC_NetStart for more detail Initiate a System Session NC_SystemOpen Syntax void NC_SystemOpen Parameter s none Return Value nothing Description This is the first function that should be called when using the stack ...

Page 90: ...iguration Most of these tags require service callback functions to implement the system functionality For example when a user adds an IP network using the CFGTAG_IPNET tag there must be a function that makes the corresponding system calls that actually adds the network to the system route table All these server callback functions are contained in the NETCTRL directory Although source code to these...

Page 91: ...ation System CFGITEM_SERVICE_DHCPSERVER DHCP Server CFGITEM_SERVICE_DHCPCLIENT DHCP Client CFGITEM_SERVICE_DNSSERVER DNS Server 4 4 3 2 Common Argument Structure Each individual service has its own specific configuration instance structure but they all share a generic argument structure This is defined as follows Common Service Arguments typedef struct _ci_srvargs uint Item Copy of Item value init...

Page 92: ...set but this flag can be set with IFIDXVALID when RESOLVEIP is also set If IFIDXVALID is set and this bit is not set the service is invoked by physical device index J CIS_FLG_RESTARTIPTERM A service that is dependent on a valid IP address as determined by the RESOLVEIP flag is shutdown if the IP address becomes invalid When this flag is set the service will be restarted when a new address becomes ...

Page 93: ... be set in Mode IPN IPAddr This is the IP address in network format on which to initiate the service This IP address can specify the wildcard INADDR_ANY in which case the service will accept connections to any valid IP address on any device Note that some services like DHCP sever do not support being launched by IP address and require a device index supplied in IfIdx on which to execute void pCbSr...

Page 94: ... typedef struct _ci_service_nat CISARGS cisargs Common arguments NTPARAM_NAT param NAT parameters CI_SERVICE_NAT DHCP Server Entry Data typedef struct _ci_service_dhcps CISARGS cisargs Common arguments NTPARAM_DHCPS param DHCPS parameters CI_SERVICE_DHCPS DHCP Client Service typedef struct _ci_service_dhcpc CISARGS cisargs Common arguments NTPARAM_DHCP param DHCP parameters CI_SERVICE_DHCPC DNS Se...

Page 95: ... with the virtual network or home network If none of these flags are set the network is a normal physical network Note that virtual and non virtual networks should not appear on the same interface Also only one network entry on each interface can have any of these flags set although more than one of these flags can be set in that one entry IPN IPAddr This is the IP address of the stack on the desi...

Page 96: ...dress of the IP network of the network that is made accessible via the IP gateway This value should be pre masked with the IPDestMask so that IPDestAddr IPDestMask IPDestMask This is used as a sanity check by the system For a default route the value is zero IPN IPDestMask This is mask of the IP network accessible by the IP gateway For a host route the value is 0xFFFFFFFF while for a default route ...

Page 97: ... addresses on a virtual home network The CLIENT entry instance structure is defined as follows typedef struct _ci_client uint ClientType Entry Status uint Status DHCPS Status init to ZERO IPN IPAddr Client IP Address char MacAddr 6 Client Physical Address char Hostname CFG_HOSTNAME_MAX Client Hostname UINT32 TimeStatus Time of last status change UINT32 TimeExpire Expiration Time from TimeStatus CI...

Page 98: ...ated It is thus the start time of a DHCP client lease UINT32 TimeExpire This is the total time in seconds of a DHCP client lease reported by the DHCP server to its clients When using an address pool for the DHCP server the server chooses this value 4 4 7 Client User Account CFGTAG_ACCT The ACCT entry specifies an account record of a client that has access to the system It is used by the PPP server...

Page 99: ...he Item parameter is set the system information item in question Note that the first 256 values for Item are reserved for items that exactly match the corresponding DHCP protocol information tag value For example define CFGITEM_DHCP_DOMAINNAMESERVER 6 Stack s DNS servers define CFGITEM_DHCP_HOSTNAME 12 Stack s host name These values are read by various network services and are written in one of tw...

Page 100: ...f type int or uint They correspond exactly to the internal system configuration structures For more information on these fields see the internal configuration discussion in both the OS Abstraction section earlier in this document and the IP stack sec tion in the attached appendices When creating a configuration entry for one of these tags the entry should be specified to be unique For example to e...

Page 101: ...c to send Router Adv 0 don t CFGITEM_IP_RTCADVLIFE Lifetime of route in RtAdv if active CFGITEM_IP_RTCADVPREF Preference of route in RtAdv if active CFGITEM_IP_RTARPDOWNTIME Time 5 failed ARPs keeps route down CFGITEM_IP_RTKEEPALIVETIME Timeout of validated route in seconds CFGITEM_IP_RTCLONETIMEOUT Timeout of newly cloned route in seconds CFGITEM_IP_RTDEFAULTMTU MTU for internal routes CFGITEM_IP...

Page 102: ...ation CFGITEM_IP_PIPETIMEIO Max time for pipe send rcv call CFGITEM_IP_PIPEBUFMAX Pipe internal buffer size CFGITEM_IP_PIPEMINTX Pipe min tx space for able to write CFGITEM_IP_PIPEMINRX Pipe min rx data for able to read CFGITEM_IP_STACKMAX Max CFGTAG_STACK item ...

Page 103: ...B and can be accessed by an application that includes the file NETTOOLS H The support supplied by NETTOOLS can be categorized into two classes support functions and services The support functions consist of a program ming API that can aid the programmer in developing network applications while services are servers that execute on the stack platform This section describes the NETTOOLS support funct...

Page 104: ...dle NtRemoveNetwork Remove a network added with NtAdd Network NtAddStaticGateway Add a static gateway route to the route table NtRemoveStaticGateway Remove a static gateway route NtIfIdx2Ip Get the IP host address assigned to a physical interface index NtGetPublicHost Get the system public IP address and domain name NtIPN2Str Convert 32 bit IP address in network format to string 5 1 3 Network Tool...

Page 105: ...k HANDLE hIF IPN IPHost IPN IPMask Parameter s hIF Handle to target interface IPHost IP Host Address in network format IPMask IP Host Subnet Mask in network format Return Value Handle to network binding on success or NULL on failure Description This function attempts to add the specified IP host address and mask to the specified logical interface handle The function returns a handle to the binding...

Page 106: ...tMask is the mask of the IP network accessible by the IP gateway For a host route the value is 0xFFFFFFFF while for a default route the value is zero IPGateAddr is the IP address of the gateway though which the specified IP net work is accessible It must be an IP address that is available on a locally con nected network I e one gateway can not point to another The function returns a handle to the ...

Page 107: ...o receive IP address Return Value Returns 1 if an address was found or 0 if it was not found Description This function obtains the first IP host address found that is assigned to the sup plied interface index The host address in network format is written to the pointer pIPAddr Get the System Public IP Address and Domain Name NtGetPublicHost Syntax int NtGetPublicHost IPN pIPAddr uint MaxSize UINT8...

Page 108: ...ddr IP address in network format pStrBuffer Pointer to receive IP address string Return Value nothing Description This function performs an sprintf of the IP address supplied in IPAddr to the buffer supplied in pStrBuffer Note no buffer size is provided This is because the size is deterministic and won t exceed 16 characters including the NULL terminator ...

Page 109: ...domain is encountered Otherwise and for all other queries the query is resolved via external DNS servers In addition to providing a more compact implementation the calls provided here are reentrant which is not true of the standard Unix counterparts 5 2 2 Function Overview The following is a summary of the support functions described in this section DNSGetHostname Return the hostname of the curren...

Page 110: ...y Code non existent domain NOTIMP 4 DNS Reply Code not implemented REFUSED 5 DNS Reply Code query refused OVERFLOW 16 Scrap Buffer Overflow MEMERROR 17 Memory Allocation Error used for packets and temp storage SOCKETERROR 18 Socket Error call fdError for socket error num ber NODNSREPLY 19 No DNS server response 5 2 4 DNS Support API Functions Return the Hostname of the Current Host DNSGetHostname ...

Page 111: ...with or without trailing pScrapBuf Pointer to a scrap buffer from which a HOSTENT structure will be allocated size Size of the supplied scrap buffer in bytes Return Value Error code as defined above Description This function is quite similar to BSD s gethostbyname It uses DNS to resolve an official hostname and address from the supplied hostname On a success ful return pScrapBuf can be treated as ...

Page 112: ...ointer to where to write TFTP server error code if any Return Value This function returns an error code indicating the results of the operation Neg ative codes are error conditions In the following cases pFileSize is set to the actual file size 1 Successful transfer and copy 0 Successful transfer with partial copy file size too large In the following cases pFileSize is set to the actual number of ...

Page 113: ...y pFileBuffer If the value at pFileSize is null the pFileBuffer parameter can be NULL This function attempts to receive the entire file even if the buffer space is insuf ficient The return value indicates if the file was received A return value of 1 indicates that the file was received and copied into the buff er A return value of 0 indicates that the file was received but was too large for the sp...

Page 114: ... The support supplied by NETTOOLS can be categorized into two classes support functions and services The support functions consist of a program ming API that can aid the programmer in developing network applications while services are servers that execute on the stack platform This section describes the NETTOOLS services Topic Page 6 1 Service Calling Conventions 6 2 6 2 Telnet Server Service 6 5 ...

Page 115: ...ault static char StatusStr Disabled Waiting IPTerm Failed Enabled static void ServiceReport uint Item uint Status uint Report HANDLE h printf Service Status 9s 9s 9s 03d n TaskName Item 1 StatusStr Status ReportStr Report 256 Report 0xFF 6 1 2 Invoking Network Services by NETTOOLS API Each service API uses a common calling format This allows the services to be invoked by the configuration system u...

Page 116: ... or on a specific IP address which can also be the wildcard INADDR_ANY Generally any service that accepts an IP address can also accept an inter face The service will simply lookup the IP address for the specified inter face Other services can only be executed by interface and are independent of IP address These are said to be compatible with NT_MODE_IFIDX only The value of CallMode can be one of ...

Page 117: ...lower byte that is specific to the service When masked with 0xFF NOT 0xFF the value will be one of the following J NETTOOLS_STAT_NONE Nothing reported J NETTOOLS_STAT_RUNNING Service is initialized running J NETTOOLS_STAT_PARAMUPDATE The service parameter struc ture has changed the configuration containing this structure should be saved J NETTOOLS_STAT_COMPLETED The service has run to comple tion ...

Page 118: ...t telnet calls when a new connection is established This call back function returns the file descriptor of one end of a full duplex communica tions pipe By allowing multiple calls to the callback function console applica tions can be written to work with multiple IO streams 6 2 2 Telnet Parameter Structure The following structure defines the unique parameters of the Telnet service It is located in...

Page 119: ...Y telnet_example CI_SERVICE_TELNET telnet bzero telnet sizeof telnet telnet cisargs IPAddr INADDR_ANY telnet cisargs pCbSrv ServiceReport telnet param MaxCon 2 telnet param Callback ConsoleOpen CfgAddEntry hCfg CFGTAG_SERVICE CFGITEM_SERVICE_TELNET 0 sizeof telnet UINT8 telnet 0 The above code is all that is required when using the configuration system to invoke this service 6 2 4 Invoking the Ser...

Page 120: ... of one end of a full duplex pipe If the callback function returns 1 the connection is aborted When either the terminal or telnet connection end of the pipe is broken the other connection is closed and the session is en ded Destroy an Instance of the Telnet Server TelnetClose Syntax void TelnetClose HANDLE hTelnet Parameter s hTelnet Handle to telnet server instance obtained from TelnetOpen Return...

Page 121: ... given interface and allows multiple instances of the DHCP server to manage different IP address pools for different inter faces 6 3 3 DHCP Server Parameter Structure The following structure defines the unique parameters of the DHCP server ser vice It is located in the file src nettools inc dhcpsif h DHCPS Parameter Structure typedef struct _ntparam_dhcps uint Flags DHCPS Execution Control Flags I...

Page 122: ...ration so the RESOLVEIP flag is not necessary The address pool we re using is already stored in IPPoolBase and PoolSize We also request that DHCPS should report the local server ad dress as a DNS server to DHCP clients dhcp_server_example CI_SERVICE_DHCPS dhcps bzero dhcps sizeof dhcps dhcps cisargs Mode CIS_FLG_IFIDXVALID dhcps cisargs IfIdx dhcpsIdx dhcps cisargs pCbSrv ServiceReport Report our ...

Page 123: ...te DHCPS control of an IP address pool on a giv en interface The base address of the address pool does not have to be the first IP address in the subnet The DHCP Server executes on a specific interface Thus it is compatible with NT_MODE_IFIDX only Closes an Instance of the DHCP Server DHCPSClose Syntax void DHCPSClose HANDLE hDHCPS Parameter s hDHCPS Handle to a DHCP server instance obtained from ...

Page 124: ...gnificant byte of the report code is reserved for service specific information The following report codes are returned in the LSB of the report code sent by the DHCP service DHCPCODE_IPADD An IP client address had been added to the system DHCPCODE_IPREMOVE An IP client address has been removed from the system DHCPCODE_IPRENEW An IP client address has been renewed Note that in each of the above cas...

Page 125: ...vice to the configuration system or when bypassing the configuration and invoking the service API di rectly 6 4 4 Specifying Service Using the Configuration Since the DHCP client service executes on a specific interface it is never exe cuted based on an IP address Thus it cannot be used with the CALLBYIP flag in the standard configuration service structure Also since the service runs without an IP...

Page 126: ...st an IP address The result of the search for an IP address will be passed to the application via the standard network tools status callback The Client will remain running so it can renew the IP address when necessary For any addition option tags entered into the DHCP client parameter structure the resulting information from the DHCP server is written to the system config uration under the CFGTAG_...

Page 127: ... the HTTP Server and Adding WEB Content This section includes information on how to invoke and monitor the status of the HTTP server WEB application developers will be more interested in how to add WEB content including HTML pages and CGI functions These topics are discussed in a special appendix to this document 6 5 4 HTTP Server Parameter Structure The HTTP server service does not require a para...

Page 128: ...used Start the HTTP Server HTTPOpen Syntax HANDLE HTTPOpen NTARGS pNTA Parameter s pNTA Pointer to common argument structure used by all services Return Value Returns a handle to the HTTP Server instance or NULL if the HTTP Server task could not be created This handle is used with HTTPClose to shutdown the client when its no longer needed Description HTTPOpen starts the HTTP server process This pr...

Page 129: ...arent to these clients Since the DNS server service uses the same internal DNS resolver as the cli ent services discussed earlier the server adds very little overhead to the sys tem 6 6 3 DNS Server Parameter Structure The DNS server service does not require a parameter structure 6 6 4 Specifying Service Using the Configuration The service can be specified as public in that it can connect using an...

Page 130: ...ly these calls can be used Create an Instance of the DNS Server DNSServerOpen Syntax HANDLE DNSServerOpen NTARGS pNTA Parameter s pNTA Pointer to common argument structure used by all services Return Value Returns a handle to the new server instance or NULL if the service could not be created This handle is used with DNSServerClose to shutdown the serv er when its no longer needed Description Crea...

Page 131: ...service that filters packets from the public network from being seen by the private network For example if someone on a public net work knew the IP address and the subnet mask of the router s stack in route mode private network it could set a gateway route to the router s public IP host address and the router would route packets from the public to the private network and back internally its does n...

Page 132: ...e configuration and invoking the service API di rectly 6 7 4 Specifying Service Using the Configuration Since the NAT service executes on a specified public interface it is never exe cuted based on an IP address Thus it can not be used with the CALLBYIP flag in the standard configuration service structure In addition since the public IP host address is required to initialize the service the RESOLV...

Page 133: ...n wishes to by pass the configuration system and launch the service directly these calls can be used Enable the NAT Service NATOpen Syntax HANDLE NATOpen NTARGS pNTA NTPARAM_NAT pNTP Parameter s pNTA Pointer to common argument structure used by all services pNTP Pointer to NAT parameter structure Return Value Returns a handle to the NAT instance 1 or NULL if the service could not be created This h...

Page 134: ...AT Service 6 21 Network Tools Library Services Disable the NAT Service NATClose Syntax void NATClose HANDLE hNAT Parameter s hNAT Handle to NAT service obtained from NATOpen Return Value nothing Description Disables the NAT service ...

Page 135: ...ation and monitoring This API does not apply to general sockets application programming 2 In addition to the internal functions described here there are scheduling and configurations tools available that make any direct coding to these functions unnecessary Topic Page A 1 Overview A 2 A 2 Stack Executive Exec A 5 A 3 Packet Pkt Object A 6 A 4 Packet Fragment Frag Object A 14 A 5 Link Layer Address...

Page 136: ...l stack functions are not designed to be reentrant This allows the stack to operate freely without the concept of a critical section which is imple mentation dependent Thus access to stack functions must be strictly con trolled The form of this control is dependant on the system environment and is embodied as two low level OS functions llEnter and llExit These func tions are called before and afte...

Page 137: ...as occurred and is ready to be passed to the stack The HAL scheduler uses the stack s Exec API to communicate to the stack A 1 4 Objects Many of the control API functions deal with object handles These handles are created by a variety of class functions contained in the stack When using an object handle it is important to realize how the object handle will be treated by the function being called A...

Page 138: ...sk of indeterminate length where the creator of the handle does not wish to track it or may not be around to track it Under the referenced handle scheme all tasks that access the object han dle make a specific RefXxx call so that references may be tracked Whenever a task is finished with the handle it calls the object s de refer ence function The object is not freed until the reference count reach...

Page 139: ...led the system can not actually do any work but after calling this function objects like routes and bindings can be created Shutdown Stack and Cleanup ExecClose Syntax void ExecClose Description Completes stack execution This function is called to perform final cleanup on the system after all user objects like devices and bindings have been de stroyed Signal Low Resource Condition ExecLowResource ...

Page 140: ...oute Size L2 Mac Header Size Protocol Header Size Transport Header Frag Object Handle FRAG OBJECT Buffer Pool ID Buffer Pointer Buffer Size Valid Size Offset to Valid Frag Object Buffer L2 Mac Header IP Header Transport Header Payload Free Buffers The packet object is the container used for all packet data The entire Ethernet packet MAC header IP header and Options Transport header and payload is ...

Page 141: ...are owned and destroyed by a single entity Passing a packet handle to a function is considered transfer of ownership A 3 3 API Function Overview The PKT API is extensive and most programmers will never need to call it but as it is so central to the design of the stack the entire API is presented here for completeness Create Destroy Functions PktNew Create New Packet Handle PktFree Destroy Packet H...

Page 142: ...create a new packet handle When first created the packet is entirely uninitialized Destroy Packet Handle PktFree Syntax void PktFree HANDLE hPkt Return Value nothing Description This function is called to destroy a packet When called all objects associated with the packet are dereferenced or destroyed Get the Packet Ethertype PktGetEthType Syntax uint PktGetEthType HANDLE hPkt Return Value Etherty...

Page 143: ... of this section and that of the following section on the FRAG object Get the Receive Ingress Interface Handle PktGetIFRx Syntax HANDLE PktGetIFRx HANDLE hPkt Return Value Handle to Rx device or NULL for local Description This function is called to get a handle to the interface which originally received the packet The receive handle is set by the Ether object to mark which Ether net device origina...

Page 144: ...not necessary Get the Packet Link Layer Control Header Size PktGetSizeLLC Syntax uint PktGetSizeLLC HANDLE hPkt Return Value LLC header length or max default if unknown Description This function is called to get the length of the link layer control header For an Ethernet packet this value is usually 14 some devices may imbed additional tags For PPP the value is 2 contains only the protocol type Th...

Page 145: ...ader along with the destina tion and source MAC addresses For a packet being transmitted this type is used to construct the Ethernet header For packets that have been received this value contains the ethertype found in the ingress header Clear Packet Flags PktSetFlagsClear Syntax void PktSetFlagsClear HANDLE hPkt uint Flags Return Value nothing Description This function is called to clear the indi...

Page 146: ...ved the packet For packets that are generated local ly this value is left NULL Set Transmit Egress Interface Handle PktSetIFTx Syntax void PktSetIFTx HANDLE hPkt HANDLE hIF Return Value nothing Description This function is called to set the egress or transmit interface handle for the packet In order for a packet to be sent via Ethernet both the transmit interface and the destination link layer add...

Page 147: ...ed for constructing and deconstructing packets in such a manner that is independent of the physical packet transport mechanism Set the Packet Network Header Size PktSetSizeNet Syntax void PktSetSizeNet HANDLE hPkt uint SizeNetHdr Return Value nothing Description This function is called to set the length of the network header For an IP packet this value is usually 20 but can be larger if IP options...

Page 148: ...n most cases only the minimum header size will be allocated Applications building packets that will use things like IP options must specify the size of the options in advance When the buffer is allocated the offset parameter contains the cumulative size of all the re served space The data payload is copied to this offset As network layers are added on the packet the offset is decreased according t...

Page 149: ...y Allocating a New Buffer FragNewWrap Create Frag by Wrapping an Existing Buffer FragCopy Create Frag by Copying an Existing Frag FragFree Free a Frag and its Associated Buffer FragGetAux1 Get Frag Auxiliary Data Value 1 FragGetAux2 Get Frag Auxiliary Data Value 2 FragGetBufParams Get the Buffer Status Parameters FragGetNext Get the Next Frag in a Chain of Frag Objects FragGetPrev Get the Previous...

Page 150: ...the buffer that is used when the buffer is allocated The pad value is then discarded The parameters ValidLen and DataOffset indicate the portion of the buffer that has valid data Obviously a newly allocated buffer can not have valid data but these values can be specified if the valid region of the packet is known in ad vance i e to set the amount of reserved space at the head of the buffer Create ...

Page 151: ...hFrag Return Value nothing Description Called to free a Frag object The buffer associated with the Frag is also freed If one or more Frag objects are chained via the FragSetNext function they are also freed Get Frag Auxiliary Data Value 1 FragGetAux1 Syntax UINT32 FragGetAux1 HANDLE hFrag Return Value nothing Description Called to get auxiliary data associated with the Frag This is used by TCP and...

Page 152: ...on Called to get a handle to the next Frag object in a chain of Frag objects Frag objects are kept in chains in several areas of the stack including IP reassembly TCP reassembly and UDP RAW socket buffering Get the Previous Frag in a Chain of Frag Objects FragGetPrev Syntax HANDLE FragGetPrev HANDLE hFrag Return Value nothing Description Called to get a handle to the previous Frag object in a chai...

Page 153: ...n a Chain of Frag Objects FragSetNext Syntax void FragSetNext HANDLE hFrag HANDLE hFragNext Return Value nothing Description Called to set a handle to the next Frag object in a chain of Frag objects Frag objects are kept in chains in several areas of the stack including IP reassembly TCP reassembly and UDP RAW socket buffering When the Frag at the head of a chain is freed all Frag objects in the c...

Page 154: ...ctions The following is the complete LLI object API Reference an LLA Object LLARef Syntax void LLARef HANDLE hLLA Description Called to add one to the reference count of an LLA An application that keeps an LLA object it did not create itself should reference the route before it uses it and dereference it when it is through Dereference an LLA Object LLADeRef Syntax void LLADeRef HANDLE hLLA Descrip...

Page 155: ...LLA uint Size UINT8 pData Description This function is called to get the LLA address data from the LLA object The number of bytes to copy is supplied in Size The exact size of the address data can be found by calling LLAGetLength Get LLA Object MAC Address Type LLAGetType Syntax uint LLAGetType HANDLE hLLA Description This function returns the MAC address type represented by the LLA object The ret...

Page 156: ... object member functions This section the API functions that are useful to a system application Get the LLA Associated with this LLI LLIGetLLA Syntax HANDLE LLIGetLLA HANDLE hLLI Return Value Handle to LLA or NULL if LLI is invalid Description This function is called to return the LLA associated with an LLI It is used by a system programmer to obtain the LLA from an LLI contained in a route entry ...

Page 157: ...reated the route It should be used when it is unclear if the route really ARP table entry already exists or not Note that this function returns a referenced route handle This handle must be dereferenced using the RtDeRef function when it is no longer required Since the route is treated as a standard ARP entry with a standard expiration time as supplied in the configuration structure the route can ...

Page 158: ...ronment and configuration system which deals in de vice indices instead of device handles The last function of the IF API is to pro vide a generic way of creating packets for the system keeping track of all de vice s header and padding requirements A 7 2 Object Type Static IF objects represent PPP or Ether objects which are created and de stroyed by the same entity A 7 3 API Function Overview The ...

Page 159: ... created IF allocates and returns a physical index for the supplied device handle If a specific index is required it is passed in the Index parameter else Index is set to NULL Free a Previously Allocated Physical Index IFIndexFree Syntax void IFIndexFree uint Index Return Value nothing Description This function is called from PPP and Ether when physical device handles are destroyed IF frees the su...

Page 160: ... the handle type of the supplied device handle When called correctly the return value should be one of the following HTYPE_ETH Ether Device HTYPE_PPP PPP Device Get the MTU of a Device IFGetMTU Syntax uint IFGetMTU HANDLE hIF Return Value MTU of the device indicated by the supplied handle Description This function is called to get the MTU maximum transmit unit size of the indi cated device The MTU...

Page 161: ...cal devices to create a packet that can be transmitted on any of the physical devices in the system It does this by applying worst case header and padding sizes A packet Frag object is also created and attached to the packet The value of SizePayload is the size of the packet without the layer 2 header The value of SizeNet and SizeTP is the size of the network header and trans port to be associated...

Page 162: ... New Ether Object EtherFree Destroy Ether Object EtherConfig Configure Ether Object Header Parameters Addressing Functions EtherGetLLADirect Get the directed Link Level Address of the Ether Object EtherGetLLABCast Get the broadcast Link Level Address of the Ether Object EtherAddMCast Add Multicast Ethernet Address EtherDelMCast Delete Multicast Ethernet Address EtherClearMCast Clear All Multicast ...

Page 163: ...ion will not result in any calls to the HAL Configure Ether Object EtherConfig Syntax void EtherConfig HANDLE hEther uint PhysMTU uint EthHdrSize uint OffDstMac uint OffSrcMac uint OffEthType uint PacketPad Description Describes to the Ether object how the Ethernet header is constructed on this device Although the MAC address is assumed to be 6 bytes long various de vices have a small variety of p...

Page 164: ...e indicated Ether object This is normally a string of 6 0xFF s Add Multicast Ethernet Address EtherAddMCast Syntax uint EtherAddMCast HANDLE hEther HANDLE hLLAMCast Description Called to add an Ethernet multicast address to the list of addresses to be re ceived by the Ethernet hardware when the Rx filter is set to ETH_PKTFLT_MULTICAST The multicast address is specified as an LLA ob ject The multic...

Page 165: ...e as follows ETH_PKTFLT_NOTHING No Packets ETH_PKTFLT_DIRECT Only directed Ethernet ETH_PKTFLT_BROADCAST Directed plus Ethernet Broadcast ETH_PKTFLT_MULTICAST Directed Broadcast and selected Ethernet Multicast ETH_PKTFLT_ALLMULTICAST Directed Broadcast and all Multicast ETH_PKTFLT_ALL All packets For selecting multicast addresses as the ETH_PKTFLT_MULTICAST level see EtherAddMCast Get Current Rece...

Page 166: ...e Bind object or NULL on error Description Binds the indicated IP address and mask to the supplied Ether device The handle to the Ether device object is specified as hIF or an handle to an inter face since the interface may or may not be an Ethernet device but always is in this version The IP address and mask arguments are given the type IPN which is an un signed 32 bit value IPN stands for IP Net...

Page 167: ...Binding Object BindGetIF Syntax HANDLE BindGetIF HANDLE hBind Description Returns a handle to the Ether object that is bound by this binding object Recall a binding is nothing more than an assignment of an Ether object to an IP ad dress network Get the IP Address Network that is Bound by this Binding Object BindGetIP Syntax void BindGetIP HANDLE hBind IPN pIPHost IPN pIPNet IPN pIPMask Description...

Page 168: ...tion Create New Timer Instance TimerNew Syntax HANDLE TimerNew void pHandler uint uint HSCount uint Msg Return Value Returns a handle to the Timer instance or NULL on error Description This function creates a new timer instance with a timeout period in half second units specified by HSCount When the timeout period has elapsed the call back function pointed to by pHandler is called The parameter to...

Page 169: ...t A 35 Internal Stack Functions Indicate Half Second Tick Event TimerHSTick Syntax void TimerHSTick Description Called by the stack scheduler to notify the stack that a half second has elapsed since the last call ...

Page 170: ...not be concerned with the route entry flags They are listed here for completeness The definition of the various flags is as follows FLG_RTE_UP Entry is up When set indicates that the route is valid The only time this flag is cleared is when the route is being initialized or when an error condition is signaled via RtSetFailure The flag is reset to TRUE by calling RtSetFailure with NULL failure code...

Page 171: ...al Ethernet network as if this is going to happen PROXYPUB entries are always created with an LLA link layer address and contain a static LLI link layer info i e ARP entry Note PROXY and PROXYPUB have nothing in common other than the word PROXY in their name Note This flag will be very rarely specified if at all FLG_RTE_PROXY Reply to ARP with router s MAC address This flag indicates that the rout...

Page 172: ... before network routes but this behavior can be overridden FLG_RTE_GATEWAY Destination is available via a Gateway When set indicates that the host or network route is indirectly accessible via an IP gateway For a route with this flag set the GateIP address is al ways valid Most GATEWAY routes will also be network routes however a host redirect from ICMP can create a host route with a different gat...

Page 173: ...CT FLG_RTE_BLACKHOLE must be OFF Setting FLG_RTE_CLONING FLG_RTE_HOST must be OFF FLG_RTE_GATEWAY must be OFF FLG_RTE_IFLOCAL must be OFF Setting FLG_RTE_HOST FLG_RTE_CLONING must be OFF Setting FLG_RTE_GATEWAY FLG_RTE_CLONING must be OFF FLG_RTE_IFLOCAL must be OFF Setting FLG_RTE_IFLOCAL FLG_RTE_HOST must be ON FLG_RTE_CLONING must be OFF FLG_RTE_GATEWAY must be OFF Setting FLG_RTE_PROXYPUB FLG_...

Page 174: ...at keeps a route it did not create itself should reference the route before it uses it and dereference it when it is through Dereference a Route RtDeRef Syntax void RtDeRef HANDLE hRt Description Called to remove one from the reference count of a route An application deref erences a route when it is through with it This is the same to the application as destroying the route The route is actually d...

Page 175: ...CAL is set then the specified host address is local to this machine and FLG_RTE_HOST must also be set FLG_RTE_GATEWAY can not be set and hIF must be valid If FLG_RTE_CLONING is specified in Flags the route is a cloning network route The IPMask argument must be valid and neither FLG_RTE_HOST nor FLG_RTE_GATEWAY may be set If FLG_RTE_STATIC is specified in Flags the route is referenced once by the r...

Page 176: ... timeout list the system will add a reference Thus once the application sets the timeout value it should call RtDeRef to dereference the route The route will stay valid until the timeout value is exceeded after which it is dereferenced by the system Note that if this function is called and the route is not dereferenced by the caller it will still be removed from the system route table when the exp...

Page 177: ...e FLG_RTE_UP bit in the flags When use of the route is attempted the error specified in FailCode is returned Defined error codes for the FailCode argument are RTC_HOSTDOWN Host is down RTC_HOSTUNREACH Host unreachable RTC_NETUNREACH Network unreachable Set the Timeout for a Non Static Route RtGetFailure Syntax uint RtGetFailure HANLE hRt Return Value Failure code or NULL for normal operation Descr...

Page 178: ...teway or NULL Description This function returns the Gateway IP address for the specified route assuming the FLG_RTF_GATEWAY bit is set in the route flags Get the Route s Destination Hardware Interface RtGetIF Syntax HANDLE RtGetIF HANLE hRt Return Value HANDLE to Ether Object representing target interface Description This function returns an Ether device handle to the egress target device of the r...

Page 179: ...king the Route Table RtWalkNext Syntax HANDLE RtWalkNext HANDLE hRt Return Value HANDLE to next route in system route table or NULL if no routes Description This function gets the next route based off the previous route supplied in a walk of the route table The walk must be terminated with RtWalkEnd for the system to behave properly Stop Walking the Route Table RtWalkEnd Syntax void RtWalkEnd HAND...

Page 180: ...wo unsigned 32 bit values for additional data In most cases these are immediate data In one instance the value is actually a 32 bit memory pointer Messages are passed internally to the stack via the function void RTCReport uint Msg UINT32 Param1 UINT32 Param2 Applications should not call this function directly The possible values for Msg are as follows Route is Valid Pending MSG_RTC_UP Parameter s...

Page 181: ...RED Parameter s Param1 Route IP Param2 Route IP Mask all ones for host route Description Called when a route with an expiration timeout has expired and been removed from the table Route has been Manually Removed MSG_RTC_REMOVED Parameter s Param1 Route IP Param2 Route IP Mask all ones for host route Description Called when a route has been manually removed from the table This message is not genera...

Page 182: ...Description Called when an ARP packet is received from a device that has an IP address which is the same as the IP address of the stack on that physical interface De pending on the age of the address the application may wish to destroy the binding A 12 3 Access Functions Hook RTC Messages RTCAddHook Syntax uint RTCAddHook void pfn uint UINT32 UINT32 Return Value 1 if the hook was installed or NULL...

Page 183: ...ol Object A 49 Internal Stack Functions Unhook RTC Messages RTCRemoveHook Syntax void RTCRemoveHook void pfn uint UINT32 UINT32 Return Value none Description Called to remove a previously hooked callback function ...

Page 184: ...nslation 1 Enabled uint IpReasmMaxTime Max reassembly time in seconds uint IpReasmMaxSize Max reassembly packet size uint RtcEnableDebug Enable Route Control Messages 1 On uint RtcAdvTime Time in sec to send RtAdv 0 don t uint RtcAdvLife Litetime of route in RtAdv int RtcAdvPref Preference Level signed in RtAdv uint RtArpDownTime Time 5 failed ARPs keep Rt down sec uint RtKeepaliveTime VALIDATED r...

Page 185: ... in messages it generates as a result of rout ing IP packets Legal values are in the range of 1 255 TTL for ICMP ECHO Reply Messages _ipcfg IcmpTtlEcho Default Value 255 Description This is the TTL value ICMP will use in echo reply messages it generates in re sponse to receiving echo requests Legal values are in the range of 1 255 IP Start Index _ipcfg IpIndexStart Default Value 1 Description This...

Page 186: ... that the total packet size exceeds this value the packet is discarded Making the size larger than 3020 will cause internal memory errors in the stack as the current memory system has a max block size of 3068 bytes Of course the memory allocation support in the HAL can be changed to support larger allocations see the HAL section This value is not otherwise restricted Enable Route Control Messages ...

Page 187: ... brought down for a period of time so that the application will receive an error when IP attempts to send After the desig nated time the route is brought back up and will attempt more ARP requests if used again Time in Seconds a Validated Route is Held _ipcfg RtKeepAliveTime Default Value 1200 Description Routes should not be held indefinitely Use of a route is also not sufficient to keep the rout...

Page 188: ...t IP packet TOS value of packets sent via a socket Note that the application can override this value with the sockets API Maximum Connections on a Listening Socket _ipcfg SockMaxConnect Default Value 8 Description This is max number of connects a socket will pend waiting for a sockets ac cept call from the application Note This value is also the upper bounds of the max connection argument supplied...

Page 189: ...ufMinTx Default Value 2048 Description This is the size in bytes required to be free in the TCP buffer before it is re garded as able to write by the system Affects how the write fd set behaves in a select call This value is usually about 25 to 50 of the send buffer size UDP and RAW IP sockets are always able to write Minimum Size in Bytes for Socket Able to Read _ipcfg SockBufMinRx Default Value ...

Page 190: ...ded as able to write by the system Affects how the write fd set behaves in a select call It is usually about 25 to 50 of the send buffer size This value is only examined when pipes are created so changing this value will not affect the buffering of existing pipes Minimum Size in Bytes for Pipe Able to Read _ipcfg PipeBufMinRx Default Value 1 Description This is the size in bytes required to be pre...

Page 191: ... It also has a physical IP address which is used as a type of proxy for the translated packets The types of packets translated include Any TCP or UDP packet ICMP EHCO and TSTAMP packets sent from the virtual network ICMP EHCOREPLY and TSTAMPREPLY packets sent to the virtual net work ICMP error packets sent to the virtual network in response to a translated packet sent from the virtual network The ...

Page 192: ...tion system this low level configuration is not required Configure the Network Address Translation Module NatSetConfig Syntax void NatSetConfig IPN IPAddr IPN IPMask IPN IPServer Parameter s IPAddr IP address of the Virtual Network IPMask IP mask of the Virtual Network IPSever Physical IP address of the server which will host the NAT translation Description This function configures NAT with a virt...

Page 193: ... arrays exported by the stack library The declaration of these global identifiers appears in the interface specification for the individual protocols The following protocols con tain statistics information Protocol Statistics Definition IP IPIF H ICMP ICMPIF H TCP TCPIF H UDP UDPIF H Raw Transport non TCP UDP RAWIF H Network Address Translation NATIF H ...

Page 194: ...unctions before attempting to use the APIs described in this sec tion NAT has a unique status in the stack software in that it can be an integral part of programming at both the user and kernel levels or can be entirely redundant and even purged from the stack build This section describes the operation of the Network Address Translation soft ware included in the TCP IP stack how to configure it ho...

Page 195: ...tion illustrated be low The TCP IP stack is executing as a home router HR and connects the home LAN subnet 192 168 0 x to the Internet WAN via an ISP which has assigned HR an address of 128 1 2 12 The hosts on the home network H1 and H2 have obtained their internet addresses from HR via DHCP The IP of HR on the home LAN as well as the IP subnet used by the home LAN is pre configured in HR The illu...

Page 196: ...n there must exist a deterministic method of map ping packets from the WAN to their correct destination on the LAN This is done be keeping records of LAN IP clients that have initiated IP traffic and by alter ing the TCP UDP port or ICMP Id field as well as the IP address when per forming the translation Every time a LAN client sends a packet to the WAN the local IP address port id and protocol is...

Page 197: ...are those that are local to hosts on the home LAN The Foreign IP value is the foreign side of the connection as viewed by hosts on the home LAN The Mapped Port value is the source port when the packet is sent from HR The source IP address used in the packet is that assigned to HR by the ISP The IP protocol of the packet is recorded and when using TCP the state of the TCP connection is tracked to e...

Page 198: ...say five hours This is because TCP connections can stay connected for an indefi nite period of time without exchanging any packets If H2 attempts to connect to the same host simultaneously there is no problem sharing the public IP address assigned to HR For example H2 sends a con nection request to IH addressed as follows Packet 3 To From Protocol 64 1 1 100 80 192 168 0 33 1024 TCP HR would not f...

Page 199: ...stination For well known ports like HTTP the port value is not usually altered Only the destination IP address changes In this case port 80 HTTP on the public IP address is mapped to port 80 of the LAN host H2 The entry would look as follows NAT Entry Table Foreign IP Foreign Port Local IP Local Port Mapped Port IP Protocol TCP State Timeout wild wild 192 168 0 32 80 80 TCP STATIC When a connectio...

Page 200: ...llation of a port map for port 80 does not prohibit HR from running its own HTTP server hosted on its private LAN IP address 192 168 0 1 This means that local hosts could get to a local HTTP server on 192 168 0 1 and the public HTTP server on 192 168 0 32 but outside hosts connecting to 128 1 2 12 could only get to the public HTTP serv er on 192 168 0 32 For example assume the same topology as bef...

Page 201: ...ion examples Client Protocol Used Target Address Resulting Server Connection IH HTTP 128 1 2 12 HTTP on H1 H2 HTTP 128 1 2 12 HTTP on HR H2 HTTP 192 168 0 1 HTTP on HR H2 HTTP 192 168 0 32 HTTP on H1 IH Telnet 128 1 2 12 Telnet on H2 H1 Telnet 128 1 2 12 Telnet on HR H1 Telnet 192 168 0 1 Telnet on HR H1 Telnet 192 168 0 33 Telnet on H2 B 1 4 NAT Proxy Filters B 1 4 1 Problem Synopsis Translating ...

Page 202: ...a connection As an example say H1 sends an FTP connec tion request to IH The packet would be address something like the following Packet 1 To From Protocol 64 1 1 100 21 192 168 0 32 1137 TCP HR would not find a NAT entry for 192 168 0 33 1137 so it would create one NAT Entry Table Foreign IP Foreign Port Local IP Local Port Mapped Port IP Protocol TCP State Timeout 64 1 1 100 21 192 168 0 32 1137...

Page 203: ...le Foreign IP Foreign Port Local IP Local Port Mapped Port IP Protocol TCP State Timeout 64 1 1 100 20 192 168 0 32 1137 50003 TCP SYNSENT 00 01 00 64 1 1 100 wild 192 168 0 32 1137 50003 TCP STATIC 64 1 1 100 21 192 168 0 32 1137 50003 TCP CONNECT 04 58 39 The second issue in dealing with an FTP client is that the client can change the port on which the FTP server attempts connection This is done...

Page 204: ...ld then look as follows NAT Entry Table Foreign IP Foreign Port Local IP Local Port Mapped Port IP Protocol TCP State Timeout 64 1 1 100 wild 192 168 0 32 1142 50004 TCP 00 02 00 64 1 1 100 wild 192 168 0 32 1137 50003 TCP STATIC 64 1 1 100 21 192 168 0 32 1137 50003 TCP CONNECT 04 58 39 In recap note that we have the original NAT entry for the FTP control connec tion and now two wildcard entries ...

Page 205: ...mations The solution is twofold First the stack allows a programmer to install proxy filter callback functions on specified TCP UDP port values either outgoing for clients or incoming for servers There are three callback functions in volved The first callback function Enable is called when a new connected is at tempted or when the NAT entry expires This function allows the programmer to establish ...

Page 206: ...he actual implementation is straightforward The code to implement the filter dis cussed in section B 1 4 3 is shown below The API for NAT and Proxy is dis cussed in the following sections GetVal Convert ASCII decimal string to integer static uint GetVal UINT8 pData uint v 0 while pData 0 pData 9 v v 10 pData 0 pData return v FTPCProxyEnable Proxy for FTP Clients behind firewall NOTE Proxy callback...

Page 207: ...set Get length of the IP payload Length HNC16 pIpHdr TotalLen Offset Get the offset into the TCP payload and payload size Offset pTcpHdr HdrLen 2 Length pTcpHdr HdrLen 2 Get pointer to TCP payload pData Offset For clients we only care about sending PORT commands For example if our client IP is 192 138 139 32 and it reports port 384 the form of the command sent to the FTP server would be PORT 192 1...

Page 208: ...ew IPNew PortNew pNI IPForeign 0 IPPROTO_TCP 0 NAT_IDLE_SECONDS if hNAT return 0 Get Server IP and Mapped Port IPNew htonl NatIpServer pNINew NatGetPNI hNAT PortNew pNINew PortMapped Print a repalcement string with with IP and Port sprintf tmpstr u u u u u u r n uint IPNew 24 uint IPNew 16 0xFF uint IPNew 8 0xFF uint IPNew 0xFF PortNew 8 PortNew 0xFF Replace the original string with ours ProxyPack...

Page 209: ...s in actuality just a NAT entry Each NAT entry has its own infor mation structure This NATINFO structure allows the programmer to examine the status of a particular entry The specification of the NATINFO structure is as follows typedef struct _natinfo uint TcpState Current TCP State Simplified define NI_TCP_CLOSED 0 Closed or closing define NI_TCP_SYNSENT 1 Connecting define NI_TCP_ESTAB 2 Establi...

Page 210: ... the port in use by the peer host on the public network WAN It is the entity that is on the physical network outside the firewall UINT8 Protocol This is protocol in use by the NAT entry It must be IPPROTO_TCP IP PROTO_UDP or IPPROTO_ICMP UINT16 PortMapped This is the port in use by the router on its public WAN IP address It is this port that maps back to a specific local IP port on the LAN HANDLE ...

Page 211: ...f WAN peer usually NULL wild Protocol IP protocol IPPROTO_TCP or IPPROTO_UDP PortMapped Port on router s public WAN to map usually a well known port Timeout Timeout of entry in seconds NULL for STATIC Return Value Handle to NAT entry or NULL on error Description This function creates a NAT entry with the parameters as specified For example to allow a host on a virtual IP address of 1 2 3 4 to run ...

Page 212: ...ry It is called to remove a STATIC NAT entry that is no longer required Get a Pointer to a NAT Entry s NATINFO Structure NatGetPNI Syntax NATINFO NatGetPNI HANDLE hNat Parameter s hNat Handle to NAT entry created with NatNew Return Value Pointer to NATINFO structure or NULL on error Description This function returns a pointer to the NATINFO structure defined above in sec tion B 2 3 It is used main...

Page 213: ...ter Callback Functions The proxy filter callback functions allow the proxy programmer to examine NAT entry properties as the entries are created plus the examination of packet data as packets pass between the LAN and WAN This section describes the syntax of the callback functions that are supplied to the proxy filter when it is first installed in the system Proxy Enable Callback Function ProxyEnab...

Page 214: ... purpose of the callback is to examine the packet and take appropriate ac tion based on its contents The packet payload can be easily modified by the ProxyPacketMod function described later in this section The translation of the IP address and port information can not be altered by this callback howev er the callback can act as a packet filter and discard unwanted packets by re turning a value of ...

Page 215: ...l IPPROTO_TCP and Port 21 IPTarget is used only in server proxies when NatMode is set to NAT_MODE_RX This specifies the machine behind the firewall that is actual ly providing the service The three pointers to callback functions correspond to the proxy filter callback functions described in the previous section The function returns a handle to the new proxy Note that a proxy handle is not the same...

Page 216: ...ize of old data at Offset NewSize Size of new data to replace old data at Offset pNewData Pointer to new data to replace old data Return Value Pointer to new IP header of packet This pointer is used for further modifica tions if needed Description This function may only be called from a proxy filter callback function Its pur pose is to modify the contents of a TCP or UDP packet and perform the nec...

Page 217: ... per connection security and billing The TCP IP stack has built in support for both PPP severs and clients The PPP support API is designed to be shared by one or more physical devices One obvious device that can be hooked to PPP is a serial line but the stack also contains support for PPP over Ethernet PPPoE The low level PPP API as well as Serial HDLC and PPPoE are all discussed in this appendix ...

Page 218: ...1 Standard PPP Frame Over Serial Line Flag 7E Addr FF Control 03 Protocol Payload CRC Flag 7E 1 1 1 2 1500 2 1 In order to abstract out the actual processing of the PPP data from the process ing of the PPP frame encoding the PPP support included in the TCP IP stack expects a smaller frame consisting of the protocol and payload fields only This format is shown in Figure C 2 Figure C 2 PPP Frame Pro...

Page 219: ...sessions There is no specific requirements in specifying the session API for any particu lar PPP device but the APIs defined for HDLC and PPPoE can be used guide C 1 3 Function Overview The SI interface module is charged with communicating with both the hard ware and the application program but the PPP packets themselves are pro cessed via the PPP support functions in the stack The PPP support sof...

Page 220: ...laration Syntax void SIControl HANDLE hSI uint Message UINT32 Data HANDLE hPkt Parameter s hSI Handle to SI private data Message Message code describing the PPP event Data Additional data concerning the message hPkt Handle to a packet when Message is SI_MSG_SENDPACKET Return Value nothing Description This function is called when a PPP needs to notify the serial interface SI of a change in status o...

Page 221: ...SI_CSTATUS_DISCONNECT_LCP Connection dropped in LCP stage SI_CSTATUS_DISCONNECT_AUTH Connection dropped in authorization stage SI_CSTATUS_DISCONNECT_IPCP Connection dropped in IP configuration stage In the case that Data is set to any of disconnect messages pppFree should be called to destroy the connection instance For all other status values no ac tion is required Note It is always safe to assum...

Page 222: ...g that must be done for the various SI callback messages The function calls made in this example are described in Appendix A SI Control Callback Function for PPPoE void pppoeSI HANDLE hSI uint Msg UINT32 Aux HANDLE hPkt hSI is really a pointer to our private data structure PPPOE_INST ppi PPPOE_INST hSI HANDLE hFrag uint Offset ValidSize Payload UINT8 pb ETHHDR pEth switch Msg case SI_MSG_CALLSTATU...

Page 223: ...PP packet PktFree hPkt return NOTE Unlike a serial port PPPoE will use Ethernet to send the packet data Thus we would like to reuse the supplied packet handle and pass that handle directly to the low level packet driver To do this we go through a little extra work on the packet A serial device could simple start encoding data at this point Aux 16 bit PPP Protocol Value ValidSize Size of Payload fi...

Page 224: ...siest way to implement this requirement is to use the timer object built into the kernel The timer can be allocated when the SI instance is allocated asso ciated with the instance and then freed when the SI instance is destroyed The timer object is supplied a callback function that is called in kernel mode In this callback function the pppTimer function is called for all known instances of PPP Thi...

Page 225: ... we know we ll have room for our 2 byte header if hPkt IFCreatePacket 1500 0 0 return 0 Get the memory frag for this packet hFrag PktGetFrag hPkt Get pointers to packet headers pb FragGetBufParams hFrag 0 0 0 Offset PktGetSizeLLC hPkt The value of Offset is that assigned by IFCreatePacket Its probably 14 bytes but we better make sure its at least 2 bytes We ll take off 2 bytes the size of our head...

Page 226: ...inter to username in client mode NULL in server mode Password Pointer to password in client mode NULL in server mode cmap 32 bit local CMAP to pass to peer pfnSICtrl Pointer to SI module callback function Return Value Handle to new PPP connection instance or NULL on error Description This function is called to create a new PPP connection instance The type of connection created is determined by the...

Page 227: ..._SIOPT_RECVCMAP Accept an async character map mru The MRU is maximum receive unit or the max size of the payload portion of a PPP packet For a standard serial link the MRU is typically 1500 but can be smaller IPServer When creating the PPP instance in SERVER mode this is the IP address in network format of the TCP IP stack reported to the peer When operating in CLIENT mode this value is NULL IPMas...

Page 228: ... in the PPP API Destroy PPP Connection Instance pppFree Syntax void pppFree HANDLE hPPP Parameter s hPPP Handle to PPP instance created with pppNew Return Value nothing Description This function is called to close and destroy a PPP connection instance created with pppNew This function MUST be called to free the PPP handle even if the PPP connection itself is already disconnected Send a PPP Packet ...

Page 229: ...pTimer HANDLE hPPP Parameter s hPPP Handle to PPP instance created with pppNew Return Value nothing Description This function is called on an active PPP instance to notify PPP that one second has elapsed Since the PPP API is entirely stateless it relies on the serial inter face for time tick notification ...

Page 230: ...need to call the PPP API directly C 2 3 Function Overview Called by Application hdlcNew Create a Serial HDLC Client Session hdlcFree Destroy a Serial HDLC Client Session hdlcGetStatus Get the Call Status of a Serial HDLC Client Session hdlcsNew Create a Serial HDLC Server Session hdlcsFree Destroy a Serial HDLC Server Session hdlcsGetStatus Get the Call Status of a Server HDLC Client Session Calle...

Page 231: ... strongly recommended PPPFLG_SIOPT_RECVCMAP Accept an async character map strongly recommended cmap This is the desired value of the async character control map that is sent to the peer to allow frame compression by skipping the escape cod ing of characters when it is not required The mask contains set bit for each character 0 to 31 that must be escaped when sent by the peer If the PPPFLG_SIOPT_SE...

Page 232: ... function returns a uint that will be set to one of the following values SI_CSTATUS_WAITING Connection is idle PPPoE session opening SI_CSTATUS_NEGOTIATE Connection in LCP negotiation stage SI_CSTATUS_AUTHORIZE Connection in authorization stage SI_CSTATUS_CONFIGURE Connection in IP configuration stage SI_CSTATUS_CONNECTED Connection is fully connected and operational SI_CSTATUS_DISCONNECT Connecti...

Page 233: ... connection instance to create and what type of options to support in the connection instance In the pppFlags parameter the following flags must be set PPPFLG_SERVER Create PPP server connection instance In addition any of the following flag can also be set PPPFLG_OPT_AUTH_PAP Require PAP authentication PPPFLG_OPT_AUTH_CHAP Require CHAP authentication PPPFLG_OPT_USE_MSE Use MS extensions as client...

Page 234: ... Serial HDLC Server Session hdlcsFree Syntax void hdlcsFree HANDLE hHDLC Parameter s hHDLC Handle to HDLC Server Session Return Value nothing Description This function is called to close and destroy a serial HDLC server session that was created with hdlcsNew This function is always called once for every HDLC instance handle If the connection is no longer active it frees the instance memory If the ...

Page 235: ...ECT_LCP Connection dropped in LCP stage SI_CSTATUS_DISCONNECT_AUTH Connection dropped in authorization stage SI_CSTATUS_DISCONNECT_IPCP Connection dropped in IP configuration stage Description This function is called to get the connection status of a serial HDLC server ses sion using the HDLC instance handle returned from hdlcsNew This function can be called anytime after the handle is created wit...

Page 236: ...he HAL layer Thus is it not necessary to access or alter the HAL to use PPPoE The software can be used as a PPP server or PPP client but not both simulta neously In both cases PPPoE makes use of the the PPP programming inter faces described earlier in this section Thus for server mode the PPP sever will make use of the same user account information as a serial based server C 3 3 Function Overview ...

Page 237: ...is is a pointer to a NULL terminated string containing the username to use in PAP or CHAP authentication The maximum string length is defined by PPPNAMELEN Password This is a pointer to a NULL terminated string containing the password to use in PAP or CHAP authentication The maximum string length is defined by PPPNAMELEN When successful this function returns a handle to a new PPPoE instance The cu...

Page 238: ...ion dropped in authorization stage SI_CSTATUS_DISCONNECT_IPCP Connection dropped in IP configuration stage Description This function is called to get the connection status of a PPPoE client session using the PPPoE instance handle returned from pppoeNew This function can be called anytime after the handle is created with pppoeNew and before it is destroyed with pppoeFree Create a PPPoE Server Sessi...

Page 239: ...erver connection instance In addition any of the following flag can also be set PPPFLG_OPT_AUTH_PAP Require PAP authentication PPPFLG_OPT_AUTH_CHAP Require CHAP authentication PPPFLG_OPT_USE_MSE Use MS extensions as server PPPFLG_OPT_LOCALDNS Claim Local IP as DNS server PPPFLG_CH1 Allow server channel group 1 account users PPPFLG_CH2 Allow server channel group 2 account users PPPFLG_CH3 Allow ser...

Page 240: ...PPoE server instance The status individual connects is not available to the caller but tracked automatically by PPPoE When sessions are added or destroyed the IP address callback supplied to NC_NetStart is called and connections can be tracked by the applications programmer via this function callback Destroy a PPPoE Server Session pppoesFree Syntax void pppoesFree HANDLE hPPPOES Parameter s hPPPOE...

Page 241: ...ient account flags This allows the system programmer to allow different classes of services for different channels The methodology of adding querying and removing user accounts is the same for any other tag in the configuration system Some simple examples fol low More example code can be found in the sample console program C 4 3 Adding a PPP User Account The following code adds a PPP user account ...

Page 242: ...rintf Account added n return C 4 4 Searching for a PPP User Account The following code implements the AcctFind function called in the previous example Note that the same method could be used to print out a list of all ac counts HANDLE AcctFind char name HANDLE hAcct CI_ACCT CA int rc int size Get the first user account rc CfgGetEntry 0 CFGTAG_ACCT CFGITEM_ACCT_PPP 1 hAcct If there are no accounts ...

Page 243: ... is no next entry we re done searching rc CfgGetNextEntry 0 hAcct hAcct if rc 0 return 0 C 4 5 Removing a PPP User Account Removing a specific user account is done by finding the account and removing the entry handle The following uses the AcctFind function to find the target account void AcctDelete char name HANDLE hAcct Find the account to delete hAcct AcctFind name If we found the account remov...

Page 244: ...s the HAL API This section is required only for system programmers who need low level ac cess to the hardware for configuration and monitoring This API does not ap ply to sockets application programming Topic Page D 1 Overview D 2 D 2 Low Level Timer Driver llTimer D 3 D 3 Low Level Packet Driver llPacket D 5 D 4 Low Level Serial Port Driver llSerial D 10 Appendix D ...

Page 245: ...application support func tions both have been given a different naming conventions Kernel layer func tions are named with an ll prefix without a leading underscore for example llPacketSend while application functions have an underscore for example _llPacketInit D 1 2 External Calls from HAL Functions Since HAL functions are called from the stack kernel they are executing within an llEnter llExit p...

Page 246: ... Level Timer API Functions The following functions are required Initialize Timer Environment _llTimerOpen Syntax void _llTimerOpen UINT32 ctime Return Value nothing Description This function is called to initialize the timer environment and to set the initial time The value of ctime is the number of seconds elapsed from a known refer ence An initial value of zero is also acceptable The stack softw...

Page 247: ...her half second Multi ple half second events are not queued up Get Current Time in Seconds and Milliseconds llTimerGetTime Syntax UINT32 llTimerGetTime UINT32 pMSFrac Description Returns the number of seconds that have elapsed since the timer driver was started If the pointer pMSFrac is non zero the function writes the fractional seconds in milliseconds to this location 0 to 999 Note Although the ...

Page 248: ...ind Logical Ether Object from Device Id llPacketSetRxFilter Set Packet Receive Filter llPacketGetMacAddr Get MAC address llPacketGetMCastMax Get the Maximum Number of Multicast Addresses llPacketGetMCast Get Multicast Address List llPacketSetMCast Set Multicast Address List llPacketService Service a Queued Packet llPacketGetBuffer Get a Packet Buffer from the System llPacketSend Send a Packet llPa...

Page 249: ... second timer intervals for dead man polling checks Open Driver and Bind Logical Ether Object to Device Id llPacketOpen Syntax uint llPacketOpen uint dev HANDLE hEther Return Value This function should return 1 on success and 0 on failure Description Opens the low level packet driver specified by the one s based index dev The maximum value of dev is the number of devices returned from the _llPacke...

Page 250: ...Data Return Value nothing Description Copies the 6 byte MAC address of the physical device index dev into the sup plied data buffer Get the Maximum Number of Multicast Addresses llPacketGetMCastMax Syntax uint llPacketGetMCastMax uint dev Return Value The maximum number of 6 byte MAC addresses that can be supplied for llPacketSetMCast Description Called to the maximum number of multicast addresses...

Page 251: ... to the Ether object via EtherRxPacket Get a Packet Buffer from the System llPacketGetBuffer Syntax UINT8 llPacketGetBuffer uint size Description Called to get a packet buffer from the system which will eventually be sent via llPacketSend or returned to the packet driver via llPacketReturnBuffer Buffering is done in this fashion so packet drivers that use their own buffer pools can support passing...

Page 252: ...etReturnBuffer Syntax void llPacketReturnBuffer UINT8 bAddr Description Called to return a packet buffer to the system which was previously obtained from a call to llPacketGetBuffer This is done so packet drivers that use their own buffer pools can support passing buffer ownership without copying buffer data ...

Page 253: ...ver Character Mode llSerialOpenHDLC Open Driver in HDLC Mode llSerialCloseHDLC Close Driver HDLC Mode llSerialConfig Set Serial Port Configuration llSerialService Service a Queued HDLC Buffer llSerialGetBuffer Get a Serial Buffer from the System llSerialSend Send a Serial Buffer llSerialReturnBuffer Return an Serial Buffer to the System D 4 3 Low Level Serial API Functions The low level support la...

Page 254: ...t callback func tion passed to llSerialOpenCharmode Second if the device has been opened in HDLC mode this function returns 1 if there are HDLC buffers pending In this case no additional character mode input is received however some queue character mode data may still be passed to the callback function In a polling system this function is called continuously In an interrupt driven semaphore system...

Page 255: ...eturn 1 on success and 0 on failure Description Opens the low level serial driver specified by the one s based index dev in HDLC mode The maximum value of dev is the number of devices returned from the _llSerialInit function HDLC mode input builds up buffers of one HDLC frame each and passes them to the HDLC object when the llSerialService function is called Note that the HDLC flag character 0x7E ...

Page 256: ...re defined HAL_SERIAL_MODE_8N1 8 Data Bits No Parity 1 Stop Bit HAL_SERIAL_MODE_7E1 7 Data Bits Even Parity 1 Stop Bit The value of flowctrl indicates the desired flow control operation Legal values for this parameter are HAL_SERIAL_FLOWCTRL_NONE No Flow Control HAL_SERIAL_FLOWCTRL_HARDWARE Hardware Flow Control This function can be called before or after the device is opened Service a Queued HDLC...

Page 257: ...r llSerialSend Syntax void llSerialSend uint dev UINT8 pb uint offset uint size Description Called to send a serial buffer out the physical serial device indicated by dev The size of the valid data is in size The byte offset to the valid data in the sup plied buffer is in offset Once the buffer has been sent the memory is returned internally to the serial port s free queue Only buffers allocated v...

Page 258: ...nd process input from a user They are very useful as interfaces to services run ning on the device Writing CGI programs for the NDK is relatively simple and only requires a few specific functions The CGI interface is limited to HTTP POST requests GET requests are not supported by CGI The CGI program is built from a single C callable entrypoint or CGI function Each CGI function is called on its own...

Page 259: ...low conversion of files to a C array The calling format for binsrc is binsrc input file name output file name identifier Parameters input file name File to be converted output file name Name for file containing C data representation of the input file name identifier C name for data For example to convert an HTML file default htm for use by EFS the follow ing command could be executed from the Wind...

Page 260: ...nt ContentLength Our function to initialize EFS with our WEB files void AddWebFiles void efs_createfile index html DEFAULT_SIZE DEFAULT efs_createfile 404 htm strlen htm404 UINT8 htm404 efs_createfile sample cgi 0 UINT8 cgiSample One the above code is run the EFS system is ready for the HTTP server to serve up the content Note the inclusion of the pragma to place the converted WEB page into a memo...

Page 261: ... content is specified by ContentLength The CGI function must decide whether or not to close the socket on which the POST arrived By de fault the socket is normally left open but in some cases may need to be closed It is also possible that the CGI function may wish to take control of the socket an close it at a later point in time Note in this latter case the socket would be transferred to another ...

Page 262: ...s input from a CGI POST operation pointed to by PostInput at an offset pointed to by pParseIndex and returns in sequence a pointer the name and then the value of each post entry This function modifies the data in PostInput It also updates the current parsing position in the variable pParseIndex The parse index must be set to 0 on initial call On the initial call to this function the integer value ...

Page 263: ...cond MACRO http501 is used to send a 501 Not Implemented error to the HTTP client Here no additional data is sent Under normal circumstances the CGI function will use the httpSendStatus Line function to send an OK message to the client followed by the httpSend ClientStr function to send client data in the form of a NULL terminated string Note that an additional carriage return and line feed are re...

Page 264: ...form method POST action sample cgi Name input type text name name br I dislike spam input type checkbox name spam value no br Favorite Pizza input type radio name pizza value pepperoni Pepperoni input type radio name pizza value sausage Sausage input type radio name pizza value cheese checked Cheese input type radio name pizza value other Other br Favorite Color select name color option value red ...

Page 265: ...htm404 html body h1 HTTP 1 0 404 Object Not Found h1 body html static int cgiSample int htmlSock int ContentLength Our CGI Function void AddWebFiles void efs_createfile index html DEFAULT_SIZE DEFAULT efs_createfile sample cgi 0 UINT8 cgiSample efs_createfile 404 htm strlen htm404 UINT8 htm404 void RemoveWebFiles void efs_destroyfile 404 htm efs_destroyfile sample cgi efs_destroyfile index html E ...

Page 266: ...function Note that this example is also included in the example application code in a slightly different form static int cgiSample int htmlSock int ContentLength char name 0 spam 0 pizza 0 color 0 char buffer key value int len int parseIndex char htmlbuf MAX_RESPONSE_SIZE 1 Read in the request data First allocate a buffer for the request buffer char mmBulkAlloc ContentLength 1 if buffer goto ERROR...

Page 267: ...nse Here we ll just echo back the input we received to an HTML table html html body text 000000 bgcolor ffffff r n html h1 Form Information h1 html divider html table border cellspacing 0 cellpadding 5 r n if name sprintf htmlbuf tablefmt Name name html htmlbuf if spam sprintf htmlbuf tablefmt Likes Spam spam html htmlbuf if pizza sprintf htmlbuf tablefmt Favorite Pizza pizza html htmlbuf if color...

Page 268: ...at all entries except the first three include a trailing space character Global Name String Value DEFAULT_NAME index html CRLF r n SPACE HTTP_VER HTTP 1 0 CONTENT_LENGTH Content length CONTENT_TYPE Content type CONTENT_TYPE_APPLET application octet stream CONTENT_TYPE_AU audio au CONTENT_TYPE_DOC application msword CONTENT_TYPE_GIF image gif CONTENT_TYPE_HTML text html CONTENT_TYPE_JPG image jpeg ...

Page 269: ...P_NOT_IMPLEMENTED 501 Send NULL Terminated String Data to Client httpSendClientStr Syntax void httpSendClientStr int Sock char Response Parameter s Sock Socket on which to send Response Pointer to NULL terminated string Return Value nothing Description This function sends the indicated NULL terminated response string to the indi cated client socket In other words it calls strlen and send Send a Fu...

Page 270: ...ault 4 8 CfgGetEntry 4 8 CfgGetEntryCnt 4 9 CfgGetImmediate 4 9 CfgGetNextEntry 4 10 CFGITEM_ACCT_PPP 4 31 CFGITEM_DHCP_DOMAINNAMESERVER 4 32 CFGITEM_DHCP_HOSTNAME 4 32 CFGITEM_IP_ICMPDOREDIRECT 4 34 CFGITEM_IP_ICMPTTL 4 34 CFGITEM_IP_ICMPTTLECHO 4 34 CFGITEM_IP_IPFORWARDING 4 34 CFGITEM_IP_IPINDEXSTART 4 34 CFGITEM_IP_IPNATENABLE 4 34 CFGITEM_IP_IPREASMMAXSIZE 4 34 CFGITEM_IP_IPREASMMAXTIME 4 34 ...

Page 271: ...ICE 4 23 CFGTAG_SYSINFO 4 32 CGI Function E 4 cgiParseVars E 5 CI_CLIENT 4 30 CI_IPNET 4 28 CI_ROUTE 4 29 CI_SERVICE_DHCPC 4 27 CI_SERVICE_DHCPS 4 27 CI_SERVICE_DNSSERVER 4 27 CI_SERVICE_HTTP 4 27 CI_SERVICE_NAT 4 27 CI_SERVICE_TELNET 4 27 ci_srvargs 4 24 CIS_FLG_CALLBYIP 4 25 CIS_FLG_IFIDXVALID 4 25 CIS_FLG_RESOLVEIP 4 25 CIS_FLG_RESTARTIPTERM 4 25 CIS_SRV_STATUS_DISABLED 4 25 CIS_SRV_STATUS_ENAB...

Page 272: ...OpenSession 3 6 fdSelect 3 7 fdSelectAbort 3 8 fdTransfer 3 8 File Descriptor Functions 3 6 File Handle Functions 3 9 File IO 2 17 FileHandleClose 3 9 FileHandleGetFd 3 10 fopen See efs_fopen FragCopy A 17 FragFree A 17 FragGetAux1 A 17 FragGetAux2 A 17 FragGetBufParams A 18 FragGetNext A 18 FragGetPrev A 18 FragNewAlloc A 16 FragNewWrap A 16 FragSetAux1 A 18 FragSetAux2 A 19 FragSetBufParams A 19...

Page 273: ...fg RtcAdvTime A 52 ipcfg RtcEnableDebug A 52 ipcfg RtCloneTimeout A 53 ipcfg RtDefaultMTU A 54 ipcfg RtDownTime A 53 ipcfg RtKeepAliveTime A 53 ipcfg SockBufMax A 55 ipcfg SockBufMinRx A 55 ipcfg SockBufMinTx A 55 ipcfg SockMaxConnect A 54 ipcfg SockTimeConnect A 54 ipcfg SockTimeIo A 55 ipcfg SockTosDefault A 54 ipcfg SockTtlDefault A 54 IPCONFIG A 50 L listen 3 22 LLADeRef A 20 LLAGetData A 21 L...

Page 274: ...T_FAULT 6 4 NETTOOLS_STAT_NONE 6 4 NETTOOLS_STAT_PARAMUPDATE 6 4 NETTOOLS_STAT_RUNNING 6 4 Network Address Translation Service 6 18 Network Control Functions 4 20 Network Tools Services 6 1 NT_MODE_IFIDX 6 3 NT_MODE_IPADDR 6 3 NtAddNetwork 5 3 NtAddStaticGateway 5 4 NTARGS 6 3 NtGetPublicHost 5 5 NtIfIdx2Ip 5 5 NtIPN2Str 5 6 NTPARAM_DHCPS 6 8 NTPARAM_NAT 6 19 NTPARAM_TELNET 6 5 NtRemoveNetwork 5 3...

Page 275: ... B 21 R recv 3 22 recvfrom 3 24 recvnc 3 12 3 25 recvncfree 3 12 3 26 recvncfrom 3 12 3 27 RTCAddHook A 48 RtCreate A 40 RTCRemoveHook A 49 RtDeRef A 40 RtFind A 41 RtGetFailure A 43 RtGetFlags A 43 RtGetGateIP A 44 RtGetIF A 44 RtGetIPAddr A 44 RtGetIPMask A 44 RtGetMTU A 44 RtRef A 40 RtRemove A 43 RtSetFailure A 42 RtSetTimeout A 42 RtWalkBegin A 45 RtWalkEnd A 45 RtWalkNext A 45 S select See f...

Page 276: ... 5 TaskDestroy 2 7 TaskExit 2 7 TaskGetEnv 2 7 TaskGetPri 2 7 TaskSelf 2 8 TaskSetEnv 2 8 TaskSetPri 2 9 TaskSleep 2 9 TaskYield 2 9 TCP_MAXSEG 3 21 TCP_NODELAY 3 21 TCP_NOOPT 3 21 TCP_NOPUSH 3 21 Telnet Parameter Structure 6 5 Telnet Server Service 6 5 TelnetClose 6 7 TelnetOpen 6 6 TimerFree A 34 TimerHSTick A 35 TimerNew A 34 TOS 3 21 TTL 3 21 V vprintf 2 15 vsprintf 2 15 W WEB Content E 1 ...

Reviews: