Lines Matching defs:nla
26 char *nla_get_string(struct nlattr *nla)
28 return (char *) nla_data(nla);
32 uint16_t nla_get_u16(struct nlattr *nla)
34 return *((uint16_t *) nla_data(nla));
38 uint32_t nla_get_u32(struct nlattr *nla)
40 return *((uint32_t *) nla_data(nla));
44 uint8_t nla_get_u8(struct nlattr *nla)
46 return *((uint8_t *) nla_data(nla));
50 uint64_t nla_get_u64(struct nlattr *nla)
53 nla_memcpy(&tmp, nla, sizeof(tmp));
58 void *nla_data(const struct nlattr *nla)
60 return (void *) ((char *) nla + NLA_HDRLEN);
64 int nla_len(const struct nlattr *nla)
66 return nla->nla_len - NLA_HDRLEN;
97 struct nlattr *nla_next(const struct nlattr *nla, int *remaining)
100 if (nla->nla_len >= sizeof(struct nlattr) &&
101 nla->nla_len <= *remaining){
103 ((char *) nla + NLA_ALIGN(nla->nla_len));
104 *remaining = *remaining - NLA_ALIGN(nla->nla_len);
112 int nla_ok(const struct nlattr *nla, int remaining)
115 nla->nla_len >= sizeof(struct nlattr) &&
117 nla->nla_len <= remaining;
144 struct nlattr *nla, struct nla_policy *policy)
146 return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy);
153 struct nlattr *nla;
155 /* Reserve space and init nla header */
156 nla = nla_reserve(msg, attrtype, datalen);
157 if (nla) {
158 memcpy(nla_data(nla), data, datalen);
182 int nla_type(const struct nlattr *nla)
184 return (int)nla->nla_type & NLA_TYPE_MASK;
192 struct nlattr *nla;
200 nla = (struct nlattr *)nlmsg_tail(msg->nm_nlh);
201 nla->nla_type = attrtype;
202 nla->nla_len = NLA_HDRLEN + data_len;
203 memset((unsigned char *)nla + nla->nla_len, 0, nla_padlen(data_len));
205 return nla;