libnl 1.1
|
Modules | |
Classifier Modules | |
Classifier Object | |
Classifier Addition/Modification/Deletion | |
struct nl_msg * | rtnl_cls_build_add_request (struct rtnl_cls *cls, int flags) |
Build a netlink message to add a new classifier. | |
int | rtnl_cls_add (struct nl_handle *handle, struct rtnl_cls *cls, int flags) |
Add a new classifier. | |
struct nl_msg * | rtnl_cls_build_change_request (struct rtnl_cls *cls, int flags) |
Build a netlink message to change classifier attributes. | |
int | rtnl_cls_change (struct nl_handle *handle, struct rtnl_cls *cls, int flags) |
Change a classifier. | |
struct nl_msg * | rtnl_cls_build_delete_request (struct rtnl_cls *cls, int flags) |
Build a netlink request message to delete a classifier. | |
int | rtnl_cls_delete (struct nl_handle *handle, struct rtnl_cls *cls, int flags) |
Delete a classifier. | |
Cache Management | |
struct nl_cache * | rtnl_cls_alloc_cache (struct nl_handle *handle, int ifindex, uint32_t parent) |
Build a classifier cache including all classifiers attached to the specified class/qdisc on eht specified interface. |
struct nl_msg* rtnl_cls_build_add_request | ( | struct rtnl_cls * | cls, |
int | flags | ||
) | [read] |
cls | classifier to add |
flags | additional netlink message flags |
Builds a new netlink message requesting an addition of a classifier 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. classifier must contain the attributes of the new classifier set via rtnl_cls_set_*
functions. opts may point to the clsasifier specific options.
Definition at line 145 of file classifier.c.
References NLM_F_CREATE.
Referenced by rtnl_cls_add().
{ return cls_build(cls, RTM_NEWTFILTER, NLM_F_CREATE | flags); }
int rtnl_cls_add | ( | struct nl_handle * | handle, |
struct rtnl_cls * | cls, | ||
int | flags | ||
) |
handle | netlink handle |
cls | classifier to add |
flags | additional netlink message flags |
Builds a netlink message by calling rtnl_cls_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.
Definition at line 162 of file classifier.c.
References nl_send_auto_complete(), nl_wait_for_ack(), nlmsg_free(), and rtnl_cls_build_add_request().
{ int err; struct nl_msg *msg; msg = rtnl_cls_build_add_request(cls, flags); if (!msg) return nl_errno(ENOMEM); err = nl_send_auto_complete(handle, msg); if (err < 0) return err; nlmsg_free(msg); return nl_wait_for_ack(handle); }
struct nl_msg* rtnl_cls_build_change_request | ( | struct rtnl_cls * | cls, |
int | flags | ||
) | [read] |
cls | classifier to change |
flags | additional netlink message flags |
Builds a new netlink message requesting a change of a neigh attributes. 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.
Definition at line 191 of file classifier.c.
References NLM_F_REPLACE.
Referenced by rtnl_cls_change().
{ return cls_build(cls, RTM_NEWTFILTER, NLM_F_REPLACE | flags); }
int rtnl_cls_change | ( | struct nl_handle * | handle, |
struct rtnl_cls * | cls, | ||
int | flags | ||
) |
handle | netlink handle |
cls | classifier to change |
flags | additional netlink message flags |
Builds a netlink message by calling rtnl_cls_build_change_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.
Definition at line 208 of file classifier.c.
References nl_send_auto_complete(), nl_wait_for_ack(), nlmsg_free(), and rtnl_cls_build_change_request().
{ int err; struct nl_msg *msg; msg = rtnl_cls_build_change_request(cls, flags); if (!msg) return nl_errno(ENOMEM); err = nl_send_auto_complete(handle, msg); if (err < 0) return err; nlmsg_free(msg); return nl_wait_for_ack(handle); }
struct nl_msg* rtnl_cls_build_delete_request | ( | struct rtnl_cls * | cls, |
int | flags | ||
) | [read] |
cls | classifier to delete |
flags | additional netlink message flags |
Builds a new netlink message requesting a deletion of a classifier. 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.
Definition at line 238 of file classifier.c.
Referenced by rtnl_cls_delete().
{
return cls_build(cls, RTM_DELTFILTER, flags);
}
int rtnl_cls_delete | ( | struct nl_handle * | handle, |
struct rtnl_cls * | cls, | ||
int | flags | ||
) |
handle | netlink handle |
cls | classifier to delete |
flags | additional netlink message flags |
Builds a netlink message by calling rtnl_cls_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 processed.
Definition at line 256 of file classifier.c.
References nl_send_auto_complete(), nl_wait_for_ack(), nlmsg_free(), and rtnl_cls_build_delete_request().
{ int err; struct nl_msg *msg; msg = rtnl_cls_build_delete_request(cls, flags); if (!msg) return nl_errno(ENOMEM); err = nl_send_auto_complete(handle, msg); if (err < 0) return err; nlmsg_free(msg); return nl_wait_for_ack(handle); }
struct nl_cache* rtnl_cls_alloc_cache | ( | struct nl_handle * | handle, |
int | ifindex, | ||
uint32_t | parent | ||
) | [read] |
handle | netlink handle |
ifindex | interface index of the link the classes are attached to. |
parent | parent qdisc/class |
Allocates a new cache, initializes it properly and updates it to include all classes attached to the specified interface.
Definition at line 295 of file classifier.c.
References nl_cache_alloc(), nl_cache_free(), and nl_cache_refill().
{ struct nl_cache * cache; cache = nl_cache_alloc(&rtnl_cls_ops); if (cache == NULL) return NULL; cache->c_iarg1 = ifindex; cache->c_iarg2 = parent; if (handle && nl_cache_refill(handle, cache) < 0) { nl_cache_free(cache); return NULL; } return cache; }