21 lines
506 B
C
21 lines
506 B
C
#include "net/nl_names.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
void nl_names_mac_suffix(const uint8_t mac[6], char out[5])
|
|
{
|
|
snprintf(out, 5, "%02x%02x", mac[4], mac[5]);
|
|
}
|
|
|
|
void nl_names_hostname(const uint8_t mac[6], char *out, size_t len)
|
|
{
|
|
char suffix[5];
|
|
nl_names_mac_suffix(mac, suffix);
|
|
snprintf(out, len, "ninlight-%s", suffix);
|
|
}
|
|
|
|
void nl_names_mac_str(const uint8_t mac[6], char out[18])
|
|
{
|
|
snprintf(out, 18, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
|
}
|