nla_nest_start.c

00001 int put_opts(struct nl_msg *msg)
00002 {
00003         struct nlattr *opts;
00004 
00005         if (!(opts = nla_nest_start(msg, ATTR_OPTS)))
00006                 goto nla_put_failure;
00007 
00008         NLA_PUT_U32(msg, NESTED_FOO, 123);
00009         NLA_PUT_STRING(msg, NESTED_BAR, "some text");
00010 
00011         nla_nest_end(msg, opts);
00012         return 0;
00013 
00014 nla_put_failure:
00015         return -EMSGSIZE;
00016 }