52 #include "net/ipv6/ip64-addr.h" 56 int curr_log_level_rpl = LOG_CONF_LEVEL_RPL;
57 int curr_log_level_tcpip = LOG_CONF_LEVEL_TCPIP;
58 int curr_log_level_ipv6 = LOG_CONF_LEVEL_IPV6;
59 int curr_log_level_6lowpan = LOG_CONF_LEVEL_6LOWPAN;
60 int curr_log_level_nullnet = LOG_CONF_LEVEL_NULLNET;
61 int curr_log_level_mac = LOG_CONF_LEVEL_MAC;
62 int curr_log_level_framer = LOG_CONF_LEVEL_FRAMER;
63 int curr_log_level_6top = LOG_CONF_LEVEL_6TOP;
64 int curr_log_level_coap = LOG_CONF_LEVEL_COAP;
65 int curr_log_level_snmp = LOG_CONF_LEVEL_SNMP;
66 int curr_log_level_lwm2m = LOG_CONF_LEVEL_LWM2M;
67 int curr_log_level_main = LOG_CONF_LEVEL_MAIN;
69 struct log_module all_modules[] = {
70 {
"rpl", &curr_log_level_rpl, LOG_CONF_LEVEL_RPL},
71 {
"tcpip", &curr_log_level_tcpip, LOG_CONF_LEVEL_TCPIP},
72 {
"ipv6", &curr_log_level_ipv6, LOG_CONF_LEVEL_IPV6},
73 {
"6lowpan", &curr_log_level_6lowpan, LOG_CONF_LEVEL_6LOWPAN},
74 {
"nullnet", &curr_log_level_nullnet, LOG_CONF_LEVEL_NULLNET},
75 {
"mac", &curr_log_level_mac, LOG_CONF_LEVEL_MAC},
76 {
"framer", &curr_log_level_framer, LOG_CONF_LEVEL_FRAMER},
77 {
"6top", &curr_log_level_6top, LOG_CONF_LEVEL_6TOP},
78 {
"coap", &curr_log_level_coap, LOG_CONF_LEVEL_COAP},
79 {
"snmp", &curr_log_level_snmp, LOG_CONF_LEVEL_SNMP},
80 {
"lwm2m", &curr_log_level_lwm2m, LOG_CONF_LEVEL_LWM2M},
81 {
"main", &curr_log_level_main, LOG_CONF_LEVEL_MAIN},
85 #if NETSTACK_CONF_WITH_IPV6 91 char buf[UIPLIB_IPV6_MAX_STR_LEN];
93 LOG_OUTPUT(
"%s", buf);
100 return snprintf(buf, size,
"6A-NULL");
110 #if BUILD_WITH_DEPLOYMENT 113 return snprintf(buf, size,
"%s-%04x", prefix,
UIP_HTONS(ipaddr->u16[
sizeof(uip_ipaddr_t)/2-1]));
123 LOG_OUTPUT(
"%s", buf);
131 LOG_OUTPUT(
"(NULL LL addr)");
135 for(i = 0; i < LINKADDR_SIZE; i++) {
136 if(i > 0 && i % 2 == 0) {
139 LOG_OUTPUT(
"%02x", lladdr->u8[i]);
148 LOG_OUTPUT(
"LL-NULL");
150 #if BUILD_WITH_DEPLOYMENT 153 #if LINKADDR_SIZE == 8 154 LOG_OUTPUT(
"LL-%04x",
UIP_HTONS(lladdr->u16[LINKADDR_SIZE/2-1]));
155 #elif LINKADDR_SIZE == 2 156 LOG_OUTPUT(
"LL-%04x",
UIP_HTONS(lladdr->u16));
165 if(level >= LOG_LEVEL_NONE && level <= LOG_LEVEL_DBG) {
167 int module_all = !strcmp(
"all", module);
168 while(all_modules[i].name != NULL) {
169 if(module_all || !strcmp(module, all_modules[i].name)) {
170 *all_modules[i].curr_log_level = MIN(level, all_modules[i].max_log_level);
184 while(all_modules[i].name != NULL) {
185 if(!strcmp(module, all_modules[i].name)) {
186 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.
Per-deployment MAC <-> nodeid mapping.
#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.
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...
uint16_t deployment_id_from_lladdr(const linkaddr_t *lladdr)
Get node ID from a link-layer address, from the deployment mapping table.
#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
uint16_t deployment_id_from_iid(const uip_ipaddr_t *ipaddr)
Get node ID from the IID of an IPv6 address.
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.