mirror of
https://github.com/netchx/netch.git
synced 2026-03-20 18:19:44 +08:00
🚑
This commit is contained in:
@@ -499,7 +499,7 @@ namespace nfapinet
|
||||
* @param driverName The name of hooking driver, without ".sys" extension.
|
||||
* @param pHandler Pointer to event handling object
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_init(String driverName, IntPtr pHandler);
|
||||
|
||||
public static NF_STATUS nf_init(String driverName, NF_EventHandler pHandler)
|
||||
@@ -537,21 +537,21 @@ namespace nfapinet
|
||||
* Stops the filtering thread, breaks all filtered connections and closes
|
||||
* a connection with the hooking driver.
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void nf_free();
|
||||
|
||||
/**
|
||||
* Registers and starts a driver with specified name (without ".sys" extension)
|
||||
* @param driverName
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_registerDriver(String driverName);
|
||||
|
||||
/**
|
||||
* Unregisters a driver with specified name (without ".sys" extension)
|
||||
* @param driverName
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_unRegisterDriver(String driverName);
|
||||
|
||||
|
||||
@@ -564,7 +564,7 @@ namespace nfapinet
|
||||
* @param id Connection identifier
|
||||
* @param suspended true for suspend, false for resume
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_tcpSetConnectionState(ulong id, int suspended);
|
||||
|
||||
/**
|
||||
@@ -573,7 +573,7 @@ namespace nfapinet
|
||||
* @param buf Pointer to data buffer
|
||||
* @param len Buffer length
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_tcpPostSend(ulong id, IntPtr buf, int len);
|
||||
|
||||
/**
|
||||
@@ -582,14 +582,14 @@ namespace nfapinet
|
||||
* @param buf Pointer to data buffer
|
||||
* @param len Buffer length
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_tcpPostReceive(ulong id, IntPtr buf, int len);
|
||||
|
||||
/**
|
||||
* Breaks the connection with given id.
|
||||
* @param id Connection identifier
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_tcpClose(ulong id);
|
||||
|
||||
//
|
||||
@@ -601,7 +601,7 @@ namespace nfapinet
|
||||
* @param id Socket identifier
|
||||
* @param suspended true for suspend, false for resume
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_udpSetConnectionState(ulong id, int suspended);
|
||||
|
||||
/**
|
||||
@@ -611,7 +611,7 @@ namespace nfapinet
|
||||
* @param buf Pointer to data buffer
|
||||
* @param len Buffer length
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_udpPostSend(ulong id,
|
||||
IntPtr remoteAddress,
|
||||
IntPtr buf, int len,
|
||||
@@ -624,7 +624,7 @@ namespace nfapinet
|
||||
* @param buf Pointer to data buffer
|
||||
* @param len Buffer length
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_udpPostReceive(ulong id,
|
||||
IntPtr remoteAddress,
|
||||
IntPtr buf, int len,
|
||||
@@ -636,7 +636,7 @@ namespace nfapinet
|
||||
* @param len Buffer length
|
||||
* @param options IP options
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_ipPostReceive(
|
||||
IntPtr buf, int len,
|
||||
ref NF_IP_PACKET_OPTIONS options);
|
||||
@@ -647,7 +647,7 @@ namespace nfapinet
|
||||
* @param len Buffer length
|
||||
* @param options IP options
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_ipPostSend(
|
||||
IntPtr buf, int len,
|
||||
ref NF_IP_PACKET_OPTIONS options);
|
||||
@@ -661,7 +661,7 @@ namespace nfapinet
|
||||
* @param pRule See <tt>NF_RULE</tt>
|
||||
* @param toHead TRUE (1) - add rule to list head, FALSE (0) - add rule to tail
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern NF_STATUS nf_addRule(ref NF_RULE pRule, int toHead);
|
||||
|
||||
private static void updateAddressLength(ref byte[] buf)
|
||||
@@ -694,7 +694,7 @@ namespace nfapinet
|
||||
* @param pRule See <tt>NF_RULE</tt>
|
||||
* @param toHead TRUE (1) - add rule to list head, FALSE (0) - add rule to tail
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern NF_STATUS nf_addRuleEx(ref NF_RULE_EX pRule, int toHead);
|
||||
|
||||
public static NF_STATUS nf_addRuleEx(NF_RULE_EX pRule, int toHead)
|
||||
@@ -712,7 +712,7 @@ namespace nfapinet
|
||||
* @param pRules Array of <tt>NF_RULE</tt> structures
|
||||
* @param count Number of items in array
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern NF_STATUS nf_setRules(IntPtr pRules, int count);
|
||||
|
||||
public static NF_STATUS nf_setRules(NF_RULE[] rules)
|
||||
@@ -744,7 +744,7 @@ namespace nfapinet
|
||||
* @param pRules Array of <tt>NF_RULE</tt> structures
|
||||
* @param count Number of items in array
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern NF_STATUS nf_setRulesEx(IntPtr pRules, int count);
|
||||
|
||||
public static NF_STATUS nf_setRulesEx(NF_RULE_EX[] rules)
|
||||
@@ -774,34 +774,34 @@ namespace nfapinet
|
||||
/**
|
||||
* Removes all rules from driver.
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_deleteRules();
|
||||
|
||||
/**
|
||||
* Sets the timeout for TCP connections and returns old timeout.
|
||||
* @param timeout Timeout value in milliseconds. Specify zero value to disable timeouts.
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern UInt32 nf_setTCPTimeout(UInt32 timeout);
|
||||
|
||||
/**
|
||||
* Disables indicating TCP packets to user mode for the specified endpoint
|
||||
* @param id Socket identifier
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_tcpDisableFiltering(ulong id);
|
||||
|
||||
/**
|
||||
* Disables indicating UDP packets to user mode for the specified endpoint
|
||||
* @param id Socket identifier
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_udpDisableFiltering(ulong id);
|
||||
|
||||
/**
|
||||
* Returns TRUE if the specified process acts as a local proxy, accepting the redirected TCP connections.
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool nf_tcpIsProxy(uint processId);
|
||||
|
||||
/**
|
||||
@@ -811,37 +811,37 @@ namespace nfapinet
|
||||
* @param nThreads Number of worker threads for NF_EventHandler events
|
||||
* @param flags A combination of flags from <tt>NF_FLAGS</tt>
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void nf_setOptions(uint nThreads, uint flags);
|
||||
|
||||
/**
|
||||
* Complete TCP connect request pended using flag NF_PEND_CONNECT_REQUEST.
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_completeTCPConnectRequest(ulong id, ref NF_TCP_CONN_INFO pConnInfo);
|
||||
|
||||
/**
|
||||
* Complete UDP connect request pended using flag NF_PEND_CONNECT_REQUEST.
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_completeUDPConnectRequest(ulong id, ref NF_UDP_CONN_REQUEST pConnInfo);
|
||||
|
||||
/**
|
||||
* Returns in pConnInfo the properties of TCP connection with specified id.
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_getTCPConnInfo(ulong id, ref NF_TCP_CONN_INFO pConnInfo);
|
||||
|
||||
/**
|
||||
* Returns in pConnInfo the properties of UDP socket with specified id.
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_getUDPConnInfo(ulong id, ref NF_UDP_CONN_INFO pConnInfo);
|
||||
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool nf_getProcessNameW(uint processId, IntPtr buf, int len);
|
||||
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool nf_getProcessNameFromKernel(uint processId, IntPtr buf, int len);
|
||||
|
||||
/**
|
||||
@@ -880,13 +880,13 @@ namespace nfapinet
|
||||
return "System";
|
||||
}
|
||||
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void nf_adjustProcessPriviledges();
|
||||
|
||||
/*
|
||||
* Set the event handler for IP filtering events
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern void nf_setIPEventHandler(IntPtr pHandler);
|
||||
|
||||
/*
|
||||
@@ -910,51 +910,51 @@ namespace nfapinet
|
||||
/**
|
||||
* Add flow control context
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_addFlowCtl(ref NF_FLOWCTL_DATA pData, ref UInt32 pFcHandle);
|
||||
|
||||
/**
|
||||
* Delete flow control context
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_deleteFlowCtl(UInt32 fcHandle);
|
||||
|
||||
/**
|
||||
* Associate flow control context with TCP connection
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_setTCPFlowCtl(ulong id, UInt32 fcHandle);
|
||||
|
||||
/**
|
||||
* Associate flow control context with UDP socket
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_setUDPFlowCtl(ulong id, UInt32 fcHandle);
|
||||
|
||||
/**
|
||||
* Modify flow control context limits
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_modifyFlowCtl(UInt32 fcHandle, ref NF_FLOWCTL_DATA pData);
|
||||
|
||||
/**
|
||||
* Get flow control context statistics as the numbers of in/out bytes
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_getFlowCtlStat(UInt32 fcHandle, ref NF_FLOWCTL_STAT pStat);
|
||||
|
||||
/**
|
||||
* Get TCP connection statistics as the numbers of in/out bytes.
|
||||
* The function can be called only from tcpClosed handler!
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_getTCPStat(ulong id, ref NF_FLOWCTL_STAT pStat);
|
||||
|
||||
/**
|
||||
* Get UDP socket statistics as the numbers of in/out bytes.
|
||||
* The function can be called only from udpClosed handler!
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_getUDPStat(ulong id, ref NF_FLOWCTL_STAT pStat);
|
||||
|
||||
public enum NF_SOCKET_OPTIONS
|
||||
@@ -967,10 +967,10 @@ namespace nfapinet
|
||||
TCP_SOCKET_WINDOW = 6
|
||||
}
|
||||
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_tcpSetSockOpt(ulong id, NF_SOCKET_OPTIONS optname, ref int optval, int optlen);
|
||||
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_tcpSetSockOpt(ulong id, NF_SOCKET_OPTIONS optname, IntPtr optval, int optlen);
|
||||
|
||||
public static NF_STATUS nf_tcpSetSockOpt(ulong id, NF_SOCKET_OPTIONS optname, bool optval)
|
||||
@@ -982,7 +982,7 @@ namespace nfapinet
|
||||
/**
|
||||
* Add binding rule to driver
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern NF_STATUS
|
||||
nf_addBindingRule(ref NF_BINDING_RULE pRule, int toHead);
|
||||
|
||||
@@ -999,14 +999,14 @@ namespace nfapinet
|
||||
/**
|
||||
* Delete all binding rules from driver
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS
|
||||
nf_deleteBindingRules();
|
||||
|
||||
/**
|
||||
* Returns the type of attached driver (DT_WFP, DT_TDI or DT_UNKNOWN)
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern UInt32
|
||||
nf_getDriverType();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user