netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Object
Collaboration diagram for Object:

Modules

 Object API
 

Data Structures

struct  nl_derived_object
 

Object Creation/Deletion

struct nl_objectnl_object_alloc (struct nl_object_ops *ops)
 Allocate a new object of kind specified by the operations handle. More...
 
int nl_object_alloc_name (const char *kind, struct nl_object **result)
 Allocate a new object of kind specified by the name. More...
 
struct nl_objectnl_object_clone (struct nl_object *obj)
 Allocate a new object and copy all data from an existing object. More...
 
void nl_object_free (struct nl_object *obj)
 Free a cacheable object. More...
 

Reference Management

void nl_object_get (struct nl_object *obj)
 Acquire a reference on a object. More...
 
void nl_object_put (struct nl_object *obj)
 Release a reference from an object. More...
 
int nl_object_shared (struct nl_object *obj)
 Check whether this object is used by multiple users. More...
 

Marks

void nl_object_mark (struct nl_object *obj)
 Add mark to object. More...
 
void nl_object_unmark (struct nl_object *obj)
 Remove mark from object. More...
 
int nl_object_is_marked (struct nl_object *obj)
 Return true if object is marked. More...
 

Utillities

void nl_object_dump (struct nl_object *obj, struct nl_dump_params *params)
 Dump this object according to the specified parameters. More...
 
int nl_object_identical (struct nl_object *a, struct nl_object *b)
 Check if the identifiers of two objects are identical. More...
 
uint32_t nl_object_diff (struct nl_object *a, struct nl_object *b)
 Compute bitmask representing difference in attribute values. More...
 
int nl_object_match_filter (struct nl_object *obj, struct nl_object *filter)
 Match a filter against an object. More...
 
char * nl_object_attrs2str (struct nl_object *obj, uint32_t attrs, char *buf, size_t len)
 Convert bitmask of attributes to a character string. More...
 
char * nl_object_attr_list (struct nl_object *obj, char *buf, size_t len)
 Return list of attributes present in an object. More...
 

Attributes

int nl_object_get_refcnt (struct nl_object *obj)
 
struct nl_cachenl_object_get_cache (struct nl_object *obj)
 

Detailed Description

Function Documentation

int nl_object_alloc_name ( const char *  kind,
struct nl_object **  result 
)

Allocate a new object of kind specified by the name.

  • kind name of object type
    Returns
    The new object or nULL

References nl_cache_ops::co_obj_ops, nl_cache_ops_lookup(), nl_object_alloc(), NLE_NOMEM, and NLE_OPNOTSUPP.

Here is the call graph for this function:

char* nl_object_attr_list ( struct nl_object obj,
char *  buf,
size_t  len 
)

Return list of attributes present in an object.

  • obj an object
  • buf destination buffer
  • len length of destination buffer
Returns
destination buffer.

References nl_object_attrs2str().

Here is the call graph for this function:

char* nl_object_attrs2str ( struct nl_object obj,
uint32_t  attrs,
char *  buf,
size_t  len 
)

Convert bitmask of attributes to a character string.

  • obj object of same type as attribute bitmask
  • attrs bitmask of attribute types
  • buf destination buffer
  • len length of destination buffer

Converts the bitmask of attribute types into a list of attribute names separated by comas.

Returns
destination buffer.

References buf, NULL, and nl_object_ops::oo_attrs2str.

Referenced by nl_object_attr_list().

Here is the caller graph for this function:

struct nl_object* nl_object_clone ( struct nl_object obj)

Allocate a new object and copy all data from an existing object.

  • obj object to inherite data from
    Returns
    The new object or NULL.

References BUG, data, nl_object_alloc(), nl_object_free(), NULL, offsetof, nl_object_ops::oo_clone, nl_object_ops::oo_free_data, nl_object_ops::oo_size, and size.

Referenced by nl_cache_add().

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t nl_object_diff ( struct nl_object a,
struct nl_object b 
)

Compute bitmask representing difference in attribute values.

  • a an object
  • b another object of same type

The bitmask returned is specific to an object type, each bit set represents an attribute which mismatches in either of the two objects. Unavailability of an attribute in one object and presence in the other is regarded a mismatch as well.

Returns
Bitmask describing differences or 0 if they are completely identical.

References NULL, and nl_object_ops::oo_compare.

void nl_object_dump ( struct nl_object obj,
struct nl_dump_params params 
)

Dump this object according to the specified parameters.

  • obj object to dump
  • params dumping parameters

References dump_from_ops().

Referenced by main(), and nl_cli_confirm().

Here is the call graph for this function:

Here is the caller graph for this function:

void nl_object_free ( struct nl_object obj)

Free a cacheable object.

  • obj object to free
Returns
0 or a negative error code.

References nl_cache_remove(), NL_DBG, and nl_object_ops::oo_free_data.

Referenced by nl_object_clone(), and nl_object_put().

Here is the call graph for this function:

Here is the caller graph for this function:

struct nl_cache* nl_object_get_cache ( struct nl_object obj)
int nl_object_get_refcnt ( struct nl_object obj)
int nl_object_identical ( struct nl_object a,
struct nl_object b 
)

Check if the identifiers of two objects are identical.

  • a an object
  • b another object of same type
Returns
true if both objects have equal identifiers, otherwise false.

References NULL, nl_object_ops::oo_compare, and nl_object_ops::oo_id_attrs.

Referenced by nl_cache_search().

Here is the caller graph for this function:

int nl_object_is_marked ( struct nl_object obj)

Return true if object is marked.

  • obj Object to check
    Returns
    true if object is marked, otherwise false

References NL_OBJ_MARK.

Referenced by nl_cache_resync().

Here is the caller graph for this function:

void nl_object_mark ( struct nl_object obj)

Add mark to object.

  • obj Object to mark

References NL_OBJ_MARK.

Referenced by nl_cache_mark_all().

Here is the caller graph for this function:

int nl_object_match_filter ( struct nl_object obj,
struct nl_object filter 
)

Match a filter against an object.

  • obj object to check
  • filter object of same type acting as filter
Returns
1 if the object matches the filter or 0 if no filter procedure is available or if the filter does not match.

References LOOSE_COMPARISON, NULL, and nl_object_ops::oo_compare.

Referenced by nl_cache_dump_filter(), nl_cache_foreach_filter(), nl_cache_nitems_filter(), and nl_cache_subset().

Here is the caller graph for this function:

int nl_object_shared ( struct nl_object obj)

Check whether this object is used by multiple users.

  • obj object to check
    Returns
    true or false
void nl_object_unmark ( struct nl_object obj)

Remove mark from object.

  • obj Object to unmark

References NL_OBJ_MARK.