本文整理汇总了C++中rtnl_tc_data函数的典型用法代码示例。如果您正苦于以下问题:C++ rtnl_tc_data函数的具体用法?C++ rtnl_tc_data怎么用?C++ rtnl_tc_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rtnl_tc_data函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rtnl_u32_set_hashmask
int rtnl_u32_set_hashmask(struct rtnl_cls *cls, uint32_t hashmask, uint32_t offset)
{
struct rtnl_u32 *u;
struct tc_u32_sel *sel;
int err;
hashmask = htonl(hashmask);
if (!(u = (struct rtnl_u32 *) rtnl_tc_data(TC_CAST(cls))))
return -NLE_NOMEM;
sel = u32_selector_alloc(u);
if (!sel)
return -NLE_NOMEM;
err = nl_data_append(u->cu_selector, NULL, sizeof(struct tc_u32_key));
if(err < 0)
return err;
sel = u32_selector(u);
sel->hmask = hashmask;
sel->hoff = offset;
return 0;
}
开发者ID:celebdor,项目名称:libnl,代码行数:25,代码来源:u32.c
示例2: rtnl_u32_add_key
/**
* Append new 32-bit key to the selector
*
* @arg cls classifier to be modifier
* @arg val value to be matched (network byte-order)
* @arg mask mask to be applied before matching (network byte-order)
* @arg off offset, in bytes, to start matching
* @arg offmask offset mask
*
* General selectors define the pattern, mask and offset the pattern will be
* matched to the packet contents. Using the general selectors you can match
* virtually any single bit in the IP (or upper layer) header.
*
*/
int rtnl_u32_add_key(struct rtnl_cls *cls, uint32_t val, uint32_t mask,
int off, int offmask)
{
struct tc_u32_sel *sel;
struct rtnl_u32 *u;
int err;
if (!(u = rtnl_tc_data(TC_CAST(cls))))
return -NLE_NOMEM;
sel = u32_selector_alloc(u);
if (!sel)
return -NLE_NOMEM;
if (sel->nkeys == UCHAR_MAX)
return -NLE_NOMEM;
err = nl_data_append(u->cu_selector, NULL, sizeof(struct tc_u32_key));
if (err < 0)
return err;
/* the selector might have been moved by realloc */
sel = u32_selector(u);
sel->keys[sel->nkeys].mask = mask;
sel->keys[sel->nkeys].val = val & mask;
sel->keys[sel->nkeys].off = off;
sel->keys[sel->nkeys].offmask = offmask;
sel->nkeys++;
u->cu_mask |= U32_ATTR_SELECTOR;
return 0;
}
开发者ID:Happy-Ferret,项目名称:libnl,代码行数:47,代码来源:u32.c
示例3: rtnl_qdisc_tbf_set_limit_by_latency
/**
* Set limit of TBF qdisc by latency.
* @arg qdisc TBF qdisc to be modified.
* @arg latency Latency in micro seconds.
*
* Calculates and sets the limit based on the desired latency and the
* configured rate and peak rate. In order for this operation to succeed,
* the rate and if required the peak rate must have been set in advance.
*
* @f[
* limit_n = \frac{{rate_n} \times {latency}}{10^6}+{bucketsize}_n
* @f]
* @f[
* limit = min(limit_{rate},limit_{peak})
* @f]
*
* @return 0 on success or a negative error code.
*/
int rtnl_qdisc_tbf_set_limit_by_latency(struct rtnl_qdisc *qdisc, int latency)
{
struct rtnl_tbf *tbf;
double limit, limit2;
if (!(tbf = rtnl_tc_data(TC_CAST(qdisc))))
BUG();
if (!(tbf->qt_mask & TBF_ATTR_RATE))
return -NLE_MISSING_ATTR;
limit = calc_limit(&tbf->qt_rate, latency, tbf->qt_rate_bucket);
if (tbf->qt_mask & TBF_ATTR_PEAKRATE) {
limit2 = calc_limit(&tbf->qt_peakrate, latency,
tbf->qt_peakrate_bucket);
if (limit2 < limit)
limit = limit2;
}
rtnl_qdisc_tbf_set_limit(qdisc, (int) limit);
return 0;
}
开发者ID:BorodaZizitopa,项目名称:libnl,代码行数:43,代码来源:tbf.c
示例4: rtnl_skbedit_get_action
int rtnl_skbedit_get_action(struct rtnl_act *act)
{
struct rtnl_skbedit *u;
if (!(u = (struct rtnl_skbedit *) rtnl_tc_data(TC_CAST(act))))
return -NLE_NOMEM;
return u->s_parm.action;
}
开发者ID:Distrotech,项目名称:libnl,代码行数:8,代码来源:skbedit.c
示例5: rtnl_mirred_get_policy
int rtnl_mirred_get_policy(struct rtnl_act *act)
{
struct rtnl_mirred *u;
if (!(u = (struct rtnl_mirred *) rtnl_tc_data(TC_CAST(act))))
return -NLE_NOMEM;
return u->m_parm.action;
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:8,代码来源:mirred.c
示例6: rtnl_mirred_get_ifindex
uint32_t rtnl_mirred_get_ifindex(struct rtnl_act *act)
{
struct rtnl_mirred *u;
if ((u = (struct rtnl_mirred *) rtnl_tc_data(TC_CAST(act))))
return u->m_parm.ifindex;
return 0;
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:8,代码来源:mirred.c
示例7:
struct rtnl_ematch_tree *rtnl_cgroup_get_ematch(struct rtnl_cls *cls)
{
struct rtnl_cgroup *c;
if (!(c = rtnl_tc_data(TC_CAST(cls))))
BUG();
return c->cg_ematch;
}
开发者ID:Alenevod,项目名称:libnl,代码行数:9,代码来源:cgroup.c
示例8: rtnl_netem_set_limit
/**
* Set limit of netem qdisc.
* @arg qdisc Netem qdisc to be modified.
* @arg limit New limit in bytes.
* @return 0 on success or a negative error code.
*/
void rtnl_netem_set_limit(struct rtnl_qdisc *qdisc, int limit)
{
struct rtnl_netem *netem;
if (!(netem = rtnl_tc_data(TC_CAST(qdisc))))
BUG();
netem->qnm_limit = limit;
netem->qnm_mask |= SCH_NETEM_ATTR_LIMIT;
}
开发者ID:Alenevod,项目名称:libnl,代码行数:16,代码来源:netem.c
示例9: rtnl_qdisc_fq_codel_get_quantum
/**
* Get quantum of a fq_codel qdisc.
* @arg qdisc fq_codel qdisc.
* @return Numeric quantum or zero.
*/
uint32_t rtnl_qdisc_fq_codel_get_quantum(struct rtnl_qdisc *qdisc)
{
struct rtnl_fq_codel *fq_codel;
if ((fq_codel = rtnl_tc_data(TC_CAST(qdisc))) &&
(fq_codel->fq_mask & SCH_FQ_CODEL_ATTR_QUANTUM))
return fq_codel->fq_quantum;
else
return 0;
}
开发者ID:Distrotech,项目名称:libnl,代码行数:15,代码来源:fq_codel.c
示例10: rtnl_qdisc_fq_codel_get_interval
/**
* Get target of a fq_codel qdisc.
* @arg qdisc fq_codel qdisc.
* @return Numeric interval or zero.
*/
uint32_t rtnl_qdisc_fq_codel_get_interval(struct rtnl_qdisc *qdisc)
{
struct rtnl_fq_codel *fq_codel;
if ((fq_codel = rtnl_tc_data(TC_CAST(qdisc))) &&
fq_codel->fq_mask & SCH_FQ_CODEL_ATTR_INTERVAL)
return fq_codel->fq_interval;
else
return 0;
}
开发者ID:Distrotech,项目名称:libnl,代码行数:15,代码来源:fq_codel.c
示例11: rtnl_qdisc_fq_codel_get_target
/**
* Get target of a fq_codel qdisc.
* @arg qdisc fq_codel qdisc.
* @return Numeric target or zero.
*/
uint32_t rtnl_qdisc_fq_codel_get_target(struct rtnl_qdisc *qdisc)
{
struct rtnl_fq_codel *fq_codel;
if ((fq_codel = rtnl_tc_data(TC_CAST(qdisc))) &&
fq_codel->fq_mask & SCH_FQ_CODEL_ATTR_TARGET)
return fq_codel->fq_target;
else
return 0;
}
开发者ID:Distrotech,项目名称:libnl,代码行数:15,代码来源:fq_codel.c
示例12: rtnl_red_set_limit
/**
* Set limit of RED qdisc.
* @arg qdisc RED qdisc to be modified.
* @arg limit New limit in number of packets.
* @return 0 on success or a negative error code.
*/
void rtnl_red_set_limit(struct rtnl_qdisc *qdisc, int limit)
{
struct rtnl_red *red;
if (!(red = rtnl_tc_data(TC_CAST(qdisc))))
BUG();
red->qr_limit = limit;
red->qr_mask |= RED_ATTR_LIMIT;
}
开发者ID:174high,项目名称:libnl-iw-android,代码行数:16,代码来源:red.c
示例13: rtnl_mirred_set_ifindex
int rtnl_mirred_set_ifindex(struct rtnl_act *act, uint32_t ifindex)
{
struct rtnl_mirred *u;
if (!(u = (struct rtnl_mirred *) rtnl_tc_data(TC_CAST(act))))
return -NLE_NOMEM;
u->m_parm.ifindex = ifindex;
return 0;
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:10,代码来源:mirred.c
示例14: rtnl_netem_set_gap
/**
* Set re-ordering gap of netem qdisc.
* @arg qdisc Netem qdisc to be modified.
* @arg gap New gap in number of packets.
* @return 0 on success or a negative error code.
*/
void rtnl_netem_set_gap(struct rtnl_qdisc *qdisc, int gap)
{
struct rtnl_netem *netem;
if (!(netem = rtnl_tc_data(TC_CAST(qdisc))))
BUG();
netem->qnm_gap = gap;
netem->qnm_mask |= SCH_NETEM_ATTR_GAP;
}
开发者ID:Alenevod,项目名称:libnl,代码行数:16,代码来源:netem.c
示例15: rtnl_netem_set_reorder_probability
/**
* Set re-ordering probability of netem qdisc.
* @arg qdisc Netem qdisc to be modified.
* @arg prob New re-ordering probability.
* @return 0 on success or a negative error code.
*/
void rtnl_netem_set_reorder_probability(struct rtnl_qdisc *qdisc, int prob)
{
struct rtnl_netem *netem;
if (!(netem = rtnl_tc_data(TC_CAST(qdisc))))
BUG();
netem->qnm_ro.nmro_probability = prob;
netem->qnm_mask |= SCH_NETEM_ATTR_RO_PROB;
}
开发者ID:Alenevod,项目名称:libnl,代码行数:16,代码来源:netem.c
示例16: rtnl_netem_set_delay_correlation
/**
* Set packet delay correlation probability of netem qdisc.
* @arg qdisc Netem qdisc to be modified.
* @arg prob New packet delay correlation probability.
*/
void rtnl_netem_set_delay_correlation(struct rtnl_qdisc *qdisc, int prob)
{
struct rtnl_netem *netem;
if (!(netem = rtnl_tc_data(TC_CAST(qdisc))))
BUG();
netem->qnm_corr.nmc_delay = prob;
netem->qnm_mask |= SCH_NETEM_ATTR_DELAY_CORR;
}
开发者ID:Alenevod,项目名称:libnl,代码行数:15,代码来源:netem.c
示例17: rtnl_qdisc_tbf_set_limit
/**
* Set limit of TBF qdisc.
* @arg qdisc TBF qdisc to be modified.
* @arg limit New limit in bytes.
* @return 0 on success or a negative error code.
*/
void rtnl_qdisc_tbf_set_limit(struct rtnl_qdisc *qdisc, int limit)
{
struct rtnl_tbf *tbf;
if (!(tbf = rtnl_tc_data(TC_CAST(qdisc))))
BUG();
tbf->qt_limit = limit;
tbf->qt_mask |= TBF_ATTR_LIMIT;
}
开发者ID:BorodaZizitopa,项目名称:libnl,代码行数:16,代码来源:tbf.c
示例18: rtnl_netem_set_delay
/**
* Set packet delay of netem qdisc.
* @arg qdisc Netem qdisc to be modified.
* @arg delay New packet delay in micro seconds.
* @return 0 on success or a negative error code.
*/
void rtnl_netem_set_delay(struct rtnl_qdisc *qdisc, int delay)
{
struct rtnl_netem *netem;
if (!(netem = rtnl_tc_data(TC_CAST(qdisc))))
BUG();
netem->qnm_latency = nl_us2ticks(delay);
netem->qnm_mask |= SCH_NETEM_ATTR_LATENCY;
}
开发者ID:Alenevod,项目名称:libnl,代码行数:16,代码来源:netem.c
示例19: rtnl_netem_set_jitter
/**
* Set packet delay jitter of netem qdisc.
* @arg qdisc Netem qdisc to be modified.
* @arg jitter New packet delay jitter in micro seconds.
* @return 0 on success or a negative error code.
*/
void rtnl_netem_set_jitter(struct rtnl_qdisc *qdisc, int jitter)
{
struct rtnl_netem *netem;
if (!(netem = rtnl_tc_data(TC_CAST(qdisc))))
BUG();
netem->qnm_jitter = nl_us2ticks(jitter);
netem->qnm_mask |= SCH_NETEM_ATTR_JITTER;
}
开发者ID:Alenevod,项目名称:libnl,代码行数:16,代码来源:netem.c
示例20: rtnl_netem_set_duplicate
/**
* Set packet duplication probability of netem qdisc.
* @arg qdisc Netem qdisc to be modified.
* @arg prob New packet duplication probability.
* @return 0 on success or a negative error code.
*/
void rtnl_netem_set_duplicate(struct rtnl_qdisc *qdisc, int prob)
{
struct rtnl_netem *netem;
if (!(netem = rtnl_tc_data(TC_CAST(qdisc))))
BUG();
netem->qnm_duplicate = prob;
netem->qnm_mask |= SCH_NETEM_ATTR_DUPLICATE;
}
开发者ID:Alenevod,项目名称:libnl,代码行数:16,代码来源:netem.c
注:本文中的rtnl_tc_data函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论