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