Lines Matching refs:nlh
70 static int enable_l2_bearer(struct nlmsghdr *nlh, struct opt *opts,
81 mnl_attr_put_strz(nlh, TIPC_NLA_BEARER_NAME, id);
86 static int get_netid_cb(const struct nlmsghdr *nlh, void *data)
88 struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh);
93 mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info);
108 struct nlmsghdr *nlh;
110 if (!(nlh = msg_init(mnl_msg, TIPC_NL_NET_GET))) {
114 if (msg_dumpit(nlh, get_netid_cb, &netid)) {
126 static int enable_udp_bearer(struct nlmsghdr *nlh, struct opt *opts,
200 mnl_attr_put_strz(nlh, TIPC_NLA_BEARER_NAME, name);
202 nest = mnl_attr_nest_start(nlh, TIPC_NLA_BEARER_UDP_OPTS);
203 mnl_attr_put(nlh, TIPC_NLA_UDP_LOCAL, loc->ai_addrlen, loc->ai_addr);
204 mnl_attr_put(nlh, TIPC_NLA_UDP_REMOTE, rem->ai_addrlen, rem->ai_addr);
205 mnl_attr_nest_end(nlh, nest);
224 static int cmd_bearer_enable(struct nlmsghdr *nlh, const struct cmd *cmd,
260 if (!(nlh = msg_init(buf, TIPC_NL_BEARER_ENABLE))) {
264 nest = mnl_attr_nest_start(nlh, TIPC_NLA_BEARER);
267 mnl_attr_put_u32(nlh, TIPC_NLA_BEARER_DOMAIN, atoi(opt->val));
272 props = mnl_attr_nest_start(nlh, TIPC_NLA_BEARER_PROP);
273 mnl_attr_put_u32(nlh, TIPC_NLA_PROP_PRIO, atoi(opt->val));
274 mnl_attr_nest_end(nlh, props);
282 if ((err = enable_udp_bearer(nlh, opts, cmdl)))
289 if ((err = enable_l2_bearer(nlh, opts, cmdl)))
296 mnl_attr_nest_end(nlh, nest);
298 return msg_doit(nlh, NULL, NULL);
301 static int add_l2_bearer(struct nlmsghdr *nlh, struct opt *opts)
312 mnl_attr_put_strz(nlh, TIPC_NLA_BEARER_NAME, id);
317 static int add_udp_bearer(struct nlmsghdr *nlh, struct opt *opts)
328 mnl_attr_put_strz(nlh, TIPC_NLA_BEARER_NAME, id);
352 static int cmd_bearer_disable(struct nlmsghdr *nlh, const struct cmd *cmd,
382 if (!(nlh = msg_init(buf, TIPC_NL_BEARER_DISABLE))) {
387 nest = mnl_attr_nest_start(nlh, TIPC_NLA_BEARER);
394 if ((err = add_udp_bearer(nlh, opts)))
401 if ((err = add_l2_bearer(nlh, opts)))
407 mnl_attr_nest_end(nlh, nest);
409 return msg_doit(nlh, NULL, NULL);
436 static int cmd_bearer_set_prop(struct nlmsghdr *nlh, const struct cmd *cmd,
477 if (!(nlh = msg_init(buf, TIPC_NL_BEARER_SET))) {
481 attrs = mnl_attr_nest_start(nlh, TIPC_NLA_BEARER);
483 props = mnl_attr_nest_start(nlh, TIPC_NLA_BEARER_PROP);
484 mnl_attr_put_u32(nlh, prop, val);
485 mnl_attr_nest_end(nlh, props);
498 if ((err = add_udp_bearer(nlh, opts)))
505 if ((err = add_l2_bearer(nlh, opts)))
511 mnl_attr_nest_end(nlh, attrs);
513 return msg_doit(nlh, NULL, NULL);
516 static int cmd_bearer_set(struct nlmsghdr *nlh, const struct cmd *cmd,
526 return run_cmd(nlh, cmd, cmds, cmdl, NULL);
552 static int bearer_get_cb(const struct nlmsghdr *nlh, void *data)
555 struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh);
560 mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info);
577 static int cmd_bearer_get_prop(struct nlmsghdr *nlh, const struct cmd *cmd,
610 if (!(nlh = msg_init(buf, TIPC_NL_BEARER_GET))) {
621 attrs = mnl_attr_nest_start(nlh, TIPC_NLA_BEARER);
627 if ((err = add_udp_bearer(nlh, opts)))
634 if ((err = add_l2_bearer(nlh, opts)))
640 mnl_attr_nest_end(nlh, attrs);
642 return msg_doit(nlh, bearer_get_cb, &prop);
645 static int cmd_bearer_get(struct nlmsghdr *nlh, const struct cmd *cmd,
655 return run_cmd(nlh, cmd, cmds, cmdl, NULL);
658 static int bearer_list_cb(const struct nlmsghdr *nlh, void *data)
660 struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh);
664 mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info);
681 static int cmd_bearer_list(struct nlmsghdr *nlh, const struct cmd *cmd,
691 if (!(nlh = msg_init(buf, TIPC_NL_BEARER_GET))) {
696 return msg_dumpit(nlh, bearer_list_cb, NULL);
712 int cmd_bearer(struct nlmsghdr *nlh, const struct cmd *cmd, struct cmdl *cmdl,
724 return run_cmd(nlh, cmd, cmds, cmdl, NULL);