libnetfilter_conntrack
1.0.6
|
Functions | |
struct nf_expect * | nfexp_new (void) |
void | nfexp_destroy (struct nf_expect *exp) |
size_t | nfexp_sizeof (const struct nf_expect *exp) |
size_t | nfexp_maxsize (void) |
struct nf_expect * | nfexp_clone (const struct nf_expect *exp) |
int | nfexp_cmp (const struct nf_expect *exp1, const struct nf_expect *exp2, unsigned int flags) |
void | nfexp_set_attr (struct nf_expect *exp, const enum nf_expect_attr type, const void *value) |
void | nfexp_set_attr_u8 (struct nf_expect *exp, const enum nf_expect_attr type, uint8_t value) |
void | nfexp_set_attr_u16 (struct nf_expect *exp, const enum nf_expect_attr type, uint16_t value) |
void | nfexp_set_attr_u32 (struct nf_expect *exp, const enum nf_expect_attr type, uint32_t value) |
const void * | nfexp_get_attr (const struct nf_expect *exp, const enum nf_expect_attr type) |
uint8_t | nfexp_get_attr_u8 (const struct nf_expect *exp, const enum nf_expect_attr type) |
uint16_t | nfexp_get_attr_u16 (const struct nf_expect *exp, const enum nf_expect_attr type) |
uint32_t | nfexp_get_attr_u32 (const struct nf_expect *exp, const enum nf_expect_attr type) |
int | nfexp_attr_is_set (const struct nf_expect *exp, const enum nf_expect_attr type) |
int | nfexp_attr_unset (struct nf_expect *exp, const enum nf_expect_attr type) |
int | nfexp_snprintf (char *buf, unsigned int size, const struct nf_expect *exp, unsigned int msg_type, unsigned int out_type, unsigned int flags) |
int nfexp_attr_is_set | ( | const struct nf_expect * | exp, |
const enum nf_expect_attr | type | ||
) |
nfexp_attr_is_set - check if a certain attribute is set
exp | pointer to a valid expectation object |
type | attribute type |
On error, -1 is returned and errno is set appropiately, otherwise the value of the attribute is returned.
Definition at line 445 of file expect/api.c.
int nfexp_attr_unset | ( | struct nf_expect * | exp, |
const enum nf_expect_attr | type | ||
) |
nfexp_attr_unset - unset a certain attribute
type | attribute type |
exp | pointer to a valid expectation object |
On error, -1 is returned and errno is set appropiately, otherwise 0 is returned.
Definition at line 465 of file expect/api.c.
struct nf_expect* nfexp_clone | ( | const struct nf_expect * | exp | ) |
nfexp_clone - clone a expectation object
exp | pointer to a valid expectation object |
On error, NULL is returned and errno is appropiately set. Otherwise, a valid pointer to the clone expect is returned.
Definition at line 88 of file expect/api.c.
int nfexp_cmp | ( | const struct nf_expect * | exp1, |
const struct nf_expect * | exp2, | ||
unsigned int | flags | ||
) |
nfexp_cmp - compare two expectation objects
exp1 | pointer to a valid expectation object |
exp2 | pointer to a valid expectation object |
flags | flags |
This function only compare attribute set in both objects, by default the comparison is not strict, ie. if a certain attribute is not set in one of the objects, then such attribute is not used in the comparison. If you want more strict comparisons, you can use the appropriate flags to modify this behaviour (see NFCT_CMP_STRICT and NFCT_CMP_MASK).
The available flags are:
Other existing flags that are used by nfct_cmp() are ignored.
If both conntrack object are equal, this function returns 1, otherwise 0 is returned.
Definition at line 126 of file expect/api.c.
void nfexp_destroy | ( | struct nf_expect * | exp | ) |
nfexp_destroy - release an expectation object
exp | pointer to the expectation object |
Definition at line 45 of file expect/api.c.
const void* nfexp_get_attr | ( | const struct nf_expect * | exp, |
const enum nf_expect_attr | type | ||
) |
nfexp_get_attr - get an expect attribute
exp | pointer to a valid expect |
type | attribute type |
In case of success a valid pointer to the attribute requested is returned, on error NULL is returned and errno is set appropiately.
Definition at line 371 of file expect/api.c.
uint16_t nfexp_get_attr_u16 | ( | const struct nf_expect * | exp, |
const enum nf_expect_attr | type | ||
) |
nfexp_get_attr_u16 - get attribute of unsigned 16-bits long
exp | pointer to a valid expectation |
type | attribute type |
Returns the value of the requested attribute, if the attribute is not set, 0 is returned. In order to check if the attribute is set or not, use nfexp_attr_is_set.
Definition at line 414 of file expect/api.c.
uint32_t nfexp_get_attr_u32 | ( | const struct nf_expect * | exp, |
const enum nf_expect_attr | type | ||
) |
nfexp_get_attr_u32 - get attribute of unsigned 32-bits long
exp | pointer to a valid expectation |
type | attribute type |
Returns the value of the requested attribute, if the attribute is not set, 0 is returned. In order to check if the attribute is set or not, use nfexp_attr_is_set.
Definition at line 430 of file expect/api.c.
uint8_t nfexp_get_attr_u8 | ( | const struct nf_expect * | exp, |
const enum nf_expect_attr | type | ||
) |
nfexp_get_attr_u8 - get attribute of unsigned 8-bits long
exp | pointer to a valid expectation |
type | attribute type |
Returns the value of the requested attribute, if the attribute is not set, 0 is returned. In order to check if the attribute is set or not, use nfexp_attr_is_set.
Definition at line 398 of file expect/api.c.
size_t nfexp_maxsize | ( | void | ) |
nfexp_maxsize - return the maximum size in bytes of a expect object
Use this function if you want to allocate a expect object in the stack instead of the heap. For example:
char buf[nfexp_maxsize()]; struct nf_expect *exp = (struct nf_expect *) buf; memset(exp, 0, nfexp_maxsize());
Note: As for now this function returns the same size that nfexp_sizeof(exp) does although this could change in the future. Therefore, do not assume that nfexp_sizeof(exp) == nfexp_maxsize().
Definition at line 76 of file expect/api.c.
struct nf_expect* nfexp_new | ( | void | ) |
nfexp_new - allocate a new expectation
In case of success, this function returns a valid pointer to a memory blob, otherwise NULL is returned and errno is set appropiately.
Definition at line 28 of file expect/api.c.
void nfexp_set_attr | ( | struct nf_expect * | exp, |
const enum nf_expect_attr | type, | ||
const void * | value | ||
) |
nfexp_set_attr - set the value of a certain expect attribute
exp | pointer to a valid expect |
type | attribute type |
value | pointer to the attribute value |
Note that certain attributes are unsettable:
Definition at line 308 of file expect/api.c.
void nfexp_set_attr_u16 | ( | struct nf_expect * | exp, |
const enum nf_expect_attr | type, | ||
uint16_t | value | ||
) |
nfexp_set_attr_u16 - set the value of a certain expect attribute
exp | pointer to a valid expect |
type | attribute type |
value | unsigned 16 bits attribute value |
Definition at line 343 of file expect/api.c.
void nfexp_set_attr_u32 | ( | struct nf_expect * | exp, |
const enum nf_expect_attr | type, | ||
uint32_t | value | ||
) |
nfexp_set_attr_u32 - set the value of a certain expect attribute
exp | pointer to a valid expect |
type | attribute type |
value | unsigned 32 bits attribute value |
Definition at line 356 of file expect/api.c.
void nfexp_set_attr_u8 | ( | struct nf_expect * | exp, |
const enum nf_expect_attr | type, | ||
uint8_t | value | ||
) |
nfexp_set_attr_u8 - set the value of a certain expect attribute
exp | pointer to a valid expect |
type | attribute type |
value | unsigned 8 bits attribute value |
Definition at line 330 of file expect/api.c.
size_t nfexp_sizeof | ( | const struct nf_expect * | exp | ) |
nfexp_sizeof - return the size in bytes of a certain expect object
exp | pointer to the expect object |
Definition at line 56 of file expect/api.c.
int nfexp_snprintf | ( | char * | buf, |
unsigned int | size, | ||
const struct nf_expect * | exp, | ||
unsigned int | msg_type, | ||
unsigned int | out_type, | ||
unsigned int | flags | ||
) |
nfexp_snprintf - print a conntrack object to a buffer
buf | buffer used to build the printable conntrack |
size | size of the buffer |
exp | pointer to a valid expectation object |
message_type | print message type (NFEXP_T_UNKNOWN, NFEXP_T_NEW,...) |
output_type | print type (NFEXP_O_DEFAULT, NFEXP_O_XML, ...) |
flags | extra flags for the output type (NFEXP_OF_LAYER3) |
If you are listening to events, probably you want to display the message type as well. In that case, set the message type parameter to any of the known existing types, ie. NFEXP_T_NEW, NFEXP_T_UPDATE, NFEXP_T_DESTROY. If you pass NFEXP_T_UNKNOWN, the message type will not be output.
Currently, the output available are:
The output flags are:
On error, -1 is returned and errno is set appropiately. Otherwise, 0 is returned.
Definition at line 774 of file expect/api.c.