mirror of
https://github.com/varun-r-mallya/pylibbpf.git
synced 2026-02-12 16:11:00 +00:00
Add StructParser utility
This commit is contained in:
20
src/utils/struct_parser.h
Normal file
20
src/utils/struct_parser.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef PYLIBBPF_STRUCT_PARSER_H
|
||||
#define PYLIBBPF_STRUCT_PARSER_H
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
class StructParser {
|
||||
private:
|
||||
std::unordered_map<std::string, py::object> struct_types_;
|
||||
|
||||
public:
|
||||
explicit StructParser(py::dict structs);
|
||||
py::object parse(const std::string &struct_name, py::bytes data);
|
||||
bool has_struct(const std::string &struct_name) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user