|
|
1.1 root 1: //
2: // nono
1.1.1.2 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
7: #pragma once
8:
9: #include "netdriver.h"
10:
11: class NetDriverTap : public NetDriver
12: {
1.1.1.2 root 13: using inherited = NetDriver;
1.1 root 14: public:
15: // コンストラクタ
1.1.1.2 root 16: NetDriverTap(EthernetDevice *parent_,
1.1.1.3 ! root 17: std::mutex *mtx_, std::condition_variable *cv_,
! 18: const std::string& devpath_);
1.1 root 19: // デストラクタ
1.1.1.2 root 20: ~NetDriverTap() override;
1.1 root 21:
1.1.1.2 root 22: bool Init() override;
23: bool SendPacket(const std::vector<uint8>& data) override;
24: void ThreadRun() override;
1.1 root 25:
26: private:
1.1.1.3 ! root 27: #if defined(__linux__)
! 28: bool OpenLinux();
! 29: #endif
! 30: bool OpenDirect();
! 31: bool OpenNumbered();
! 32: bool OpenCloning();
! 33:
! 34: void CloseFd();
1.1.1.2 root 35: void Close();
1.1.1.3 ! root 36:
! 37: // Open*() のエラーメッセージ。
! 38: // Open*() は複数呼ぶ場合もあったりするのでエラーは基本的にログレベル1
! 39: // で表示しておき、最後に一つだけそれっぽいのを warn() で出力する。
! 40: std::string errmsg {};
1.1 root 41: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.