tfUserStartArpSend

Jump to: navigation, search

Table of Contents >> Optional Protocols >> AutoIP Configuration


#include <trsocket.h>


int tfUserStartArpSend (
ttUserInterface interfaceHandle,
ttUserIpAddress ipAddress,
int numberArpProbes,
ttUser32Bit arpProbeInterval,
ttUser32Bit timeout
);


Function Description

This function starts sending one or more ARP probes or ARP requests on a given interface.

If the interface is not configured yet with that IP address on any multi-home, then this command instructs the Treck stack to send one or more ARP probes. An ARP probe is an ARP request with the sender net address set to zero.

If the interface has been configured with that IP address on one of its multi-home, then this command instructs the Treck stack to send one or more ARP requests with the configured IP address as the source address.

The user will pass the interface handle, the IP address to check for collision, a maximum number of ARP probes/requests, the interval of time between ARP probes/requests, and a timeout parameter. We send an ARP probe/request on the interface(s) specified by the interface handle, create a timer, and return. If 'numberArpProbes' is bigger than one, then the Treck stack, in the context of the timer task, will send (numberArpProbes - 1) additional ARP probes/requests every time the 'arpProbeInterval' expires.

If a "matching" ARP reply/request/probe is received before all ARP probes have been sent, the Treck stack will stop sending any more ARP probes, cancel the timer, and call the user call back function with a TM_EADDRINUSE error code. If a "matching" ARP reply/request is received before all ARP requests have been sent, the Treck stack will stop sending any more ARP probes, cancel the timer, and call the user call back function with a TM_EADDRINUSE error code.

When the timeout parameter expires, the Treck stack will stop sending any more ARP probe(s) request(s), cancel the timer, and will call the user call back function passed by the user in tfUseCollisionDetection(), with a TM_ENOERROR error code.

tfUserStartArpSend() can be called before the interface has been configured with that IP address. In that case, the user has to have at least opened the interface with another IP address first, or with a zero IP address and the TM_DEV_IP_USER_BOOT flag. If the TM_DEV_IP_USER_BOOT flag has been used to open the interface, then the user need to use tfFinishOpenInterface() to finish the configuration with the selected IP address, when it is determined that no other host uses that IP address.

tfUserStartArpSend() can be called, after the interface has been configured with the IP address parameter. In that case ARP requests are being sent, instead of ARP probes.


Warning Warning: tfUseCollisionDetection() must to be called before tfUserStartArpSend() is called.


Parameters

  • interfaceHandle
    Interface on which to send the ARP probe(s)/request(s).
  • ipAddress
    Target IP address of the ARP probe(s)/request(s). Sender IP address of the ARP request(s).
  • numberArpProbes
    Maximum number of ARP probes/requests to send. Interval between ARP requests is 'arpProbeInterval' in milliseconds. If set to zero, TM_MAX_PROBE (4) is used instead.
  • arpProbeInterval
    Interval in milliseconds between ARP probes/requests. If set to zero, the default TM_PROBE_INTERVAL (2000 milliseconds) is used for the probe interval.
  • timeout
    Number of milliseconds to wait after sending the first ARP probe/request, and call the user call back function set by the user with tfUseCollisionDetection(). If set to zero, it will be set to the default value of 'numberArpProbes' * 'arpProbeInterval'.


Returns

  • TM_ENOERROR
    Success.
  • TM_EINVAL
    One of the following:
  • 'interfaceHandle' is invalid or NULL.
  • 'timeout' is less than 'arpProbeInterval' * 'numberArpProbes'.
  • TM_ENOENT
    The user is not checking the IP address for collision detection, i.e. the user has not called tfUseCollisionDetection() before calling tfUserStartArpSend().
  • TM_EALREADY
    tfUserStartArpSend() has already been called for that IP address and it has either not timed out yet or was called using a different interface.
  • TM_ENOBUFS
    No memory to allocate a timer.
  • TM_EPERM
    Interface is not a LAN interface, i.e. ARP not permitted on that interface.
  • TM_ENXIO
    Interface has not been opened.


Table of Contents >> Optional Protocols >> AutoIP Configuration