Share via


Managing IP Addresses

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

IP Helper can assist you in managing IP addresses that are associated with interfaces on the local computer. Use the functions described following for IP address management.

The GetIpAddrTable function retrieves a table that contains the mapping of IP addresses to interfaces. More than one IP address may be associated with the same interface.

Use the AddIPAddress function to add an IP address to a particular interface. To remove IP addresses that were previously added using AddIPAddress, use the DeleteIPAddress function. IP addresses added using the AddIPAddress function will not remain after reboot. Typically a valid interface already has an IP Address assigned to it. This function is used when an application needs to add an IP address or needs to add multiple IP addresses. For example, this function can be used to map IP addresses to devices that do not support IP, but are using Windows Embedded CE as a front end to access the network. When AddIPAddress is called, an ARP packet is sent to ensure that the address is not in use.

The IpReleaseAddress and IpRenewAddress functions require the local computer to be using Dynamic Host Configuration Protocol (DHCP). The IpReleaseAddress function releases an IP address that was previously obtained from DHCP. The IpRenewAddress function renews (or acquires) a DHCP lease on a particular IP address.

The following table describes each GetIpAddrTable variable.

Value Description

pIpAddrTable

Pointer to a buffer that, on successful return, contains the interface–to–IP address mapping table as a MIB_IPADDRTABLE structure.

pdwSize

Specifies the size of the buffer pointed to by the pIpAddrTable 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_IPADDRTABLE

(The table is read-only, but addresses can be added and removed using AddIPAddress and DeleteIPAddress)

dwNumEntries

Specifies the number of IP address entries in the table.

table[ANY_SIZE]

Pointer to a table of IP address entries implemented as an array of MIB_ADDRROW structures.

The following table describes each AddIPAddress variable.

Value Description

Address

Specifies the IP address to add to the adapter.

IpMask

Specifies the subnet mask for the IP address.

IfIndex

Specifies the adapter to which to add the address.

NTEXontext

Pointer to a ULONG variable that, on successful return, points to the Net Table Entry (NTE) context for this IP address. The caller can later use this context in a call to DeleteIPAddress.

NTEInstance

Pointer to a ULONG variable that, on successful return, points to the NTE instance for this IP address.

The following table describes each DeleteIPAddress variable.

Value Description

NTEContext

Specifies the Net Table Entry (NTE) context for the IP address. This context was returned by the previous call to AddIPAddress.

The following table describes each IpReleaseAddress variable and IP_ADAPTER_INDEX_MAP member.

Value Description

AdapterInfo

Pointer to an IP_ADAPTER_INDEX_MAP structure that identifies the adapter associated with the IP address to release.

IP_ADAPTER_INDEX_MAP

Index

Specifies the index of the adapter.

Name[MAX_ADAPTER_NAME]

Pointer to a Unicode string that contains the name of the adapter.

The following table describes each IpRenewAddress variable.

Value Description

AdapterInfo

Pointer to an IP_ADAPTER_INDEX_MAP structure that identifies the adapter associated with the IP address to release. See IpReleaseAddress above for a description of IP_ADAPTER_INDEX_MAP members.

See Also

Concepts

Internet Protocol Helper APIs