diff options
Diffstat (limited to 'Kernel')
| -rw-r--r-- | Kernel/NetworkKit/NetworkDevice.hpp | 9 | ||||
| -rw-r--r-- | Kernel/Sources/Network/NetworkDevice.cxx | 20 |
2 files changed, 26 insertions, 3 deletions
diff --git a/Kernel/NetworkKit/NetworkDevice.hpp b/Kernel/NetworkKit/NetworkDevice.hpp index 20c2a66a..4ea98e4f 100644 --- a/Kernel/NetworkKit/NetworkDevice.hpp +++ b/Kernel/NetworkKit/NetworkDevice.hpp @@ -35,12 +35,17 @@ namespace NewOS public: const char* Name() const override; + Boolean Name(const char* strView); private: - void (*fCleanup)(void); + constexpr auto cNetworkNameLen = 512; + + Void (*fCleanup)(void); + Char fNetworkName[cNetworkNameLen]; + }; - struct PACKED NetworkDeviceCommand final + struct NetworkDeviceCommand final { UInt32 CommandName; UInt32 CommandType; diff --git a/Kernel/Sources/Network/NetworkDevice.cxx b/Kernel/Sources/Network/NetworkDevice.cxx index 511246c7..e1994baa 100644 --- a/Kernel/Sources/Network/NetworkDevice.cxx +++ b/Kernel/Sources/Network/NetworkDevice.cxx @@ -8,8 +8,26 @@ namespace NewOS { + /// \brief Getter for fNetworkName. const char* NetworkDevice::Name() const { - return "NetworkDevice"; + return this->fNetworkName; + } + + /// \brief Setter for fNetworkName. + Boolean NetworkDevice::Name(const char* strView) + { + if (strView == nullptr) + return false; + + if (*strView == 0) + return false; + + if (rt_string_len(strView) > cNetworkNameLen) + return false; + + rt_copy_memory(strView, this->fNetworkName, rt_string_len(strView)); + + return true; } } // namespace NewOS |
