1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:47:35 +00:00

Kernel: Add a simple MACAddress class.

This commit is contained in:
Andreas Kling 2019-03-10 19:15:22 +01:00
parent 405413c354
commit 4641ee49b5
4 changed files with 32 additions and 8 deletions

27
Kernel/MACAddress.h Normal file
View file

@ -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 };
};