tfRegisterIPForwCB

Jump to: navigation, search

Table of Contents >> Programmer's Reference


#include <trsocket.h>


int tfRegisterIPForwCB (ttUserIpForwCBFuncPtr ipForwCBFuncPtr);


Function Description

Used to register a function for the Treck stack to call when a packet cannot be forwarded. The callback function parameters will indicate the source IP address and destination IP address of the packet in network byte order. This is useful to let the user know that a packet cannot be forwarded because a dial-up interface is closed for example. In that case the user call back function could trigger a dial-up on demand to allow forwarding of subsequent packets. If the user does not want to enable or configure the interface, then the callback function should return a non-zero error code. In that case the stack will send a host unreachable ICMP error message as if no callback function had been registered. If the user wants to enable or configure the interface, then the callback function should return TM_ENOERROR. In that case the Treck stack will silently drop the packet without sending an ICMP error message, allowing the sender to try and send more data.


Parameters

  • ipForwCBFuncPtr
    Pointer to the user callback function that returns an integer as described above. The callback function takes two parameters of type ttUserIpAddress, the first one being the source IP address in network byte order of the IP datagram to be forwarded and the second one being its destination IP address in network byte order.


Function prototype for the user supplied IP forward callback function:

int ipForwCBFunc(ttUserIpAddress srcIpAddress, ttUserIpAddress destIpAddress);


Returns

  • TM_ENOERROR
    Success


Table of Contents >> Programmer's Reference