X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fnetlink.h;h=2d3457167a819f10b5111b7769069c90cd5ab1f7;hb=320232ec7f37218a6fce0704f9b0ba7696e5ad21;hp=0bd2c41e60357df54dbda65aae4a34c71797420e;hpb=08c4a39ef8417de8f48874296f07ad58de46eefc;p=openvswitch diff --git a/lib/netlink.h b/lib/netlink.h index 0bd2c41e..2d345716 100644 --- a/lib/netlink.h +++ b/lib/netlink.h @@ -124,6 +124,12 @@ nl_attr_is_valid(const struct nlattr *nla, size_t maxlen) (LEFT) > 0; \ (LEFT) -= NLA_ALIGN((ITER)->nla_len), (ITER) = nl_attr_next(ITER)) +/* These variants are convenient for iterating nested attributes. */ +#define NL_NESTED_FOR_EACH(ITER, LEFT, A) \ + NL_ATTR_FOR_EACH(ITER, LEFT, nl_attr_get(A), nl_attr_get_size(A)) +#define NL_NESTED_FOR_EACH_UNSAFE(ITER, LEFT, A) \ + NL_ATTR_FOR_EACH_UNSAFE(ITER, LEFT, nl_attr_get(A), nl_attr_get_size(A)) + /* Netlink attribute parsing. */ int nl_attr_type(const struct nlattr *); const void *nl_attr_get(const struct nlattr *); @@ -160,5 +166,7 @@ bool nl_parse_nested(const struct nlattr *, const struct nl_policy[], const struct nlattr *nl_attr_find(const struct ofpbuf *, size_t hdr_len, uint16_t type); const struct nlattr *nl_attr_find_nested(const struct nlattr *, uint16_t type); +const struct nlattr *nl_attr_find__(const struct nlattr *attrs, size_t size, + uint16_t type); #endif /* netlink.h */