libnl
3.2.3
|
Object Operations. More...
#include <object-api.h>
Data Fields | |
char * | oo_name |
Unique name of object type. | |
size_t | oo_size |
Size of object including its header. | |
uint32_t | oo_id_attrs |
void(* | oo_constructor )(struct nl_object *) |
Constructor function. | |
void(* | oo_free_data )(struct nl_object *) |
Destructor function. | |
int(* | oo_clone )(struct nl_object *, struct nl_object *) |
Cloning function. | |
void(* | oo_dump [NL_DUMP_MAX+1])(struct nl_object *, struct nl_dump_params *) |
Dumping functions. | |
int(* | oo_compare )(struct nl_object *, struct nl_object *, uint32_t, int) |
Comparison function. | |
char *(* | oo_attrs2str )(int, char *, size_t) |
Object Operations.
Definition at line 268 of file object-api.h.
char* nl_object_ops::oo_name |
Unique name of object type.
Must be in the form family/name, e.g. "route/addr"
Definition at line 275 of file object-api.h.
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.
Definition at line 289 of file object-api.h.
Referenced by nl_object_alloc().
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.
Definition at line 298 of file object-api.h.
Referenced by nl_object_clone(), and nl_object_free().
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.
Definition at line 310 of file object-api.h.
Referenced by nl_object_clone().
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.
Definition at line 321 of file object-api.h.
Referenced by nl_cache_dump_filter().
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.
Definition at line 335 of file object-api.h.
Referenced by nl_object_diff(), nl_object_identical(), and nl_object_match_filter().