mirror of
https://git.netfilter.org/libnftnl
synced 2026-01-27 19:04:07 +00:00
This data structure holds an array of allocated strings for use in nftnl_chain and nftnl_flowtable structs. For convenience, implement functions to clear, populate and iterate over contents. While at it, extend chain and flowtable tests to cover these attributes, too. Signed-off-by: Phil Sutter <phil@nwl.cc> Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>
23 lines
555 B
C
23 lines
555 B
C
#ifndef LIBNFTNL_STR_ARRAY_H
|
|
#define LIBNFTNL_STR_ARRAY_H 1
|
|
|
|
#include <stdint.h>
|
|
|
|
struct nlattr;
|
|
|
|
struct nftnl_str_array {
|
|
char **array;
|
|
uint32_t len;
|
|
};
|
|
|
|
void nftnl_str_array_clear(struct nftnl_str_array *sa);
|
|
int nftnl_str_array_set(struct nftnl_str_array *sa, const char * const *array);
|
|
int nftnl_parse_devs(struct nftnl_str_array *sa, const struct nlattr *nest);
|
|
|
|
#define nftnl_str_array_foreach(ptr, sa, idx) \
|
|
for (idx = 0, ptr = (sa)->array[idx]; \
|
|
idx < (sa)->len; \
|
|
ptr = (sa)->array[++idx])
|
|
|
|
#endif /* LIBNFTNL_STR_ARRAY_H */
|