From c9ec3b818df3dceb78c0535b6e962291d21a1619 Mon Sep 17 00:00:00 2001 From: Ido Barnea Date: Mon, 7 Nov 2016 16:18:50 +0200 Subject: Support multi dest and src addresses in pretest Signed-off-by: Ido Barnea --- src/common/Network/Packet/MacAddress.h | 11 ++++++++--- src/common/basic_utils.cpp | 7 +++++++ src/common/basic_utils.h | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'src/common') diff --git a/src/common/Network/Packet/MacAddress.h b/src/common/Network/Packet/MacAddress.h index 7e872fd6..2bc25333 100755 --- a/src/common/Network/Packet/MacAddress.h +++ b/src/common/Network/Packet/MacAddress.h @@ -29,7 +29,7 @@ public: MacAddress() { - set(0xca, 0xfe, 0xde, 0xad, 0xbe, 0xef); + set(0xff, 0xff, 0xff, 0xff, 0xff, 0xff); }; MacAddress(uint8_t a0, @@ -81,12 +81,17 @@ public: data[5]=val; } + bool isDefaultAddress() const + { + static MacAddress defaultMac; + return (*this == defaultMac); + } bool isInvalidAddress() const { static MacAddress allZeros(0,0,0,0,0,0); - static MacAddress cafeDeadBeef; - return (*this == allZeros || *this == cafeDeadBeef); + static MacAddress defaultMac; + return (*this == allZeros || *this == defaultMac); } void setIdentifierAsBogusAddr(uint32_t identifier) { diff --git a/src/common/basic_utils.cpp b/src/common/basic_utils.cpp index f169c29f..04e7aaba 100755 --- a/src/common/basic_utils.cpp +++ b/src/common/basic_utils.cpp @@ -174,6 +174,13 @@ void TestDump(void){ utl_DumpBuffer2(stdout,buffer,31,1,4,SHOW_BUFFER_ADDR_EN |SHOW_BUFFER_CHAR); } +std::string +utl_macaddr_to_str(const uint8_t *mac) { + std::string tmp; + utl_macaddr_to_str(mac, tmp); + return tmp; +} + void utl_macaddr_to_str(const uint8_t *macaddr, std::string &output) { for (int i = 0; i < 6; i++) { diff --git a/src/common/basic_utils.h b/src/common/basic_utils.h index f6250a2b..1079ecfc 100755 --- a/src/common/basic_utils.h +++ b/src/common/basic_utils.h @@ -85,6 +85,7 @@ inline void utl_swap(T& a, T& b) { bool utl_is_file_exists (const std::string& name) ; void utl_macaddr_to_str(const uint8_t *macaddr, std::string &output); +std::string utl_macaddr_to_str(const uint8_t *macaddr); std::string utl_generate_random_str(unsigned int &seed, int len); -- cgit 1.2.3-korg