Mercurial > hg > nginx-quic
comparison src/core/ngx_bpf.h @ 8268:d3747ba486e7 quic
Core: added interface to linux bpf() system call.
It contains wrappers for operations with BPF maps and for loading BPF programs.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Tue, 15 Dec 2020 15:23:07 +0300 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
8267:2c7f927f7999 | 8268:d3747ba486e7 |
---|---|
1 | |
2 /* | |
3 * Copyright (C) Nginx, Inc. | |
4 */ | |
5 | |
6 | |
7 #ifndef _NGX_BPF_H_INCLUDED_ | |
8 #define _NGX_BPF_H_INCLUDED_ | |
9 | |
10 | |
11 #include <ngx_config.h> | |
12 #include <ngx_core.h> | |
13 | |
14 #include <linux/bpf.h> | |
15 | |
16 | |
17 typedef struct { | |
18 char *name; | |
19 int offset; | |
20 } ngx_bpf_reloc_t; | |
21 | |
22 typedef struct { | |
23 char *license; | |
24 enum bpf_prog_type type; | |
25 struct bpf_insn *ins; | |
26 size_t nins; | |
27 ngx_bpf_reloc_t *relocs; | |
28 size_t nrelocs; | |
29 } ngx_bpf_program_t; | |
30 | |
31 | |
32 void ngx_bpf_program_link(ngx_bpf_program_t *program, const char *symbol, | |
33 int fd); | |
34 int ngx_bpf_load_program(ngx_log_t *log, ngx_bpf_program_t *program); | |
35 | |
36 int ngx_bpf_map_create(ngx_log_t *log, enum bpf_map_type type, int key_size, | |
37 int value_size, int max_entries, uint32_t map_flags); | |
38 int ngx_bpf_map_update(int fd, const void *key, const void *value, | |
39 uint64_t flags); | |
40 int ngx_bpf_map_delete(int fd, const void *key); | |
41 int ngx_bpf_map_lookup(int fd, const void *key, void *value); | |
42 | |
43 #endif /* _NGX_BPF_H_INCLUDED_ */ |