在Windows上有路由信息有C / C ++ API吗? [英] Is there a C/C++ API to the route information on Windows?

查看:514
本文介绍了在Windows上有路由信息有C / C ++ API吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有Windows或cygwin C / C ++ API来收集Windows上的route命令提供的信息吗?我对路由指标特别感兴趣。下面是一个路由输出的例子,IP已被更改以保护无辜。

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


推荐答案

您应该使用 GetIpForwardTable (仅作为路由表管理器API)适用于Windows版本的服务器。

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

这篇关于在Windows上有路由信息有C / C ++ API吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆