VxWorks API Reference : OS Libraries
rdiscLib - ICMP router discovery server library
rdiscLibInit( ) - Initialize router discovery
rdiscInit( ) - initialize the ICMP router discovery function
sendAdvert( ) - send an advertisement to one location
sendAdvertAll( ) - send an advertisement to all active locations
rdiscTimerEvent( ) - called after watchdog timeout
rdisc( ) - implement the ICMP router discovery function
rdCtl( ) - implement the ICMP router discovery control function
rdiscIfReset( ) - check for new or removed interfaces for router discovery
rdiscLib contains code to implement ICMP Router Discovery. This feature allows routers to advertise an address to the hosts on each of the routers interfaces. This address is placed by the host into its route table as a default router. A host may also solicit the address by multicasting the request to the ALL_ROUTERS address (224.0.0.2), to which a router would respond with a unicast version of the advertisement.
There are three routines in this implementation of router discovery: rdiscInit( ), rdisc( ) and rdCtl( ). rdiscInit( ) is the initialization routine, rdisc( ) handles the periodic transmission of advertisements and processing of solicitations, and rdCtl( ) sets/gets user parameters.
rdiscLibInit( ) - Initialize router discovery
void rdiscLibInit ( int priority, /* Priority of router discovery task. */ int options, /* Options to taskSpawn(1) for router */ /* discovery task. */ int stackSize /* Stack size for router discovery task. */ )
This routine links the ICMP Router Discovery facility into the VxWorks system. The arguments are the task's priority, options and stackSize.
N/A
rdiscInit( ) - initialize the ICMP router discovery function
STATUS rdiscInit ()
This routine allocates resources for the router discovery function. Since it called in the rdisc( ) routine, it should not be called subsequently
OK on successful initialization, ERROR otherwise
sendAdvert( ) - send an advertisement to one location
void sendAdvert ( int index, struct in_addr dstAddr )
This routine sends a router advertisement using the data stored for its' corresponding interface. Only the primary network address of the interface is used as the advertised router address.
N/A
sendAdvertAll( ) - send an advertisement to all active locations
void sendAdvertAll ()
This routine sends a router advertisement using the data stored for each corresponding interface. Only the primary network address of the interface is used as the advertised router address.
N/A
rdiscTimerEvent( ) - called after watchdog timeout
#ifdef VIRTUAL_STACK void rdiscTimerEventRestart ( int stackNum )
This routine is called when a new advertisement is to be sent.
N/A
rdisc( ) - implement the ICMP router discovery function
void rdisc ()
This routine is the entry point for the router discovery function. It allocates and initializes resources, listens for solicitation messages on the ALL_ROUTERS (224.0.0.1) multicast address and processes the messages.
This routine usually runs until explicitly killed by a system operator, but can also be terminated cleanly (see rdCtl( ) routine).
N/A
rdCtl( ) - implement the ICMP router discovery control function
STATUS rdCtl ( char * ifName, int cmd, void* value /* my be an int (set-cmds) or an int* */ /* (get-cmds) */ )
This routine allows a user to get and set router discovery parameters, and control the mode of operation.
The following section discuss the various flags that may be passed to rdCtl( ).
This flag does not require an interface to be specified it is best to specify NULL.This flag is used in conjunction with the following values:
rdCtl (NULL, SET_MODE, MODE_DEBUG_ON);
rdCtl (NULL, SET_MODE, MODE_DEBUG_OFF);
rdCtl (NULL, SET_MODE, MODE_STOP);
Specify the minimum time between advertisements in seconds. The minimum value allowed is 4 seconds, the maximum is 1800.
rdCtl (NULL, SET_MIN_ADVERT_INT, <seconds>);
Specify the maximum time between advertisements in seconds. The minimum value allowed is 4 seconds, the maximum is 1800.
rdCtl (NULL, SET_MAX_ADVERT_INT, <seconds>);
If this flag is 1 then advertisements are sent on this interface. If it is 0 then they are not.
rdCtl (<interface>, SET_FLAG, <0 or 1>);
Set the multicast IP address to which advertisements are sent.
rdCtl (<interface>, SET_ADVERT_ADDRESS, <multicast address>);
Set the lifetime in seconds to be contained in each advertisement.
rdCtl (<interface>, SET_ADVERT_LIFETIME, seconds);
Set the preference level contained in advertisements.
rdCtl (<interface>, SET_ADVERT_PREF, value);
rdCtl (NULL, GET_MIN_ADVERT_INT, &value);
rdCtl (NULL, GET_MAX_ADVERT_INT, &value);
rdCtl (<interface>, GET_FLAG, &value);
rdCtl (<interface>, GET_ADVERT_ADDRESS, &value);
rdCtl (<interface>, GET_ADVERT_LIFETIME, &value);
rdCtl (<interface>, GET_ADVERT_PREF, value);
OK on success, ERROR on failure
rdiscIfReset( ) - check for new or removed interfaces for router discovery
STATUS rdiscIfReset ()
This routine MUST be called any time an interface is added to or removed from the system so that the router discovery code can deal with this case. Failure to do so will cause the sending of packets on missing interfaces to fail as well as no transmission of packets on new interfaces.
OK on success, ERROR on failure