Functions

Accounting object handling

Functions

struct nfacct * nfacct_alloc (void)
void nfacct_free (struct nfacct *nfacct)
void nfacct_attr_set (struct nfacct *nfacct, enum nfacct_attr_type type, const void *data)
void nfacct_attr_set_str (struct nfacct *nfacct, enum nfacct_attr_type type, const char *name)
void nfacct_attr_set_u64 (struct nfacct *nfacct, enum nfacct_attr_type type, uint64_t value)
void nfacct_attr_unset (struct nfacct *nfacct, enum nfacct_attr_type type)
const void * nfacct_attr_get (struct nfacct *nfacct, enum nfacct_attr_type type)
const char * nfacct_attr_get_str (struct nfacct *nfacct, enum nfacct_attr_type type)
uint64_t nfacct_attr_get_u64 (struct nfacct *nfacct, enum nfacct_attr_type type)
int nfacct_snprintf (char *buf, size_t size, struct nfacct *nfacct, uint16_t type, uint16_t flags)

Function Documentation

struct nfacct* nfacct_alloc ( void   )  [read]

nfacct_alloc - allocate a new accounting object

In case of success, this function returns a valid pointer, otherwise NULL s returned and errno is appropriately set.

Definition at line 76 of file libnetfilter_acct.c.

const void* nfacct_attr_get ( struct nfacct *  nfacct,
enum nfacct_attr_type  type 
)

nfacct_attr_get - get one attribute the accounting object

Parameters:
nfacct pointer to the accounting object
type attribute type you want to set

This function returns a valid pointer to the attribute data. If a unsupported attribute is used, this returns NULL.

Definition at line 178 of file libnetfilter_acct.c.

const char* nfacct_attr_get_str ( struct nfacct *  nfacct,
enum nfacct_attr_type  type 
)

nfacct_attr_get_str - get one attribute the accounting object

Parameters:
nfacct pointer to the accounting object
type attribute type you want to set

This function returns a valid pointer to the beginning of the string. If the attribute is unsupported, this returns NULL.

Definition at line 209 of file libnetfilter_acct.c.

uint64_t nfacct_attr_get_u64 ( struct nfacct *  nfacct,
enum nfacct_attr_type  type 
)

nfacct_attr_get_u64 - get one attribute the accounting object

Parameters:
nfacct pointer to the accounting object
type attribute type you want to set

This function returns a unsigned 64-bits integer. If the attribute is unsupported, this returns NULL.

Definition at line 223 of file libnetfilter_acct.c.

void nfacct_attr_set ( struct nfacct *  nfacct,
enum nfacct_attr_type  type,
const void *  data 
)

nfacct_attr_set - set one attribute of the accounting object

Parameters:
nfacct pointer to the accounting object
type attribute type you want to set
data pointer to data that will be used to set this attribute

Definition at line 99 of file libnetfilter_acct.c.

void nfacct_attr_set_str ( struct nfacct *  nfacct,
enum nfacct_attr_type  type,
const char *  name 
)

nfacct_attr_set_str - set one attribute the accounting object

Parameters:
nfacct pointer to the accounting object
type attribute type you want to set
name string that will be used to set this attribute

Definition at line 127 of file libnetfilter_acct.c.

void nfacct_attr_set_u64 ( struct nfacct *  nfacct,
enum nfacct_attr_type  type,
uint64_t  value 
)

nfacct_attr_set_u64 - set one attribute the accounting object

Parameters:
nfacct pointer to the accounting object
type attribute type you want to set
value unsigned 64-bits integer

Definition at line 141 of file libnetfilter_acct.c.

void nfacct_attr_unset ( struct nfacct *  nfacct,
enum nfacct_attr_type  type 
)

nfacct_attr_unset - unset one attribute the accounting object

Parameters:
nfacct pointer to the accounting object
type attribute type you want to set

Definition at line 154 of file libnetfilter_acct.c.

void nfacct_free ( struct nfacct *  nfacct  ) 

nfacct_free - release one accounting object

Parameters:
nfacct pointer to the accounting object

Definition at line 86 of file libnetfilter_acct.c.

int nfacct_snprintf ( char *  buf,
size_t  size,
struct nfacct *  nfacct,
uint16_t  type,
uint16_t  flags 
)

nfacct_snprintf - print accounting object into one buffer

Parameters:
buf,: pointer to buffer that is used to print the object
size,: size of the buffer (or remaining room in it).
nfacct,: pointer to a valid accounting object.
type,: format output type, NFACCT_SNPRINTF_T_[PLAIN|XML]
flags,: output flags (NFACCT_SNPRINTF_F_FULL).

This function returns -1 in case that some mandatory attributes are missing. On sucess, it returns 0.

Definition at line 241 of file libnetfilter_acct.c.