tfAddInterface
Table of Contents >> Programmer's Reference
| #include <trsocket.h> |
| ttUserInterface tfAddInterface | ( |
| const char * namePtr, | |
| ttUserLinkLayer linkLayerHandle, | |
| ttDevOpenCloseFuncPtr drvOpenFuncPtr, | |
| ttDevOpenCloseFuncPtr drvCloseFuncPtr, | |
| ttDevSendFuncPtr drvSendFuncPtr, | |
| ttDevRecvFuncPtr drvRecvFuncPtr, | |
| ttDevFreeRecvFuncPtr drvFreeRecvFuncPtr, | |
| ttDevIoctlFuncPtr drvIoctlFuncPtr, | |
| ttDevGetPhysAddrFuncPtr drvGetPhysAddrFuncPtr, | |
| int * drvAddErrorPtr | |
| ); |
Function Description
This function is the main function to use when adding an interface to the Treck TCP/IP system. Note: Interfaces are added in the CLOSED state. An example would be as follows:
myInterfaceHandle=tfAddInterface("NE2000.001",
etherLinkLayerHandle,
ne2kOpen,
ne2kClose,
ne2kSend,
ne2kReceive,
(ttDevFreeRecvFuncPtr)0,
ne2kIoctl,
ne2kGetPhyAddr,
&errorCode);
Parameters
- namePtr
- The callers name for the device (each call to tfAddInterface() must use a unique name). The name length cannot exceed TM_MAX_DEVICE_NAME - 1 (13 bytes).
- linkLayerHandle
- The link layer (layer 2) protocol handle that this interface will use. This is returned by tfUseEthernet(), tfUseAsyncPpp(), tfUseAsyncServerPPP(), or tfUseSlip().
- drvOpenFuncPtr
- A function pointer to the device drivers open function. The function prototype is defined here.
- drvCloseFuncPtr
- A function pointer to the device drivers close function. The function prototype is defined here.
- drvSendFuncPtr
- A function pointer to the device driver's send routine. The function prototype is defined here.
- drvRecvFuncPtr
- A function pointer to the device driver's receive routine. The function prototype is defined here.
- drvFreeRecvBufFuncPtr
- A function pointer a device driver function that will free a receive buffer (OPTIONAL). The function prototype is defined here.
- drvIoctlFuncPtr
- A function pointer to an IOCTL routine. This function is called by tfIoctlInterface(). The function prototype is defined here.
- drvGetPhyAddrFuncPtr
- A function pointer to the device driver that will return the physical address for the device. The function prototype is defined here.
- drvAddErrorPtr
- A pointer to an int that will contain an error (if one occurred).
Returns
- ttUserInterface
- Success.
- NULL
- Failure. See value stored in *drvAddErrorPtr.
Possible values for *drvAddErrorPtr:
- TM_EINVAL
- One of the parameters was invalid.
- TM_EALREADY
- Device has already been added.
- TM_ENOBUFS
- Not enough buffers to allocate a device entry.
- TM_ENOSPC
- The maximum number of devices has already been added (default 255). To modify this default, #define TM_MAX_NUM_IFS in your trsystem.h file to be the maximum number of devices you wish to add.