Partager via


Using the Address Resolution Protocol (Windows Embedded CE 6.0)

1/6/2010

You can use IP Helper to perform Address Resolution Protocol (ARP) operations for the local computer. Use the following functions to retrieve and modify the ARP table.

The GetIpNetTable retrieves the ARP table. The ARP table contains the mapping of IP addresses to physical addresses. Physical addresses are sometimes referred to as Media Access Controller (MAC) addresses. Changes to this table can be made with SetIpNetEntry.

Use the CreateIpNetEntry and DeleteIpNetEntry functions to add or remove particular ARP entries to or from the table. The FlushIpNetTable function deletes all entries from the table.

To create or delete proxy ARP entries, use the CreateProxyArpEntry and DeleteProxyArpEntry functions.

The SendARP function sends an ARP request to the local network.

The following table describes each GetIpNetTable variable.

Value Description

pIpNetTable

Pointer to a buffer that, on successful return, contains the IP-to-physical address mapping table as a MIB_IPNETTABLE structure.

pdwSize

Specifies the size of the buffer pointed to by the pIpNetTable parameter. If the buffer is not large enough to hold the returned mapping table, the function sets this parameter equal to the required buffer size.

bOrder

Specifies whether the returned mapping table should be sorted in ascending order by IP address. If this parameter is TRUE, the table is sorted.

MIB_IPNETTABLE

dwNumEntries

Specifies the number of ARP entries in the table.

table[ANY_SIZE]

Pointer to a table of ARP entries implemented as an array of MIB_IPNETROW structures.

MIB_IPNETROW

(All fields are read-write, and can be changed by the API user with the SetIpNetEntry function)

dwIndex

Specifies the index of the adapter.

dwPhysAddrLen

Specifies the length of the physical address.

bPhysAddr[MAXLEN_PHYSADDR]

Specifies the physical address.

dwAddr

Specifies the IP address.

dwType

Specifies the type of ARP entry. This type can be one of the following values. 4   Static 3   Dynamic 2   Invalid 1   Other

The following table describes each CreateIpNetEntry variable.

Value Description

pArpEntry

Pointer to a MIB_IPNETROW structure that specifies information for the new entry. The caller must specify values for all members of this structure. (See GetIpNetTable table, above).

The following table describes each DeleteIpNetEntry variable.

Value Description

pArpEntry

Pointer to a MIB_IPNETROW structure. The information in this structure identifies the entry to delete. The caller must specify values for at least the dwIndex and dwAddr members of this structure. (See GetIpNetTable table, above).

The following table describes each FlushIpNetTable variable.

Value Description

dwIfIndex

Specifies the index of the interface for which to delete all ARP entries.

The following table describes each CreateProxyArpEntry variable.

Value Description

dwAddress

Specifies the IP address for which this computer acts as a proxy.

dwMask

Specifies the subnet mask for the IP address specified by the dwAddress parameter.

dwIfIndex

Specifies the index of the interface on which to proxy ARP for the IP address specified by the dwAddress parameter. In other words, when an ARP request for dwAddress is received on this interface, the local computer responds with the physical address of this interface. If this interface is of a type that does not support ARP, such as PPP, then the call fails.

The following table describes each DeleteProxyArpEntry variable.

Value Description

dwAddress

Specifies the IP address for which this computer is acting as a proxy.

dwMask

Specifies the subnet mask for the IP address specified by the dwAddress parameter.

dwInIndex

Specifies the index of the interface on which this computer is supporting proxy ARP for the IP address specified by dwAddress.

The following table describes each SendARP variable.

Value Description

DestIp

Specifies the destination IP address. The ARP request attempts to obtain the physical address that corresponds to this IP address.

SrcIP

Specifies the IP address of the sender. This parameter is optional. The caller may specify zero for the parameter.

pMacAddr

Pointer to a ULONG variable. On successful return, this variable contains the physical address that corresponds to the IP address specified by the DestIP parameter.

PhyAddrLen

Pointer to a ULONG variable. On successful return, this variable contains the length of the physical address pointed to by the pMacAddr parameter.

See Also

Concepts

Internet Protocol Helper APIs