Lines Matching refs:nla

449 int nla_type(const struct nlattr *nla)  in nla_type()  argument
451 return nla->nla_type & NLA_TYPE_MASK; in nla_type()
460 void *nla_data(const struct nlattr *nla) in nla_data() argument
462 return (char *) nla + NLA_HDRLEN; in nla_data()
471 int nla_len(const struct nlattr *nla) in nla_len() argument
473 return nla->nla_len - NLA_HDRLEN; in nla_len()
488 int nla_ok(const struct nlattr *nla, int remaining) in nla_ok() argument
490 return remaining >= sizeof(*nla) && in nla_ok()
491 nla->nla_len >= sizeof(*nla) && in nla_ok()
492 nla->nla_len <= remaining; in nla_ok()
511 struct nlattr *nla_next(const struct nlattr *nla, int *remaining) in nla_next() argument
513 int totlen = NLA_ALIGN(nla->nla_len); in nla_next()
516 return (struct nlattr *) ((char *) nla + totlen); in nla_next()
527 static int validate_nla(struct nlattr *nla, int maxtype, in validate_nla() argument
531 int minlen = 0, type = nla_type(nla); in validate_nla()
546 if (pt->type == NLA_FLAG && nla_len(nla) > 0) in validate_nla()
549 if (nla_len(nla) < minlen) in validate_nla()
552 if (pt->maxlen && nla_len(nla) > pt->maxlen) in validate_nla()
556 char *data = nla_data(nla); in validate_nla()
557 if (data[nla_len(nla) - 1] != '\0') in validate_nla()
586 struct nlattr *nla; in nla_parse() local
591 nla_for_each_attr(nla, head, len, rem) { in nla_parse()
592 int type = nla_type(nla); in nla_parse()
601 err = validate_nla(nla, maxtype, policy); in nla_parse()
606 tb[type] = nla; in nla_parse()
639 struct nlattr *nla; in nla_validate() local
642 nla_for_each_attr(nla, head, len, rem) { in nla_validate()
643 err = validate_nla(nla, maxtype, policy); in nla_validate()
667 struct nlattr *nla; in nla_find() local
670 nla_for_each_attr(nla, head, len, rem) in nla_find()
671 if (nla_type(nla) == attrtype) in nla_find()
672 return nla; in nla_find()
720 size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize) in nla_strlcpy() argument
722 size_t srclen = nla_len(nla); in nla_strlcpy()
723 char *src = nla_data(nla); in nla_strlcpy()
747 int nla_memcmp(const struct nlattr *nla, const void *data, size_t size) in nla_memcmp() argument
749 int d = nla_len(nla) - size; in nla_memcmp()
752 d = memcmp(nla_data(nla), data, size); in nla_memcmp()
765 int nla_strcmp(const struct nlattr *nla, const char *str) in nla_strcmp() argument
768 int d = nla_len(nla) - len; in nla_strcmp()
771 d = memcmp(nla_data(nla), str, len); in nla_strcmp()
800 struct nlattr *nla; in nla_reserve() local
808 nla = (struct nlattr *) nlmsg_tail(msg->nm_nlh); in nla_reserve()
809 nla->nla_type = attrtype; in nla_reserve()
810 nla->nla_len = nla_attr_size(attrlen); in nla_reserve()
812 memset((unsigned char *) nla + nla->nla_len, 0, nla_padlen(attrlen)); in nla_reserve()
817 (void *) nla - nlmsg_data(msg->nm_nlh), in nla_reserve()
820 return nla; in nla_reserve()
839 struct nlattr *nla; in nla_put() local
841 nla = nla_reserve(msg, attrtype, datalen); in nla_put()
842 if (!nla) in nla_put()
845 memcpy(nla_data(nla), data, datalen); in nla_put()
847 msg, datalen, (void *) nla - nlmsg_data(msg->nm_nlh), attrtype); in nla_put()
911 uint8_t nla_get_u8(struct nlattr *nla) in nla_get_u8() argument
913 return *(uint8_t *) nla_data(nla); in nla_get_u8()
936 uint16_t nla_get_u16(struct nlattr *nla) in nla_get_u16() argument
938 return *(uint16_t *) nla_data(nla); in nla_get_u16()
961 uint32_t nla_get_u32(struct nlattr *nla) in nla_get_u32() argument
963 return *(uint32_t *) nla_data(nla); in nla_get_u32()
986 uint64_t nla_get_u64(struct nlattr *nla) in nla_get_u64() argument
990 nla_memcpy(&tmp, nla, sizeof(tmp)); in nla_get_u64()
1021 char *nla_get_string(struct nlattr *nla) in nla_get_string() argument
1023 return (char *) nla_data(nla); in nla_get_string()
1026 char *nla_strdup(struct nlattr *nla) in nla_strdup() argument
1028 return strdup(nla_get_string(nla)); in nla_strdup()
1056 int nla_get_flag(struct nlattr *nla) in nla_get_flag() argument
1058 return !!nla; in nla_get_flag()
1084 unsigned long nla_get_msecs(struct nlattr *nla) in nla_get_msecs() argument
1086 return nla_get_u64(nla); in nla_get_msecs()
1161 int nla_parse_nested(struct nlattr *tb[], int maxtype, struct nlattr *nla, in nla_parse_nested() argument
1164 return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy); in nla_parse_nested()