--- nono/host/hostnet.h 2026/04/29 17:05:34 1.1.1.5 +++ nono/host/hostnet.h 2026/04/29 17:05:47 1.1.1.7 @@ -58,6 +58,27 @@ class NetPacket : public std::array GetDrivers(); + // デバッグ用。 + static std::vector DumpHex(const void *, size_t); + static std::vector DumpFrame(const void *, size_t); + private: - bool SelectDriver(); - bool CreateNone(); - bool CreateTap(); - bool CreateBPF(); - bool CreateAFPacket(); + bool SelectDriver(bool startup) override; + void CreateNone(); + void CreateSlirp(bool startup); + void CreateTap(); + void CreateBPF(); + void CreateAFPacket(); int Read() override; // 外部への書き出し(パケットを送信) - void Write(uint32 data) override; + void Write() override; DECLARE_MONITOR_CALLBACK(MonitorUpdate); + // デバッグ用 (下請け) + static std::vector DumpARP(const void *, size_t); + static std::vector DumpIPv4(const void *, size_t); + static std::vector DumpICMPv4(const char *, const char *, + const void *, size_t); + static std::vector DumpTCPv4(const char *, const char *, + const void *, size_t); + static std::vector DumpUDPv4(const char *, const char *, + const void *, size_t); + static std::vector DumpDHCP(const void *, size_t); + static std::vector DumpIPv6(const void *, size_t); + static std::vector DumpICMPv6(const char *, const char *, + const void *, size_t); + static std::string DumpDHCPAddrList(const uint8 *, size_t); + static std::string GetServByPort(uint16 port_be, const char *protoname); + std::unique_ptr driver {}; bool rx_enable {}; - macaddr_t myaddr {}; // 自身の MAC アドレス - bool promisc {}; // プロミスキャスモードなら true - - // マルチキャストフィルタ。 - // 64ビットのうち、LSB 側を0番目、MSB 側を63番目となるようにしたもの。 - uint64 multicast_filter {}; // キュー NetTxQueue txq {}; @@ -163,7 +198,7 @@ class HostNetDevice : public HostDevice // 統計情報 struct stat_t stat {}; - std::string errmsg {}; - Monitor *monitor {}; + + IHWAddrFilter *ihwaddrfilter {}; };