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 |
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().
00146 { 00147 return cls_build(cls, RTM_NEWTFILTER, NLM_F_CREATE | flags); 00148 }
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 |
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().
00163 { 00164 int err; 00165 struct nl_msg *msg; 00166 00167 msg = rtnl_cls_build_add_request(cls, flags); 00168 if (!msg) 00169 return nl_errno(ENOMEM); 00170 00171 err = nl_send_auto_complete(handle, msg); 00172 if (err < 0) 00173 return err; 00174 00175 nlmsg_free(msg); 00176 return nl_wait_for_ack(handle); 00177 }
struct nl_msg* rtnl_cls_build_change_request | ( | struct rtnl_cls * | cls, | |
int | flags | |||
) | [read] |
cls | classifier to change | |
flags | additional netlink message flags |
Definition at line 191 of file classifier.c.
References NLM_F_REPLACE.
Referenced by rtnl_cls_change().
00192 { 00193 return cls_build(cls, RTM_NEWTFILTER, NLM_F_REPLACE | flags); 00194 }
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 |
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().
00210 { 00211 int err; 00212 struct nl_msg *msg; 00213 00214 msg = rtnl_cls_build_change_request(cls, flags); 00215 if (!msg) 00216 return nl_errno(ENOMEM); 00217 00218 err = nl_send_auto_complete(handle, msg); 00219 if (err < 0) 00220 return err; 00221 00222 nlmsg_free(msg); 00223 return nl_wait_for_ack(handle); 00224 }
struct nl_msg* rtnl_cls_build_delete_request | ( | struct rtnl_cls * | cls, | |
int | flags | |||
) | [read] |
cls | classifier to delete | |
flags | additional netlink message flags |
Definition at line 238 of file classifier.c.
Referenced by rtnl_cls_delete().
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 |
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().
00257 { 00258 int err; 00259 struct nl_msg *msg; 00260 00261 msg = rtnl_cls_build_delete_request(cls, flags); 00262 if (!msg) 00263 return nl_errno(ENOMEM); 00264 00265 err = nl_send_auto_complete(handle, msg); 00266 if (err < 0) 00267 return err; 00268 00269 nlmsg_free(msg); 00270 return nl_wait_for_ack(handle); 00271 }
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 |
Definition at line 295 of file classifier.c.
References nl_cache_alloc(), nl_cache_free(), and nl_cache_refill().
00297 { 00298 struct nl_cache * cache; 00299 00300 cache = nl_cache_alloc(&rtnl_cls_ops); 00301 if (cache == NULL) 00302 return NULL; 00303 00304 cache->c_iarg1 = ifindex; 00305 cache->c_iarg2 = parent; 00306 00307 if (handle && nl_cache_refill(handle, cache) < 0) { 00308 nl_cache_free(cache); 00309 return NULL; 00310 } 00311 00312 return cache; 00313 }