Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a C/C++ API to the route information on Windows?

Is there a windows or cygwin C/C++ API to collect information provided by the route command on Windows? I'm specifically interested in the route metrics. Here's an example of what route outputs, the IPs have been changed to protect the innocent.

$ route PRINT -4
===========================================================================
Interface List
 11...64 31 50 3b ba 96 ......Broadcom NetXtreme Gigabit Ethernet
 17...00 50 56 c0 00 01 ......VMware Virtual Ethernet Adapter for VMnet1
 18...00 50 56 c0 00 08 ......VMware Virtual Ethernet Adapter for VMnet8
  1...........................Software Loopback Interface 1
 12...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
 10...00 00 00 00 00 00 00 e0 Microsoft Teredo Tunneling Adapter
 13...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2
 14...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter
 15...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      99.10.168.1     99.10.170.11     10
      99.10.168.0    255.255.248.0         On-link      99.10.170.11    266
     99.10.170.11  255.255.255.255         On-link      99.10.170.11    266
    99.10.175.255  255.255.255.255         On-link      99.10.170.11    266
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
like image 719
mfisch Avatar asked Aug 18 '11 16:08

mfisch


People also ask

What is the use of API in route?

The reason for using "api" in the route is to avoid collisions with ASP.NET MVC routing. That way, you can have "/contacts" go to an MVC controller, and "/api/contacts" go to a Web API controller.

What is convention based routing in web API?

Convention-based Routing. In the convention-based routing, Web API uses route templates to determine which controller and action method to execute. At least one route template must be added into route table in order to handle various HTTP requests.

How does web API route HTTP requests to controllers?

by Mike Wasson. This article describes how ASP.NET Web API routes HTTP requests to controllers. Note. If you are familiar with ASP.NET MVC, Web API routing is very similar to MVC routing. The main difference is that Web API uses the HTTP verb, not the URI path, to select the action.

How does the routing table work in web API?

When the Web API framework receives a request, it routes the request to an action. To determine which action to invoke, the framework uses a routing table. The Visual Studio project template for Web API creates a default route:


2 Answers

You should use GetIpForwardTable as the Routing Table Manager API only works for Server editions of Windows.

like image 124
Mikko Korkalo Avatar answered Sep 28 '22 10:09

Mikko Korkalo


You want the Routing Table Manager API.

like image 29
Joe Avatar answered Sep 28 '22 10:09

Joe