libnl 1.1.4
Variables

Variables

struct nl_object_ops qdisc_obj_ops
 

Allocation/Freeing

struct rtnl_qdisc * rtnl_qdisc_alloc (void)
 
void rtnl_qdisc_put (struct rtnl_qdisc *qdisc)
 

Iterators

void rtnl_qdisc_foreach_child (struct rtnl_qdisc *qdisc, struct nl_cache *cache, void(*cb)(struct nl_object *, void *), void *arg)
 Call a callback for each child class of a qdisc.
 
void rtnl_qdisc_foreach_cls (struct rtnl_qdisc *qdisc, struct nl_cache *cache, void(*cb)(struct nl_object *, void *), void *arg)
 Call a callback for each filter attached to the qdisc.
 

Attributes

void rtnl_qdisc_set_ifindex (struct rtnl_qdisc *qdisc, int ifindex)
 
int rtnl_qdisc_get_ifindex (struct rtnl_qdisc *qdisc)
 
void rtnl_qdisc_set_handle (struct rtnl_qdisc *qdisc, uint32_t handle)
 
uint32_t rtnl_qdisc_get_handle (struct rtnl_qdisc *qdisc)
 
void rtnl_qdisc_set_parent (struct rtnl_qdisc *qdisc, uint32_t parent)
 
uint32_t rtnl_qdisc_get_parent (struct rtnl_qdisc *qdisc)
 
void rtnl_qdisc_set_kind (struct rtnl_qdisc *qdisc, const char *name)
 
char * rtnl_qdisc_get_kind (struct rtnl_qdisc *qdisc)
 
uint64_t rtnl_qdisc_get_stat (struct rtnl_qdisc *qdisc, enum rtnl_tc_stats_id id)
 

Qdisc Specific Options

struct nl_msg * rtnl_qdisc_get_opts (struct rtnl_qdisc *qdisc)
 Return qdisc specific options for use in TCA_OPTIONS.
 

Detailed Description

Function Documentation

◆ rtnl_qdisc_alloc()

struct rtnl_qdisc * rtnl_qdisc_alloc ( void  )

Definition at line 114 of file qdisc_obj.c.

115{
116 return (struct rtnl_qdisc *) nl_object_alloc(&qdisc_obj_ops);
117}
struct nl_object * nl_object_alloc(struct nl_object_ops *ops)
Allocate a new object of kind specified by the operations handle.
Definition: object.c:42

◆ rtnl_qdisc_put()

void rtnl_qdisc_put ( struct rtnl_qdisc *  qdisc)

Definition at line 119 of file qdisc_obj.c.

120{
121 nl_object_put((struct nl_object *) qdisc);
122}
void nl_object_put(struct nl_object *obj)
Release a reference from an object.
Definition: object.c:178

◆ rtnl_qdisc_foreach_child()

void rtnl_qdisc_foreach_child ( struct rtnl_qdisc *  qdisc,
struct nl_cache *  cache,
void(*)(struct nl_object *, void *)  cb,
void *  arg 
)
Parameters
qdiscthe parent qdisc
cachea class cache including all classes of the interface the specified qdisc is attached to
cbcallback function
argargument to be passed to callback function

Definition at line 139 of file qdisc_obj.c.

141{
142 struct rtnl_class *filter;
143
144 filter = rtnl_class_alloc();
145 if (!filter)
146 return;
147
148 rtnl_class_set_parent(filter, qdisc->q_handle);
149 rtnl_class_set_ifindex(filter, qdisc->q_ifindex);
150 rtnl_class_set_kind(filter, qdisc->q_kind);
151
152 nl_cache_foreach_filter(cache, (struct nl_object *) filter, cb, arg);
153
154 rtnl_class_put(filter);
155}
void nl_cache_foreach_filter(struct nl_cache *cache, struct nl_object *filter, void(*cb)(struct nl_object *, void *), void *arg)
Call a callback on each element of the cache (filtered).
Definition: cache.c:808

References nl_cache_foreach_filter().

◆ rtnl_qdisc_foreach_cls()

void rtnl_qdisc_foreach_cls ( struct rtnl_qdisc *  qdisc,
struct nl_cache *  cache,
void(*)(struct nl_object *, void *)  cb,
void *  arg 
)
Parameters
qdiscthe parent qdisc
cachea filter cache including at least all the filters attached to the specified qdisc
cbcallback function
argargument to be passed to callback function

Definition at line 165 of file qdisc_obj.c.

167{
168 struct rtnl_cls *filter;
169
170 filter = rtnl_cls_alloc();
171 if (!filter)
172 return;
173
174 rtnl_cls_set_ifindex(filter, qdisc->q_ifindex);
175 rtnl_cls_set_parent(filter, qdisc->q_parent);
176
177 nl_cache_foreach_filter(cache, (struct nl_object *) filter, cb, arg);
178 rtnl_cls_put(filter);
179}

References nl_cache_foreach_filter().

◆ rtnl_qdisc_set_ifindex()

void rtnl_qdisc_set_ifindex ( struct rtnl_qdisc *  qdisc,
int  ifindex 
)

Definition at line 188 of file qdisc_obj.c.

189{
190 tca_set_ifindex((struct rtnl_tca *) qdisc, ifindex);
191}

◆ rtnl_qdisc_get_ifindex()

int rtnl_qdisc_get_ifindex ( struct rtnl_qdisc *  qdisc)

Definition at line 193 of file qdisc_obj.c.

194{
195 return tca_get_ifindex((struct rtnl_tca *) qdisc);
196}

◆ rtnl_qdisc_set_handle()

void rtnl_qdisc_set_handle ( struct rtnl_qdisc *  qdisc,
uint32_t  handle 
)

Definition at line 198 of file qdisc_obj.c.

199{
200 tca_set_handle((struct rtnl_tca *) qdisc, handle);
201}

◆ rtnl_qdisc_get_handle()

uint32_t rtnl_qdisc_get_handle ( struct rtnl_qdisc *  qdisc)

Definition at line 203 of file qdisc_obj.c.

204{
205 return tca_get_handle((struct rtnl_tca *) qdisc);
206}

◆ rtnl_qdisc_set_parent()

void rtnl_qdisc_set_parent ( struct rtnl_qdisc *  qdisc,
uint32_t  parent 
)

Definition at line 208 of file qdisc_obj.c.

209{
210 tca_set_parent((struct rtnl_tca *) qdisc, parent);
211}

◆ rtnl_qdisc_get_parent()

uint32_t rtnl_qdisc_get_parent ( struct rtnl_qdisc *  qdisc)

Definition at line 213 of file qdisc_obj.c.

214{
215 return tca_get_parent((struct rtnl_tca *) qdisc);
216}

◆ rtnl_qdisc_set_kind()

void rtnl_qdisc_set_kind ( struct rtnl_qdisc *  qdisc,
const char *  name 
)

Definition at line 218 of file qdisc_obj.c.

219{
220 tca_set_kind((struct rtnl_tca *) qdisc, name);
221 qdisc->q_ops = __rtnl_qdisc_lookup_ops(name);
222}

◆ rtnl_qdisc_get_kind()

char * rtnl_qdisc_get_kind ( struct rtnl_qdisc *  qdisc)

Definition at line 224 of file qdisc_obj.c.

225{
226 return tca_get_kind((struct rtnl_tca *) qdisc);
227}

◆ rtnl_qdisc_get_stat()

uint64_t rtnl_qdisc_get_stat ( struct rtnl_qdisc *  qdisc,
enum rtnl_tc_stats_id  id 
)

Definition at line 229 of file qdisc_obj.c.

231{
232 return tca_get_stat((struct rtnl_tca *) qdisc, id);
233}

◆ rtnl_qdisc_get_opts()

struct nl_msg * rtnl_qdisc_get_opts ( struct rtnl_qdisc *  qdisc)
Parameters
qdiscqdisc carrying the optiosn
Returns
new headerless netlink message carrying the options as payload

Definition at line 248 of file qdisc_obj.c.

249{
250 struct rtnl_qdisc_ops *ops;
251
252 ops = rtnl_qdisc_lookup_ops(qdisc);
253 if (ops && ops->qo_get_opts)
254 return ops->qo_get_opts(qdisc);
255
256 return NULL;
257}
Qdisc Operations.
Definition: qdisc-modules.h:26
struct nl_msg *(* qo_get_opts)(struct rtnl_qdisc *)
Must return the contents supposed to be in TCA_OPTIONS.
Definition: qdisc-modules.h:41

References rtnl_qdisc_ops::qo_get_opts.

Variable Documentation

◆ qdisc_obj_ops

struct nl_object_ops qdisc_obj_ops
Initial value:
= {
.oo_name = "route/qdisc",
.oo_size = sizeof(struct rtnl_qdisc),
.oo_free_data = qdisc_free_data,
.oo_clone = qdisc_clone,
.oo_dump[NL_DUMP_BRIEF] = qdisc_dump_brief,
.oo_dump[NL_DUMP_FULL] = qdisc_dump_full,
.oo_dump[NL_DUMP_STATS] = qdisc_dump_stats,
.oo_compare = tca_compare,
.oo_id_attrs = (TCA_ATTR_IFINDEX | TCA_ATTR_HANDLE),
}
@ NL_DUMP_FULL
Dump all attributes but no statistics.
Definition: types.h:23
@ NL_DUMP_BRIEF
Dump object in a brief one-liner.
Definition: types.h:22
@ NL_DUMP_STATS
Dump all attributes including statistics.
Definition: types.h:24

Definition at line 261 of file qdisc_obj.c.