Routing Rules
[Routing Netlink]


Function Documentation

struct nl_cache* rtnl_rule_alloc_cache_by_family ( struct nl_handle *  handle,
int  family 
) [read]

Parameters:
handle netlink handle
family address family
Allocates a new rule cache, initializes it properly and updates it to include all rules of the specified address family currently configured in the kernel.

Note:
The caller is responsible for destroying and freeing the cache after using it. (nl_cache_destroy_and_free())
Returns:
The new cache or NULL if an error occured.

Definition at line 449 of file rule.c.

References nl_cache_alloc(), and nl_cache_refill().

Referenced by rtnl_rule_alloc_cache().

struct nl_cache* rtnl_rule_alloc_cache ( struct nl_handle *  handle  )  [read]

Parameters:
handle netlink handle
Allocates a new rule cache, initializes it properly and updates it to include all rules currently configured in the kernel.

Note:
The caller is responsible for destroying and freeing the cache after using it. (nl_cache_destroy_and_free())
Returns:
The new cache or NULL if an error occured.

Definition at line 479 of file rule.c.

References rtnl_rule_alloc_cache_by_family().

struct nl_msg* rtnl_rule_build_add_request ( struct rtnl_rule *  tmpl,
int  flags 
) [read]

Parameters:
tmpl template with data of new rule
flags additional netlink message flags
Builds a new netlink message requesting a addition of a new rule. The netlink message header isn't fully equipped with all relevant fields and must thus be sent out via nl_send_auto_complete() or supplemented as needed. tmpl must contain the attributes of the new address set via rtnl_rule_set_* functions.

Returns:
The netlink message

Definition at line 564 of file rule.c.

References NLM_F_CREATE.

Referenced by rtnl_rule_add().

int rtnl_rule_add ( struct nl_handle *  handle,
struct rtnl_rule *  tmpl,
int  flags 
)

Parameters:
handle netlink handle
tmpl template with requested changes
flags additional netlink message flags
Builds a netlink message by calling rtnl_rule_build_add_request(), sends the request to the kernel and waits for the next ACK to be received and thus blocks until the request has been fullfilled.

Returns:
0 on sucess or a negative error if an error occured.

Definition at line 581 of file rule.c.

References nl_send_auto_complete(), nl_wait_for_ack(), nlmsg_free(), and rtnl_rule_build_add_request().

struct nl_msg* rtnl_rule_build_delete_request ( struct rtnl_rule *  rule,
int  flags 
) [read]

Parameters:
rule rule to delete
flags additional netlink message flags
Builds a new netlink message requesting a deletion of a rule. The netlink message header isn't fully equipped with all relevant fields and must thus be sent out via nl_send_auto_complete() or supplemented as needed. rule must point to an existing address.

Returns:
The netlink message

Definition at line 618 of file rule.c.

Referenced by rtnl_rule_delete().

int rtnl_rule_delete ( struct nl_handle *  handle,
struct rtnl_rule *  rule,
int  flags 
)

Parameters:
handle netlink handle
rule rule to delete
flags additional netlink message flags
Builds a netlink message by calling rtnl_rule_build_delete_request(), sends the request to the kernel and waits for the next ACK to be received and thus blocks until the request has been fullfilled.

Returns:
0 on sucess or a negative error if an error occured.

Definition at line 635 of file rule.c.

References nl_send_auto_complete(), nl_wait_for_ack(), nlmsg_free(), and rtnl_rule_build_delete_request().


Generated on Thu May 28 01:01:27 2009 for libnl by  doxygen 1.5.7.1