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:
parent
405413c354
commit
4641ee49b5
4 changed files with 32 additions and 8 deletions
27
Kernel/MACAddress.h
Normal file
27
Kernel/MACAddress.h
Normal 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 };
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue