|
|
1.1 ! root 1: // ! 2: // nono ! 3: // Copyright (C) 2021 nono project ! 4: // Licensed under nono-license.txt ! 5: // ! 6: ! 7: // ! 8: // MAC アドレス ! 9: // ! 10: ! 11: #pragma once ! 12: ! 13: #include "header.h" ! 14: #include <array> ! 15: ! 16: // MAC アドレス格納用のクラス ! 17: class macaddr_t : public std::array<uint8, 6> ! 18: { ! 19: using inherited = std::array<uint8, 6>; ! 20: public: ! 21: // この MAC アドレスが 00:00:00:00:00:00 なら true ! 22: bool Empty() const; ! 23: ! 24: // MAC アドレスを適当に生成する。 ! 25: void Generate(); ! 26: ! 27: // 文字列から MAC アドレスを作成する。"HH:HH:HH:HH:HH:HH" 形式のみ。 ! 28: // 成功すれば true を返す。 ! 29: bool FromString(const std::string& src); ! 30: ! 31: // 区切り文字なしの文字列形式を返す。主に ROM 埋め込み用で英字は大文字。 ! 32: // 01:23:AB なら "0123AB" のような感じ。 ! 33: std::string ToString() const; ! 34: ! 35: // sep を区切り文字とする文字列形式を返す。主に表示用で英字は小文字。 ! 36: // 01:23:AB で sep = ":" なら "01:23:ab" のような感じ。 ! 37: std::string ToString(char sep) const; ! 38: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.