libnl
3.2.24-rc1
|
Modules | |
Class Based Queueing (CBQ) | |
Differentiated Services Marker (DSMARK) | |
Hierachical Token Bucket (HTB) | |
Allocation/Freeing | |
struct rtnl_class * | rtnl_class_alloc (void) |
void | rtnl_class_put (struct rtnl_class *class) |
Addition/Modification/Deletion | |
int | rtnl_class_build_add_request (struct rtnl_class *class, int flags, struct nl_msg **result) |
Build a netlink message requesting the addition of a traffic class. More... | |
int | rtnl_class_add (struct nl_sock *sk, struct rtnl_class *class, int flags) |
Add/Update traffic class. More... | |
int | rtnl_class_build_delete_request (struct rtnl_class *class, struct nl_msg **result) |
Build netlink message requesting the deletion of a traffic class. More... | |
int | rtnl_class_delete (struct nl_sock *sk, struct rtnl_class *class) |
Delete traffic class. More... | |
Leaf Qdisc | |
struct rtnl_qdisc * | rtnl_class_leaf_qdisc (struct rtnl_class *class, struct nl_cache *cache) |
Lookup the leaf qdisc of a traffic class. More... | |
Cache Related Functions | |
int | rtnl_class_alloc_cache (struct nl_sock *sk, int ifindex, struct nl_cache **result) |
Allocate a cache and fill it with all configured traffic classes. More... | |
struct rtnl_class * | rtnl_class_get (struct nl_cache *cache, int ifindex, uint32_t handle) |
Search traffic class by interface index and handle. More... | |
Deprecated Functions | |
void | rtnl_class_foreach_child (struct rtnl_class *class, struct nl_cache *cache, void(*cb)(struct nl_object *, void *), void *arg) |
Call a callback for each child of a class. More... | |
void | rtnl_class_foreach_cls (struct rtnl_class *class, struct nl_cache *cache, void(*cb)(struct nl_object *, void *), void *arg) |
Call a callback for each classifier attached to the class. More... | |
int rtnl_class_build_add_request | ( | struct rtnl_class * | class, |
int | flags, | ||
struct nl_msg ** | result | ||
) |
Build a netlink message requesting the addition of a traffic class.
class | Traffic class to add |
flags | Additional netlink message flags |
result | Pointer to store resulting netlink message |
The behaviour of this function is identical to rtnl_class_add() with the exception that it will not send the message but return it int the provided return pointer instead.
Definition at line 129 of file class.c.
Referenced by rtnl_class_add().
int rtnl_class_add | ( | struct nl_sock * | sk, |
struct rtnl_class * | class, | ||
int | flags | ||
) |
Add/Update traffic class.
sk | Netlink socket |
class | Traffic class to add |
flags | Additional netlink message flags |
Builds a RTM_NEWTCLASS
netlink message requesting the addition of a new traffic class and sends the message to the kernel. The configuration of the traffic class is derived from the attributes of the specified traffic class.
The following flags may be specified:
NLM_F_CREATE:
Create traffic class if it does not exist, otherwise -NLE_OBJ_NOTFOUND is returned.NLM_F_EXCL:
Return -NLE_EXISTS if a traffic class with matching handle exists already.Existing traffic classes with matching handles will be updated, unless the flag NLM_F_EXCL
is specified. If no matching traffic class exists, it will be created if the flag NLM_F_CREATE
is set, otherwise the error -NLE_OBJ_NOTFOUND is returned.
If the parent qdisc does not support classes, the error NLE_OPNOTSUPP
is returned.
After sending, the function will wait for the ACK or an eventual error message to be received and will therefore block until the operation has been completed.
Definition at line 171 of file class.c.
References nl_send_sync(), and rtnl_class_build_add_request().
int rtnl_class_build_delete_request | ( | struct rtnl_class * | class, |
struct nl_msg ** | result | ||
) |
Build netlink message requesting the deletion of a traffic class.
class | Traffic class to delete |
result | Pointer to store resulting netlink message |
The behaviour of this function is identical to rtnl_class_delete() with the exception that it will not send the message but return it in the provided return pointer instead.
Definition at line 195 of file class.c.
References nlmsg_alloc_simple(), nlmsg_append(), and nlmsg_free().
Referenced by rtnl_class_delete().
int rtnl_class_delete | ( | struct nl_sock * | sk, |
struct rtnl_class * | class | ||
) |
Delete traffic class.
sk | Netlink socket |
class | Traffic class to delete |
Builds a RTM_DELTCLASS
netlink message requesting the deletion of a traffic class and sends the message to the kernel.
The message is constructed out of the following attributes:
ifindex
and handle
(required)parent
(optional, must match if provided)All other class attributes including all class type specific attributes are ignored.
After sending, the function will wait for the ACK or an eventual error message to be received and will therefore block until the operation has been completed.
Definition at line 252 of file class.c.
References nl_send_sync(), and rtnl_class_build_delete_request().
|
read |
Lookup the leaf qdisc of a traffic class.
class | the parent traffic class |
cache | a qdisc cache allocated using rtnl_qdisc_alloc_cache() |
Definition at line 277 of file class.c.
References rtnl_qdisc_get_by_parent().
int rtnl_class_alloc_cache | ( | struct nl_sock * | sk, |
int | ifindex, | ||
struct nl_cache ** | result | ||
) |
Allocate a cache and fill it with all configured traffic classes.
sk | Netlink socket |
ifindex | Interface index of the network device |
result | Pointer to store the created cache |
Allocates a new traffic class cache and fills it with a list of all configured traffic classes on a specific network device. Release the cache with nl_cache_free().
Definition at line 312 of file class.c.
References nl_cache_alloc(), nl_cache_free(), and nl_cache_refill().
|
read |
Search traffic class by interface index and handle.
cache | Traffic class cache |
ifindex | Interface index |
handle | ID of traffic class |
Searches a traffic class cache previously allocated with rtnl_class_alloc_cache() and searches for a traffi class matching the interface index and handle.
The reference counter is incremented before returning the traffic class, therefore the reference must be given back with rtnl_class_put() after usage.
Definition at line 353 of file class.c.
References nl_object_get().
void rtnl_class_foreach_child | ( | struct rtnl_class * | class, |
struct nl_cache * | cache, | ||
void(*)(struct nl_object *, void *) | cb, | ||
void * | arg | ||
) |
Call a callback for each child of a class.
Definition at line 383 of file class.c.
References nl_cache_foreach_filter(), rtnl_tc_set_ifindex(), rtnl_tc_set_kind(), rtnl_tc_set_parent(), and TC_CAST.
void rtnl_class_foreach_cls | ( | struct rtnl_class * | class, |
struct nl_cache * | cache, | ||
void(*)(struct nl_object *, void *) | cb, | ||
void * | arg | ||
) |
Call a callback for each classifier attached to the class.
Definition at line 406 of file class.c.
References nl_cache_foreach_filter(), rtnl_tc_set_ifindex(), and rtnl_tc_set_parent().