libnick 2025.9.1
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
macaddress.h
Go to the documentation of this file.
1
22
23#ifndef MACADDRESS_H
24#define MACADDRESS_H
25
26#include <optional>
27#include <string>
28
29namespace Nickvision::Network
30{
35 {
36 public:
46 MacAddress(unsigned char oui1, unsigned char oui2, unsigned char oui3, unsigned char nic1, unsigned char nic2, unsigned char nic3) noexcept;
52 static std::optional<MacAddress> parse(const std::string& address) noexcept;
57 unsigned char getFirst() const noexcept;
62 unsigned char getSecond() const noexcept;
67 unsigned char getThird() const noexcept;
72 unsigned char getFourth() const noexcept;
77 unsigned char getFifth() const noexcept;
82 unsigned char getSixth() const noexcept;
87 std::string str() const noexcept;
88
89 private:
90 unsigned char m_oui1;
91 unsigned char m_oui2;
92 unsigned char m_oui3;
93 unsigned char m_nic1;
94 unsigned char m_nic2;
95 unsigned char m_nic3;
96 };
97}
98
99#endif //MACADDRESS_H
unsigned char getSixth() const noexcept
Gets the sixth byte of the address.
unsigned char getFourth() const noexcept
Gets the fourth byte of the address.
unsigned char getFifth() const noexcept
Gets the fifth byte of the address.
unsigned char getThird() const noexcept
Gets the third byte of the address.
std::string str() const noexcept
Gets the string representation of the address.
MacAddress(unsigned char oui1, unsigned char oui2, unsigned char oui3, unsigned char nic1, unsigned char nic2, unsigned char nic3) noexcept
Constructs a MacAddress.
unsigned char getSecond() const noexcept
Gets the second byte of the address.
unsigned char getFirst() const noexcept
Gets the first byte of the address.
static std::optional< MacAddress > parse(const std::string &address) noexcept
Parses a MacAddress from a string.
Definition ipv4address.h:30