diff options
-rw-r--r-- | examples/genl-family-get.c | 2 | ||||
-rw-r--r-- | examples/rtnl-link-dump.c | 2 | ||||
-rw-r--r-- | examples/rtnl-link-dump2.c | 2 | ||||
-rw-r--r-- | examples/rtnl-link-dump3.c | 2 | ||||
-rw-r--r-- | examples/rtnl-link-event.c | 2 | ||||
-rw-r--r-- | examples/rtnl-route-dump.c | 2 | ||||
-rw-r--r-- | include/libmnl/libmnl.h | 12 | ||||
-rw-r--r-- | src/attr.c | 24 | ||||
-rw-r--r-- | src/callback.c | 2 | ||||
-rw-r--r-- | src/nlmsg.c | 12 |
10 files changed, 31 insertions, 31 deletions
diff --git a/examples/genl-family-get.c b/examples/genl-family-get.c index ddbb557..674a529 100644 --- a/examples/genl-family-get.c +++ b/examples/genl-family-get.c @@ -146,7 +146,7 @@ static int data_attr_cb(const struct nlattr *attr, void *data) static int data_cb(const struct nlmsghdr *nlh, void *data) { struct nlattr *tb[CTRL_ATTR_MAX+1] = {}; - struct genlmsghdr *genl = mnl_nlmsg_get_data(nlh); + struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); mnl_attr_parse(nlh, sizeof(*genl), data_attr_cb, tb); if (tb[CTRL_ATTR_FAMILY_NAME]) { diff --git a/examples/rtnl-link-dump.c b/examples/rtnl-link-dump.c index c9d06b0..d888cbc 100644 --- a/examples/rtnl-link-dump.c +++ b/examples/rtnl-link-dump.c @@ -38,7 +38,7 @@ static int data_attr_cb(const struct nlattr *attr, void *data) static int data_cb(const struct nlmsghdr *nlh, void *data) { struct nlattr *tb[IFLA_MAX+1] = {}; - struct ifinfomsg *ifm = mnl_nlmsg_get_data(nlh); + struct ifinfomsg *ifm = mnl_nlmsg_get_payload(nlh); int len = mnl_nlmsg_get_len(nlh); struct nlattr *attr; diff --git a/examples/rtnl-link-dump2.c b/examples/rtnl-link-dump2.c index bd93f9d..2276eba 100644 --- a/examples/rtnl-link-dump2.c +++ b/examples/rtnl-link-dump2.c @@ -35,7 +35,7 @@ static int data_attr_cb(const struct nlattr *attr, void *data) static int data_cb(const struct nlmsghdr *nlh, void *data) { - struct ifinfomsg *ifm = mnl_nlmsg_get_data(nlh); + struct ifinfomsg *ifm = mnl_nlmsg_get_payload(nlh); int len = mnl_nlmsg_get_len(nlh); struct nlattr *attr; diff --git a/examples/rtnl-link-dump3.c b/examples/rtnl-link-dump3.c index 6da62ad..fac3b87 100644 --- a/examples/rtnl-link-dump3.c +++ b/examples/rtnl-link-dump3.c @@ -9,7 +9,7 @@ static int data_cb(const struct nlmsghdr *nlh, void *data) { - struct ifinfomsg *ifm = mnl_nlmsg_get_data(nlh); + struct ifinfomsg *ifm = mnl_nlmsg_get_payload(nlh); int len = mnl_nlmsg_get_len(nlh); struct nlattr *attr; diff --git a/examples/rtnl-link-event.c b/examples/rtnl-link-event.c index c3600ca..1f3ceaf 100644 --- a/examples/rtnl-link-event.c +++ b/examples/rtnl-link-event.c @@ -38,7 +38,7 @@ static int data_attr_cb(const struct nlattr *attr, void *data) static int data_cb(const struct nlmsghdr *nlh, void *data) { struct nlattr *tb[IFLA_MAX+1] = {}; - struct ifinfomsg *ifm = mnl_nlmsg_get_data(nlh); + struct ifinfomsg *ifm = mnl_nlmsg_get_payload(nlh); int len = mnl_nlmsg_get_len(nlh); struct nlattr *attr; diff --git a/examples/rtnl-route-dump.c b/examples/rtnl-route-dump.c index 4a0f790..ddfbaa9 100644 --- a/examples/rtnl-route-dump.c +++ b/examples/rtnl-route-dump.c @@ -100,7 +100,7 @@ static int data_attr_cb(const struct nlattr *attr, void *data) static int data_cb(const struct nlmsghdr *nlh, void *data) { struct nlattr *tb[RTA_MAX+1] = {}; - struct rtmsg *rm = mnl_nlmsg_get_data(nlh); + struct rtmsg *rm = mnl_nlmsg_get_payload(nlh); int len = mnl_nlmsg_get_len(nlh); struct nlattr *attr; diff --git a/include/libmnl/libmnl.h b/include/libmnl/libmnl.h index b7e72c8..11eda8a 100644 --- a/include/libmnl/libmnl.h +++ b/include/libmnl/libmnl.h @@ -53,9 +53,9 @@ int mnl_nlmsg_portid_ok(const struct nlmsghdr *nlh, unsigned int portid); /* Netlink header getters */ extern uint16_t mnl_nlmsg_get_len(const struct nlmsghdr *nlh); -extern void *mnl_nlmsg_get_data(const struct nlmsghdr *nlh); -extern void *mnl_nlmsg_get_data_offset(const struct nlmsghdr *nlh, int offset); -extern void *mnl_nlmsg_get_tail(const struct nlmsghdr *nlh); +extern void *mnl_nlmsg_get_payload(const struct nlmsghdr *nlh); +extern void *mnl_nlmsg_get_payload_offset(const struct nlmsghdr *nlh, int offset); +extern void *mnl_nlmsg_get_payload_tail(const struct nlmsghdr *nlh); /* Netlink dump message */ extern void mnl_nlmsg_print(const struct nlmsghdr *nlh); @@ -69,7 +69,7 @@ extern void mnl_nlmsg_print(const struct nlmsghdr *nlh); extern uint16_t mnl_attr_get_type(const struct nlattr *attr); extern uint16_t mnl_attr_get_len(const struct nlattr *attr); extern uint16_t mnl_attr_get_payload_len(const struct nlattr *attr); -extern void *mnl_attr_get_data(const struct nlattr *attr); +extern void *mnl_attr_get_payload(const struct nlattr *attr); extern uint8_t mnl_attr_get_u8(const struct nlattr *attr); extern uint16_t mnl_attr_get_u16(const struct nlattr *attr); extern uint32_t mnl_attr_get_u32(const struct nlattr *attr); @@ -113,13 +113,13 @@ extern struct nlattr *mnl_attr_next(const struct nlattr *attr, int *len); #define mnl_attr_for_each(attr, nlh, offset) \ int __len__ = mnl_nlmsg_get_payload_len(nlh); \ - for (attr = mnl_nlmsg_get_data_offset(nlh, offset); \ + for (attr = mnl_nlmsg_get_payload_offset(nlh, offset); \ mnl_attr_ok(attr, __len__); \ attr = mnl_attr_next(attr, &(__len__))) #define mnl_attr_for_each_nested(attr, nest) \ int __len__ = mnl_attr_get_len(nest); \ - for (pos = mnl_attr_get_data(nest); \ + for (pos = mnl_attr_get_payload(nest); \ mnl_attr_ok(attr, __len__); \ pos = mnl_attr_next(attr, &(__len__))) @@ -56,11 +56,11 @@ uint16_t mnl_attr_get_payload_len(const struct nlattr *attr) } /** - * mnl_attr_get_data - get pointer to the attribute payload + * mnl_attr_get_payload - get pointer to the attribute payload * * This function return a pointer to the attribute payload */ -void *mnl_attr_get_data(const struct nlattr *attr) +void *mnl_attr_get_payload(const struct nlattr *attr) { return (void *)attr + MNL_ATTR_HDRLEN; } @@ -124,7 +124,7 @@ static int __mnl_attr_validate(const struct nlattr *attr, enum mnl_attr_data_type type, int exp_len) { uint16_t attr_len = mnl_attr_get_payload_len(attr); - char *attr_data = mnl_attr_get_data(attr); + char *attr_data = mnl_attr_get_payload(attr); if (attr_len < exp_len) { errno = ERANGE; @@ -235,7 +235,7 @@ int mnl_attr_parse(const struct nlmsghdr *nlh, int offset, mnl_attr_cb_t cb, void *data) { int ret = MNL_CB_OK; - struct nlattr *attr = mnl_nlmsg_get_data_offset(nlh, offset); + struct nlattr *attr = mnl_nlmsg_get_payload_offset(nlh, offset); int len = mnl_nlmsg_get_len(nlh); while (mnl_attr_ok(attr, len)) { @@ -260,7 +260,7 @@ int mnl_attr_parse_nested(const struct nlattr *nested, mnl_attr_cb_t cb, void *data) { int ret = MNL_CB_OK; - struct nlattr *attr = mnl_attr_get_data(nested); + struct nlattr *attr = mnl_attr_get_payload(nested); int len = mnl_attr_get_payload_len(nested); while (mnl_attr_ok(attr, len)) { @@ -279,7 +279,7 @@ int mnl_attr_parse_nested(const struct nlattr *nested, */ uint8_t mnl_attr_get_u8(const struct nlattr *attr) { - return *((uint8_t *)mnl_attr_get_data(attr)); + return *((uint8_t *)mnl_attr_get_payload(attr)); } /** @@ -290,7 +290,7 @@ uint8_t mnl_attr_get_u8(const struct nlattr *attr) */ uint16_t mnl_attr_get_u16(const struct nlattr *attr) { - return *((uint16_t *)mnl_attr_get_data(attr)); + return *((uint16_t *)mnl_attr_get_payload(attr)); } /** @@ -301,7 +301,7 @@ uint16_t mnl_attr_get_u16(const struct nlattr *attr) */ uint32_t mnl_attr_get_u32(const struct nlattr *attr) { - return *((uint32_t *)mnl_attr_get_data(attr)); + return *((uint32_t *)mnl_attr_get_payload(attr)); } /** @@ -315,7 +315,7 @@ uint32_t mnl_attr_get_u32(const struct nlattr *attr) uint64_t mnl_attr_get_u64(const struct nlattr *attr) { uint64_t tmp; - memcpy(&tmp, mnl_attr_get_data(attr), sizeof(tmp)); + memcpy(&tmp, mnl_attr_get_payload(attr), sizeof(tmp)); return tmp; } @@ -327,7 +327,7 @@ uint64_t mnl_attr_get_u64(const struct nlattr *attr) */ const char *mnl_attr_get_str(const struct nlattr *attr) { - return (const char *)mnl_attr_get_data(attr); + return (const char *)mnl_attr_get_payload(attr); } /** @@ -339,12 +339,12 @@ const char *mnl_attr_get_str(const struct nlattr *attr) */ void mnl_attr_put(struct nlmsghdr *nlh, int type, size_t len, const void *data) { - struct nlattr *attr = mnl_nlmsg_get_tail(nlh); + struct nlattr *attr = mnl_nlmsg_get_payload_tail(nlh); int payload_len = MNL_ALIGN(sizeof(struct nlattr)) + len; attr->nla_type = type; attr->nla_len = payload_len; - memcpy(mnl_attr_get_data(attr), data, len); + memcpy(mnl_attr_get_payload(attr), data, len); nlh->nlmsg_len += MNL_ALIGN(payload_len); } diff --git a/src/callback.c b/src/callback.c index f6637b3..a8818ba 100644 --- a/src/callback.c +++ b/src/callback.c @@ -17,7 +17,7 @@ static int mnl_cb_noop(const struct nlmsghdr *nlh, void *data) static int mnl_cb_error(const struct nlmsghdr *nlh, void *data) { - const struct nlmsgerr *err = mnl_nlmsg_get_data(nlh); + const struct nlmsgerr *err = mnl_nlmsg_get_payload(nlh); if (nlh->nlmsg_len < mnl_nlmsg_size(sizeof(struct nlmsgerr))) { errno = EBADMSG; diff --git a/src/nlmsg.c b/src/nlmsg.c index 274aa8e..20a3e81 100644 --- a/src/nlmsg.c +++ b/src/nlmsg.c @@ -98,25 +98,25 @@ uint16_t mnl_nlmsg_get_len(const struct nlmsghdr *nlh) } /** - * mnl_nlmsg_get_data - get a pointer to the payload of the netlink message + * mnl_nlmsg_get_payload - get a pointer to the payload of the netlink message * @nlh: pointer to a netlink header * * This function returns a pointer to the payload of the netlink message. */ -void *mnl_nlmsg_get_data(const struct nlmsghdr *nlh) +void *mnl_nlmsg_get_payload(const struct nlmsghdr *nlh) { return (void *)nlh + MNL_NLMSG_HDRLEN; } /** - * mnl_nlmsg_get_data_offset - get a pointer to the payload of the message + * mnl_nlmsg_get_payload_offset - get a pointer to the payload of the message * @nlh: pointer to a netlink header * @offset: offset to the payload of the attributes TLV set * * This function returns a pointer to the payload of the netlink message plus * a given offset. */ -void *mnl_nlmsg_get_data_offset(const struct nlmsghdr *nlh, int offset) +void *mnl_nlmsg_get_payload_offset(const struct nlmsghdr *nlh, int offset) { return (void *)nlh + MNL_NLMSG_HDRLEN + MNL_ALIGN(offset); } @@ -161,13 +161,13 @@ struct nlmsghdr *mnl_nlmsg_next(const struct nlmsghdr *nlh, int *len) } /** - * mnl_nlmsg_get_tail - get the ending of the netlink message + * mnl_nlmsg_get_payload_tail - get the ending of the netlink message * @nlh: pointer to netlink message * * This function returns a pointer to the netlink message tail. This is useful * to build a message since we continue adding attribute at the end of it. */ -void *mnl_nlmsg_get_tail(const struct nlmsghdr *nlh) +void *mnl_nlmsg_get_payload_tail(const struct nlmsghdr *nlh) { return (struct nlmsghdr *)((void *)nlh + MNL_ALIGN(nlh->nlmsg_len)); } |