diff options
author | Roman Arutyunyan <arut@nginx.com> | 2023-05-19 21:46:36 +0400 |
---|---|---|
committer | Roman Arutyunyan <arut@nginx.com> | 2023-05-19 21:46:36 +0400 |
commit | 4b0266174814e6cf60a275321121dbaab084ee64 (patch) | |
tree | 1c47a0b456cb1bb6d6dd08aa2d94342d738b56c6 /src/core/ngx_bpf.h | |
parent | 1a8ef991d92d22eb8aded7f49595dd31a639e8a4 (diff) | |
parent | 94941bd840ce7b011a36f7fe33f3fc7f4c600688 (diff) | |
download | nginx-4b0266174814e6cf60a275321121dbaab084ee64.tar.gz nginx-4b0266174814e6cf60a275321121dbaab084ee64.zip |
Merged with the quic branch.
Diffstat (limited to 'src/core/ngx_bpf.h')
-rw-r--r-- | src/core/ngx_bpf.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/core/ngx_bpf.h b/src/core/ngx_bpf.h new file mode 100644 index 000000000..f62a36e11 --- /dev/null +++ b/src/core/ngx_bpf.h @@ -0,0 +1,43 @@ + +/* + * Copyright (C) Nginx, Inc. + */ + + +#ifndef _NGX_BPF_H_INCLUDED_ +#define _NGX_BPF_H_INCLUDED_ + + +#include <ngx_config.h> +#include <ngx_core.h> + +#include <linux/bpf.h> + + +typedef struct { + char *name; + int offset; +} ngx_bpf_reloc_t; + +typedef struct { + char *license; + enum bpf_prog_type type; + struct bpf_insn *ins; + size_t nins; + ngx_bpf_reloc_t *relocs; + size_t nrelocs; +} ngx_bpf_program_t; + + +void ngx_bpf_program_link(ngx_bpf_program_t *program, const char *symbol, + int fd); +int ngx_bpf_load_program(ngx_log_t *log, ngx_bpf_program_t *program); + +int ngx_bpf_map_create(ngx_log_t *log, enum bpf_map_type type, int key_size, + int value_size, int max_entries, uint32_t map_flags); +int ngx_bpf_map_update(int fd, const void *key, const void *value, + uint64_t flags); +int ngx_bpf_map_delete(int fd, const void *key); +int ngx_bpf_map_lookup(int fd, const void *key, void *value); + +#endif /* _NGX_BPF_H_INCLUDED_ */ |