--- nono/host/netdriver_tap.h 2026/04/29 17:04:28 1.1.1.1 +++ nono/host/netdriver_tap.h 2026/04/29 17:05:47 1.1.1.7 @@ -1,6 +1,11 @@ // // nono -// Copyright (C) 2019 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt +// + +// +// ホストネットワークの tap ドライバ // #pragma once @@ -9,18 +14,27 @@ class NetDriverTap : public NetDriver { - typedef NetDriver inherited; + using inherited = NetDriver; public: - // コンストラクタ - NetDriverTap(EthernetDevice *p, - std::mutex *m, std::condition_variable *c); - // デストラクタ - virtual ~NetDriverTap(); - - virtual bool Init(); - virtual bool SendPacket(const std::vector& data); - virtual void ThreadRun(); + NetDriverTap(HostDevice *hostdev_, const std::string& devpath_); + ~NetDriverTap() 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: - virtual void Close(); +#if defined(__linux__) + bool OpenLinux(); +#endif + bool OpenDirect(); + bool OpenNumbered(); + bool OpenCloning(); + + void Close(); + + // デバイスファイルパス + std::string devpath {}; };