summaryrefslogtreecommitdiff
path: root/Kernel/MACAddress.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-10 19:15:22 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-10 19:15:22 +0100
commit4641ee49b556619aa7a6618c42d4a3c126ad5f33 (patch)
tree906749c12d258281a54b55e1682f36226275e13a /Kernel/MACAddress.h
parent405413c354a28e5f53c5e317aae2dd71d014b9e8 (diff)
downloadserenity-4641ee49b556619aa7a6618c42d4a3c126ad5f33.zip
Kernel: Add a simple MACAddress class.
Diffstat (limited to 'Kernel/MACAddress.h')
-rw-r--r--Kernel/MACAddress.h27
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 };
+};