|
|
1.1 root 1: //
2: // nono
1.1.1.3 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
7: #pragma once
8:
9: #include "netdriver.h"
10:
11: class NetDriverBPF : public NetDriver
12: {
1.1.1.3 root 13: using inherited = NetDriver;
1.1 root 14: public:
15: // コンストラクタ
1.1.1.5 ! root 16: NetDriverBPF(EthernetDevice *parent_, int loglevel_,
! 17: const std::string& ifname_);
1.1 root 18: // デストラクタ
1.1.1.3 root 19: ~NetDriverBPF() override;
1.1 root 20:
1.1.1.5 ! root 21: bool InitDriver() override;
1.1.1.3 root 22: bool SendPacket(const std::vector<uint8>& data) override;
1.1.1.5 ! root 23:
! 24: protected:
! 25: ssize_t RecvPacket() override;
! 26: void MonitorUpdateMD(TextScreen&) override;
1.1 root 27:
28: private:
1.1.1.3 root 29: void Close();
1.1 root 30:
1.1.1.5 ! root 31: std::string FindInterface() const;
! 32:
! 33: // デバイスファイルパス
! 34: std::string devpath {};
1.1 root 35:
1.1.1.5 ! root 36: std::unique_ptr<uint8[]> bpfbuf {};
1.1.1.4 root 37: int bpfbuflen {};
1.1 root 38: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.