tfUseIntfDriver

Jump to: navigation, search

Table of Contents >> Programmer's Reference


#include <trsocket.h>


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


Function Description

tfUseIntfDriver() adds a loop back driver below the link layer and returns an interface handle. An example would be as follows:

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

This function is very useful to debug a link layer. When using the loopback driver some macro definitions and configurations are necessary to insure 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 tfUseIntfDriver() 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