libnl 3.7.0
|
Generic object data type, for inheritance purposes to implement cacheable data types. More...
Data Structures | |
struct | nl_derived_object |
Object Creation/Deletion | |
struct nl_object * | nl_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 new object of kind specified by the name. More... | |
struct nl_object * | nl_object_clone (struct nl_object *obj) |
Allocate a new object and copy all data from an existing object. More... | |
int | nl_object_update (struct nl_object *dst, struct nl_object *src) |
Merge a cacheable 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... | |
void | nl_object_dump_buf (struct nl_object *obj, char *buf, size_t len) |
int | nl_object_identical (struct nl_object *a, struct nl_object *b) |
Check if the identifiers of two objects are identical. More... | |
uint64_t | nl_object_diff64 (struct nl_object *a, struct nl_object *b) |
Compute bitmask representing difference in attribute values. More... | |
uint32_t | nl_object_diff (struct nl_object *a, struct nl_object *b) |
Compute 32-bit 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... | |
void | nl_object_keygen (struct nl_object *obj, uint32_t *hashkey, uint32_t hashtbl_sz) |
Generate object hash key. More... | |
Attributes | |
int | nl_object_get_refcnt (struct nl_object *obj) |
Return number of references held. More... | |
struct nl_cache * | nl_object_get_cache (struct nl_object *obj) |
Return cache the object is associated with. More... | |
const char * | nl_object_get_type (const struct nl_object *obj) |
Return the object's type. More... | |
int | nl_object_get_msgtype (const struct nl_object *obj) |
Return the netlink message type the object was derived from. More... | |
struct nl_object_ops * | nl_object_get_ops (const struct nl_object *obj) |
Return object operations structure. More... | |
uint32_t | nl_object_get_id_attrs (struct nl_object *obj) |
Return object id attribute mask. More... | |
Generic object data type, for inheritance purposes to implement cacheable data types.
Related sections in the development guide:
struct nl_object * nl_object_alloc | ( | struct nl_object_ops * | ops | ) |
Allocate a new object of kind specified by the operations handle.
ops | cache operations handle |
Definition at line 48 of file object.c.
Referenced by genl_family_alloc(), nl_object_alloc_name(), nl_object_clone(), and rtnl_link_alloc().
int nl_object_alloc_name | ( | const char * | kind, |
struct nl_object ** | result | ||
) |
Allocate new object of kind specified by the name.
kind | name of object type |
result | Result pointer |
Definition at line 78 of file object.c.
References nl_cache_ops_lookup_safe(), nl_cache_ops_put(), and nl_object_alloc().
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 |
Definition at line 104 of file object.c.
References nl_object_alloc(), and nl_object_free().
Referenced by nl_cache_add().
int nl_object_update | ( | struct nl_object * | dst, |
struct nl_object * | src | ||
) |
void nl_object_free | ( | struct nl_object * | obj | ) |
Free a cacheable object.
obj | object to free |
Definition at line 169 of file object.c.
References nl_cache_remove().
Referenced by nl_object_clone(), and nl_object_put().
void nl_object_get | ( | struct nl_object * | obj | ) |
Acquire a reference on a object.
obj | object to acquire reference from |
Definition at line 203 of file object.c.
Referenced by genl_ctrl_search(), genl_ctrl_search_by_name(), nl_cache_add(), nl_cache_find(), nl_cache_foreach_filter(), nl_cache_move(), nl_cache_search(), nl_hash_table_add(), rtnl_addr_get(), rtnl_class_get(), rtnl_class_get_by_parent(), rtnl_cls_find_by_handle(), rtnl_cls_find_by_prio(), rtnl_link_get(), rtnl_link_get_by_name(), rtnl_link_veth_get_peer(), rtnl_neigh_get(), rtnl_neigh_get_by_vlan(), rtnl_neightbl_get(), rtnl_netconf_get_by_idx(), rtnl_qdisc_get(), rtnl_qdisc_get_by_kind(), rtnl_qdisc_get_by_parent(), rtnl_tc_get_link(), and rtnl_tc_set_link().
void nl_object_put | ( | struct nl_object * | obj | ) |
Release a reference from an object.
obj | object to release reference from |
Definition at line 214 of file object.c.
References nl_object_free().
Referenced by genl_family_put(), nl_cache_add(), nl_cache_foreach_filter(), nl_cache_remove(), nl_hash_table_del(), nl_hash_table_free(), and rtnl_link_put().
int nl_object_shared | ( | struct nl_object * | obj | ) |
void nl_object_mark | ( | struct nl_object * | obj | ) |
Add mark to object.
obj | Object to mark |
Definition at line 251 of file object.c.
Referenced by nl_cache_mark_all().
void nl_object_unmark | ( | struct nl_object * | obj | ) |
int nl_object_is_marked | ( | struct nl_object * | obj | ) |
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 |
Definition at line 287 of file object.c.
References nl_dump_params::dp_buf, and nl_dump_params::dp_buflen.
void nl_object_dump_buf | ( | struct nl_object * | obj, |
char * | buf, | ||
size_t | len | ||
) |
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 |
Definition at line 312 of file object.c.
Referenced by nl_cache_search(), nl_hash_table_add(), nl_hash_table_del(), and nl_hash_table_lookup().
uint64_t nl_object_diff64 | ( | 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.
Definition at line 364 of file object.c.
Referenced by nl_object_diff().
uint32_t nl_object_diff | ( | struct nl_object * | a, |
struct nl_object * | b | ||
) |
Compute 32-bit 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.
Definition at line 388 of file object.c.
References nl_object_diff64().
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 |
Definition at line 408 of file object.c.
Referenced by nl_cache_dump_filter(), nl_cache_find(), nl_cache_foreach_filter(), nl_cache_nitems_filter(), and nl_cache_subset().
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.
Definition at line 431 of file object.c.
Referenced by nl_object_attr_list().
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 |
Definition at line 452 of file object.c.
References nl_object_attrs2str().
void nl_object_keygen | ( | struct nl_object * | obj, |
uint32_t * | hashkey, | ||
uint32_t | hashtbl_sz | ||
) |
Generate object hash key.
obj | the object |
hashkey | destination buffer to be used for key stream |
hashtbl_sz | hash table size |
Definition at line 465 of file object.c.
Referenced by nl_hash_table_add(), nl_hash_table_del(), and nl_hash_table_lookup().
int nl_object_get_refcnt | ( | struct nl_object * | obj | ) |
struct nl_cache * nl_object_get_cache | ( | struct nl_object * | obj | ) |
const char * nl_object_get_type | ( | const struct nl_object * | obj | ) |
int nl_object_get_msgtype | ( | const struct nl_object * | obj | ) |
struct nl_object_ops * nl_object_get_ops | ( | const struct nl_object * | obj | ) |
uint32_t nl_object_get_id_attrs | ( | struct nl_object * | obj | ) |
Return object id attribute mask.
obj | object |
Definition at line 554 of file object.c.
Referenced by nl_cache_find().