From d5f33ac36eff7857083786e9daf076c4101cbd3c Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 5 Mar 2024 16:38:50 +0000 Subject: Kernel: bump. --- Private/NetworkKit/MAC.hxx | 2 +- Private/NetworkKit/NetworkDevice.hpp | 12 +++++++++--- Private/NetworkKit/NetworkDevice.inl | 27 +++++++++++++++++++++++++++ Private/Source/Network/NetworkDevice.cxx | 18 ------------------ 4 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 Private/NetworkKit/NetworkDevice.inl diff --git a/Private/NetworkKit/MAC.hxx b/Private/NetworkKit/MAC.hxx index c383cc59..fb11ae2b 100644 --- a/Private/NetworkKit/MAC.hxx +++ b/Private/NetworkKit/MAC.hxx @@ -14,7 +14,7 @@ namespace HCore { class MacAddressGetter; /// \brief This retrieves the MAC address of the device. -/// \note Checks on \Mount\Devices\MacAddr +/// \note Listens for the current NIC. class MacAddressGetter final { public: explicit MacAddressGetter() = default; diff --git a/Private/NetworkKit/NetworkDevice.hpp b/Private/NetworkKit/NetworkDevice.hpp index 94f17bb9..1550afd1 100644 --- a/Private/NetworkKit/NetworkDevice.hpp +++ b/Private/NetworkKit/NetworkDevice.hpp @@ -12,12 +12,16 @@ namespace HCore { struct NetworkDeviceCommand; +class NetworkDevice; +/** +* \brief Network device interface, establishes a connection to the NIC. +*/ class NetworkDevice final : public DeviceInterface { public: NetworkDevice(void (*out)(NetworkDeviceCommand), void (*in)(NetworkDeviceCommand), - void (*on_cleanup)(void) = nullptr); + void (*onCleanup)(void) = nullptr); ~NetworkDevice() override; @@ -26,13 +30,13 @@ class NetworkDevice final : public DeviceInterface { NetworkDevice(const NetworkDevice &) = default; public: - const char *Name() const override { return ("NetworkDevice"); } + const char *Name() const override { return "NetworkDevice"; } private: void (*fCleanup)(void); }; -struct NetworkDeviceCommand { +struct PACKED NetworkDeviceCommand final { UInt32 Command; UInt32 VLan; UInt32 DmaLow; @@ -44,4 +48,6 @@ using UDPNetworkDevice = NetworkDevice; using PPPNetworkDevice = NetworkDevice; } // namespace HCore +#include + #endif // !_INC_NETWORKDEVICE_HPP__ diff --git a/Private/NetworkKit/NetworkDevice.inl b/Private/NetworkKit/NetworkDevice.inl new file mode 100644 index 00000000..f80f5d1c --- /dev/null +++ b/Private/NetworkKit/NetworkDevice.inl @@ -0,0 +1,27 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +/*** + Dtor and ctors. +*/ + +namespace HCore { +NetworkDevice::NetworkDevice(void (*out)(NetworkDeviceCommand), + void (*in)(NetworkDeviceCommand), + void (*on_cleanup)(void)) + : DeviceInterface(out, in), fCleanup(on_cleanup) {_ + kcout << "NK: NetworkDevice initialize.\r\n"; + + MUST_PASS(out && in && on_cleanup); +} + +NetworkDevice::~NetworkDevice() { + MUST_PASS(fCleanup); + + kcout << "NK: NetworkDevice cleanup.\r\n"; + if (fCleanup) fCleanup(); +} +} // namespace HCore \ No newline at end of file diff --git a/Private/Source/Network/NetworkDevice.cxx b/Private/Source/Network/NetworkDevice.cxx index 0d9af73d..eba95a2c 100644 --- a/Private/Source/Network/NetworkDevice.cxx +++ b/Private/Source/Network/NetworkDevice.cxx @@ -6,24 +6,6 @@ #include -// network devices implementation. -// PPPNetworkService, TCPNetworkDevice, UDPNetworkService - namespace HCore { -NetworkDevice::NetworkDevice(void (*out)(NetworkDeviceCommand), - void (*in)(NetworkDeviceCommand), - void (*on_cleanup)(void)) - : DeviceInterface(out, in), fCleanup(on_cleanup) { -#ifdef __DEBUG__ - kcout << "NetworkDevice init.\r\n"; -#endif -} - -NetworkDevice::~NetworkDevice() { -#ifdef __DEBUG__ - kcout << "NetworkDevice cleanup.\r\n"; -#endif - if (fCleanup) fCleanup(); -} } // namespace HCore -- cgit v1.2.3 From 0ecf818273008e96032ba5013ec55372c6a82e92 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 5 Mar 2024 16:55:42 +0000 Subject: Compiler: Fix syntax error. --- Private/NetworkKit/NetworkDevice.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Private/NetworkKit/NetworkDevice.inl b/Private/NetworkKit/NetworkDevice.inl index f80f5d1c..0780a0b0 100644 --- a/Private/NetworkKit/NetworkDevice.inl +++ b/Private/NetworkKit/NetworkDevice.inl @@ -12,7 +12,7 @@ namespace HCore { NetworkDevice::NetworkDevice(void (*out)(NetworkDeviceCommand), void (*in)(NetworkDeviceCommand), void (*on_cleanup)(void)) - : DeviceInterface(out, in), fCleanup(on_cleanup) {_ + : DeviceInterface(out, in), fCleanup(on_cleanup) { kcout << "NK: NetworkDevice initialize.\r\n"; MUST_PASS(out && in && on_cleanup); -- cgit v1.2.3