mirror of
https://github.com/varun-r-mallya/pylibbpf.git
synced 2026-02-12 08:00:55 +00:00
add map support
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
#ifndef PYLIBBPF_BPF_PROGRAM_H
|
||||
#define PYLIBBPF_BPF_PROGRAM_H
|
||||
|
||||
#include "libbpf.h"
|
||||
#include <libbpf.h>
|
||||
#include <pybind11/stl.h>
|
||||
#include <string>
|
||||
|
||||
@ -9,19 +9,26 @@ namespace py = pybind11;
|
||||
|
||||
class BpfProgram {
|
||||
private:
|
||||
struct bpf_object* obj_;
|
||||
struct bpf_program* prog_;
|
||||
struct bpf_link* link_;
|
||||
struct bpf_object *obj_;
|
||||
struct bpf_program *prog_;
|
||||
struct bpf_link *link_;
|
||||
std::string object_path_;
|
||||
std::string program_name_;
|
||||
std::vector<std::pair<bpf_program*, bpf_link*>> programs;
|
||||
std::vector<std::pair<bpf_program *, bpf_link *> > programs;
|
||||
|
||||
public:
|
||||
explicit BpfProgram(std::string object_path, std::string program_name = "");
|
||||
explicit BpfProgram(std::string object_path, std::string program_name = "");
|
||||
|
||||
~BpfProgram();
|
||||
|
||||
struct bpf_object *get_obj() const;
|
||||
|
||||
bool load();
|
||||
|
||||
bool attach();
|
||||
|
||||
bool destroy();
|
||||
|
||||
void load_and_attach();
|
||||
|
||||
[[nodiscard]] bool is_loaded() const { return obj_ != nullptr; }
|
||||
|
||||
Reference in New Issue
Block a user