//////////////////////////////////////////////////////////////////////////////
// //
// error codes. these extend the win32 errors by having errors specific to //
// these apis. besides these errors, the apis may return any of the win32 //
// errors. //
// //
//////////////////////////////////////////////////////////////////////////////
#define error_base 23000
#define pferror_no_pf_interface (error_base + 0) // never returned.
#define pferror_no_filters_given (error_base + 1)
#define pferror_buffer_too_small (error_base + 2)
#define error_ipv6_not_implemented (error_base + 3)
//////////////////////////////////////////////////////////////////////////////
// //
// the api prototypes //
// //
//////////////////////////////////////////////////////////////////////////////
pfapientry
pfcreateinterface(
dword dwname,
pfforward_action inaction,
pfforward_action outaction,
bool buselog,
bool bmustbeunique,
interface_handle *ppinterface
);
pfapientry
pfdeleteinterface(
interface_handle pinterface
);
pfapientry
pfaddfilterstointerface(
interface_handle ih,
dword cinfilters,
ppf_filter_descriptor pfiltin,
dword coutfilters,
ppf_filter_descriptor pfiltout,
pfilter_handle pfhandle
);
pfapientry
pfremovefiltersfrominterface(
interface_handle ih,
dword cinfilters,
ppf_filter_descriptor pfiltin,
dword coutfilters,
ppf_filter_descriptor pfiltout
);
pfapientry
pfremovefilterhandles(
interface_handle pinterface,
dword cfilters,
pfilter_handle pvhandles
);
pfapientry
pfunbindinterface(
interface_handle pinterface
);
pfapientry
pfbindinterfacetoindex(
interface_handle pinterface,
dword dwindex,
pfaddresstype pfatlinktype,
pbyte linkipaddress
);
pfapientry
pfbindinterfacetoipaddress(
interface_handle pinterface,
pfaddresstype pfattype,
pbyte ipaddress
);
pfapientry
pfrebindfilters(
interface_handle pinterface,
ppf_latebind_info platebindinfo
);
pfapientry
pfaddglobalfiltertointerface(
interface_handle pinterface,
global_filter gffilter
);
pfapientry
pfremoveglobalfilterfrominterface(
interface_handle pinterface,
global_filter gffilter
);
//////////////////////////////////////////////////////////////////////////////
// //
// log apis. note that there is at most one log and it must be created //
// before any interface needing it is created. there is no way to set a //
// log onto an existing interface. the log can be applied to any or all of //
// the interfaces. //
// //
//////////////////////////////////////////////////////////////////////////////
pfapientry
pfmakelog(
handle hevent
);
//
// provide a buffer, and notification parameters, and get back
// the old buffer and status.
//
pfapientry
pfsetlogbuffer(
pbyte pbbuffer,
dword dwsize,
dword dwthreshold,
dword dwentries,
pdword pdwloggedentries,
pdword pdwlostentries,
pdword pdwsizeused
);
//
// doing this will disable the log on any of the interfaces. but if
// an interface was created with the log, the actual log will not be
// completely deleted until that interface is deleted. this is a small
// point, but it might explain a mystery or two.
//
pfapientry
pfdeletelog(
void
);
//////////////////////////////////////////////////////////////////////////////
// //
// get statistics. note pdwbuffersize in an in/out parameter. if //
// error_insufficient_buffer is returned, the common statistics are //
// available and the correct byte count is in *pdwbuffersize. if only the //
// interface statistics are needed, provide a buffer of size //
// pf_interface_stats only. //
// if the filter descriptions are also needed, then supply a large buffer, //
// or use the returned count from the first call to allocate a buffer of //
// sufficient size. note that for a shared interface, this second call may //
// fail with error_insufficient_buffer. this can happen if the other //
// sharers add filters in the interim. this should not happen for a unique //
// interface. //
// //
//////////////////////////////////////////////////////////////////////////////
pfapientry
pfgetinterfacestatistics(
interface_handle pinterface,
ppf_interface_stats ppfstats,
pdword pdwbuffersize,
bool fresetcounters
);
//////////////////////////////////////////////////////////////////////////////
// //
// test a packet. //
// this call will evaluate the packet against the given interfaces //
// and return the filtering action. //
// //
//////////////////////////////////////////////////////////////////////////////
pfapientry
pftestpacket(
interface_handle pininterface optional,
interface_handle poutinterface optional,
dword cbytes,
pbyte pbpacket,
ppfforward_action ppaction
);
#endif