VxWorks Reference Manual : Libraries
arpLib - Address Resolution Protocol (ARP) table manipulation library
arpAdd( ) - create or modify an ARP table entry
arpDelete( ) - remove an ARP table entry
arpFlush( ) - flush all entries in the system ARP table
This library provides direct access to the address translation table maintained by the Address Resolution Protocol (ARP). Each entry in the table maps an Internet Protocol (IP) address to a physical hardware address. This library only supports entries which translate between IP and Ethernet addresses. It is linked into the VxWorks image if INCLUDE_ARP is defined at the time the image is built. The underlying ARP protocol which creates and maintains the table is included automatically as part of the IP component.
The arpShow( ) routine (in the netShow library) displays the current contents of the ARP table.
A low level interface to the ARP table is available with the socket-specific SIOCSARP, SIOCDARP and SIOCGARP ioctl functions.
arpLib.h
arpLib, inetLib, routeLib, etherLib, netShow, VxWorks Programmer's Guide: Network
arpAdd( ) - create or modify an ARP table entry
STATUS arpAdd ( char * pHost, /* host name or IP address */ char * pEther, /* Ethernet address */ int flags /* ARP flags */ )
This routine assigns an Ethernet address to an IP address in the ARP table. The pHost parameter specifies the host by name, or by Internet address using standard dotted decimal notation. The pEther parameter provides the Ethernet address as six hexadecimal bytes (between 0 and ff) separated by colons. A new entry is created for the specified host if necessary. Otherwise, the existing entry is changed to use the given Ethernet address.
The flags parameter combines any of the following options:
- ATF_PERM (0x04)
- Create a permanent ARP entry which will not time out.
- ATF_PUBL (0x08)
- Publish this entry. The host will respond to ARP requests even if the pHost parameter does not match a local IP address. This setting provides a limited form of proxy ARP.
- ATF_PROXY (0x10)
- Use a "wildcard" hardware address. The proxy server uses this setting to support multiple proxy networks. The entry always supplies the hardware address of the sending interface.
* Create a permanent ARP table entry for the host named "myHost" with Ethernet address 0:80:f9:1:2:3:
arpAdd ("myHost", "0:80:f9:1:2:3", 0x4);Assuming "myHost" has the Internet address "90.0.0.3", the following call changes the Ethernet address to 0:80:f9:1:2:4. No additional flags are set for that entry.arpAdd ("90.0.0.3", "0:80:f9:1:2:4", 0);
OK, or ERROR if unsuccessful.
S_arpLib_INVALID_ARGUMENT
S_arpLib_INVALID_HOST
S_arpLib_INVALID_ENET_ADDRESS
S_arpLib_INVALID_FLAG
or results of low-level ioctl call.
arpDelete( ) - remove an ARP table entry
STATUS arpDelete ( char * pHost /* host name or IP address */ )
This routine deletes an ARP table entry. The pHost parameter indicates the target entry using the host name or Internet address.
arpDelete ("91.0.0.3") arpDelete ("myHost")
OK, or ERROR if unsuccessful.
S_arpLib_INVALID_ARGUMENT
S_arpLib_INVALID_HOST
arpFlush( ) - flush all entries in the system ARP table
void arpFlush (void)
This routine flushes all non-permanent entries in the ARP cache.
N/A