Cache Management
[Utilities]


Message Type Association

nl_cache_ops * nl_cache_mngt_associate (int protocol, int message_type)
 Associate a message type to a set of cache operations.
char * nl_cache_mngt_type2name (struct nl_cache_ops *ops, int msgtype, char *buf, size_t len)
 Convert message type to character string.

Access Functions

char * nl_cache_ops_get_name (struct nl_cache_ops *ops)
 Return the cache type of the cache operations.

Cache Type Management

nl_cache_ops * nl_cache_mngt_lookup (const char *name)
 Lookup the set cache operations of a certain cache type.
int nl_cache_mngt_register (struct nl_cache_ops *ops)
 Register a set of cache operations.
int nl_cache_mngt_unregister (struct nl_cache_ops *ops)
 Unregister a set of cache operations.

Global Cache Provisioning/Requiring

void nl_cache_mngt_provide (struct nl_cache *cache)
 Provide a cache for global use.
void nl_cache_mngt_unprovide (struct nl_cache *cache)
 Unprovide a cache for global use.
nl_cache * nl_cache_mngt_require (const char *name)
 Demand the use of a global cache.


Function Documentation

char* nl_cache_ops_get_name ( struct nl_cache_ops *  ops  ) 

Return the cache type of the cache operations.

Parameters:
ops cache operations

Definition at line 32 of file cache_mngt.c.

struct nl_cache_ops* nl_cache_mngt_associate ( int  protocol,
int  message_type 
)

Associate a message type to a set of cache operations.

Parameters:
protocol netlink protocol
message_type netlink message type
Associates the specified netlink message type with a registered set of cache operations.

Returns:
The cache operations or NULL if no association could be made.

Definition at line 57 of file cache_mngt.c.

Referenced by nl_msg_parse().

char* nl_cache_mngt_type2name ( struct nl_cache_ops *  ops,
int  msgtype,
char *  buf,
size_t  len 
)

Convert message type to character string.

Parameters:
ops Cache operations.
msgtype Message type.
buf Destination buffer.
len Size of destination buffer.
Converts a message type to a character string and stores it in the provided buffer.

Returns:
The destination buffer or the message type encoded in hexidecimal form if no match was found.

Definition at line 84 of file cache_mngt.c.

struct nl_cache_ops* nl_cache_mngt_lookup ( const char *  name  ) 

Lookup the set cache operations of a certain cache type.

Parameters:
name name of the cache type
Returns:
The cache operations or NULL if no operations have been registered under the specified name.

Definition at line 116 of file cache_mngt.c.

Referenced by nl_cache_alloc_name(), nl_cache_mngt_provide(), nl_cache_mngt_register(), nl_cache_mngt_require(), nl_cache_mngt_unprovide(), and nl_object_alloc_name().

int nl_cache_mngt_register ( struct nl_cache_ops *  ops  ) 

Register a set of cache operations.

Parameters:
ops cache operations
Called by users of caches to announce the avaibility of a certain cache type.

Returns:
0 on success or a negative error code.

Definition at line 136 of file cache_mngt.c.

References nl_cache_mngt_lookup().

int nl_cache_mngt_unregister ( struct nl_cache_ops *  ops  ) 

Unregister a set of cache operations.

Parameters:
ops cache operations
Called by users of caches to announce a set of cache operations is no longer available. The specified cache operations must have been registered previously using nl_cache_mngt_register()

Returns:
0 on success or a negative error code

Definition at line 163 of file cache_mngt.c.

void nl_cache_mngt_provide ( struct nl_cache *  cache  ) 

Provide a cache for global use.

Parameters:
cache cache to provide
Offers the specified cache to be used by other modules. Only one cache per type may be shared at a time, a previsouly provided caches will be overwritten.

Definition at line 195 of file cache_mngt.c.

References nl_cache_mngt_lookup().

void nl_cache_mngt_unprovide ( struct nl_cache *  cache  ) 

Unprovide a cache for global use.

Parameters:
cache cache to unprovide
Cancels the offer to use a cache globally. The cache will no longer be returned via lookups but may still be in use.

Definition at line 214 of file cache_mngt.c.

References nl_cache_mngt_lookup().

struct nl_cache* nl_cache_mngt_require ( const char *  name  ) 

Demand the use of a global cache.

Parameters:
name name of the required cache type
Trys to find a cache of the specified type for global use.

Returns:
A cache provided by another subsystem of the specified type marked to be available.

Definition at line 235 of file cache_mngt.c.

References nl_cache_mngt_lookup().


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