Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

IP Helper provides the functionality to manage network routing. Use the following functions to manage the IP routing table, and to obtain other routing information.

You can manipulate specific entries in the IP routing table. Use the CreateIpForwardEntryfunction to add a new routing table entry. Use the DeleteIpForwardEntryfunction to remove an existing entry. The SetIpForwardEntryfunction modifies an existing entry. You can retrieve the contents of the IP routing table by making a call to the GetIpForwardTablefunction.

You can also use the router management capabilities of IP Helper to retrieve information about how datagrams are routed over the network. The GetBestRoutefunction retrieves the best route to a specified destination address. The GetBestInterfacefunction retrieves the index of the interface used by the best route to a specified destination address. Lastly, the GetRTTAndHopCountfunction retrieves the round-trip time (RTT) and number of hops to a specified destination address.

The following table describes each CreateIpForwardEntryvariable and MIB_IPFORWARDROWmember.

Value Description

pRoute

Pointer to a MIB_IPFORWARDROWstructure that specifies the information for the new route. The caller must specify values for all members of this structure. The caller must specify PROTO_IP_NETMGMT for the dwForwardProtomember of MIB_IPFORWARDROW.

MIB_IPFORWARDROW

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

dwForwardDest

Note:
The IP address of the destination host.

dwForwardMask

Note:
The subnet mask of the destination host.

dwForwardPolicy

Note:
Specifies the set of conditions that would cause the selection of a multi-path route. This member is typically in IP TOS format. For more information, see RFC 1354. This is not supported in Windows Embedded CE.

dwForwardNextHop

Note:
Specifies the IP address of the next hop in the route.

dwForwardIfIndex

Note:
Specifies the index of the interface for this route.

dwForwardType

Note:
Specifies the route type as defined in RFC 1354. The following list shows the possible values for this member:
Note:
MIB_IPROUTE_TYPE_INDIRECT: The next hop is not the final destination (remote route).
Note:
MIB_IPROUTE_TYPE_DIRECT: The next hop is the final destination (local route).
Note:
MIB_IPROUTE_TYPE_INVALID: The route is valid.
Note:
MIB_IPROUTE_TYPE_OTHER: Other.
Note:
These values are declared in Iprtrmib.h.

dwForwardProto

Note:
Specifies the protocol that generated the route. Possible protocols are declared in Iprtrmib.h

dwForwardAge

Note:
Specifies the age of the route in seconds.

dwForwardNextHopAS

Note:
Specifies the autonomous system number of the next hop. The autonomous system number is a way to identify an entire network (usually under a single administration), using the same routing protocol. This is not supported in Windows Embedded CE.

dwForwardMetric1

Note:
Specifies a routing-protocol-specific metric value. This metric value is documented in RFC 1354. The first Metric is the only one currently used in Windows Embedded CE.

dwForwardMetric2

Note:
Specifies a routing-protocol-specific metric value. This metric value is documented in RFC 1354. This Metric is unused in Windows Embedded CE, and is set to MIB_IPROUTE_METRIC_UNUSED.

dwForwardMetric3

Note:
Specifies a routing-protocol-specific metric value. This metric value is documented in RFC 1354. This Metric is unused in Windows Embedded CE, and is set to MIB_IPROUTE_METRIC_UNUSED.

dwForwardMetric4

Note:
Specifies a routing-protocol-specific metric value. This metric value is documented in RFC 1354. This Metric is unused in Windows Embedded CE, and is set to MIB_IPROUTE_METRIC_UNUSED.

dwForwardMetric5

Note:
Specifies a routing-protocol-specific metric value. This metric value is documented in RFC 1354. This Metric is unused in Windows Embedded CE, and is set to MIB_IPROUTE_METRIC_UNUSED.
Note:
An example that shows how to set a routing-protocol-specific metric value is included within this document. See the code sample titled Setting ForwardMetric Values.

The following table describes each DeleteIpForwardEntryvariable.

Value Description

pRoute

Pointer to a MIB_FORWARDROWstructure (see the CreateIpForwardEntrydescription above). This structure specifies information that identifies the route to delete. The caller must specify values for the dwForwardIfIndex, dwForwardDest, dwForwardMask, dwForwardNextHop, and dwForwardPolicymembers of the structure.

The following table describes each SetIpForwardEntryvariable.

Value Description

pRoute

Pointer to a MIB_FORWARDROWstructure (see the CreateIpForwardEntrydescription above). This structure specifies information that identifies the route to delete. The caller must specify values for the dwForwardIfIndex, dwForwardDest, dwForwardMask, dwForwardNextHop, and dwForwardPolicymembers of the structure.

The following table describes each GetIpForwardTablevariable.

Value Description

pIpForwardTable

Pointer to a buffer that, on successful return, contains the IP routing table as a MIB_IPFORWARDTABLEstructure.

pdwSize

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

bOrder

Specifies whether the returned table should be sorted. If this parameter is TRUE, the table is sorted in this order:

  1. Destination address

  2. Protocol that generated the route

  3. Multipath routing policy

  4. Next-hop address

MIB_IPFORWARDTABLE

(The table itself is read-only, but the entries can be changed using SetIpForwardEntry)

dwNumEntries

Note:
Specifies the number of route entries in the table.

table[ANY_SIZE]

Note:
Pointer to a table of route entries implemented as an array of MIB_IPFORWARDROWstructures. (See the CreateIpForwardEntrydescription above).

The following table describes each GetBestRoutevariable.

Value Description

dwDestAddr

Specifies the destination IP address for which to obtain the best route.

dwSourceAddr

Specifies a source IP address. This IP address corresponds to an interface on the local computer. If multiple best routes to the destination address exist, the function selects the route that uses this interface.

This parameter is optional. The caller may specify zero for this parameter.

pBestRoute

Pointer to a MIB_IPFORWARDROWstructure (See the CreateIpForwardEntrydescription above). On successful return, this structure contains the best route for the IP address specified by dwDestAddr.

The following table describes each GetBestInterfacevariable.

Value Description

dwDestAddr

Specifies the destination IP address for which to retrieve the interface that has the best route.

pdwBestIfIndex

Pointer to a DWORDvariable. On successful return, this variable contains the index of the interface that has the best route to the address specified by the dwDestAddrparameter.

The following table describes each GetRTTAndHopCountvariable.

Value Description

DestIpAddress

Specifies the IP address of the destination for which to determine the RTT and hop count.

HopCount

Pointer to a ULONGvariable. On successful return, this variable contains the hop count to the destination specified by the DestIpAddressparameter.

MaxHops

Specifies the maximum number of hops to search for the destination. If the number of hops to the destination exceeds this number, the function terminates the search and returns FALSE.

RTT

Round-trip time in milliseconds to the destination specified by DestIpAddress.

See Also