Add the specified filtering rule to driver.

NF_STATUS nf_addRuleEx(PNF_RULE_EX pRule, int toHead)


A pointer to NF_RULE_EX structure.
TRUE (1) - add rule to list head, FALSE (0) - add rule to list tail

Return Values

NF_STATUS_SUCCESS on success, or other NF_STATUS error code on fail.


The driver scans the list of rules from the beginning and uses the filtering flag of a first matching rule. The new rules are added to the list head or tail, depending on toHead parameter.
The driver doesn't filter the network activity of the attached process. In effect the rules are not applied to the sockets created by a process that uses driver API.
NF_RULE_EX rules are added to the same list with NF_RULE. NF_RULE is treated as NF_RULE_EX without additional condition. So it is possible to add both types of rules in any order.

This function requires WFP driver.


Driver type WFP
Header nfapi.h
Library nfapi.lib