|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2024 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: //
8: // VirtIO ネットワークデバイス
9: //
10:
11: #pragma once
12:
13: #include "virtio_base.h"
14: #include "event.h"
15: #include "hostnet.h"
16: #include "message.h"
17: #include "monitor.h"
18:
19: class VirtIONetDevice : public VirtIODevice
20: {
21: using inherited = VirtIODevice;
22: public:
1.1.1.2 ! root 23: explicit VirtIONetDevice(uint slot_);
1.1 root 24: ~VirtIONetDevice() override;
25:
26: bool Create() override;
27: bool Init() override;
28:
29: private:
30: DECLARE_MONITOR_CALLBACK(MonitorUpdate);
31:
32: void QueueReady() override;
1.1.1.2 ! root 33: void ProcessDesc(VirtIOReq&) override;
1.1 root 34:
1.1.1.2 ! root 35: const char *GetFeatureName(uint feature) const override;
1.1 root 36:
37: // 受信
38: void HostRxCallback();
39: void RxMessage(MessageID, uint32);
40: void RxEvent(Event&);
41: void Rx(VirtQueue *);
42:
43: // MAC アドレス自体は動作中は不要なので表示用の文字列だけ持っておく。
44: std::string macaddr_str {};
45:
46: NetPacket rx_packet {};
47:
48: std::unique_ptr<HostNetDevice> hostnet /*{}*/;
49:
50: Event event { this };
51: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.