52 #include "net/ipv6/ip64-addr.h" 55 int curr_log_level_rpl = LOG_CONF_LEVEL_RPL;
56 int curr_log_level_tcpip = LOG_CONF_LEVEL_TCPIP;
57 int curr_log_level_ipv6 = LOG_CONF_LEVEL_IPV6;
58 int curr_log_level_6lowpan = LOG_CONF_LEVEL_6LOWPAN;
59 int curr_log_level_nullnet = LOG_CONF_LEVEL_NULLNET;
60 int curr_log_level_mac = LOG_CONF_LEVEL_MAC;
61 int curr_log_level_framer = LOG_CONF_LEVEL_FRAMER;
62 int curr_log_level_6top = LOG_CONF_LEVEL_6TOP;
63 int curr_log_level_coap = LOG_CONF_LEVEL_COAP;
64 int curr_log_level_lwm2m = LOG_CONF_LEVEL_LWM2M;
65 int curr_log_level_main = LOG_CONF_LEVEL_MAIN;
67 struct log_module all_modules[] = {
68 {
"rpl", &curr_log_level_rpl, LOG_CONF_LEVEL_RPL},
69 {
"tcpip", &curr_log_level_tcpip, LOG_CONF_LEVEL_TCPIP},
70 {
"ipv6", &curr_log_level_ipv6, LOG_CONF_LEVEL_IPV6},
71 {
"6lowpan", &curr_log_level_6lowpan, LOG_CONF_LEVEL_6LOWPAN},
72 {
"nullnet", &curr_log_level_nullnet, LOG_CONF_LEVEL_NULLNET},
73 {
"mac", &curr_log_level_mac, LOG_CONF_LEVEL_MAC},
74 {
"framer", &curr_log_level_framer, LOG_CONF_LEVEL_FRAMER},
75 {
"6top", &curr_log_level_6top, LOG_CONF_LEVEL_6TOP},
76 {
"coap", &curr_log_level_coap, LOG_CONF_LEVEL_COAP},
77 {
"lwm2m", &curr_log_level_lwm2m, LOG_CONF_LEVEL_LWM2M},
78 {
"main", &curr_log_level_main, LOG_CONF_LEVEL_MAIN},
82 #if NETSTACK_CONF_WITH_IPV6 88 char buf[UIPLIB_IPV6_MAX_STR_LEN];
90 LOG_OUTPUT(
"%s", buf);
97 LOG_OUTPUT(
"6A-NULL");
99 LOG_OUTPUT(
"6M-%04x",
UIP_HTONS(ipaddr->u16[
sizeof(uip_ipaddr_t)/2-1]));
101 LOG_OUTPUT(
"6L-%04x",
UIP_HTONS(ipaddr->u16[
sizeof(uip_ipaddr_t)/2-1]));
103 LOG_OUTPUT(
"6G-%04x",
UIP_HTONS(ipaddr->u16[
sizeof(uip_ipaddr_t)/2-1]));
114 LOG_OUTPUT(
"(NULL LL addr)");
118 for(i = 0; i < LINKADDR_SIZE; i++) {
119 if(i > 0 && i % 2 == 0) {
122 LOG_OUTPUT(
"%02x", lladdr->u8[i]);
131 LOG_OUTPUT(
"LL-NULL");
133 #if LINKADDR_SIZE == 8 134 LOG_OUTPUT(
"LL-%04x",
UIP_HTONS(lladdr->u16[LINKADDR_SIZE/2-1]));
135 #elif LINKADDR_SIZE == 2 136 LOG_OUTPUT(
"LL-%04x",
UIP_HTONS(lladdr->u16));
144 if(level >= LOG_LEVEL_NONE && level <= LOG_LEVEL_DBG) {
146 int module_all = !strcmp(
"all", module);
147 while(all_modules[i].name != NULL) {
148 if(module_all || !strcmp(module, all_modules[i].name)) {
149 *all_modules[i].curr_log_level = MIN(level, all_modules[i].max_log_level);
163 while(all_modules[i].name != NULL) {
164 if(!strcmp(module, all_modules[i].name)) {
165 return *all_modules[i].curr_log_level;
static uip_ipaddr_t ipaddr
Pointer to prefix information option in uip_buf.
const linkaddr_t linkaddr_null
The null link-layer address.
void log_lladdr_compact(const linkaddr_t *lladdr)
Logs a link-layer address with a compact format.
void log_set_level(const char *module, int level)
Sets a log level at run-time.
void log_lladdr(const linkaddr_t *lladdr)
Logs a link-layer address.
Header file for the IP address manipulation library.
#define uip_is_addr_mcast(a)
is address a multicast address, see RFC 4291 a is of type uip_ipaddr_t*
void log_6addr(const uip_ipaddr_t *ipaddr)
Logs an IPv6 address.
int linkaddr_cmp(const linkaddr_t *addr1, const linkaddr_t *addr2)
Compare two link-layer addresses.
#define UIP_HTONS(n)
Convert 16-bit quantity from host byte order to network byte order.
const char * log_level_to_str(int level)
Returns a textual description of a log level.
int log_get_level(const char *module)
Returns the current log level.
#define uip_is_addr_linklocal(a)
is addr (a) a link local unicast address, see RFC 4291 i.e.
Header file for the logging system
void log_6addr_compact(const uip_ipaddr_t *ipaddr)
Logs an IPv6 address with a compact format.
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.