2 * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr>
3 * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com>
4 * Copyright (c) 2016-2018 The strace developers.
7 * SPDX-License-Identifier: LGPL-2.1-or-later
10 #ifndef STRACE_NLATTR_H
11 # define STRACE_NLATTR_H
15 struct decode_nla_xlat_opts {
16 const struct xlat *xlat;
18 enum xlat_style style;
21 uint64_t (*process_fn)(uint64_t val);
26 * Used for IFLA_LINKINFO decoding. Since there are no other indicators
27 * regarding the nature of data except for previously provided string
28 * in an IFLA_LINKINFO_KIND attribute, we have to store it in order to pass
29 * between calls as an opaque data.
31 struct ifla_linkinfo_ctx {
35 typedef bool (*nla_decoder_t)(struct tcb *, kernel_ulong_t addr,
36 unsigned int len, const void *opaque_data);
39 * The case of non-NULL decoders and zero size is handled in a special way:
40 * the zeroth decoder is always called with nla_type being passed as opaque
44 decode_nlattr(struct tcb *,
49 const nla_decoder_t *decoders,
51 const void *opaque_data);
53 # define DECL_NLA(name) \
55 decode_nla_ ## name(struct tcb *, kernel_ulong_t addr, \
56 unsigned int len, const void *) \
57 /* End of DECL_NLA definition. */
81 DECL_NLA(ether_proto);
90 #endif /* !STRACE_NLATTR_H */