netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
nl_object_ops Struct Reference

Object Operations. More...

#include <object-api.h>

Data Fields

char * oo_name
 Unique name of object type. More...
 
size_t oo_size
 Size of object including its header. More...
 
uint32_t oo_id_attrs
 
void(* oo_constructor )(struct nl_object *)
 Constructor function. More...
 
void(* oo_free_data )(struct nl_object *)
 Destructor function. More...
 
int(* oo_clone )(struct nl_object *, struct nl_object *)
 Cloning function. More...
 
void(* oo_dump [NL_DUMP_MAX+1])(struct nl_object *, struct nl_dump_params *)
 Dumping functions. More...
 
int(* oo_compare )(struct nl_object *, struct nl_object *, uint32_t, int)
 Comparison function. More...
 
char *(* oo_attrs2str )(int, char *, size_t)
 

Detailed Description

Object Operations.

Field Documentation

char*(* nl_object_ops::oo_attrs2str)(int, char *, size_t)

Referenced by nl_object_attrs2str().

int(* nl_object_ops::oo_clone)(struct nl_object *, struct nl_object *)

Cloning function.

Will be called when an object needs to be cloned. Please note that the generic object code will make an exact copy of the object first, therefore you only need to take care of members which require reference counting etc.

May return a negative error code to abort cloning.

Referenced by nl_object_clone().

int(* nl_object_ops::oo_compare)(struct nl_object *, struct nl_object *, uint32_t, int)

Comparison function.

Will be called when two objects of the same type are compared. It takes the two objects in question, an object specific bitmask defining which attributes should be compared and flags to control the behaviour.

The function must return a bitmask with the relevant bit set for each attribute that mismatches.

Referenced by nl_object_diff(), nl_object_identical(), and nl_object_match_filter().

void(* nl_object_ops::oo_constructor)(struct nl_object *)

Constructor function.

Will be called when a new object of this type is allocated. Can be used to initialize members such as lists etc.

Referenced by nl_object_alloc().

void(* nl_object_ops::oo_dump[NL_DUMP_MAX+1])(struct nl_object *, struct nl_dump_params *)

Dumping functions.

Will be called when an object is dumped. The implementations have to use nl_dump(), nl_dump_line(), and nl_new_line() to dump objects.

The functions must return the number of lines printed.

Referenced by nl_cache_dump_filter().

void(* nl_object_ops::oo_free_data)(struct nl_object *)

Destructor function.

Will be called when an object is freed. Must free all resources which may have been allocated as part of this object.

Referenced by nl_object_clone(), and nl_object_free().

uint32_t nl_object_ops::oo_id_attrs

Referenced by nl_object_identical().

char* nl_object_ops::oo_name

Unique name of object type.

Must be in the form family/name, e.g. "route/addr"

size_t nl_object_ops::oo_size

Size of object including its header.

Referenced by nl_object_alloc(), and nl_object_clone().


The documentation for this struct was generated from the following file: