52#include "net/ipv6/ip64-addr.h"
56int curr_log_level_rpl = LOG_CONF_LEVEL_RPL;
57int curr_log_level_tcpip = LOG_CONF_LEVEL_TCPIP;
58int curr_log_level_ipv6 = LOG_CONF_LEVEL_IPV6;
59int curr_log_level_6lowpan = LOG_CONF_LEVEL_6LOWPAN;
60int curr_log_level_nullnet = LOG_CONF_LEVEL_NULLNET;
61int curr_log_level_mac = LOG_CONF_LEVEL_MAC;
62int curr_log_level_framer = LOG_CONF_LEVEL_FRAMER;
63int curr_log_level_6top = LOG_CONF_LEVEL_6TOP;
64int curr_log_level_coap = LOG_CONF_LEVEL_COAP;
65int curr_log_level_snmp = LOG_CONF_LEVEL_SNMP;
66int curr_log_level_lwm2m = LOG_CONF_LEVEL_LWM2M;
67int curr_log_level_sys = LOG_CONF_LEVEL_SYS;
68int curr_log_level_main = LOG_CONF_LEVEL_MAIN;
70struct log_module all_modules[] = {
71 {
"rpl", &curr_log_level_rpl, LOG_CONF_LEVEL_RPL},
72 {
"tcpip", &curr_log_level_tcpip, LOG_CONF_LEVEL_TCPIP},
73 {
"ipv6", &curr_log_level_ipv6, LOG_CONF_LEVEL_IPV6},
74 {
"6lowpan", &curr_log_level_6lowpan, LOG_CONF_LEVEL_6LOWPAN},
75 {
"nullnet", &curr_log_level_nullnet, LOG_CONF_LEVEL_NULLNET},
76 {
"mac", &curr_log_level_mac, LOG_CONF_LEVEL_MAC},
77 {
"framer", &curr_log_level_framer, LOG_CONF_LEVEL_FRAMER},
78 {
"6top", &curr_log_level_6top, LOG_CONF_LEVEL_6TOP},
79 {
"coap", &curr_log_level_coap, LOG_CONF_LEVEL_COAP},
80 {
"snmp", &curr_log_level_snmp, LOG_CONF_LEVEL_SNMP},
81 {
"lwm2m", &curr_log_level_lwm2m, LOG_CONF_LEVEL_LWM2M},
82 {
"sys", &curr_log_level_sys, LOG_CONF_LEVEL_SYS},
83 {
"main", &curr_log_level_main, LOG_CONF_LEVEL_MAIN},
87#if NETSTACK_CONF_WITH_IPV6
93 char buf[UIPLIB_IPV6_MAX_STR_LEN];
95 LOG_OUTPUT(
"%s", buf);
102 return snprintf(buf, size,
"6A-NULL");
112#if BUILD_WITH_DEPLOYMENT
115 return snprintf(buf, size,
"%s-%04x", prefix,
UIP_HTONS(
ipaddr->u16[
sizeof(uip_ipaddr_t)/2-1]));
125 LOG_OUTPUT(
"%s", buf);
133 LOG_OUTPUT(
"(NULL LL addr)");
137 for(i = 0; i < LINKADDR_SIZE; i++) {
138 if(i > 0 && i % 2 == 0) {
141 LOG_OUTPUT(
"%02x", lladdr->u8[i]);
150 LOG_OUTPUT(
"LL-NULL");
152#if BUILD_WITH_DEPLOYMENT
155#if LINKADDR_SIZE == 8
156 LOG_OUTPUT(
"LL-%04x",
UIP_HTONS(lladdr->u16[LINKADDR_SIZE/2-1]));
157#elif LINKADDR_SIZE == 2
158 LOG_OUTPUT(
"LL-%04x",
UIP_HTONS(lladdr->u16));
167 const uint8_t *u8data = (
const uint8_t *)data;
169 for(i = 0; i != length; ++i) {
170 LOG_OUTPUT(
"%02x", u8data[i]);
177 if(level >= LOG_LEVEL_NONE && level <= LOG_LEVEL_DBG) {
179 int module_all = !strcmp(
"all", module);
180 while(all_modules[i].name != NULL) {
181 if(module_all || !strcmp(module, all_modules[i].name)) {
182 *all_modules[i].curr_log_level = MIN(level, all_modules[i].max_log_level);
196 while(all_modules[i].name != NULL) {
197 if(!strcmp(module, all_modules[i].name)) {
198 return *all_modules[i].curr_log_level;
Per-deployment MAC <-> nodeid mapping.
uint16_t deployment_id_from_iid(const uip_ipaddr_t *ipaddr)
Get node ID from the IID of an IPv6 address.
uint16_t deployment_id_from_lladdr(const linkaddr_t *lladdr)
Get node ID from a link-layer address, from the deployment mapping table.
bool linkaddr_cmp(const linkaddr_t *addr1, const linkaddr_t *addr2)
Compare two link-layer addresses.
const linkaddr_t linkaddr_null
The null link-layer address.
void log_set_level(const char *module, int level)
Sets a log level at run-time.
int log_6addr_compact_snprint(char *buf, size_t size, const uip_ipaddr_t *ipaddr)
Write at most size - 1 characters of the IP address to the output string, in a compact representation...
void log_6addr_compact(const uip_ipaddr_t *ipaddr)
Logs an IPv6 address with a compact format.
void log_lladdr(const linkaddr_t *lladdr)
Logs a link-layer address.
const char * log_level_to_str(int level)
Returns a textual description of a log level.
void log_lladdr_compact(const linkaddr_t *lladdr)
Logs a link-layer address with a compact format.
void log_6addr(const uip_ipaddr_t *ipaddr)
Logs an IPv6 address.
int log_get_level(const char *module)
Returns the current log level.
void log_bytes(const void *data, size_t length)
Logs a byte array as hex characters.
int uiplib_ipaddr_snprint(char *buf, size_t size, const uip_ipaddr_t *addr)
Write at most size - 1 characters of the IP address to the output string.
#define uip_is_addr_mcast(a)
is address a multicast address, see RFC 4291 a is of type uip_ipaddr_t*
#define uip_is_addr_linklocal(a)
is addr (a) a link local unicast address, see RFC 4291 i.e.
#define UIP_HTONS(n)
Convert 16-bit quantity from host byte order to network byte order.
Header file for the logging system.
static uip_ipaddr_t ipaddr
Pointer to prefix information option in uip_buf.
Header file for the IP address manipulation library.