diff options
author | Thomas Graf <tgraf@suug.ch> | 2010-11-22 12:13:04 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2010-11-22 12:13:04 (GMT) |
commit | e52a09c5078364f0a645f407c797e68a2c1d5f04 (patch) | |
tree | 41ec65416103c790722d9e616cff4dbe087aaace /lib | |
parent | 6545206187c97136d69c5a456257cafa104667bc (diff) | |
download | libnl-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')
-rw-r--r-- | lib/attr.c | 2 | ||||
-rw-r--r-- | lib/msg.c | 58 | ||||
-rw-r--r-- | lib/nl.c | 2 |
3 files changed, 47 insertions, 15 deletions
@@ -1115,7 +1115,7 @@ int nla_put_nested(struct nl_msg *msg, int attrtype, struct nl_msg *nested) NL_DBG(2, "msg %p: attr <> %d: adding msg %p as nested attribute\n", msg, attrtype, nested); - return nla_put(msg, attrtype, nlmsg_len(nested->nm_nlh), + return nla_put(msg, attrtype, nlmsg_datalen(nested->nm_nlh), nlmsg_data(nested->nm_nlh)); } @@ -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); +} + /** @} */ /** @@ -637,7 +637,7 @@ continue_reading: else if (hdr->nlmsg_type == NLMSG_ERROR) { struct nlmsgerr *e = nlmsg_data(hdr); - if (hdr->nlmsg_len < nlmsg_msg_size(sizeof(*e))) { + if (hdr->nlmsg_len < nlmsg_size(sizeof(*e))) { /* Truncated error message, the default action * is to stop parsing. The user may overrule * this action by returning NL_SKIP or |