minor improvements

This commit is contained in:
/jdi/ 2015-10-08 00:52:06 +02:00
parent e077b4ca8a
commit f11f281a2c
6 changed files with 91 additions and 58 deletions

View file

@ -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++) {