Modules | |
Class Modules | |
Class Object | |
Addition/Modification | |
| |
struct nl_msg * | rtnl_class_build_add_request (struct rtnl_class *class, int flags) |
Build a netlink message to add a new class. | |
int | rtnl_class_add (struct nl_handle *handle, struct rtnl_class *class, int flags) |
Add a new class. | |
Cache Management | |
| |
struct nl_cache * | rtnl_class_alloc_cache (struct nl_handle *handle, int ifindex) |
Build a class cache including all classes attached to the specified interface. |
struct nl_msg* rtnl_class_build_add_request | ( | struct rtnl_class * | class, | |
int | flags | |||
) | [read] |
class | class to add | |
flags | additional netlink message flags |
Builds a new netlink message requesting an addition of a class. 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.
Common message flags
Definition at line 128 of file class.c.
References NLM_F_CREATE.
Referenced by rtnl_class_add().
00129 { 00130 return class_build(class, RTM_NEWTCLASS, NLM_F_CREATE | flags); 00131 }
int rtnl_class_add | ( | struct nl_handle * | handle, | |
struct rtnl_class * | class, | |||
int | flags | |||
) |
handle | netlink handle | |
class | class to delete | |
flags | additional netlink message flags |
Builds a netlink message by calling rtnl_qdisc_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 processed.
Common message flags
Definition at line 148 of file class.c.
References nl_send_auto_complete(), nl_wait_for_ack(), nlmsg_free(), and rtnl_class_build_add_request().
00150 { 00151 struct nl_msg *msg; 00152 int err; 00153 00154 msg = rtnl_class_build_add_request(class, flags); 00155 if (!msg) 00156 return nl_errno(ENOMEM); 00157 00158 err = nl_send_auto_complete(handle, msg); 00159 if (err < 0) 00160 return err; 00161 00162 nlmsg_free(msg); 00163 return nl_wait_for_ack(handle); 00164 }
struct nl_cache* rtnl_class_alloc_cache | ( | struct nl_handle * | handle, | |
int | ifindex | |||
) | [read] |
handle | netlink handle | |
ifindex | interface index of the link the classes are attached to. |
Allocates a new cache, initializes it properly and updates it to include all classes attached to the specified interface.
Definition at line 184 of file class.c.
References nl_cache_alloc(), nl_cache_free(), and nl_cache_refill().
00185 { 00186 struct nl_cache * cache; 00187 00188 cache = nl_cache_alloc(&rtnl_class_ops); 00189 if (!cache) 00190 return NULL; 00191 00192 cache->c_iarg1 = ifindex; 00193 00194 if (handle && nl_cache_refill(handle, cache) < 0) { 00195 nl_cache_free(cache); 00196 return NULL; 00197 } 00198 00199 return cache; 00200 }