3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 18:59:22 +01:00

util: Add util_address_to_string

This commit is contained in:
Denis Kenzior 2016-06-06 18:23:17 -05:00
parent 9f3711954b
commit 92c943998f
2 changed files with 12 additions and 0 deletions

View File

@ -25,6 +25,7 @@
#endif
#include <string.h>
#include <stdio.h>
#include <ell/string.h>
#include <ell/genl.h>
@ -86,6 +87,16 @@ bool util_ssid_is_utf8(size_t len, const uint8_t *ssid)
return l_utf8_validate((const char *)ssid, len, NULL);
}
const char *util_address_to_string(const uint8_t *addr)
{
static char str[18];
sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x",
addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
return str;
}
bool _msg_append_attr(struct l_genl_msg *msg,
uint16_t type, const char *type_str,
uint16_t len, const void *value)

View File

@ -28,6 +28,7 @@
const char *util_ssid_to_utf8(size_t len, const uint8_t *ssid);
bool util_ssid_is_utf8(size_t len, const uint8_t *ssid);
const char *util_address_to_string(const uint8_t *addr);
static inline uint8_t util_bit_field(const uint8_t oct, int start, int num)
{