summaryrefslogtreecommitdiffstats
path: root/lib/msg.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2010-11-22 12:13:04 (GMT)
committerThomas Graf <tgraf@suug.ch>2010-11-22 12:13:04 (GMT)
commite52a09c5078364f0a645f407c797e68a2c1d5f04 (patch)
tree41ec65416103c790722d9e616cff4dbe087aaace /lib/msg.c
parent6545206187c97136d69c5a456257cafa104667bc (diff)
downloadlibnl-e52a09c5078364f0a645f407c797e68a2c1d5f04.zip
libnl-e52a09c5078364f0a645f407c797e68a2c1d5f04.tar.gz
libnl-e52a09c5078364f0a645f407c797e68a2c1d5f04.tar.bz2
nl: rename nlmsg_msg_size() to nlmsg_size(), nlmsg_len() -> nlmsg_datalen()
The old symbols are left around for compatibility.
Diffstat (limited to 'lib/msg.c')
-rw-r--r--lib/msg.c58
1 files changed, 45 insertions, 13 deletions
diff --git a/lib/msg.c b/lib/msg.c
index f6d1ee4..95ad188 100644
--- a/lib/msg.c
+++ b/lib/msg.c
@@ -178,17 +178,32 @@ static void __init init_msg_size(void)
*/
/**
- * length of netlink message not including padding
- * @arg payload length of message payload
+ * Calculates size of netlink message based on payload length.
+ * @arg payload Length of payload
+ *
+ * See \ref core_msg_fmt_align for more information on alignment.
+ *
+ * @return size of netlink message without padding.
*/
-int nlmsg_msg_size(int payload)
+int nlmsg_size(int payload)
{
return NLMSG_HDRLEN + payload;
}
+int nlmsg_msg_size(int payload)
+{
+ return nlmsg_size(payload);
+}
+
/**
- * length of netlink message including padding
- * @arg payload length of message payload
+ * Calculates size of netlink message including padding based on payload length
+ * @arg payload Length of payload
+ *
+ * This function is idential to nlmsg_size() + nlmsg_padlen().
+ *
+ * See \ref core_msg_fmt_align for more information on alignment.
+ *
+ * @return Size of netlink message including padding.
*/
int nlmsg_total_size(int payload)
{
@@ -196,8 +211,16 @@ int nlmsg_total_size(int payload)
}
/**
- * length of padding at the message's tail
- * @arg payload length of message payload
+ * Size of padding that needs to be added at end of message
+ * @arg payload Length of payload
+ *
+ * Calculates the number of bytes of padding which is required to be added to
+ * the end of the message to ensure that the next netlink message header begins
+ * properly aligned to NLMSG_ALIGNTO.
+ *
+ * See \ref core_msg_fmt_align for more information on alignment.
+ *
+ * @return Number of bytes of padding needed.
*/
int nlmsg_padlen(int payload)
{
@@ -207,13 +230,15 @@ int nlmsg_padlen(int payload)
/** @} */
/**
- * @name Payload Access
+ * @name Access to Message Payload
* @{
*/
/**
- * head of message payload
- * @arg nlh netlink messsage header
+ * Return pointer to message payload
+ * @arg nlh Netlink message header
+ *
+ * @return Pointer to start of message payload.
*/
void *nlmsg_data(const struct nlmsghdr *nlh)
{
@@ -226,14 +251,21 @@ void *nlmsg_tail(const struct nlmsghdr *nlh)
}
/**
- * length of message payload
- * @arg nlh netlink message header
+ * Return length of message payload
+ * @arg nlh Netlink message header
+ *
+ * @return Length of message payload in bytes.
*/
-int nlmsg_len(const struct nlmsghdr *nlh)
+int nlmsg_datalen(const struct nlmsghdr *nlh)
{
return nlh->nlmsg_len - NLMSG_HDRLEN;
}
+int nlmsg_len(const struct nlmsghdr *nlh)
+{
+ return nlmsg_datalen(nlh);
+}
+
/** @} */
/**