// DLL 导入定义
[DllImport ("D:\\XYDcapSDK2.dll")]
public static extern IntPtr YouMiIp_init ([MarshalAs (UnmanagedType.LPStr)] string driverName, [MarshalAs (UnmanagedType.LPStr)] string bindIp, [MarshalAs (UnmanagedType.LPStr)] string loopbackIpv4, [MarshalAs (UnmanagedType.LPStr)] string loopbackIpv6, bool compatibilityMode);
[DllImport ("D:\\XYDcapSDK2.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
public static extern bool YouMiIp_interceptMode (int interceptMode);
[DllImport ("D:\\XYDcapSDK2.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
public static extern int YouMiIp_addRule (int toHead, int protocol, int pid, int direction, int localPort, int remotePort, int ipFamily, string localIpAddress, string localIpMask, string remoteIpAddress, string remoteIpMask, int filteringFlag, string processName);
[DllImport ("D:\\XYDcapSDK2.dll")]
public static extern bool YouMiIp_addPidProxy (int pid, int proxyMode, [MarshalAs (UnmanagedType.LPStr)] string proxyUrl, int targetFilter, [MarshalAs (UnmanagedType.LPStr)] string targetFilterList, int dnsMode, [MarshalAs (UnmanagedType.LPStr)] string dnsModeList, int speedLimitId);
[DllImport ("D:\\XYDcapSDK2.dll", CharSet = CharSet.Ansi)]
public static extern void YouMiIp_free ();
[DllImport ("D:\\XYDcapSDK2.dll")]
public static extern long YouMiIp_getSendFlow (int pid);
[DllImport ("D:\\XYDcapSDK2.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
public static extern long YouMiIp_getRecvFlow (int pid);
[DllImport ("D:\\XYDcapSDK2.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
public static extern int YouMiIp_getNumConnections (int pid);
public IntPtr Init (string driverName, string bindIp, string loopbackIpv4, string loopbackIpv6, bool compatibilityMode)
{
return YouMiIp_init (driverName, bindIp, loopbackIpv4, loopbackIpv6, compatibilityMode);
}
public bool AddPidProxy (int pid, int proxyMode, string proxyUrl, int targetFilter, string targetFilterList, int dnsMode, string dnsModeList, int speedLimitId)
{
return YouMiIp_addPidProxy (pid, proxyMode, proxyUrl, targetFilter, targetFilterList, dnsMode, dnsModeList, speedLimitId);
}
public void close ()
{
YouMiIp_free ();
}