From af8a516fc22865abd80d6e26f1541fa3d6bebfdc Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 9 May 2024 00:42:44 +0200 Subject: MHR-23: :boom:, refactors. - Move NewBoot to /Boot, thus making Kernel directory only containing the kernel. Signed-off-by: Amlal El Mahrouss --- Kernel/NetworkKit/NetworkDevice.hpp | 65 +++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Kernel/NetworkKit/NetworkDevice.hpp (limited to 'Kernel/NetworkKit/NetworkDevice.hpp') diff --git a/Kernel/NetworkKit/NetworkDevice.hpp b/Kernel/NetworkKit/NetworkDevice.hpp new file mode 100644 index 00000000..b00ce7a6 --- /dev/null +++ b/Kernel/NetworkKit/NetworkDevice.hpp @@ -0,0 +1,65 @@ +/* ------------------------------------------- + + Copyright SoftwareLabs + +------------------------------------------- */ + +#ifndef __NETWORK_DEVICE__ +#define __NETWORK_DEVICE__ + +#include +#include + +namespace NewOS +{ + 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 (*onCleanup)(void) = nullptr); + + ~NetworkDevice() override; + + public: + NetworkDevice& operator=(const NetworkDevice&) = default; + NetworkDevice(const NetworkDevice&) = default; + + public: + const char* Name() const override; + + private: + void (*fCleanup)(void); + }; + + struct PACKED NetworkDeviceCommand final + { + UInt32 CommandName; + UInt32 CommandType; + UInt32 CommandFlags; + VoidPtr CommandBuffer; + SizeT CommandSizeBuffer; + }; + + /// @brief TCP device. + using TCPNetworkDevice = NetworkDevice; + + /// @brief UDP device. + using UDPNetworkDevice = NetworkDevice; + + /// @brief PPP device. + using PPPNetworkDevice = NetworkDevice; + + /// @brief HPC device. + using HPCNetworkDevice = NetworkDevice; +} // namespace NewOS + +#include + +#endif // !__NETWORK_DEVICE__ -- cgit v1.2.3