VxWorks API Reference : OS Libraries

rdiscLib

NAME

rdiscLib - ICMP router discovery server library

ROUTINES

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

DESCRIPTION

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.


OS Libraries : Routines

rdiscLibInit( )

NAME

rdiscLibInit( ) - Initialize router discovery

SYNOPSIS

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. */
    )

DESCRIPTION

This routine links the ICMP Router Discovery facility into the VxWorks system. The arguments are the task's priority, options and stackSize.

RETURNS

N/A

SEE ALSO

rdiscLib


OS Libraries : Routines

rdiscInit( )

NAME

rdiscInit( ) - initialize the ICMP router discovery function

SYNOPSIS

STATUS rdiscInit ()

DESCRIPTION

This routine allocates resources for the router discovery function. Since it called in the rdisc( ) routine, it should not be called subsequently

RETURNS

OK on successful initialization, ERROR otherwise

SEE ALSO

rdiscLib


OS Libraries : Routines

sendAdvert( )

NAME

sendAdvert( ) - send an advertisement to one location

SYNOPSIS

void sendAdvert
    (
    int            index,
    struct in_addr dstAddr
    )

DESCRIPTION

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.

RETURNS

N/A

SEE ALSO

rdiscLib


OS Libraries : Routines

sendAdvertAll( )

NAME

sendAdvertAll( ) - send an advertisement to all active locations

SYNOPSIS

void sendAdvertAll ()

DESCRIPTION

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.

RETURNS

N/A

SEE ALSO

rdiscLib


OS Libraries : Routines

rdiscTimerEvent( )

NAME

rdiscTimerEvent( ) - called after watchdog timeout

SYNOPSIS

#ifdef VIRTUAL_STACK void rdiscTimerEventRestart
    (
    int stackNum
    )

DESCRIPTION

This routine is called when a new advertisement is to be sent.

RETURNS

N/A

SEE ALSO

rdiscLib


OS Libraries : Routines

rdisc( )

NAME

rdisc( ) - implement the ICMP router discovery function

SYNOPSIS

void rdisc ()

DESCRIPTION

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).

RETURNS

N/A

SEE ALSO

rdiscLib


OS Libraries : Routines

rdCtl( )

NAME

rdCtl( ) - implement the ICMP router discovery control function

SYNOPSIS

STATUS rdCtl
    (
    char * ifName,
    int    cmd,
    void*  value              /* my be an int (set-cmds) or an int* */
                              /* (get-cmds) */ 
    )

DESCRIPTION

This routine allows a user to get and set router discovery parameters, and control the mode of operation.

OPTIONS

The following section discuss the various flags that may be passed to rdCtl( ).

SET_MODE -- Set debug mode or exit router discovery

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:

MODE_DEBUG_ON -- Turn debugging messages on.

    rdCtl (NULL, SET_MODE, MODE_DEBUG_ON);

MODE_DEBUG_OFF -- Turn debugging messages off.

    rdCtl (NULL, SET_MODE, MODE_DEBUG_OFF);

MODE_STOP -- Exit from router discovery.

    rdCtl (NULL, SET_MODE, MODE_STOP);

SET_MIN_ADVERT_INT -- set minimum advertisement interval in seconds

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>);

SET_MAX_ADVERT_INT -- set maximum advertisement interval in 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>);

SET_FLAG -- Set whether advertisements are sent on an interface.

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_ADVERT_ADDRESS -- Set the IP address to which advertisements are sent.


 Set the multicast IP address to which advertisements are sent.

   rdCtl (<interface>, SET_ADVERT_ADDRESS, <multicast address>);

SET_ADVERT_LIFETIME -- Set the lifetime for advertisements in seconds.

Set the lifetime in seconds to be contained in each advertisement.

   rdCtl (<interface>, SET_ADVERT_LIFETIME, seconds);

SET_ADVERT_PREF -- Set the preference level contained in advertisements.

Set the preference level contained in advertisements.

   rdCtl (<interface>, SET_ADVERT_PREF, value);

GET_MIN_ADVERT_INT -- Get the minimum advertisement interval.

   rdCtl (NULL, GET_MIN_ADVERT_INT, &value);

GET_MAX_ADVERT_INT -- Get the maximum advertisement interval.

   rdCtl (NULL, GET_MAX_ADVERT_INT, &value);

GET_FLAG -- Get the flag on an interface..

   rdCtl (<interface>, GET_FLAG, &value);

GET_ADVERT_ADDRESS -- Get the advertisement address for an interface.

   rdCtl (<interface>, GET_ADVERT_ADDRESS, &value);

GET_ADVERT_LIFETIME -- Get the advertisement lifetime.

   rdCtl (<interface>, GET_ADVERT_LIFETIME, &value);

GET_ADVERT_PREF -- Get the advertisement preference.

   rdCtl (<interface>, GET_ADVERT_PREF, value);

RETURNS

OK on success, ERROR on failure

SEE ALSO

rdiscLib


OS Libraries : Routines

rdiscIfReset( )

NAME

rdiscIfReset( ) - check for new or removed interfaces for router discovery

SYNOPSIS

STATUS rdiscIfReset ()

DESCRIPTION

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.

RETURNS

OK on success, ERROR on failure

SEE ALSO

rdiscLib