NLA_FLAG, /**< Flag */
NLA_MSECS, /**< Micro seconds (64bit) */
NLA_NESTED, /**< Nested attributes */
+ NLA_NESTED_COMPAT,
+ NLA_NUL_STRING,
+ NLA_BINARY,
+ NLA_S8,
+ NLA_S16,
+ NLA_S32,
+ NLA_S64,
__NLA_TYPE_MAX,
};
extern int nla_put_addr(struct nl_msg *, int, struct nl_addr *);
/* Integer attribute */
+extern int8_t nla_get_s8(const struct nlattr *);
+extern int nla_put_s8(struct nl_msg *, int, int8_t);
extern uint8_t nla_get_u8(const struct nlattr *);
extern int nla_put_u8(struct nl_msg *, int, uint8_t);
+extern int16_t nla_get_s16(const struct nlattr *);
+extern int nla_put_s16(struct nl_msg *, int, int16_t);
extern uint16_t nla_get_u16(const struct nlattr *);
extern int nla_put_u16(struct nl_msg *, int, uint16_t);
extern int32_t nla_get_s32(const struct nlattr *);
extern int nla_put_s32(struct nl_msg *, int, int32_t);
extern uint32_t nla_get_u32(const struct nlattr *);
extern int nla_put_u32(struct nl_msg *, int, uint32_t);
+extern int64_t nla_get_s64(const struct nlattr *);
+extern int nla_put_s64(struct nl_msg *, int, int64_t);
extern uint64_t nla_get_u64(const struct nlattr *);
extern int nla_put_u64(struct nl_msg *, int, uint64_t);
NLA_PUT(msg, attrtype, sizeof(type), &__tmp); \
} while(0)
+/**
+ * Add 8 bit signed integer attribute to netlink message.
+ * @arg msg Netlink message.
+ * @arg attrtype Attribute type.
+ * @arg value Numeric value.
+ */
+#define NLA_PUT_S8(msg, attrtype, value) \
+ NLA_PUT_TYPE(msg, int8_t, attrtype, value)
+
/**
* Add 8 bit integer attribute to netlink message.
* @arg msg Netlink message.
#define NLA_PUT_U8(msg, attrtype, value) \
NLA_PUT_TYPE(msg, uint8_t, attrtype, value)
+/**
+ * Add 16 bit signed integer attribute to netlink message.
+ * @arg msg Netlink message.
+ * @arg attrtype Attribute type.
+ * @arg value Numeric value.
+ */
+#define NLA_PUT_S16(msg, attrtype, value) \
+ NLA_PUT_TYPE(msg, int16_t, attrtype, value)
+
/**
* Add 16 bit integer attribute to netlink message.
* @arg msg Netlink message.
NLA_PUT_TYPE(msg, uint16_t, attrtype, value)
/**
- * Add 32 bit integer attribute to netlink message.
+ * Add 32 bit signed integer attribute to netlink message.
* @arg msg Netlink message.
* @arg attrtype Attribute type.
* @arg value Numeric value.
#define NLA_PUT_U32(msg, attrtype, value) \
NLA_PUT_TYPE(msg, uint32_t, attrtype, value)
+/**
+ * Add 64 bit signed integer attribute to netlink message.
+ * @arg msg Netlink message.
+ * @arg attrtype Attribute type.
+ * @arg value Numeric value.
+ */
+#define NLA_PUT_S64(msg, attrtype, value) \
+ NLA_PUT_TYPE(msg, int64_t, attrtype, value)
+
/**
* Add 64 bit integer attribute to netlink message.
* @arg msg Netlink message.
* @name Integer Attributes
*/
+/**
+ * Add 8 bit signed integer attribute to netlink message.
+ * @arg msg Netlink message.
+ * @arg attrtype Attribute type.
+ * @arg value Numeric value to store as payload.
+ *
+ * @see nla_put
+ * @return 0 on success or a negative error code.
+ */
+int nla_put_s8(struct nl_msg *msg, int attrtype, int8_t value)
+{
+ return nla_put(msg, attrtype, sizeof(int8_t), &value);
+}
+
+/**
+ * Return value of 8 bit signed integer attribute.
+ * @arg nla 8 bit integer attribute
+ *
+ * @return Payload as 8 bit integer.
+ */
+int8_t nla_get_s8(const struct nlattr *nla)
+{
+ return *(const int8_t *) nla_data(nla);
+}
+
/**
* Add 8 bit integer attribute to netlink message.
* @arg msg Netlink message.
return *(const uint8_t *) nla_data(nla);
}
+/**
+ * Add 16 bit signed integer attribute to netlink message.
+ * @arg msg Netlink message.
+ * @arg attrtype Attribute type.
+ * @arg value Numeric value to store as payload.
+ *
+ * @see nla_put
+ * @return 0 on success or a negative error code.
+ */
+int nla_put_s16(struct nl_msg *msg, int attrtype, int16_t value)
+{
+ return nla_put(msg, attrtype, sizeof(int16_t), &value);
+}
+
+/**
+ * Return payload of 16 bit signed integer attribute.
+ * @arg nla 16 bit integer attribute
+ *
+ * @return Payload as 16 bit integer.
+ */
+int16_t nla_get_s16(const struct nlattr *nla)
+{
+ return *(const int16_t *) nla_data(nla);
+}
+
/**
* Add 16 bit integer attribute to netlink message.
* @arg msg Netlink message.
}
/**
- * Add 32 bit integer attribute to netlink message.
- * @arg msg Netlink message.
- * @arg attrtype Attribute type.
- * @arg value Numeric value to store as payload.
+ * Add 32 bit signed integer attribute to netlink message.
+ * @arg msg Netlink message.
+ * @arg attrtype Attribute type.
+ * @arg value Numeric value to store as payload.
*
* @see nla_put
* @return 0 on success or a negative error code.
}
/**
- * Return payload of 32 bit integer attribute.
- * @arg nla 32 bit integer attribute.
+ * Return payload of 32 bit signed integer attribute.
+ * @arg nla 32 bit integer attribute.
*
* @return Payload as 32 bit integer.
*/
return *(const uint32_t *) nla_data(nla);
}
+/**
+ * Add 64 bit signed integer attribute to netlink message.
+ * @arg msg Netlink message.
+ * @arg attrtype Attribute type.
+ * @arg value Numeric value to store as payload.
+ *
+ * @see nla_put
+ * @return 0 on success or a negative error code.
+ */
+int nla_put_s64(struct nl_msg *msg, int attrtype, int64_t value)
+{
+ return nla_put(msg, attrtype, sizeof(int64_t), &value);
+}
+
+/**
+ * Return payload of s64 attribute
+ * @arg nla s64 netlink attribute
+ *
+ * @return Payload as 64 bit integer.
+ */
+int64_t nla_get_s64(const struct nlattr *nla)
+{
+ int64_t tmp = 0;
+
+ if (nla && nla_len(nla) >= sizeof(tmp))
+ memcpy(&tmp, nla_data(nla), sizeof(tmp));
+
+ return tmp;
+}
+
/**
* Add 64 bit integer attribute to netlink message.
* @arg msg Netlink message.