diff --git a/Netch/NativeMethods.cs b/Netch/NativeMethods.cs index dace1e94..f43dc2e0 100644 --- a/Netch/NativeMethods.cs +++ b/Netch/NativeMethods.cs @@ -4,9 +4,21 @@ namespace Netch { public static class NativeMethods { + /// + /// 分配 IP 地址 + /// + /// AF_INET / AF_INET6 + /// 目标地址 + /// CIDR + /// 适配器索引 + /// 是否成功 + [DllImport("RouteHelper.bin", CallingConvention = CallingConvention.Cdecl, EntryPoint = "CreateUnicastIP")] + public static extern bool CreateUnicastIP(int inet, string address, int cidr, int index); + /// /// 创建路由规则 /// + /// AF_INET / AF_INET6 /// 目标地址 /// CIDR /// 网关地址 @@ -14,11 +26,12 @@ namespace Netch /// 跃点数 /// 是否成功 [DllImport("RouteHelper.bin", CallingConvention = CallingConvention.Cdecl, EntryPoint = "CreateRoute")] - public static extern bool CreateRoute(string address, int cidr, string gateway, int index, int metric = 0); + public static extern bool CreateRoute(int inet, string address, int cidr, string gateway, int index, int metric = 0); /// /// 删除路由规则 /// + /// AF_INET / AF_INET6 /// 目标地址 /// 掩码地址 /// 网关地址 @@ -26,7 +39,7 @@ namespace Netch /// 跃点数 /// 是否成功 [DllImport("RouteHelper.bin", CallingConvention = CallingConvention.Cdecl, EntryPoint = "DeleteRoute")] - public static extern bool DeleteRoute(string address, int cidr, string gateway, int index, int metric = 0); + public static extern bool DeleteRoute(int inet, string address, int cidr, string gateway, int index, int metric = 0); [DllImport("dnsapi", EntryPoint = "DnsFlushResolverCache")] public static extern uint FlushDNSResolverCache();