Example #1
0
int nl_dect_cell_build_msg(struct nl_msg *msg, struct nl_dect_cell *cell)
{
	struct dectmsg dm = {
		.dm_index	= cell->c_index,
	};

	if (nlmsg_append(msg, &dm, sizeof(dm), NLMSG_ALIGNTO) < 0)
		goto nla_put_failure;
	if (cell->ce_mask & CELL_ATTR_NAME)
		NLA_PUT_STRING(msg, DECTA_CELL_NAME, cell->c_name);
	if (cell->ce_mask & CELL_ATTR_FLAGS)
		NLA_PUT_U32(msg, DECTA_CELL_FLAGS, cell->c_flags);
	if (cell->ce_mask & CELL_ATTR_LINK)
		NLA_PUT_U8(msg, DECTA_CELL_CLUSTER, cell->c_link);
	return 0;

nla_put_failure:
	return -NLE_MSGSIZE;
}

static struct trans_tbl cell_flags[] = {
	__ADD(DECT_CELL_CCP,		ccp)
	__ADD(DECT_CELL_SLAVE,		slave)
	__ADD(DECT_CELL_MONITOR,	monitor)
};

char *nl_dect_cell_flags2str(uint32_t flags, char *buf, size_t len)
{
	return __flags2str(flags, buf, len, cell_flags, ARRAY_SIZE(cell_flags));
}

uint32_t nl_dect_cell_str2flags(const char *str)
{
	return __str2flags(str, cell_flags, ARRAY_SIZE(cell_flags));
}

/** @cond SKIP */
struct nl_object_ops nl_dect_cell_obj_ops = {
	.oo_name	= "nl_dect/cell",
	.oo_size	= sizeof(struct nl_dect_cell),
	.oo_free_data	= cell_free_data,
	.oo_dump	= {
		[NL_DUMP_LINE]	= cell_dump,
	},
	.oo_id_attrs	= CELL_ATTR_NAME,
int rtnl_link_vlan_str2flags(const char *name)
{
	return __str2flags(name, vlan_flags, ARRAY_SIZE(vlan_flags));
}
unsigned int nfnl_log_str2flags(const char *name)
{
    return __str2flags(name, log_flags, ARRAY_SIZE(log_flags));
}
Example #4
0
int nfnl_ct_str2status(const char *name)
{
	return __str2flags(name, status_flags, ARRAY_SIZE(status_flags));
}
Example #5
0
int rtnl_route_nh_str2flags(const char *name)
{
	return __str2flags(name, nh_flags, ARRAY_SIZE(nh_flags));
}
Example #6
0
File: ae.c Project: Domikk/libnl
int xfrmnl_ae_str2flag(const char *name)
{
	return __str2flags(name, ae_flags, ARRAY_SIZE(ae_flags));
}
Example #7
0
int nfnl_exp_str2flags(const char *name)
{
	return __str2flags(name, flag_table, ARRAY_SIZE(flag_table));
}
Example #8
0
int rtnl_link_bridge_str2flags(const char *name)
{
	return __str2flags(name, bridge_flags, ARRAY_SIZE(bridge_flags));
}