From 5ad97d9ef3f77a246a588f4256d92f831e542f5d Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Tue, 26 Jan 2016 22:25:03 +0200 Subject: str: Add str2mac helper function Add function to convert a string in the format xx:xx:xx:xx:xx:xx to a MAC address byte array. Signed-off-by: Vadim Kochan [tk: Add len parameter and error out on too short buffers] Signed-off-by: Tobias Klauser --- str.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'str.h') diff --git a/str.h b/str.h index 3ffb2b9..7879af6 100644 --- a/str.h +++ b/str.h @@ -1,6 +1,8 @@ #ifndef STR_H #define STR_H +#include + #include "built_in.h" extern size_t strlcpy(char *dest, const char *src, size_t size); @@ -11,5 +13,6 @@ extern noinline void *xmemset(void *s, int c, size_t n); extern char *argv2str(int startind, int argc, char **argv); extern char **argv_insert(char **argv, size_t *count, const char *str); extern void argv_free(char **argv); +extern int str2mac(const char *str, uint8_t *mac, size_t len); #endif /* STR_H */ -- cgit v1.2.3-54-g00ecf