libnl 3.7.0
|
Modules | |
Class Based Queueing (CBQ) | |
Differentiated Services Marker (DSMARK) | |
Hierachical Token Bucket (HTB) | |
Hierarchical Fair Service Curve (HFSC) | |
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... | |
struct rtnl_class * | rtnl_class_get_by_parent (struct nl_cache *cache, int ifindex, uint32_t parent) |
Search class by interface index and parent. 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 123 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 165 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 189 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 246 of file class.c.
References nl_send_sync(), and rtnl_class_build_delete_request().
struct rtnl_qdisc * rtnl_class_leaf_qdisc | ( | struct rtnl_class * | class, |
struct nl_cache * | cache | ||
) |
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 271 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 306 of file class.c.
References nl_cache_alloc(), nl_cache_free(), and nl_cache_refill().
struct rtnl_class * rtnl_class_get | ( | struct nl_cache * | cache, |
int | ifindex, | ||
uint32_t | handle | ||
) |
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 347 of file class.c.
References nl_object_get().
struct rtnl_class * rtnl_class_get_by_parent | ( | struct nl_cache * | cache, |
int | ifindex, | ||
uint32_t | parent | ||
) |
Search class by interface index and parent.
cache | Traffic class cache |
ifindex | Interface index |
parent | Handle of parent qdisc |
Searches a class cache previously allocated with rtnl_class_alloc_cache() and searches for a class matching the interface index and parent qdisc.
The reference counter is incremented before returning the class, therefore the reference must be given back with rtnl_class_put() after usage.
Definition at line 378 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 409 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 432 of file class.c.
References nl_cache_foreach_filter(), rtnl_tc_set_ifindex(), and rtnl_tc_set_parent().