diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fb37e27..7f0cd937 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,7 +146,6 @@ check_include_file(netdb.h HAVE_NETDB_H) check_include_file(pthread.h HAVE_PTHREAD_H) check_include_file(stdlib.h HAVE_STDINT_H) check_include_file(stdint.h HAVE_STDLIB_H) -check_include_file(syslog.h HAVE_SYSLOG_H) check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H) check_include_file(sys/socket.h HAVE_SYS_SOCKET_H) check_include_file(sys/stat.h HAVE_SYS_STAT_H) diff --git a/cmake_coap_config.h.in b/cmake_coap_config.h.in index c4fa50bf..4cfb083c 100644 --- a/cmake_coap_config.h.in +++ b/cmake_coap_config.h.in @@ -137,9 +137,6 @@ /* Define to 1 if the system has the type `struct cmsghdr'. */ #cmakedefine HAVE_STRUCT_CMSGHDR @HAVE_STRUCT_CMSGHDR@ -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYSLOG_H @HAVE_SYSLOG_H@ - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_IOCTL_H @HAVE_SYS_IOCTL_H@ diff --git a/configure.ac b/configure.ac index 1a83150a..29029dd8 100644 --- a/configure.ac +++ b/configure.ac @@ -826,7 +826,7 @@ fi AC_CHECK_HEADERS([assert.h arpa/inet.h limits.h netdb.h netinet/in.h \ pthread.h errno.h \ stdlib.h string.h strings.h sys/socket.h sys/time.h \ - time.h unistd.h sys/unistd.h syslog.h sys/ioctl.h net/if.h]) + time.h unistd.h sys/unistd.h sys/ioctl.h net/if.h]) # For epoll, need two headers (sys/epoll.h sys/timerfd.h), but set up one #define AC_CHECK_HEADER([sys/epoll.h]) diff --git a/examples/coap-client.c b/examples/coap-client.c index 641b25fd..6c6875fa 100644 --- a/examples/coap-client.c +++ b/examples/coap-client.c @@ -43,6 +43,7 @@ strndup(const char* s1, size_t n) { #include #include #include +#include #endif #include diff --git a/examples/coap-server.c b/examples/coap-server.c index ae82cfe9..ecbf7d76 100644 --- a/examples/coap-server.c +++ b/examples/coap-server.c @@ -50,6 +50,7 @@ strndup(const char* s1, size_t n) { #include #include #include +#include #endif /* diff --git a/include/coap3/coap_debug.h b/include/coap3/coap_debug.h index 05235a90..60417963 100644 --- a/include/coap3/coap_debug.h +++ b/include/coap3/coap_debug.h @@ -67,44 +67,6 @@ typedef enum { #define COAP_LOG_CIPHERS COAP_LOG_DTLS_BASE /* For backward compatability */ } coap_log_t; -#ifdef HAVE_SYSLOG_H -#include -#else -#if defined(RIOT_VERSION) -/* RIOT defines a subset of the syslog levels in log.h with different - * numeric values. The remaining levels are defined here. Note that - * output granularity differs from what would be expected when - * adhering to the syslog levels. - */ -#include -#endif /* RIOT_VERSION */ -#endif /* HAVE_SYSLOG_H */ - -#ifndef LOG_EMERG -# define LOG_EMERG COAP_LOG_EMERG -#endif -#ifndef LOG_ALERT -# define LOG_ALERT COAP_LOG_ALERT -#endif -#ifndef LOG_CRIT -# define LOG_CRIT COAP_LOG_CRIT -#endif -#ifndef LOG_ERR -# define LOG_ERR COAP_LOG_ERR -#endif -#ifndef LOG_WARNING -# define LOG_WARNING COAP_LOG_WARN -#endif -#ifndef LOG_NOTICE -# define LOG_NOTICE COAP_LOG_NOTICE -#endif -#ifndef LOG_INFO -# define LOG_INFO COAP_LOG_INFO -#endif -#ifndef LOG_DEBUG -# define LOG_DEBUG COAP_LOG_DEBUG -#endif - /** * Get the current logging level. * diff --git a/src/coap_io_contiki.c b/src/coap_io_contiki.c index 914363f1..6bff1ea7 100644 --- a/src/coap_io_contiki.c +++ b/src/coap_io_contiki.c @@ -65,7 +65,7 @@ PROCESS_THREAD(libcoap_io_process, ev, data) { if (ev == tcpip_event) { coap_socket = (struct coap_socket_t *)data; if (!coap_socket) { - coap_log(LOG_CRIT, "libcoap_io_process: data should never be NULL\n"); + coap_log_crit("libcoap_io_process: data should never be NULL\n"); continue; } if (uip_newdata()) { @@ -87,14 +87,14 @@ coap_socket_bind_udp(coap_socket_t *sock, addr = uip_ds6_get_global(ADDR_PREFERRED); if (!addr) { - coap_log(LOG_ERR, "coap_socket_bind_udp: called before getting an IPv6 address\n"); + coap_log_err("coap_socket_bind_udp: called before getting an IPv6 address\n"); return 0; } PROCESS_CONTEXT_BEGIN(&libcoap_io_process); sock->udp_conn = udp_new(NULL, 0, sock); PROCESS_CONTEXT_END(); if (!sock->udp_conn) { - coap_log(LOG_ERR, "coap_socket_bind_udp: udp_new returned NULL\n"); + coap_log_err("coap_socket_bind_udp: udp_new returned NULL\n"); return 0; } udp_bind(sock->udp_conn, listen_addr->port); @@ -113,18 +113,18 @@ coap_socket_connect_udp(coap_socket_t *sock, uip_ds6_addr_t *addr; if (local_if) { - coap_log(LOG_WARNING, "coap_socket_connect_udp: ignoring local_if parameter\n"); + coap_log_warn("coap_socket_connect_udp: ignoring local_if parameter\n"); } addr = uip_ds6_get_global(ADDR_PREFERRED); if (!addr) { - coap_log(LOG_ERR, "coap_socket_connect_udp: called before getting an IPv6 address\n"); + coap_log_err("coap_socket_connect_udp: called before getting an IPv6 address\n"); return 0; } PROCESS_CONTEXT_BEGIN(&libcoap_io_process); sock->udp_conn = udp_new(&server->addr, server->port ? server->port : default_port, sock); PROCESS_CONTEXT_END(); if (!sock->udp_conn) { - coap_log(LOG_ERR, "coap_socket_connect_udp: udp_new returned NULL\n"); + coap_log_err("coap_socket_connect_udp: udp_new returned NULL\n"); return 0; } uip_ipaddr_copy(&local_addr->addr, &addr->ipaddr); @@ -169,7 +169,7 @@ coap_socket_send(coap_socket_t *sock, const coap_session_t *session, const uint8 } if (bytes_written < 0) { - coap_log(LOG_CRIT, "coap_socket_send: %s\n", coap_socket_strerror()); + coap_log_crit("coap_socket_send: %s\n", coap_socket_strerror()); } return bytes_written; @@ -202,7 +202,7 @@ coap_socket_recv(coap_socket_t *sock, coap_packet_t *packet) { len = uip_datalen(); if (len > COAP_RXBUFFER_SIZE) { - coap_log(LOG_WARNING, "Received message does not fit within buffer\n"); + coap_log_warn("Received message does not fit within buffer\n"); return -1; } packet->length = len;