|
|
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:
18: class VirtIONetDevice : public VirtIODevice
19: {
20: using inherited = VirtIODevice;
21: public:
1.1.1.2 root 22: explicit VirtIONetDevice(uint slot_);
1.1 root 23: ~VirtIONetDevice() override;
24:
25: bool Create() override;
26: bool Init() override;
27:
28: private:
29: DECLARE_MONITOR_CALLBACK(MonitorUpdate);
30:
1.1.1.3 ! root 31: void QueueReadyChanged(VirtQueue *) override;
1.1.1.2 root 32: void ProcessDesc(VirtIOReq&) override;
1.1 root 33:
1.1.1.2 root 34: const char *GetFeatureName(uint feature) const override;
1.1 root 35:
36: // 受信
37: void HostRxCallback();
38: void RxMessage(MessageID, uint32);
39: void RxEvent(Event&);
40: void Rx(VirtQueue *);
41:
42: // MAC アドレス自体は動作中は不要なので表示用の文字列だけ持っておく。
43: std::string macaddr_str {};
44:
45: NetPacket rx_packet {};
46:
47: std::unique_ptr<HostNetDevice> hostnet /*{}*/;
48:
49: Event event { this };
50: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.