diff options
author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2016-05-17 11:00:29 -0400 |
---|---|---|
committer | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2016-05-17 16:55:20 -0400 |
commit | dd4d201ab1c9456e1bffc39f9dec00a4a4619084 (patch) | |
tree | ca157d8ed22b9197380640af08b0785fdfacdcdf /src/basic/ether-addr-util.h | |
parent | 1a7906ae914fd233305fff0acf4b9138ff944209 (diff) |
util-lib: add ether_addr_from_string()
This isn't quite symmetrical to in_addr_from_string() because it also returns
an offset indicating how much of the string was consumed by the matched
pattern. This offset reporting is needed for either of the following use
cases:
* verifying the lack of trailing garbage after such an address
* parsing subsequent data from the same string
Diffstat (limited to 'src/basic/ether-addr-util.h')
-rw-r--r-- | src/basic/ether-addr-util.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/basic/ether-addr-util.h b/src/basic/ether-addr-util.h index 074363793e..74e125a95f 100644 --- a/src/basic/ether-addr-util.h +++ b/src/basic/ether-addr-util.h @@ -35,3 +35,5 @@ bool ether_addr_equal(const struct ether_addr *a, const struct ether_addr *b); static inline bool ether_addr_is_null(const struct ether_addr *addr) { return ether_addr_equal(addr, ÐER_ADDR_NULL); } + +int ether_addr_from_string(const char *s, struct ether_addr *ret, size_t *offset); |