libnetfilter_acct  1.0.3
Macros | Functions
Accounting object handling

Macros

#define BUFFER_SIZE(ret, size, rem, offset)
 

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)
 

Detailed Description

Macro Definition Documentation

#define BUFFER_SIZE (   ret,
  size,
  rem,
  offset 
)
Value:
size += ret; \
if (ret > rem) \
ret = rem; \
offset += ret; \
rem -= ret;

Definition at line 343 of file libnetfilter_acct.c.

Function Documentation

struct nfacct* nfacct_alloc ( void  )

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 79 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
nfacctpointer to the accounting object
typeattribute 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 195 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
nfacctpointer to the accounting object
typeattribute 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 234 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
nfacctpointer to the accounting object
typeattribute type you want to set

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

Definition at line 248 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
nfacctpointer to the accounting object
typeattribute type you want to set
datapointer to data that will be used to set this attribute

Definition at line 102 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
nfacctpointer to the accounting object
typeattribute type you want to set
namestring that will be used to set this attribute

Definition at line 138 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
nfacctpointer to the accounting object
typeattribute type you want to set
valueunsigned 64-bits integer

Definition at line 152 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
nfacctpointer to the accounting object
typeattribute type you want to set

Definition at line 165 of file libnetfilter_acct.c.

void nfacct_free ( struct nfacct *  nfacct)

nfacct_free - release one accounting object

Parameters
nfacctpointer to the accounting object

Definition at line 89 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
bufpointer to buffer that is used to print the object
sizesize of the buffer (or remaining room in it).
nfacctpointer to a valid accounting object.
typeformat output type, NFACCT_SNPRINTF_T_[PLAIN|XML]
flagsoutput 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 427 of file libnetfilter_acct.c.