Cacheable Object
[Caching]


Data Structures

struct  nl_derived_object

Object Creation/Deletion

nl_object * nl_object_alloc (size_t size)
 Allocate a cacheable object.
nl_object * nl_object_alloc_from_ops (struct nl_cache_ops *ops)
 Allocate a new object of kind specified by the operations handle.
nl_object * nl_object_alloc_name (const char *kind)
 Allocate a new object of kind specified by the name.
nl_object * nl_object_clone (struct nl_object *obj)
 Allocate a new object and copy all data from an existing object.
void nl_object_free (struct nl_object *obj)
 Free a cacheable object.

Reference Management

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

Utillities

void nl_object_dump (struct nl_object *obj, struct nl_dump_params *params)
 Dump this object according to the specified parameters.
int nl_object_match (struct nl_object *obj, struct nl_object *filter)
 Match a filter against an object.

Access Functions

int nl_object_get_refcnt (struct nl_object *obj)
 Get reference count of object.
nl_cache_ops * nl_object_get_ops (struct nl_object *obj)
 Get cache operations of object.
nl_cache * nl_object_get_cache (struct nl_object *obj)
 Get cache this object is in.
void * nl_object_priv (struct nl_object *obj)
 Get the private data of object.


Function Documentation

struct nl_object* nl_object_alloc ( size_t  size  ) 

Allocate a cacheable object.

Parameters:
size size of object
Returns:
The new object or NULL.

Definition at line 42 of file object.c.

Referenced by nl_object_alloc_from_ops(), and nl_object_clone().

struct nl_object* nl_object_alloc_from_ops ( struct nl_cache_ops *  ops  ) 

Allocate a new object of kind specified by the operations handle.

Parameters:
ops cache operations handle
Returns:
The new object or NULL

Definition at line 66 of file object.c.

References nl_object_alloc().

Referenced by flnl_result_alloc(), nl_object_alloc_name(), rtnl_addr_alloc(), rtnl_class_alloc(), rtnl_cls_alloc(), rtnl_link_alloc(), rtnl_neigh_alloc(), rtnl_neightbl_alloc(), rtnl_qdisc_alloc(), rtnl_route_alloc(), and rtnl_rule_alloc().

struct nl_object* nl_object_alloc_name ( const char *  kind  ) 

Allocate a new object of kind specified by the name.

Parameters:
kind name of object type
Returns:
The new object or nULL

Definition at line 85 of file object.c.

References nl_cache_mngt_lookup(), and nl_object_alloc_from_ops().

struct nl_object* nl_object_clone ( struct nl_object *  obj  ) 

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

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

Definition at line 108 of file object.c.

References nl_object_alloc(), and nl_object_get().

Referenced by nl_cache_add().

void nl_object_free ( struct nl_object *  obj  ) 

Free a cacheable object.

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

Definition at line 143 of file object.c.

References nl_object_put().

Referenced by flnl_result_free(), nl_object_put(), rtnl_addr_free(), rtnl_class_free(), rtnl_cls_free(), rtnl_link_free(), rtnl_neigh_free(), rtnl_neightbl_free(), rtnl_qdisc_free(), rtnl_route_free(), and rtnl_rule_free().

void nl_object_get ( struct nl_object *  obj  ) 

Acquire a reference on a object.

Parameters:
obj object to acquire reference from

Definition at line 169 of file object.c.

Referenced by nl_object_clone(), rtnl_link_get(), rtnl_link_get_by_name(), rtnl_neigh_get(), rtnl_neightbl_get(), rtnl_qdisc_get(), rtnl_qdisc_get_by_parent(), and rtnl_route_get().

void nl_object_put ( struct nl_object *  obj  ) 

Release a reference from an object.

Parameters:
obj object to release reference from

Definition at line 178 of file object.c.

References nl_object_free().

Referenced by flnl_result_put(), nl_cache_add(), nl_cache_delete(), nl_object_free(), rtnl_addr_put(), rtnl_class_put(), rtnl_cls_put(), rtnl_link_put(), rtnl_neigh_put(), rtnl_neightbl_put(), rtnl_qdisc_put(), rtnl_route_put(), and rtnl_rule_put().

int nl_object_shared ( struct nl_object *  obj  ) 

Check whether this object is used by multiple users.

Parameters:
obj object to check
Returns:
true or false

Definition at line 197 of file object.c.

Referenced by nl_cache_add().

void nl_object_dump ( struct nl_object *  obj,
struct nl_dump_params params 
)

Dump this object according to the specified parameters.

Parameters:
obj object to dump
params dumping parameters

Definition at line 214 of file object.c.

int nl_object_match ( struct nl_object *  obj,
struct nl_object *  filter 
)

Match a filter against an object.

Parameters:
obj object to check
filter filter object
Returns:
0 if the object matches the filter or non-zero if no filter procedure is available or if the filter does not match.

Definition at line 228 of file object.c.

int nl_object_get_refcnt ( struct nl_object *  obj  ) 

Get reference count of object.

Parameters:
obj object handle

Definition at line 250 of file object.c.

struct nl_cache_ops* nl_object_get_ops ( struct nl_object *  obj  ) 

Get cache operations of object.

Parameters:
obj object handle

Definition at line 259 of file object.c.

struct nl_cache* nl_object_get_cache ( struct nl_object *  obj  ) 

Get cache this object is in.

Parameters:
obj object handle
Returns:
cache handle or NULL if object is not associated to a cache

Definition at line 269 of file object.c.

void* nl_object_priv ( struct nl_object *  obj  )  [inline]

Get the private data of object.

Parameters:
obj object handle

Definition at line 278 of file object.c.


Generated on Fri Apr 27 14:14:07 2007 for libnl by  doxygen 1.5.1