Skip to content

Commit

Permalink
🚑
Browse files Browse the repository at this point in the history
  • Loading branch information
AmazingDM committed May 7, 2020
1 parent 5276d90 commit b69ed09
Showing 1 changed file with 44 additions and 44 deletions.
88 changes: 44 additions & 44 deletions Netch/3rd/NFSDK2/nfapinet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public class NFAPI
* @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)
Expand Down Expand Up @@ -537,21 +537,21 @@ public static NF_STATUS nf_init(String driverName, NF_EventHandler pHandler)
* 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);


Expand All @@ -564,7 +564,7 @@ public static NF_STATUS nf_init(String driverName, NF_EventHandler pHandler)
* @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);

/**
Expand All @@ -573,7 +573,7 @@ public static NF_STATUS nf_init(String driverName, NF_EventHandler pHandler)
* @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);

/**
Expand All @@ -582,14 +582,14 @@ public static NF_STATUS nf_init(String driverName, NF_EventHandler pHandler)
* @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);

//
Expand All @@ -601,7 +601,7 @@ public static NF_STATUS nf_init(String driverName, NF_EventHandler pHandler)
* @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);

/**
Expand All @@ -611,7 +611,7 @@ public static NF_STATUS nf_init(String driverName, NF_EventHandler pHandler)
* @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,
Expand All @@ -624,7 +624,7 @@ public static extern NF_STATUS nf_udpPostSend(ulong id,
* @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,
Expand All @@ -636,7 +636,7 @@ public static extern NF_STATUS nf_udpPostReceive(ulong id,
* @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);
Expand All @@ -647,7 +647,7 @@ public static extern NF_STATUS nf_ipPostReceive(
* @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);
Expand All @@ -661,7 +661,7 @@ public static extern NF_STATUS nf_ipPostSend(
* @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)
Expand Down Expand Up @@ -694,7 +694,7 @@ public static NF_STATUS nf_addRule(NF_RULE pRule, int toHead)
* @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)
Expand All @@ -712,7 +712,7 @@ public static NF_STATUS nf_addRuleEx(NF_RULE_EX pRule, int toHead)
* @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)
Expand Down Expand Up @@ -744,7 +744,7 @@ public static NF_STATUS nf_setRules(NF_RULE[] rules)
* @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)
Expand Down Expand Up @@ -774,34 +774,34 @@ public static NF_STATUS nf_setRulesEx(NF_RULE_EX[] rules)
/**
* 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);

/**
Expand All @@ -811,37 +811,37 @@ public static NF_STATUS nf_setRulesEx(NF_RULE_EX[] rules)
* @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);

/**
Expand Down Expand Up @@ -880,13 +880,13 @@ public static unsafe String nf_getProcessName(UInt32 processId)
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);

/*
Expand All @@ -910,51 +910,51 @@ public static void nf_setIPEventHandler(NF_IPEventHandler pHandler)
/**
* 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
Expand All @@ -967,10 +967,10 @@ public enum NF_SOCKET_OPTIONS
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)
Expand All @@ -982,7 +982,7 @@ public static NF_STATUS nf_tcpSetSockOpt(ulong id, NF_SOCKET_OPTIONS optname, bo
/**
* 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);

Expand All @@ -999,14 +999,14 @@ public static NF_STATUS
/**
* 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();
};
Expand Down

0 comments on commit b69ed09

Please sign in to comment.