mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 23:09:34 +01:00
util: Add util_address_to_string
This commit is contained in:
parent
9f3711954b
commit
92c943998f
11
src/util.c
11
src/util.c
@ -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)
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user