diff options
| author | Jouni Malinen <j@w1.fi> | 2012-08-09 14:30:42 -0700 |
|---|---|---|
| committer | Dmitry Shmidt <dimitrysh@google.com> | 2012-08-09 14:38:47 -0700 |
| commit | 831cbc9d2958d1553acd4f58e52569fab4fd64c5 (patch) | |
| tree | 0d3a1451b894bb7d0961b584f3b15823bb733775 /libnl_2 | |
| parent | 845999d232298043c899820c3e9f56e3c00a5845 (diff) | |
| download | system_core-831cbc9d2958d1553acd4f58e52569fab4fd64c5.tar.gz system_core-831cbc9d2958d1553acd4f58e52569fab4fd64c5.tar.bz2 system_core-831cbc9d2958d1553acd4f58e52569fab4fd64c5.zip | |
libnl: Add nla_put_u8/u16/u32/u64() wrapper
Change-Id: I9c07bbff1f678b5c406dbd455c830363af093703
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'libnl_2')
| -rw-r--r-- | libnl_2/attr.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libnl_2/attr.c b/libnl_2/attr.c index f3a2b58c4..2ef759027 100644 --- a/libnl_2/attr.c +++ b/libnl_2/attr.c @@ -160,9 +160,31 @@ int nla_put(struct nl_msg *msg, int attrtype, int datalen, const void *data) } return -EINVAL; +} + +/* Add 8 bit integer attribute to netlink message. */ +int nla_put_u8(struct nl_msg *msg, int attrtype, uint8_t value) +{ + return nla_put(msg, attrtype, sizeof(uint8_t), &value); +} + +/* Add 16 bit integer attribute to netlink message. */ +int nla_put_u16(struct nl_msg *msg, int attrtype, uint16_t value) +{ + return nla_put(msg, attrtype, sizeof(uint16_t), &value); +} +/* Add 32 bit integer attribute to netlink message. */ +int nla_put_u32(struct nl_msg *msg, int attrtype, uint32_t value) +{ + return nla_put(msg, attrtype, sizeof(uint32_t), &value); } +/* Add 64 bit integer attribute to netlink message. */ +int nla_put_u64(struct nl_msg *msg, int attrtype, uint64_t value) +{ + return nla_put(msg, attrtype, sizeof(uint64_t), &value); +} /* Add nested attributes to netlink message. */ /* Takes the attributes found in the nested message and appends them |
