diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-10 19:15:22 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-10 19:15:22 +0100 |
commit | 4641ee49b556619aa7a6618c42d4a3c126ad5f33 (patch) | |
tree | 906749c12d258281a54b55e1682f36226275e13a /Kernel/MACAddress.h | |
parent | 405413c354a28e5f53c5e317aae2dd71d014b9e8 (diff) | |
download | serenity-4641ee49b556619aa7a6618c42d4a3c126ad5f33.zip |
Kernel: Add a simple MACAddress class.
Diffstat (limited to 'Kernel/MACAddress.h')
-rw-r--r-- | Kernel/MACAddress.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Kernel/MACAddress.h b/Kernel/MACAddress.h new file mode 100644 index 0000000000..e9b8dd41a2 --- /dev/null +++ b/Kernel/MACAddress.h @@ -0,0 +1,27 @@ +#pragma once + +#include <AK/Assertions.h> +#include <AK/Types.h> +#include <Kernel/StdLib.h> + +class MACAddress { +public: + MACAddress() { } + MACAddress(const byte data[6]) + : m_valid(true) + { + memcpy(m_data, data, 6); + } + ~MACAddress() { } + + bool is_valid() const { return m_valid; } + byte operator[](int i) const + { + ASSERT(i >= 0 && i < 6); + return m_data[i]; + } + +private: + byte m_data[6]; + bool m_valid { false }; +}; |