--- nono/host/netdriver_bpf.h 2026/04/29 17:04:34 1.1.1.3 +++ nono/host/netdriver_bpf.h 2026/04/29 17:05:47 1.1.1.8 @@ -4,29 +4,38 @@ // Licensed under nono-license.txt // +// +// ホストネットワークの BPF ドライバ +// + #pragma once #include "netdriver.h" +#include "hostnet.h" class NetDriverBPF : public NetDriver { using inherited = NetDriver; public: - // コンストラクタ - NetDriverBPF(EthernetDevice *parent_, std::mutex *mtx_, - std::condition_variable *cv_); - // デストラクタ + NetDriverBPF(HostDevice *hostdev_, const std::string& ifname_); ~NetDriverBPF() override; - bool Init() override; - bool SendPacket(const std::vector& data) override; - void ThreadRun() override; + bool InitDriver(bool startup) override; + + int Read(NetPacket *p) override; + void Write(const void *buf, int buflen) override; + + void MonitorUpdateMD(TextScreen&, int y) override; private: void Close(); - std::string FindInterface(); + std::string FindInterface() const; + + // デバイスファイルパス + std::string devpath {}; - std::unique_ptr bpfbuf {}; - int bpfbuflen = 0; + std::vector bpfbuf {}; + uint8 *bpfptr {}; + ssize_t bpflen {}; };