Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Macros

#define NPF_IFACE_MATCH(_name, _iface)
 Statically define an "interface match" packet filter condition.
#define NPF_IFACE_UNMATCH(_name, _iface)
 Statically define an "interface unmatch" packet filter condition.
#define NPF_ORIG_IFACE_MATCH(_name, _iface)
 Statically define an "orig interface match" packet filter condition.
#define NPF_ORIG_IFACE_UNMATCH(_name, _iface)
 Statically define an "orig interface unmatch" packet filter condition.
#define NPF_SIZE_MIN(_name, _size)
 Statically define a "data minimum size" packet filter condition.
#define NPF_SIZE_MAX(_name, _size)
 Statically define a "data maximum size" packet filter condition.
#define NPF_SIZE_BOUNDS(_name, _min_size, _max_size)
 Statically define a "data bounded size" packet filter condition.
#define NPF_LOCAL_IN_MATCH(_name, _handler, _user_data)
 Statically define a "local_in match" packet filter condition.

Typedefs

typedef bool npf_local_in_fn_t(struct net_pkt *pkt, void *user_data)
 Function that is called to get the verdict what should happen to the network packet.

Detailed Description

Since
3.0
Version
0.8.0

Macro Definition Documentation

◆ NPF_IFACE_MATCH

#define NPF_IFACE_MATCH ( _name,
_iface )

#include <zephyr/net/net_pkt_filter.h>

Value:
struct npf_test_iface _name = { \
.iface = (_iface), \
.test.fn = npf_iface_match, \
IF_ENABLED(NPF_TEST_ENABLE_NAME, \
(.test.name = "iface", \
.test.type = NPF_TEST_TYPE_IFACE_MATCH,)) \
}
#define IF_ENABLED(_flag, _code)
Insert code if _flag is defined and equals 1.
Definition util_macro.h:290

Statically define an "interface match" packet filter condition.

Parameters
_nameName of the condition
_ifaceInterface to match

◆ NPF_IFACE_UNMATCH

#define NPF_IFACE_UNMATCH ( _name,
_iface )

#include <zephyr/net/net_pkt_filter.h>

Value:
struct npf_test_iface _name = { \
.iface = (_iface), \
.test.fn = npf_iface_unmatch, \
IF_ENABLED(NPF_TEST_ENABLE_NAME, \
(.test.name = "!iface", \
.test.type = NPF_TEST_TYPE_IFACE_UNMATCH,)) \
}

Statically define an "interface unmatch" packet filter condition.

Parameters
_nameName of the condition
_ifaceInterface to exclude

◆ NPF_LOCAL_IN_MATCH

#define NPF_LOCAL_IN_MATCH ( _name,
_handler,
_user_data )

#include <zephyr/net/net_pkt_filter.h>

Value:
struct npf_test_local_in _name = { \
.test.fn = npf_local_in_match, \
.fn = (_handler), \
.user_data = (_user_data), \
IF_ENABLED(NPF_TEST_ENABLE_NAME, \
(.test.name = "local_in", \
.test.type = NPF_TEST_TYPE_LOCAL_IN_MATCH,)) \
}

Statically define a "local_in match" packet filter condition.

This condition is only available if CONFIG_NET_PKT_FILTER_LOCAL_IN_HOOK is enabled.

Parameters
_nameName of the condition
_handlerFunction to call for the local_in hook
_user_dataOptional user data pointer passed to the handler

◆ NPF_ORIG_IFACE_MATCH

#define NPF_ORIG_IFACE_MATCH ( _name,
_iface )

#include <zephyr/net/net_pkt_filter.h>

Value:
struct npf_test_iface _name = { \
.iface = (_iface), \
.test.fn = npf_orig_iface_match, \
IF_ENABLED(NPF_TEST_ENABLE_NAME, \
(.test.name = "orig iface", \
.test.type = NPF_TEST_TYPE_ORIG_IFACE_MATCH,)) \
}

Statically define an "orig interface match" packet filter condition.

Parameters
_nameName of the condition
_ifaceInterface to match

◆ NPF_ORIG_IFACE_UNMATCH

#define NPF_ORIG_IFACE_UNMATCH ( _name,
_iface )

#include <zephyr/net/net_pkt_filter.h>

Value:
struct npf_test_iface _name = { \
.iface = (_iface), \
.test.fn = npf_orig_iface_unmatch, \
IF_ENABLED(NPF_TEST_ENABLE_NAME, \
(.test.name = "!orig iface", \
.test.type = NPF_TEST_TYPE_ORIG_IFACE_UNMATCH,)) \
}

Statically define an "orig interface unmatch" packet filter condition.

Parameters
_nameName of the condition
_ifaceInterface to exclude

◆ NPF_SIZE_BOUNDS

#define NPF_SIZE_BOUNDS ( _name,
_min_size,
_max_size )

#include <zephyr/net/net_pkt_filter.h>

Value:
struct npf_test_size_bounds _name = { \
.min = (_min_size), \
.max = (_max_size), \
.test.fn = npf_size_inbounds, \
IF_ENABLED(NPF_TEST_ENABLE_NAME, \
(.test.name = "size bounds", \
.test.type = NPF_TEST_TYPE_SIZE_BOUNDS,)) \
}
#define max(a, b)
Return larger value of two provided expressions.
Definition minmax.h:65

Statically define a "data bounded size" packet filter condition.

Parameters
_nameName of the condition
_min_sizeLower bound of the packet's data size
_max_sizeHigher bound of the packet's data size

◆ NPF_SIZE_MAX

#define NPF_SIZE_MAX ( _name,
_size )

#include <zephyr/net/net_pkt_filter.h>

Value:
struct npf_test_size_bounds _name = { \
.min = 0, \
.max = (_size), \
.test.fn = npf_size_inbounds, \
IF_ENABLED(NPF_TEST_ENABLE_NAME, \
(.test.name = "size max", \
.test.type = NPF_TEST_TYPE_SIZE_MAX,)) \
}

Statically define a "data maximum size" packet filter condition.

Parameters
_nameName of the condition
_sizeHigher bound of the packet's data size

◆ NPF_SIZE_MIN

#define NPF_SIZE_MIN ( _name,
_size )

#include <zephyr/net/net_pkt_filter.h>

Value:
struct npf_test_size_bounds _name = { \
.min = (_size), \
.max = SIZE_MAX, \
.test.fn = npf_size_inbounds, \
IF_ENABLED(NPF_TEST_ENABLE_NAME, \
(.test.name = "size min", \
.test.type = NPF_TEST_TYPE_SIZE_MIN,)) \
}
#define SIZE_MAX
Definition stdint.h:70

Statically define a "data minimum size" packet filter condition.

Parameters
_nameName of the condition
_sizeLower bound of the packet's data size

Typedef Documentation

◆ npf_local_in_fn_t

typedef bool npf_local_in_fn_t(struct net_pkt *pkt, void *user_data)

#include <zephyr/net/net_pkt_filter.h>

Function that is called to get the verdict what should happen to the network packet.

Parameters
pktPointer to the network packet to be evaluated
user_dataA valid pointer to user data or NULL
Returns
True if the packet matches, false otherwise