#ifndef __BPF_HELPER_H__
#define __BPF_HELPER_H__
#include <asm/bitsperlong.h>
#include <endian.h>
#include <linux/filter.h>
#include <linux/seccomp.h>
#include <linux/types.h>
#include <linux/unistd.h>
#include <stddef.h>
#define BPF_LABELS_MAX …
struct bpf_labels { … };
int bpf_resolve_jumps(struct bpf_labels *labels,
struct sock_filter *filter, size_t count);
__u32 seccomp_bpf_label(struct bpf_labels *labels, const char *label);
void seccomp_bpf_print(struct sock_filter *filter, size_t count);
#define JUMP_JT …
#define JUMP_JF …
#define LABEL_JT …
#define LABEL_JF …
#define ALLOW …
#define DENY …
#define JUMP(labels, label) …
#define LABEL(labels, label) …
#define SYSCALL(nr, jt) …
#define FIND_LABEL(labels, label) …
#define EXPAND(...) …
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define LO_ARG(idx) …
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define LO_ARG …
#else
#error "Unknown endianness"
#endif
#if __BITS_PER_LONG == 32
#define JEQ …
#define JNE …
#define JGT …
#define JLT …
#define JGE …
#define JLE …
#define JA …
#define ARG …
#elif __BITS_PER_LONG == 64
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define ENDIAN(_lo, _hi) …
#define HI_ARG(idx) …
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define ENDIAN …
#define HI_ARG …
#endif
arg64;
#define JEQ(x, jt) …
#define JGT(x, jt) …
#define JGE(x, jt) …
#define JNE(x, jt) …
#define JLT(x, jt) …
#define JLE(x, jt) …
#define JA(x, jt) …
#define ARG(i) …
#else
#error __BITS_PER_LONG value unusable.
#endif
#define ARG_32(idx) …
#define ARG_64(idx) …
#define JEQ32(value, jt) …
#define JNE32(value, jt) …
#define JA32(value, jt) …
#define JGE32(value, jt) …
#define JGT32(value, jt) …
#define JLE32(value, jt) …
#define JLT32(value, jt) …
#define JEQ64(lo, hi, jt) …
#define JNE64(lo, hi, jt) …
#define JA64(lo, hi, jt) …
#define JGE64(lo, hi, jt) …
#define JGT64(lo, hi, jt) …
#define JLE64(lo, hi, jt) …
#define JLT64(lo, hi, jt) …
#define LOAD_SYSCALL_NR …
#endif