-#ifndef _SQUID_EUI_EUI48_H
-#define _SQUID_EUI_EUI48_H
+/*
+ * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#ifndef SQUID_SRC_EUI_EUI48_H
+#define SQUID_SRC_EUI_EUI48_H
#if USE_SQUID_EUI
class Address;
};
-#if HAVE_CSTRING
#include <cstring>
-#endif
-
-/* memcpy and friends */
-#if HAVE_STRING_H
-#include <string.h>
-#endif
namespace Eui
{
{
public:
- Eui48() { clear(); };
- Eui48(const Eui48 &t) { memcpy(this, &t, sizeof(Eui48)); };
- ~Eui48() {};
+ Eui48() { clear(); }
+ bool operator== (const Eui48 &t) const { return memcmp(eui, t.eui, SZ_EUI48_BUF) == 0; }
+ bool operator< (const Eui48 &t) const { return memcmp(eui, t.eui, SZ_EUI48_BUF) < 0; }
const unsigned char *get(void);
if (len < SZ_EUI48_BUF) clear();
memcpy(eui, src, len);
return true;
- };
+ }
- void clear() { memset(eui, 0, SZ_EUI48_BUF); };
+ void clear() { memset(eui, 0, SZ_EUI48_BUF); }
/**
* Decode an ascii representation of an EUI-48 ethernet address.
* \retval false Conversion to ASCII failed.
* \retval true Conversion completed successfully.
*/
- bool encode(char *buf, const int len);
+ bool encode(char *buf, const int len) const;
// lookup an EUI-48 / MAC address via ARP
bool lookup(const Ip::Address &c);
} // namespace Eui
#endif /* USE_SQUID_EUI */
-#endif /* _SQUID_EUI_EUI48_H */
+#endif /* SQUID_SRC_EUI_EUI48_H */
+