--- nono/vm/ethernet.h 2026/04/29 17:04:35 1.1.1.3 +++ nono/vm/ethernet.h 2026/04/29 17:04:50 1.1.1.6 @@ -7,7 +7,6 @@ #pragma once #include "device.h" -#include "mystring.h" #include "qvector.h" #include #include @@ -25,7 +24,7 @@ // (LUNA, AM7990) (X68000, RTL8019) // // これ自体は IODevice である必要はないが、LanceDevice などの親になるため -// IODevice にしてある。(多重継承はしない) +// IODevice にしてある。(多重継承はしない) class NetDriver; @@ -72,11 +71,14 @@ class EthernetDevice : public IODevice protected: EthernetDevice(); public: - ~EthernetDevice() override; + virtual ~EthernetDevice() override; bool Create() override; bool Init() override; + // ワーカスレッド + virtual void ThreadRun() = 0; + // パケットを受信した。 // ホストネットワークドライバから呼ばれる。 // ホストネットワークスレッドで mtx 取得状態で呼ばれるので、 @@ -87,7 +89,7 @@ class EthernetDevice : public IODevice // パケット受信許可。 // true の場合のみホストドライバは RecvPacket() をコールしてよい。 - bool RecvEnabled = false; + bool RecvEnabled {}; // MAC アドレスを取得 macaddr_t GetMacAddr() const { @@ -101,7 +103,7 @@ class EthernetDevice : public IODevice // ワーカスレッドへ指示を出すための条件変数 std::condition_variable cv {}; // ワーカスレッドへのリクエストフラグ - uint32 request = 0; + uint32 request {}; protected: // MAC アドレスを生成する @@ -114,7 +116,7 @@ class EthernetDevice : public IODevice bool SendPacket(const std::vector& buf); // MAC アドレス - macaddr_t macaddr; + macaddr_t macaddr {}; }; extern std::unique_ptr gEthernet;