MIB_IPFORWARD_ROW2 structure (netioapi.h)

The MIB_IPFORWARD_ROW2 structure stores information about an IP route entry.

Syntax

typedef struct _MIB_IPFORWARD_ROW2 {
  NET_LUID          InterfaceLuid;
  NET_IFINDEX       InterfaceIndex;
  IP_ADDRESS_PREFIX DestinationPrefix;
  SOCKADDR_INET     NextHop;
  UCHAR             SitePrefixLength;
  ULONG             ValidLifetime;
  ULONG             PreferredLifetime;
  ULONG             Metric;
  NL_ROUTE_PROTOCOL Protocol;
  BOOLEAN           Loopback;
  BOOLEAN           AutoconfigureAddress;
  BOOLEAN           Publish;
  BOOLEAN           Immortal;
  ULONG             Age;
  NL_ROUTE_ORIGIN   Origin;
} MIB_IPFORWARD_ROW2, *PMIB_IPFORWARD_ROW2;

Members

InterfaceLuid

Type: NET_LUID

The locally unique identifier (LUID) for the network interface associated with this IP route entry.

InterfaceIndex

Type: NET_IFINDEX

The local index value for the network interface associated with this IP route entry. This index value may change when a network adapter is disabled and then enabled, or under other circumstances, and should not be considered persistent.

DestinationPrefix

Type: IP_ADDRESS_PREFIX

The IP address prefix for the destination IP address for this route.

NextHop

Type: SOCKADDR_INET

For a remote route, the IP address of the next system or gateway en route. If the route is to a local loopback address or an IP address on the local link, the next hop is unspecified (all zeros). For a local loopback route, this member should be an IPv4 address of 0.0.0.0 for an IPv4 route entry or an IPv6 address of 0::0 for an IPv6 route entry.

SitePrefixLength

Type: UCHAR

The length, in bits, of the site prefix or network part of the IP address for this route. For an IPv4 route entry, any value greater than 32 is an illegal value. For an IPv6 route entry, any value greater than 128 is an illegal value. A value of 255 is commonly used to represent an illegal value.

ValidLifetime

Type: ULONG

The maximum time, in seconds, that the IP route entry is valid. A value of 0xffffffff is considered to be infinite.

PreferredLifetime

Type: ULONG

The preferred time, in seconds, that the IP route entry is valid. A value of 0xffffffff is considered to be infinite.

Metric

Type: ULONG

The route metric offset value for this IP route entry. Note the actual route metric used to compute the route preference is the summation of interface metric specified in the Metric member of the MIB_IPINTERFACE_ROW structure and the route metric offset specified in this member. The semantics of this metric are determined by the routing protocol specified in the Protocol member. If this metric is not used, its value should be set to -1. This value is documented in RFC 4292. For more information, see http://www.ietf.org/rfc/rfc4292.txt.

Protocol

Type: NL_ROUTE_PROTOCOL

The routing mechanism how this IP route was added. This member can be one of the values from the NL_ROUTE_PROTOCOL enumeration type defined in the Nldef.h header file. The member is described in RFC 4292. For more information, see http://www.ietf.org/rfc/rfc4292.txt.

Note that the Nldef.h header is automatically included by the Ipmib.h header file which is automatically included by the Iprtrmib.h header. The Iphlpapi.h header automatically includes the Iprtrmib.h header file. The Iprtrmib.h, Ipmib.h, and Nldef.h header files should never be used directly.

The following list shows the possible values for this member.

Value Meaning
MIB_IPPROTO_OTHER
1
The routing mechanism was not specified.
MIB_IPPROTO_LOCAL
2
A local interface.
MIB_IPPROTO_NETMGMT
3
A static route. This value is used to identify route information for IP routing set through network management such as the Dynamic Host Configuration Protocol (DCHP), the Simple Network Management Protocol (SNMP), or by calls to the CreateIpForwardEntry2, DeleteIpForwardEntry2, or SetIpForwardEntry2 functions.
MIB_IPPROTO_ICMP
4
The result of an ICMP redirect.
MIB_IPPROTO_EGP
5
The Exterior Gateway Protocol (EGP), a dynamic routing protocol.
MIB_IPPROTO_GGP
6
The Gateway-to-Gateway Protocol (GGP), a dynamic routing protocol.
MIB_IPPROTO_HELLO
7
The Hellospeak protocol, a dynamic routing protocol. This is a historical entry no longer in use and was an early routing protocol used by the original ARPANET routers that ran special software called the Fuzzball routing protocol, sometimes called Hellospeak, as described in RFC 891 and RFC 1305. For more information, see http://www.ietf.org/rfc/rfc891.txt and http://www.ietf.org/rfc/rfc1305.txt.
MIB_IPPROTO_RIP
8
The Berkeley Routing Information Protocol (RIP) or RIP-II, a dynamic routing protocol.
MIB_IPPROTO_IS_IS
9
The Intermediate System-to-Intermediate System (IS-IS) protocol, a dynamic routing protocol. The IS-IS protocol was developed for use in the Open Systems Interconnection (OSI) protocol suite.
MIB_IPPROTO_ES_IS
10
The End System-to-Intermediate System (ES-IS) protocol, a dynamic routing protocol. The ES-IS protocol was developed for use in the Open Systems Interconnection (OSI) protocol suite.
MIB_IPPROTO_CISCO
11
The Cisco Interior Gateway Routing Protocol (IGRP), a dynamic routing protocol.
MIB_IPPROTO_BBN
12
The Bolt, Beranek, and Newman (BBN) Interior Gateway Protocol (IGP) that used the Shortest Path First (SPF) algorithm. This was an early dynamic routing protocol.
MIB_IPPROTO_OSPF
13
The Open Shortest Path First (OSPF) protocol, a dynamic routing protocol.
MIB_IPPROTO_BGP
14
The Border Gateway Protocol (BGP), a dynamic routing protocol.
MIB_IPPROTO_NT_AUTOSTATIC
10002
A Windows specific entry added originally by a routing protocol, but which is now static.
MIB_IPPROTO_NT_STATIC
10006
A Windows specific entry added as a static route from the routing user interface or a routing command.
MIB_IPPROTO_NT_STATIC_NON_DOD
10007
A Windows specific entry added as a static route from the routing user interface or a routing command, except these routes do not cause Dial On Demand (DOD).

Loopback

Type: BOOLEAN

A value that specifies if the route is a loopback route (the gateway is on the local host).

AutoconfigureAddress

Type: BOOLEAN

A value that specifies if the IP address is autoconfigured.

Publish

Type: BOOLEAN

A value that specifies if the route is published.

Immortal

Type: BOOLEAN

A value that specifies if the route is immortal.

Age

Type: ULONG

The number of seconds since the route was added or modified in the network routing table.

Origin

Type: NL_ROUTE_ORIGIN

The origin of the route. This member can be one of the values from the NL_ROUTE_ORIGIN enumeration type defined in the Nldef.h header file.

Value Meaning
NlroManual
0
A result of manual configuration.
NlroWellKnown
1
A well-known route.
NlroDHCP
2
A result of DHCP configuration.
NlroRouterAdvertisement
3
The result of router advertisement.
Nlro6to4
4
A result of 6to4 tunneling.

Remarks

The MIB_IPFORWARD_ROW2 structure is defined on Windows Vista and later.

The GetIpForwardTable2 function enumerates the IP route entries on a local system and returns this information in a MIB_IPFORWARD_TABLE2 structure as an array of MIB_IPFORWARD_ROW2 entries.

The GetIpForwardEntry2 function retrieves a single IP route entry and returns this information in a MIB_IPFORWARD_ROW2 structure.

An entry with the Prefix and the PrefixLength members of the IP_ADDRESS_PREFIX set to zero in the DestinationPrefix member in the MIB_IPFORWARD_ROW2 structure is considered a default route. The MIB_IPFORWARD_TABLE2 may contain multiple MIB_IPFORWARD_ROW2 entries with the Prefix and the PrefixLength members of the IP_ADDRESS_PREFIX set to zero in the DestinationPrefix member when there are multiple network adapters installed.

The Metric member of a MIB_IPFORWARD_ROW2 entry is a value that is assigned to an IP route for a particular network interface that identifies the cost that is associated with using that route. For example, the metric can be valued in terms of link speed, hop count, or time delay. Automatic metric is a feature on Windows XP and later that automatically configures the metric for the local routes that are based on link speed. The automatic metric feature is enabled by default (the UseAutomaticMetric member of the MIB_IPINTERFACE_ROW structure is set to TRUE) on Windows XP and later. It can also be manually configured to assign a specific metric to an IP route.

The route metric specified in the Metric member of the MIB_IPFORWARD_ROW2 structure represents just the route metric offset. The complete metric is a combination of this route metric offset added to the interface metric specified in the Metric member of the MIB_IPINTERFACE_ROW structure of the associated interface. An application can retrieve the interface metric by calling the GetIpInterfaceEntry function.

Note that the Netioapi.h header file is automatically included in the Iphlpapi.h header file. The Netioapi.h header file should never be used directly.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Header netioapi.h (include Iphlpapi.h)

See also

CreateIpForwardEntry2

DeleteIpForwardEntry2

GetIpForwardEntry2

GetIpForwardTable2

GetIpInterfaceEntry

IP_ADDRESS_PREFIX

MIB_IPFORWARD_TABLE2

MIB_IPINTERFACE_ROW

SOCKADDR_INET

SetIpForwardEntry2