~ubuntu-branches/ubuntu/trusty/libnl3/trusty

« back to all changes in this revision

Viewing changes to doc/src/examples/NLA_PUT.c

  • Committer: Bazaar Package Importer
  • Author(s): Heiko Stuebner
  • Date: 2011-05-21 19:25:13 UTC
  • Revision ID: james.westby@ubuntu.com-20110521192513-1ieyu9w9kym4bt16
Tags: upstream-3.0
ImportĀ upstreamĀ versionĀ 3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <netlink/msg.h>
 
2
#include <netlink/attr.h>
 
3
 
 
4
void construct_attrs(struct nl_msg *msg)
 
5
{
 
6
        NLA_PUT_STRING(msg, MY_ATTR_FOO1, "some text");
 
7
        NLA_PUT_U32(msg, MY_ATTR_FOO1, 0x1010);
 
8
        NLA_PUT_FLAG(msg, MY_ATTR_FOO3, 1);
 
9
 
 
10
        return 0;
 
11
 
 
12
nla_put_failure:
 
13
        /* NLA_PUT* macros jump here in case of an error */
 
14
        return -EMSGSIZE;
 
15
}