|
|
1.1 ! root 1: // ! 2: // nono ! 3: // Copyright (C) 2021 nono project ! 4: // Licensed under nono-license.txt ! 5: // ! 6: ! 7: // AF_PACKET を用いたドライバ ! 8: // Linux 2.2 以降専用 ! 9: ! 10: #pragma once ! 11: ! 12: #include "netdriver.h" ! 13: #include <sys/socket.h> ! 14: #include <netpacket/packet.h> ! 15: #include <net/ethernet.h> ! 16: ! 17: class NetDriverAFPacket : public NetDriver ! 18: { ! 19: using inherited = NetDriver; ! 20: public: ! 21: // コンストラクタ ! 22: NetDriverAFPacket(EthernetDevice *parent_, int loglevel_, ! 23: const std::string& devpath_); ! 24: // デストラクタ ! 25: ~NetDriverAFPacket() override; ! 26: ! 27: bool InitDriver() override; ! 28: bool SendPacket(const std::vector<uint8>& data) override; ! 29: ! 30: protected: ! 31: ssize_t RecvPacket() override; ! 32: void MonitorUpdateMD(TextScreen&) override; ! 33: ! 34: private: ! 35: void Close(); ! 36: ! 37: int SelectInterface(); ! 38: ! 39: sockaddr_ll sll {}; ! 40: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.