src/core/ngx_bpf.h - nginx source code

Data types defined

Macros defined

Source code


  1. /*
  2. * Copyright (C) Nginx, Inc.
  3. */


  4. #ifndef _NGX_BPF_H_INCLUDED_
  5. #define _NGX_BPF_H_INCLUDED_


  6. #include <ngx_config.h>
  7. #include <ngx_core.h>

  8. #include <linux/bpf.h>


  9. typedef struct {
  10.     char                *name;
  11.     int                  offset;
  12. } ngx_bpf_reloc_t;

  13. typedef struct {
  14.     char                *license;
  15.     enum bpf_prog_type   type;
  16.     struct bpf_insn     *ins;
  17.     size_t               nins;
  18.     ngx_bpf_reloc_t     *relocs;
  19.     size_t               nrelocs;
  20. } ngx_bpf_program_t;


  21. void ngx_bpf_program_link(ngx_bpf_program_t *program, const char *symbol,
  22.     int fd);
  23. int ngx_bpf_load_program(ngx_log_t *log, ngx_bpf_program_t *program);

  24. int ngx_bpf_map_create(ngx_log_t *log, enum bpf_map_type type, int key_size,
  25.     int value_size, int max_entries, uint32_t map_flags);
  26. int ngx_bpf_map_update(int fd, const void *key, const void *value,
  27.     uint64_t flags);
  28. int ngx_bpf_map_delete(int fd, const void *key);
  29. int ngx_bpf_map_lookup(int fd, const void *key, void *value);

  30. #endif /* _NGX_BPF_H_INCLUDED_ */