netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Accounting object handling

Macros

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

Functions

struct nfacctnfacct_alloc (void)
 nfacct_alloc - allocate a new accounting object More...
 
 EXPORT_SYMBOL (nfacct_alloc)
 
void nfacct_free (struct nfacct *nfacct)
 nfacct_free - release one accounting object More...
 
 EXPORT_SYMBOL (nfacct_free)
 
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 More...
 
 EXPORT_SYMBOL (nfacct_attr_set)
 
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 More...
 
 EXPORT_SYMBOL (nfacct_attr_set_str)
 
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 More...
 
 EXPORT_SYMBOL (nfacct_attr_set_u64)
 
void nfacct_attr_unset (struct nfacct *nfacct, enum nfacct_attr_type type)
 nfacct_attr_unset - unset one attribute the accounting object More...
 
 EXPORT_SYMBOL (nfacct_attr_unset)
 
const void * nfacct_attr_get (struct nfacct *nfacct, enum nfacct_attr_type type)
 nfacct_attr_get - get one attribute the accounting object More...
 
 EXPORT_SYMBOL (nfacct_attr_get)
 
const char * nfacct_attr_get_str (struct nfacct *nfacct, enum nfacct_attr_type type)
 nfacct_attr_get_str - get one attribute the accounting object More...
 
 EXPORT_SYMBOL (nfacct_attr_get_str)
 
uint64_t nfacct_attr_get_u64 (struct nfacct *nfacct, enum nfacct_attr_type type)
 nfacct_attr_get_u64 - get one attribute the accounting object More...
 
 EXPORT_SYMBOL (nfacct_attr_get_u64)
 
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 More...
 
 EXPORT_SYMBOL (nfacct_snprintf)
 

Detailed Description

Macro Definition Documentation

#define BUFFER_SIZE (   ret,
  size,
  rem,
  offset 
)
Value:
size += ret; \
if (ret > rem) \
ret = rem; \
offset += ret; \
rem -= ret;
u8 size
Definition: ip_set_hash_gen.h:186

Referenced by __snprintf_addr_xml(), __snprintf_connlabels(), __snprintf_conntrack_default(), __snprintf_conntrack_xml(), __snprintf_expect_default(), __snprintf_expect_xml(), __snprintf_localtime_xml(), and __snprintf_proto_xml().

Function Documentation

EXPORT_SYMBOL ( nfacct_alloc  )
EXPORT_SYMBOL ( nfacct_free  )
EXPORT_SYMBOL ( nfacct_attr_set  )
EXPORT_SYMBOL ( nfacct_attr_set_str  )
EXPORT_SYMBOL ( nfacct_attr_set_u64  )
EXPORT_SYMBOL ( nfacct_attr_unset  )
EXPORT_SYMBOL ( nfacct_attr_get  )
EXPORT_SYMBOL ( nfacct_attr_get_str  )
EXPORT_SYMBOL ( nfacct_attr_get_u64  )
EXPORT_SYMBOL ( nfacct_snprintf  )
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.

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.

References bitset, bytes, flags, name, NFACCT_ATTR_BYTES, NFACCT_ATTR_FLAGS, NFACCT_ATTR_NAME, NFACCT_ATTR_PKTS, NFACCT_ATTR_QUOTA, NULL, pkts, and quota.

Referenced by nfacct_attr_get_str(), and nfacct_attr_get_u64().

Here is the caller graph for this function:

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.

References nfacct_attr_get().

Here is the call graph for this function:

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.

References nfacct_attr_get().

Here is the call graph for this function:

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

References bitset, bytes, flags, name, NFACCT_ATTR_BYTES, NFACCT_ATTR_FLAGS, NFACCT_ATTR_NAME, NFACCT_ATTR_PKTS, NFACCT_ATTR_QUOTA, NFACCT_NAME_MAX, pkts, and quota.

Referenced by nfacct_attr_set_str(), nfacct_attr_set_u64(), and nfacct_nlmsg_parse_payload().

Here is the caller graph for this function:

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

References nfacct_attr_set().

Referenced by nfacct_nlmsg_parse_payload().

Here is the call graph for this function:

Here is the caller graph for this function:

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

References nfacct_attr_set().

Referenced by nfacct_nlmsg_parse_payload().

Here is the call graph for this function:

Here is the caller graph for this function:

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

References bitset, NFACCT_ATTR_BYTES, NFACCT_ATTR_FLAGS, NFACCT_ATTR_NAME, NFACCT_ATTR_PKTS, and NFACCT_ATTR_QUOTA.

void nfacct_free ( struct nfacct nfacct)

nfacct_free - release one accounting object

Parameters
nfacctpointer to the accounting object
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.

References NFACCT_SNPRINTF_T_PLAIN, and NFACCT_SNPRINTF_T_XML.