plaform/posix/{coap_io,run}.c: fixed LWS in source

Removed trailing whitespace and reformatted indentation as suggested by
Carsten in [1].

[1] https://sourceforge.net/p/libcoap/mailman/message/34988221/
This commit is contained in:
Olaf Bergmann committed 2016-04-05 16:34:10 +02:00
1 parent b223d9f422
commit ca0f3f3188
2 files changed
+22 -22

No files matched your search

+21 -21
View File
@@ -3,7 +3,7 @@
* Copyright (C) 2012,2014,2016 Olaf Bergmann <bergmann@tzi.org>
*
* This file is part of the CoAP library libcoap. Please see
* README for terms of use.
* README for terms of use.
*/
#include "coap_config.h"
@@ -14,7 +14,7 @@
#ifdef HAVE_SYS_SELECT_H
# include <sys/select.h>
#endif
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
@@ -23,10 +23,10 @@
#endif
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#endif
#include <errno.h>
#include <fcntl.h>
@@ -93,13 +93,13 @@ coap_new_endpoint(const coap_address_t *addr, int flags) {
break;
case AF_INET6:
#ifdef IPV6_RECVPKTINFO
if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on)) < 0)
coap_log(LOG_ALERT, "coap_new_endpoint: setsockopt IPV6_RECVPKTINFO\n");
if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on)) < 0)
coap_log(LOG_ALERT, "coap_new_endpoint: setsockopt IPV6_RECVPKTINFO\n");
#else /* IPV6_RECVPKTINFO */
if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_PKTINFO, &on, sizeof(on)) < 0)
coap_log(LOG_ALERT, "coap_new_endpoint: setsockopt IPV6_PKTINFO\n");
#endif /* IPV6_RECVPKTINFO */
break;
if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_PKTINFO, &on, sizeof(on)) < 0)
coap_log(LOG_ALERT, "coap_new_endpoint: setsockopt IPV6_PKTINFO\n");
#endif /* IPV6_RECVPKTINFO */
break;
default:
coap_log(LOG_ALERT, "coap_new_endpoint: unsupported sa_family\n");
}
@@ -133,7 +133,7 @@ coap_new_endpoint(const coap_address_t *addr, int flags) {
unsigned char addr_str[INET6_ADDRSTRLEN+8];
if (coap_print_addr(&ep->addr, addr_str, INET6_ADDRSTRLEN+8)) {
debug("created %sendpoint %s\n",
debug("created %sendpoint %s\n",
ep->flags & COAP_ENDPOINT_DTLS ? "DTLS " : "",
addr_str);
}
@@ -163,7 +163,7 @@ coap_free_endpoint(coap_endpoint_t *ep) {
#ifndef HAVE_NETINET_IN_H
/* define struct in6_pktinfo and struct in_pktinfo if not available
FIXME: check with configure
FIXME: check with configure
*/
struct in6_pktinfo {
struct in6_addr ipi6_addr; /* src/dst IPv6 address */
@@ -195,7 +195,7 @@ coap_network_send(struct coap_context_t *context UNUSED_PARAM,
unsigned char *data,
size_t datalen) {
struct coap_endpoint_t *ep =
struct coap_endpoint_t *ep =
(struct coap_endpoint_t *)local_interface;
/* a buffer large enough to hold all protocol address types */
@@ -227,10 +227,10 @@ coap_network_send(struct coap_context_t *context UNUSED_PARAM,
cmsg->cmsg_level = IPPROTO_IPV6;
cmsg->cmsg_type = IPV6_PKTINFO;
cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
pktinfo = (struct in6_pktinfo *)CMSG_DATA(cmsg);
memset(pktinfo, 0, sizeof(struct in6_pktinfo));
pktinfo->ipi6_ifindex = ep->ifindex;
if (coap_is_mcast(&local_interface->addr)) {
/* We cannot send with multicast address as source address
@@ -342,7 +342,7 @@ ssize_t
coap_network_read(coap_endpoint_t *ep, coap_packet_t **packet) {
ssize_t len = -1;
char msg_control[CMSG_LEN(sizeof(struct sockaddr_storage))];
char msg_control[CMSG_LEN(sizeof(struct sockaddr_storage))];
struct msghdr mhdr;
struct iovec iov[1];
@@ -357,7 +357,7 @@ coap_network_read(coap_endpoint_t *ep, coap_packet_t **packet) {
}
*packet = coap_malloc_packet();
if (!*packet) {
warn("coap_network_read: insufficient memory, drop packet\n");
return -1;
@@ -376,7 +376,7 @@ coap_network_read(coap_endpoint_t *ep, coap_packet_t **packet) {
mhdr.msg_iov = iov;
mhdr.msg_iovlen = 1;
mhdr.msg_control = msg_control;
mhdr.msg_controllen = sizeof(msg_control);
assert(sizeof(msg_control) == CMSG_LEN(sizeof(struct sockaddr_storage)));
@@ -403,7 +403,7 @@ coap_network_read(coap_endpoint_t *ep, coap_packet_t **packet) {
/* Walk through ancillary data records until the local interface
* is found where the data was received. */
for (cmsg = CMSG_FIRSTHDR(&mhdr); cmsg; cmsg = CMSG_NXTHDR(&mhdr, cmsg)) {
/* get the local interface for IPv6 */
if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) {
union {
@@ -413,7 +413,7 @@ coap_network_read(coap_endpoint_t *ep, coap_packet_t **packet) {
u.c = CMSG_DATA(cmsg);
(*packet)->ifindex = (int)(u.p->ipi6_ifindex);
memcpy(&(*packet)->dst.addr.sin6.sin6_addr,
memcpy(&(*packet)->dst.addr.sin6.sin6_addr,
&u.p->ipi6_addr, sizeof(struct in6_addr));
(*packet)->src.size = mhdr.msg_namelen;
@@ -436,7 +436,7 @@ coap_network_read(coap_endpoint_t *ep, coap_packet_t **packet) {
u.c = CMSG_DATA(cmsg);
(*packet)->ifindex = u.p->ipi_ifindex;
memcpy(&(*packet)->dst.addr.sin.sin_addr,
memcpy(&(*packet)->dst.addr.sin.sin_addr,
&u.p->ipi_addr, sizeof(struct in_addr));
(*packet)->src.size = mhdr.msg_namelen;
+1 -1
View File
@@ -3,7 +3,7 @@
* Copyright (C) 2016 Olaf Bergmann <bergmann@tzi.org>
*
* This file is part of the CoAP library libcoap. Please see
* README for terms of use.
* README for terms of use.
*/
#include "coap_config.h"