From 4641ee49b556619aa7a6618c42d4a3c126ad5f33 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 10 Mar 2019 19:15:22 +0100 Subject: Kernel: Add a simple MACAddress class. --- Kernel/MACAddress.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Kernel/MACAddress.h (limited to 'Kernel/MACAddress.h') 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 +#include +#include + +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 }; +}; -- cgit v1.2.3