FIB Lookup


Modules

 Request

FIB Result Allocation/Freeage

flnl_result * flnl_result_alloc (void)
 Allocate and initialize new lookup result object.
nl_cache * flnl_result_alloc_cache (void)
 Allocate lookup result cache.
void flnl_result_put (struct flnl_result *res)
 Give back reference on lookup result object.
void flnl_result_free (struct flnl_result *res)
 Free lookup result object.

Lookup

nl_msg * flnl_lookup_build_request (struct flnl_request *req, int flags)
 Builds a netlink request message to do a lookup.
int flnl_lookup (struct nl_handle *handle, struct flnl_request *req, struct nl_cache *cache)
 Perform FIB Lookup.

Attribute Access

int flnl_result_get_table_id (struct flnl_result *res)
int flnl_result_get_prefixlen (struct flnl_result *res)
int flnl_result_get_nexthop_sel (struct flnl_result *res)
int flnl_result_get_type (struct flnl_result *res)
int flnl_result_get_scope (struct flnl_result *res)
int flnl_result_get_error (struct flnl_result *res)


Function Documentation

struct flnl_result* flnl_result_alloc ( void   ) 

Allocate and initialize new lookup result object.

Note:
Free the memory after usage using flnl_result_put() or flnl_result_free().
Returns:
Newly allocated lookup result object or NULL if an error occured.

Definition at line 155 of file lookup.c.

References nl_object_alloc_from_ops().

struct nl_cache* flnl_result_alloc_cache ( void   ) 

Allocate lookup result cache.

Allocates a new lookup result cache and initializes it properly.

Note:
Free the memory after usage using nl_cache_destroy_and_free().
Returns:
Newly allocated cache or NULL if an error occured.

Definition at line 168 of file lookup.c.

References nl_cache_alloc_from_ops().

void flnl_result_put ( struct flnl_result *  res  ) 

Give back reference on lookup result object.

Parameters:
res lookup result object to be given back.
Decrements the reference counter and frees the object if the last reference has been released.

Definition at line 180 of file lookup.c.

References nl_object_put().

void flnl_result_free ( struct flnl_result *  res  ) 

Free lookup result object.

Parameters:
res lookup result object to be freed.
Note:
Always use flnl_result_put() unless you're absolutely sure that no other user may have a reference on this object.

Definition at line 192 of file lookup.c.

References nl_object_free().

struct nl_msg* flnl_lookup_build_request ( struct flnl_request *  req,
int  flags 
)

Builds a netlink request message to do a lookup.

Parameters:
req Requested match.
flags additional netlink message flags
Builds a new netlink message requesting a change of link attributes. The netlink message header isn't fully equipped with all relevant fields and must be sent out via nl_send_auto_complete() or supplemented as needed. old must point to a link currently configured in the kernel and tmpl must contain the attributes to be changed set via rtnl_link_set_* functions.

Returns:
New netlink message
Note:
Not all attributes can be changed, see Changeable Attributes for more details.

Definition at line 221 of file lookup.c.

References flnl_request_get_addr(), flnl_request_get_fwmark(), flnl_request_get_scope(), flnl_request_get_table(), flnl_request_get_tos(), nl_addr_get_binary_addr(), nlmsg_append(), nlmsg_build_simple(), and nlmsg_free().

Referenced by flnl_lookup().

int flnl_lookup ( struct nl_handle *  handle,
struct flnl_request *  req,
struct nl_cache *  cache 
)

Perform FIB Lookup.

Parameters:
handle Netlink handle.
req Lookup request object.
cache Cache for result.
Builds a netlink message to request a FIB lookup, waits for the reply and adds the result to the specified cache.

Returns:
0 on success or a negative error code.

Definition at line 272 of file lookup.c.

References flnl_lookup_build_request(), nl_cache_pickup(), nl_send_auto_complete(), and nlmsg_free().


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