--- nono/host/hostnet.h 2026/04/29 17:05:11 1.1 +++ nono/host/hostnet.h 2026/04/29 17:05:39 1.1.1.6 @@ -12,7 +12,6 @@ #include "hostdevice.h" #include "macaddr.h" -#include "monitor.h" #include "netdriver.h" #include "spscqueue.h" @@ -24,14 +23,60 @@ 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 CreateSlirp(); bool CreateTap(); bool CreateBPF(); bool CreateAFPacket(); @@ -117,11 +171,25 @@ class HostNetDevice : public HostDevice 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 // キュー NetTxQueue txq {}; @@ -132,5 +200,7 @@ class HostNetDevice : public HostDevice std::string errmsg {}; - Monitor monitor { this }; + Monitor *monitor {}; + + IHWAddrFilter *ihwaddrfilter {}; };