minor improvements
This commit is contained in:
parent
e077b4ca8a
commit
f11f281a2c
6 changed files with 91 additions and 58 deletions
16
src/Types.h
16
src/Types.h
|
|
@ -39,6 +39,14 @@ public:
|
|||
else break;
|
||||
}
|
||||
}
|
||||
|
||||
macAddr(bytes bts) {
|
||||
int i = 0;
|
||||
for (byte b : bts) {
|
||||
if(i<6) (*this)[i++]=b;
|
||||
else break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class ipAddr: public std::array<byte, 4> {
|
||||
|
|
@ -56,6 +64,14 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
ipAddr(bytes bts) {
|
||||
int i = 0;
|
||||
for (byte b : bts) {
|
||||
if(i<4) (*this)[i++]=b;
|
||||
else break;
|
||||
}
|
||||
}
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& out, ipAddr& arr) {
|
||||
out << std::dec << (unsigned) arr[0];
|
||||
for (unsigned i = 1; i < 4; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue