tfUseScatIntfDriver

Jump to: navigation, search

Table of Contents >> Programmer's Reference


#include <trsocket.h>


ttUserInterface tfUseScatIntfDriver (
ttCharPtr namePtr,
ttUserLinkLayer linkLayerHandle,
int TM_FAR * errorCodePtr
);


Function Description

tfUseScatIntfDriver() adds a loopback driver below link layer using one scattered device driver send call and scattered device driver recv. tfUseIntfDriver() and tfUseScatIntfDriver() are very useful to debug a link layer. tfUseScatIntfDriver() avoids copying the data in the loopback driver. An example would be as follows:


ethernetLinkLayerHandle = tfUseEthernet();
myInterfaceHandle=tfUseScatIntfDriver("TEST1",
                                      etherLinkLayerHandle,
                                      &errorCode);


Note Note: Both TM_USE_ONE_SCAT_DRV_SEND and TM_USE_DRV_SCAT_RECV need to be defined. If either one of these macros is not defined then tfUseScatIntfDriver() will revert to tfUseIntfDriver().


When using the loop back driver (scattered or non scattered version) some macro definitions and configurations are necessary to ensure that the loopback driver is used and not bypassed for a given destination IP address (peer IP address).

Peer IP Address Steps to ensure that the loopback driver is used
Configured in the stack Define TM_LOOP_TO_DRIVER or TM_SINGLE_INTERFACE_HOME.
Not configured in the stack Define TM_DEV_IP_NO_CHECK. If the link layer is Ethernet then a proxy ARP entry should be added for the peer IP address.


Parameters

  • namePtr
    The caller's name for the device (each call to tfUseScatIntfDriver() 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(), or tfUseSlip().
  • drvAddErrorPtr
    A pointer to an int that will contain an error (if one occured).


Returns

  • interfaceHandle
    Success
  • NULL
    Failure


Possible *drvAddErrorPtr Values

  • TM_EINVAL
    One of the parameters is invalid.
  • TM_EALREADY
    A device with the same name has already been added.
  • TM_ENOBUFS
    Insufficient memory to allocate the device entry.


Table of Contents >> Programmer's Reference