summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2018-05-18 16:40:36 +0200
committerLubomir Rintel <lkundrak@v3.sk>2018-06-26 16:21:54 +0200
commitdfa8d35e57e2f8b1200803dd635d71fe95c983be (patch)
treef9c3c2b9122e7c7a4e0ae3230c311cba324745fd
parent732b63ffb7d9c4cc8f3ec04a89a02d0ab3ae5aad (diff)
downloadNetworkManager-dfa8d35e57e2f8b1200803dd635d71fe95c983be.tar.gz
netlink: add signed 8-bit and 32-bit accessors
-rw-r--r--src/platform/nm-netlink.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/platform/nm-netlink.h b/src/platform/nm-netlink.h
index b938fa4a4d..8ae2641d6a 100644
--- a/src/platform/nm-netlink.h
+++ b/src/platform/nm-netlink.h
@@ -177,6 +177,12 @@ nla_get_u8 (const struct nlattr *nla)
}
static inline uint8_t
+nla_get_s8 (const struct nlattr *nla)
+{
+ return *(const int8_t *) nla_data (nla);
+}
+
+static inline uint8_t
nla_get_u8_cond (/*const*/ struct nlattr *const*tb, int attr, uint8_t default_val)
{
nm_assert (tb);
@@ -197,6 +203,12 @@ nla_get_u32(const struct nlattr *nla)
return *(const uint32_t *) nla_data (nla);
}
+static inline int32_t
+nla_get_s32(const struct nlattr *nla)
+{
+ return *(const int32_t *) nla_data (nla);
+}
+
uint64_t nla_get_u64 (const struct nlattr *nla);
static inline char *
@@ -232,12 +244,18 @@ nla_put_string (struct nl_msg *msg, int attrtype, const char *str)
#define NLA_PUT_U8(msg, attrtype, value) \
NLA_PUT_TYPE(msg, uint8_t, attrtype, value)
+#define NLA_PUT_S8(msg, attrtype, value) \
+ NLA_PUT_TYPE(msg, int8_t, attrtype, value)
+
#define NLA_PUT_U16(msg, attrtype, value) \
NLA_PUT_TYPE(msg, uint16_t, attrtype, value)
#define NLA_PUT_U32(msg, attrtype, value) \
NLA_PUT_TYPE(msg, uint32_t, attrtype, value)
+#define NLA_PUT_S32(msg, attrtype, value) \
+ NLA_PUT_TYPE(msg, int32_t, attrtype, value)
+
#define NLA_PUT_U64(msg, attrtype, value) \
NLA_PUT_TYPE(msg, uint64_t, attrtype, value)