]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
d8500c53 TG |
2 | #pragma once |
3 | ||
d8500c53 | 4 | #include <net/ethernet.h> |
b553a6b1 | 5 | #include <stdbool.h> |
d8500c53 | 6 | |
583706ab YW |
7 | #include "hash-funcs.h" |
8 | ||
d8500c53 TG |
9 | #define ETHER_ADDR_FORMAT_STR "%02X%02X%02X%02X%02X%02X" |
10 | #define ETHER_ADDR_FORMAT_VAL(x) (x).ether_addr_octet[0], (x).ether_addr_octet[1], (x).ether_addr_octet[2], (x).ether_addr_octet[3], (x).ether_addr_octet[4], (x).ether_addr_octet[5] | |
81a56d6f LP |
11 | |
12 | #define ETHER_ADDR_TO_STRING_MAX (3*6) | |
81a56d6f | 13 | char* ether_addr_to_string(const struct ether_addr *addr, char buffer[ETHER_ADDR_TO_STRING_MAX]); |
b553a6b1 | 14 | |
7a08d314 | 15 | int ether_addr_compare(const struct ether_addr *a, const struct ether_addr *b); |
583706ab YW |
16 | static inline bool ether_addr_equal(const struct ether_addr *a, const struct ether_addr *b) { |
17 | return ether_addr_compare(a, b) == 0; | |
18 | } | |
6b0132e4 ZJS |
19 | |
20 | #define ETHER_ADDR_NULL ((const struct ether_addr){}) | |
21 | ||
22 | static inline bool ether_addr_is_null(const struct ether_addr *addr) { | |
23 | return ether_addr_equal(addr, ÐER_ADDR_NULL); | |
24 | } | |
dd4d201a | 25 | |
e5c1be89 | 26 | int ether_addr_from_string(const char *s, struct ether_addr *ret); |
583706ab YW |
27 | |
28 | extern const struct hash_ops ether_addr_hash_ops; |