diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-03-23 19:13:48 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-03-23 19:15:17 +0100 |
| commit | a13e1c0911c0627184bc38f18c7fdda64447b3ad (patch) | |
| tree | 073a62c09bf216e85a3f310376640fa1805147f9 /dev/kernel/NetworkKit/NetworkDevice.h | |
| parent | 149fa096eb306d03686b3b67e813cf1a78e08cd0 (diff) | |
meta(kernel): Reworked repository's filesystem structure.
Removing useless parts of the project too.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/kernel/NetworkKit/NetworkDevice.h')
| -rw-r--r-- | dev/kernel/NetworkKit/NetworkDevice.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/dev/kernel/NetworkKit/NetworkDevice.h b/dev/kernel/NetworkKit/NetworkDevice.h new file mode 100644 index 00000000..c95573f3 --- /dev/null +++ b/dev/kernel/NetworkKit/NetworkDevice.h @@ -0,0 +1,83 @@ +/* ------------------------------------------- + + Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. + +------------------------------------------- */ + +#ifndef __INC_NETWORK_DEVICE_H__ +#define __INC_NETWORK_DEVICE_H__ + +#include <KernelKit/DeviceMgr.h> +#include <NetworkKit/IP.h> + +/// @note Can either work with: Ethernet, GPRS, WiFi + +namespace NeOS +{ + struct NetworkDeviceCommand; + class NetworkDevice; + + /** + * \brief Network device interface, establishes a connection to the NIC. + */ + class NetworkDevice final : public IDeviceObject<NetworkDeviceCommand> + { + public: + NetworkDevice(void (*out)(IDeviceObject<NetworkDeviceCommand>*, NetworkDeviceCommand), + void (*in)(IDeviceObject<NetworkDeviceCommand>*, NetworkDeviceCommand), + void (*onCleanup)(void) = nullptr); + + ~NetworkDevice() override; + + public: + NetworkDevice& operator=(const NetworkDevice&) = default; + NetworkDevice(const NetworkDevice&) = default; + + public: + const Char* Name() const override; + Boolean Name(const Char* newStr); + + private: + static constexpr auto cNetworkNameLen = 512; + + Void (*fCleanup)(void); + Char fNetworkName[cNetworkNameLen]; + }; + + struct 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 IPC device. + using IPCNetworkDevice = NetworkDevice; + + /// @brief GRPS device. + using GPRSNetworkDevice = NetworkDevice; + + /// @brief GSM device. + using GSMNetworkDevice = NetworkDevice; + + /// @brief Bluetooth device. + using BTNetworkDevice = NetworkDevice; + + /// @brief LTE device. + using LTENetworkDevice = NetworkDevice; +} // namespace NeOS + +#include <NetworkKit/NetworkDevice.inl> + +#endif // !__INC_NETWORK_DEVICE_H__ |
