| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- #ifndef PHPCPP_HELLOWORLD_TABLE_H
- #define PHPCPP_HELLOWORLD_TABLE_H
- #include <iostream>
- #include <phpcpp.h>
- #include "bpf_module.h"
- #include "BPF.h"
- class BaseTable : public Php::Base {
- public:
- ebpf::BPF *bpf;
- std::string tb_name;
- BaseTable(ebpf::BPF *bpf_instance, const std::string &tb_name)
- : bpf(bpf_instance), tb_name(tb_name) {}
- virtual ~BaseTable() = default;
- void printName();
- // void printName() { std::cout << "Table name: " << tb_name << std::endl; }
- // Php::Value Value(Php::Parameters ¶m) {
- // auto index = param[0].numericValue();
- // // todo val type
- // uint64_t val;
- // auto table = bpf->get_array_table<uint64_t>(tb_name);
- // auto res = table.get_value(index, val);
- // if (!res.ok()) {
- // throw Php::Exception("Get value error in" + std::string(tb_name));
- // }
- // Php::Value phpValue = static_cast<int64_t>(val);
- // return phpValue;
- // }
- };
- class PerfEventArrayTable : public BaseTable {
- private:
- std::string cb;
- public:
- using BaseTable::BaseTable;
- virtual ~PerfEventArrayTable() = default;
- static void callbackfn(void *cookie, void *data, int data_size);
- void php_open_perf_buffer(Php::Parameters ¶ms);
- int perf_buffer_poll(int timeout_ms);
- };
- class HashTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- Php::Value php_get_values();
- void php_clear();
- };
- class ArrayTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- Php::Value php_get_value(Php::Parameters ¶m);
- };
- class ProgArrayTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- // void Value(Php::Parameters ¶m) {
- // auto index = param[0].numericValue();
- // // todo key type
- // uint64_t val;
- // auto table = bpf->get_array_table<uint64_t>(tb_name);
- //// virtual StatusTuple get_value(const int& index, ValueType& value) {
- // auto res = table.get_value(index, val);
- // }
- };
- class PerCpuHashTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- };
- class PerCpuArrayTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- Php::Value php_sum_value(Php::Parameters ¶m);
- };
- class LpmTrieTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- };
- class StackTraceTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- Php::Value php_get_values(Php::Parameters ¶m);
- };
- class LruHashTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- };
- class LruPerCpuHashTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- };
- class CgroupArrayTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- };
- class DevMapTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- };
- class CpuMapTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- };
- class XskMapTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- };
- class MapInMapArrayTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- };
- class MapInMapHashTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- };
- class QueueStackTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- };
- class RingBufTable : public BaseTable {
- public:
- using BaseTable::BaseTable;
- };
- #endif //PHPCPP_HELLOWORLD_TABLE_H
|