diff options
| author | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-03-05 16:38:50 +0000 |
|---|---|---|
| committer | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-03-05 16:38:50 +0000 |
| commit | d5f33ac36eff7857083786e9daf076c4101cbd3c (patch) | |
| tree | 0a55ea1dc85cf03cae1d7a1d35698c3a2bd27384 | |
| parent | 3f898e74b7666acf51da16b03c2866ce379d8eb2 (diff) | |
Kernel: bump.
| -rw-r--r-- | Private/NetworkKit/MAC.hxx | 2 | ||||
| -rw-r--r-- | Private/NetworkKit/NetworkDevice.hpp | 12 | ||||
| -rw-r--r-- | Private/NetworkKit/NetworkDevice.inl | 27 | ||||
| -rw-r--r-- | Private/Source/Network/NetworkDevice.cxx | 18 |
4 files changed, 37 insertions, 22 deletions
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<NetworkDeviceCommand> { 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<NetworkDeviceCommand> { 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 <NetworkKit/NetworkDevice.inl> + #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<NetworkDeviceCommand>(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 <NetworkKit/NetworkDevice.hpp> -// network devices implementation. -// PPPNetworkService, TCPNetworkDevice, UDPNetworkService - namespace HCore { -NetworkDevice::NetworkDevice(void (*out)(NetworkDeviceCommand), - void (*in)(NetworkDeviceCommand), - void (*on_cleanup)(void)) - : DeviceInterface<NetworkDeviceCommand>(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 |
