Enforce coding conventions in destiny via astyle

This commit is contained in:
Martin Lenders 2013-09-30 13:28:19 +02:00
parent 4825ec21b9
commit 6b999dc7bf
9 changed files with 118 additions and 118 deletions

View File

@ -1,5 +1,5 @@
/** /**
* Destiny transpor layer implementation * Destiny transport layer implementation
* *
* Copyright (C) 2013 INRIA. * Copyright (C) 2013 INRIA.
* *
@ -7,10 +7,10 @@
* Public License. See the file LICENSE in the top level directory for more * Public License. See the file LICENSE in the top level directory for more
* details. * details.
* *
* @ingroup destiny * @ingroup destiny
* @{ * @{
* @file destiny.c * @file destiny.c
* @brief transpor layer functions * @brief transpor layer functions
* @author Oliver Gesch <oliver.gesch@googlemail.com> * @author Oliver Gesch <oliver.gesch@googlemail.com>
* @} * @}
*/ */

View File

@ -7,7 +7,7 @@
* Public License. See the file LICENSE in the top level directory for more * Public License. See the file LICENSE in the top level directory for more
* details. * details.
* *
* @ingroup destiny * @ingroup destiny
* @{ * @{
* @file socket.c * @file socket.c
* @brief functions for BSD socket API * @brief functions for BSD socket API
@ -63,7 +63,7 @@ void print_tcp_flags(tcp_hdr_t *tcp_header)
{ {
printf("FLAGS: "); printf("FLAGS: ");
switch(tcp_header->reserved_flags) { switch (tcp_header->reserved_flags) {
case TCP_ACK: { case TCP_ACK: {
printf("ACK "); printf("ACK ");
break; break;
@ -109,7 +109,7 @@ void print_tcp_cb(tcp_cb_t *cb)
vtimer_now(&now); vtimer_now(&now);
printf("Send_ISS: %" PRIu32 "\nSend_UNA: %" PRIu32 "\nSend_NXT: %" PRIu32 "\nSend_WND: %u\n", printf("Send_ISS: %" PRIu32 "\nSend_UNA: %" PRIu32 "\nSend_NXT: %" PRIu32 "\nSend_WND: %u\n",
cb->send_iss, cb->send_una, cb->send_nxt, cb->send_wnd); cb->send_iss, cb->send_una, cb->send_nxt, cb->send_wnd);
printf("Rcv_IRS: %" PRIu32 "\nRcv_NXT: %" PRIu32 "\nRcv_WND: %u\n", printf("Rcv_IRS: %" PRIu32 "\nRcv_NXT: %" PRIu32 "\nRcv_WND: %u\n",
cb->rcv_irs, cb->rcv_nxt, cb->rcv_wnd); cb->rcv_irs, cb->rcv_nxt, cb->rcv_wnd);
printf("Time difference: %" PRIu32 ", No_of_retries: %u, State: %u\n\n", printf("Time difference: %" PRIu32 ", No_of_retries: %u, State: %u\n\n",
timex_sub(now, cb->last_packet_time).microseconds, cb->no_of_retries, cb->state); timex_sub(now, cb->last_packet_time).microseconds, cb->no_of_retries, cb->state);
@ -121,9 +121,9 @@ void print_tcp_status(int in_or_out, ipv6_hdr_t *ipv6_header,
char addr_str[IPV6_MAX_ADDR_STR_LEN]; char addr_str[IPV6_MAX_ADDR_STR_LEN];
printf("--- %s TCP packet: ---\n", printf("--- %s TCP packet: ---\n",
(in_or_out == INC_PACKET ? "Incoming" : "Outgoing")); (in_or_out == INC_PACKET ? "Incoming" : "Outgoing"));
printf("IPv6 Source: %s\n", printf("IPv6 Source: %s\n",
ipv6_addr_to_str(addr_str, &ipv6_header->srcaddr)); ipv6_addr_to_str(addr_str, &ipv6_header->srcaddr));
printf("IPv6 Dest: %s\n", printf("IPv6 Dest: %s\n",
ipv6_addr_to_str(addr_str, &ipv6_header->destaddr)); ipv6_addr_to_str(addr_str, &ipv6_header->destaddr));
printf("TCP Length: %x\n", ipv6_header->length - TCP_HDR_LEN); printf("TCP Length: %x\n", ipv6_header->length - TCP_HDR_LEN);
printf("Source Port: %x, Dest. Port: %x\n", printf("Source Port: %x, Dest. Port: %x\n",
@ -148,8 +148,8 @@ void print_socket(socket_t *current_socket)
current_socket->domain, current_socket->domain,
current_socket->type, current_socket->type,
current_socket->protocol); current_socket->protocol);
printf("Local address: %s\n", printf("Local address: %s\n",
ipv6_addr_to_str(addr_str, ipv6_addr_to_str(addr_str,
&current_socket->local_address.sin6_addr)); &current_socket->local_address.sin6_addr));
printf("Foreign address: %s\n", printf("Foreign address: %s\n",
ipv6_addr_to_str(addr_str, ipv6_addr_to_str(addr_str,
@ -210,10 +210,10 @@ void close_socket(socket_internal_t *current_socket)
bool isUDPSocket(uint8_t s) bool isUDPSocket(uint8_t s)
{ {
if ((exists_socket(s)) && if ((exists_socket(s)) &&
(get_socket(s)->socket_values.domain == PF_INET6) && (get_socket(s)->socket_values.domain == PF_INET6) &&
(get_socket(s)->socket_values.type == SOCK_DGRAM) && (get_socket(s)->socket_values.type == SOCK_DGRAM) &&
((get_socket(s)->socket_values.protocol == IPPROTO_UDP) || ((get_socket(s)->socket_values.protocol == IPPROTO_UDP) ||
(get_socket(s)->socket_values.protocol == 0))) { (get_socket(s)->socket_values.protocol == 0))) {
return true; return true;
} }
else { else {
@ -224,10 +224,10 @@ bool isUDPSocket(uint8_t s)
bool is_tcp_socket(int s) bool is_tcp_socket(int s)
{ {
if ((exists_socket(s)) && if ((exists_socket(s)) &&
(get_socket(s)->socket_values.domain == PF_INET6) && (get_socket(s)->socket_values.domain == PF_INET6) &&
(get_socket(s)->socket_values.type == SOCK_STREAM) && (get_socket(s)->socket_values.type == SOCK_STREAM) &&
((get_socket(s)->socket_values.protocol == IPPROTO_TCP) || ((get_socket(s)->socket_values.protocol == IPPROTO_TCP) ||
(get_socket(s)->socket_values.protocol == 0))) { (get_socket(s)->socket_values.protocol == 0))) {
return true; return true;
} }
else { else {
@ -245,7 +245,7 @@ int bind_udp_socket(int s, sockaddr6_t *name, int namelen, uint8_t pid)
for (i = 1; i < MAX_SOCKETS + 1; i++) { for (i = 1; i < MAX_SOCKETS + 1; i++) {
if (isUDPSocket(i) && if (isUDPSocket(i) &&
(get_socket(i)->socket_values.local_address.sin6_port == name->sin6_port)) { (get_socket(i)->socket_values.local_address.sin6_port == name->sin6_port)) {
return -1; return -1;
} }
} }
@ -265,7 +265,7 @@ int bind_tcp_socket(int s, sockaddr6_t *name, int namelen, uint8_t pid)
for (i = 1; i < MAX_SOCKETS + 1; i++) { for (i = 1; i < MAX_SOCKETS + 1; i++) {
if (is_tcp_socket(i) && if (is_tcp_socket(i) &&
(get_socket(i)->socket_values.local_address.sin6_port == name->sin6_port)) { (get_socket(i)->socket_values.local_address.sin6_port == name->sin6_port)) {
return -1; return -1;
} }
} }
@ -304,8 +304,8 @@ socket_internal_t *get_udp_socket(ipv6_hdr_t *ipv6_header, udp_hdr_t *udp_header
while (i < MAX_SOCKETS + 1) { while (i < MAX_SOCKETS + 1) {
if (isUDPSocket(i) && if (isUDPSocket(i) &&
(get_socket(i)->socket_values.local_address.sin6_port == (get_socket(i)->socket_values.local_address.sin6_port ==
udp_header->dst_port)) { udp_header->dst_port)) {
return get_socket(i); return get_socket(i);
} }
@ -339,20 +339,20 @@ socket_internal_t *get_tcp_socket(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header
/* Check for matching 4 touple, ESTABLISHED connection */ /* Check for matching 4 touple, ESTABLISHED connection */
if (is_tcp_socket(i) && is_four_touple(current_socket, ipv6_header, if (is_tcp_socket(i) && is_four_touple(current_socket, ipv6_header,
tcp_header)) { tcp_header)) {
return current_socket; return current_socket;
} }
/* Sockets in LISTEN and SYN_RCVD state should only be tested on local TCP values */ /* Sockets in LISTEN and SYN_RCVD state should only be tested on local TCP values */
else if (is_tcp_socket(i) && else if (is_tcp_socket(i) &&
((current_socket->socket_values.tcp_control.state == LISTEN) || ((current_socket->socket_values.tcp_control.state == LISTEN) ||
(current_socket->socket_values.tcp_control.state == SYN_RCVD)) && (current_socket->socket_values.tcp_control.state == SYN_RCVD)) &&
(current_socket->socket_values.local_address.sin6_addr.uint8[15] == (current_socket->socket_values.local_address.sin6_addr.uint8[15] ==
ipv6_header->destaddr.uint8[15]) && ipv6_header->destaddr.uint8[15]) &&
(current_socket->socket_values.local_address.sin6_port == (current_socket->socket_values.local_address.sin6_port ==
tcp_header->dst_port) && tcp_header->dst_port) &&
(current_socket->socket_values.foreign_address.sin6_addr.uint8[15] == (current_socket->socket_values.foreign_address.sin6_addr.uint8[15] ==
0x00) && 0x00) &&
(current_socket->socket_values.foreign_address.sin6_port == 0)) { (current_socket->socket_values.foreign_address.sin6_port == 0)) {
listening_socket = current_socket; listening_socket = current_socket;
} }
@ -371,7 +371,7 @@ uint16_t get_free_source_port(uint8_t protocol)
/* Remember biggest ephemeral port number used so far and add 1 */ /* Remember biggest ephemeral port number used so far and add 1 */
for (i = 0; i < MAX_SOCKETS; i++) { for (i = 0; i < MAX_SOCKETS; i++) {
if ((sockets[i].socket_values.protocol == protocol) && if ((sockets[i].socket_values.protocol == protocol) &&
(sockets[i].socket_values.local_address.sin6_port > biggest_port)) { (sockets[i].socket_values.local_address.sin6_port > biggest_port)) {
biggest_port = sockets[i].socket_values.local_address.sin6_port; biggest_port = sockets[i].socket_values.local_address.sin6_port;
} }
} }
@ -380,7 +380,7 @@ uint16_t get_free_source_port(uint8_t protocol)
} }
void set_socket_address(sockaddr6_t *sockaddr, uint8_t sin6_family, void set_socket_address(sockaddr6_t *sockaddr, uint8_t sin6_family,
uint16_t sin6_port, uint32_t sin6_flowinfo, ipv6_addr_t *sin6_addr) uint16_t sin6_port, uint32_t sin6_flowinfo, ipv6_addr_t *sin6_addr)
{ {
sockaddr->sin6_family = sin6_family; sockaddr->sin6_family = sin6_family;
sockaddr->sin6_port = sin6_port; sockaddr->sin6_port = sin6_port;
@ -449,7 +449,7 @@ void switch_tcp_packet_byte_order(tcp_hdr_t *current_tcp_packet)
} }
int send_tcp(socket_internal_t *current_socket, tcp_hdr_t *current_tcp_packet, int send_tcp(socket_internal_t *current_socket, tcp_hdr_t *current_tcp_packet,
ipv6_hdr_t *temp_ipv6_header, uint8_t flags, uint8_t payload_length) ipv6_hdr_t *temp_ipv6_header, uint8_t flags, uint8_t payload_length)
{ {
socket_t *current_tcp_socket = &current_socket->socket_values; socket_t *current_tcp_socket = &current_socket->socket_values;
uint8_t header_length = TCP_HDR_LEN / 4; uint8_t header_length = TCP_HDR_LEN / 4;
@ -462,7 +462,7 @@ int send_tcp(socket_internal_t *current_socket, tcp_hdr_t *current_tcp_packet,
current_mss_option.len = sizeof(tcp_mss_option_t); current_mss_option.len = sizeof(tcp_mss_option_t);
current_mss_option.mss = DESTINY_SOCKET_STATIC_MSS; current_mss_option.mss = DESTINY_SOCKET_STATIC_MSS;
memcpy(((uint8_t *)current_tcp_packet) + TCP_HDR_LEN, memcpy(((uint8_t *)current_tcp_packet) + TCP_HDR_LEN,
&current_mss_option, sizeof(tcp_mss_option_t)); &current_mss_option, sizeof(tcp_mss_option_t));
} }
set_tcp_packet(current_tcp_packet, current_tcp_socket->local_address.sin6_port, set_tcp_packet(current_tcp_packet, current_tcp_socket->local_address.sin6_port,
@ -474,9 +474,9 @@ int send_tcp(socket_internal_t *current_socket, tcp_hdr_t *current_tcp_packet,
/* Fill IPv6 Header */ /* Fill IPv6 Header */
memcpy(&(temp_ipv6_header->destaddr), memcpy(&(temp_ipv6_header->destaddr),
&current_tcp_socket->foreign_address.sin6_addr, 16); &current_tcp_socket->foreign_address.sin6_addr, 16);
memcpy(&(temp_ipv6_header->srcaddr), memcpy(&(temp_ipv6_header->srcaddr),
&current_tcp_socket->local_address.sin6_addr, 16); &current_tcp_socket->local_address.sin6_addr, 16);
temp_ipv6_header->length = header_length * 4 + payload_length; temp_ipv6_header->length = header_length * 4 + payload_length;
current_tcp_packet->checksum = ~tcp_csum(temp_ipv6_header, current_tcp_packet); current_tcp_packet->checksum = ~tcp_csum(temp_ipv6_header, current_tcp_packet);
@ -495,7 +495,7 @@ int send_tcp(socket_internal_t *current_socket, tcp_hdr_t *current_tcp_packet,
} }
ipv6_sendto(&current_tcp_socket->foreign_address.sin6_addr, ipv6_sendto(&current_tcp_socket->foreign_address.sin6_addr,
IPPROTO_TCP, (uint8_t *)(current_tcp_packet), IPPROTO_TCP, (uint8_t *)(current_tcp_packet),
compressed_size); compressed_size);
return 1; return 1;
#else #else
@ -621,7 +621,7 @@ int destiny_socket_connect(int socket, sockaddr6_t *addr, uint32_t addrlen)
/* Got SYN ACK from Server */ /* Got SYN ACK from Server */
/* Refresh foreign TCP socket information */ /* Refresh foreign TCP socket information */
if ((tcp_header->dataOffset_reserved * 4 > TCP_HDR_LEN) && if ((tcp_header->dataOffset_reserved * 4 > TCP_HDR_LEN) &&
(*(((uint8_t *)tcp_header) + TCP_HDR_LEN) == TCP_MSS_OPTION)) { (*(((uint8_t *)tcp_header) + TCP_HDR_LEN) == TCP_MSS_OPTION)) {
current_tcp_socket->tcp_control.mss = current_tcp_socket->tcp_control.mss =
*((uint16_t *)(((uint8_t *)tcp_header) + TCP_HDR_LEN + 2)); *((uint16_t *)(((uint8_t *)tcp_header) + TCP_HDR_LEN + 2));
} }
@ -694,14 +694,14 @@ void calculate_rto(tcp_cb_t *tcp_control, long current_time)
srtt = rtt; srtt = rtt;
rttvar = 0.5 * rtt; rttvar = 0.5 * rtt;
rto = rtt + (((4 * rttvar) < TCP_TIMER_RESOLUTION) ? rto = rtt + (((4 * rttvar) < TCP_TIMER_RESOLUTION) ?
(TCP_TIMER_RESOLUTION) : (4 * rttvar)); (TCP_TIMER_RESOLUTION) : (4 * rttvar));
} }
else { else {
/* every other calculation */ /* every other calculation */
srtt = (1 - TCP_ALPHA) * srtt + TCP_ALPHA * rtt; srtt = (1 - TCP_ALPHA) * srtt + TCP_ALPHA * rtt;
rttvar = (1 - TCP_BETA) * rttvar + TCP_BETA * abs(srtt - rtt); rttvar = (1 - TCP_BETA) * rttvar + TCP_BETA * abs(srtt - rtt);
rto = srtt + (((4 * rttvar) < TCP_TIMER_RESOLUTION) ? rto = srtt + (((4 * rttvar) < TCP_TIMER_RESOLUTION) ?
(TCP_TIMER_RESOLUTION) : (4 * rttvar)); (TCP_TIMER_RESOLUTION) : (4 * rttvar));
} }
if (rto < SECOND) { if (rto < SECOND) {
@ -757,7 +757,7 @@ int32_t destiny_socket_send(int s, const void *buf, uint32_t len, int flags)
while (recv_msg.type != TCP_ACK) { while (recv_msg.type != TCP_ACK) {
/* Add packet data */ /* Add packet data */
if (current_tcp_socket->tcp_control.send_wnd > if (current_tcp_socket->tcp_control.send_wnd >
current_tcp_socket->tcp_control.mss) { current_tcp_socket->tcp_control.mss) {
/* Window size > Maximum Segment Size */ /* Window size > Maximum Segment Size */
if ((len - total_sent_bytes) > current_tcp_socket->tcp_control.mss) { if ((len - total_sent_bytes) > current_tcp_socket->tcp_control.mss) {
memcpy(&send_buffer[IPV6_HDR_LEN + TCP_HDR_LEN], buf, memcpy(&send_buffer[IPV6_HDR_LEN + TCP_HDR_LEN], buf,
@ -792,7 +792,7 @@ int32_t destiny_socket_send(int s, const void *buf, uint32_t len, int flags)
current_tcp_socket->tcp_control.send_wnd -= sent_bytes; current_tcp_socket->tcp_control.send_wnd -= sent_bytes;
if (send_tcp(current_int_tcp_socket, current_tcp_packet, if (send_tcp(current_int_tcp_socket, current_tcp_packet,
temp_ipv6_header, 0, sent_bytes) != 1) { temp_ipv6_header, 0, sent_bytes) != 1) {
/* Error while sending tcp data */ /* Error while sending tcp data */
current_tcp_socket->tcp_control.send_nxt -= sent_bytes; current_tcp_socket->tcp_control.send_nxt -= sent_bytes;
current_tcp_socket->tcp_control.send_wnd += sent_bytes; current_tcp_socket->tcp_control.send_wnd += sent_bytes;
@ -800,7 +800,7 @@ int32_t destiny_socket_send(int s, const void *buf, uint32_t len, int flags)
memcpy(&current_tcp_socket->tcp_control.tcp_context, memcpy(&current_tcp_socket->tcp_control.tcp_context,
&saved_tcp_context, sizeof(tcp_hc_context_t)); &saved_tcp_context, sizeof(tcp_hc_context_t));
current_tcp_socket->tcp_control.tcp_context.hc_type = current_tcp_socket->tcp_control.tcp_context.hc_type =
COMPRESSED_HEADER; COMPRESSED_HEADER;
#endif #endif
printf("Error while sending, returning to application thread!\n"); printf("Error while sending, returning to application thread!\n");
return -1; return -1;
@ -808,10 +808,10 @@ int32_t destiny_socket_send(int s, const void *buf, uint32_t len, int flags)
/* Remember current time */ /* Remember current time */
current_tcp_socket->tcp_control.last_packet_time.microseconds = current_tcp_socket->tcp_control.last_packet_time.microseconds =
hwtimer_now(); hwtimer_now();
net_msg_receive(&recv_msg); net_msg_receive(&recv_msg);
switch(recv_msg.type) { switch (recv_msg.type) {
case TCP_ACK: { case TCP_ACK: {
if (current_tcp_socket->tcp_control.no_of_retries == 0) { if (current_tcp_socket->tcp_control.no_of_retries == 0) {
calculate_rto(&current_tcp_socket->tcp_control, calculate_rto(&current_tcp_socket->tcp_control,
@ -821,26 +821,26 @@ int32_t destiny_socket_send(int s, const void *buf, uint32_t len, int flags)
tcp_hdr_t *tcp_header = ((tcp_hdr_t *)(recv_msg.content.ptr)); tcp_hdr_t *tcp_header = ((tcp_hdr_t *)(recv_msg.content.ptr));
if ((current_tcp_socket->tcp_control.send_nxt == if ((current_tcp_socket->tcp_control.send_nxt ==
tcp_header->ack_nr) && (total_sent_bytes == len)) { tcp_header->ack_nr) && (total_sent_bytes == len)) {
current_tcp_socket->tcp_control.send_una = tcp_header->ack_nr; current_tcp_socket->tcp_control.send_una = tcp_header->ack_nr;
current_tcp_socket->tcp_control.send_nxt = tcp_header->ack_nr; current_tcp_socket->tcp_control.send_nxt = tcp_header->ack_nr;
current_tcp_socket->tcp_control.send_wnd = tcp_header->window; current_tcp_socket->tcp_control.send_wnd = tcp_header->window;
/* Got ACK for every sent byte */ /* Got ACK for every sent byte */
#ifdef TCP_HC #ifdef TCP_HC
current_tcp_socket->tcp_control.tcp_context.hc_type = current_tcp_socket->tcp_control.tcp_context.hc_type =
COMPRESSED_HEADER; COMPRESSED_HEADER;
#endif #endif
return sent_bytes; return sent_bytes;
} }
else if ((current_tcp_socket->tcp_control.send_nxt == else if ((current_tcp_socket->tcp_control.send_nxt ==
tcp_header->ack_nr) && (total_sent_bytes != len)) { tcp_header->ack_nr) && (total_sent_bytes != len)) {
current_tcp_socket->tcp_control.send_una = tcp_header->ack_nr; current_tcp_socket->tcp_control.send_una = tcp_header->ack_nr;
current_tcp_socket->tcp_control.send_nxt = tcp_header->ack_nr; current_tcp_socket->tcp_control.send_nxt = tcp_header->ack_nr;
current_tcp_socket->tcp_control.send_wnd = tcp_header->window; current_tcp_socket->tcp_control.send_wnd = tcp_header->window;
/* Got ACK for every sent byte */ /* Got ACK for every sent byte */
#ifdef TCP_HC #ifdef TCP_HC
current_tcp_socket->tcp_control.tcp_context.hc_type = current_tcp_socket->tcp_control.tcp_context.hc_type =
COMPRESSED_HEADER; COMPRESSED_HEADER;
#endif #endif
break; break;
} }
@ -862,7 +862,7 @@ int32_t destiny_socket_send(int s, const void *buf, uint32_t len, int flags)
memcpy(&current_tcp_socket->tcp_control.tcp_context, memcpy(&current_tcp_socket->tcp_control.tcp_context,
$&saved_tcp_context, sizeof(tcp_hc_context_t)); $&saved_tcp_context, sizeof(tcp_hc_context_t));
current_tcp_socket->tcp_control.tcp_context.hc_type = current_tcp_socket->tcp_control.tcp_context.hc_type =
MOSTLY_COMPRESSED_HEADER; MOSTLY_COMPRESSED_HEADER;
#endif #endif
break; break;
} }
@ -874,7 +874,7 @@ int32_t destiny_socket_send(int s, const void *buf, uint32_t len, int flags)
memcpy(&current_tcp_socket->tcp_control.tcp_context, memcpy(&current_tcp_socket->tcp_control.tcp_context,
&saved_tcp_context, sizeof(tcp_hc_context_t)); &saved_tcp_context, sizeof(tcp_hc_context_t));
current_tcp_socket->tcp_control.tcp_context.hc_type = current_tcp_socket->tcp_control.tcp_context.hc_type =
COMPRESSED_HEADER; COMPRESSED_HEADER;
#endif #endif
return -1; return -1;
break; break;
@ -995,7 +995,7 @@ int32_t destiny_socket_sendto(int s, const void *buf, uint32_t len, int flags,
sockaddr6_t *to, uint32_t tolen) sockaddr6_t *to, uint32_t tolen)
{ {
if (isUDPSocket(s) && if (isUDPSocket(s) &&
(get_socket(s)->socket_values.foreign_address.sin6_port == 0)) { (get_socket(s)->socket_values.foreign_address.sin6_port == 0)) {
uint8_t send_buffer[BUFFER_SIZE]; uint8_t send_buffer[BUFFER_SIZE];
ipv6_hdr_t *temp_ipv6_header = ((ipv6_hdr_t *)(&send_buffer)); ipv6_hdr_t *temp_ipv6_header = ((ipv6_hdr_t *)(&send_buffer));
@ -1014,9 +1014,9 @@ int32_t destiny_socket_sendto(int s, const void *buf, uint32_t len, int flags,
temp_ipv6_header->length = UDP_HDR_LEN + len; temp_ipv6_header->length = UDP_HDR_LEN + len;
current_udp_packet->checksum = ~udp_csum(temp_ipv6_header, current_udp_packet->checksum = ~udp_csum(temp_ipv6_header,
current_udp_packet); current_udp_packet);
ipv6_sendto(&to->sin6_addr, IPPROTO_UDP, ipv6_sendto(&to->sin6_addr, IPPROTO_UDP,
(uint8_t *)(current_udp_packet), (uint8_t *)(current_udp_packet),
current_udp_packet->length); current_udp_packet->length);
return current_udp_packet->length; return current_udp_packet->length;
@ -1082,7 +1082,7 @@ int destiny_socket_bind(int s, sockaddr6_t *addr, int addrlen)
if (exists_socket(s)) { if (exists_socket(s)) {
socket_t *current_socket = &get_socket(s)->socket_values; socket_t *current_socket = &get_socket(s)->socket_values;
switch(current_socket->domain) { switch (current_socket->domain) {
case (PF_INET): { case (PF_INET): {
/* Not provided */ /* Not provided */
return -1; return -1;
@ -1090,7 +1090,7 @@ int destiny_socket_bind(int s, sockaddr6_t *addr, int addrlen)
} }
case (PF_INET6): { case (PF_INET6): {
switch(current_socket->type) { switch (current_socket->type) {
/* TCP */ /* TCP */
case (SOCK_STREAM): { case (SOCK_STREAM): {
if ((current_socket->protocol == 0) || if ((current_socket->protocol == 0) ||
@ -1172,8 +1172,8 @@ int destiny_socket_listen(int s, int backlog)
} }
socket_internal_t *get_waiting_connection_socket(int socket, socket_internal_t *get_waiting_connection_socket(int socket,
ipv6_hdr_t *ipv6_header, ipv6_hdr_t *ipv6_header,
tcp_hdr_t *tcp_header) tcp_hdr_t *tcp_header)
{ {
int i; int i;
socket_internal_t *current_socket, *listening_socket = get_socket(socket); socket_internal_t *current_socket, *listening_socket = get_socket(socket);
@ -1184,15 +1184,15 @@ socket_internal_t *get_waiting_connection_socket(int socket,
/* Connection establishment ACK, Check for 4 touple and state */ /* Connection establishment ACK, Check for 4 touple and state */
if ((ipv6_header != NULL) && (tcp_header != NULL)) { if ((ipv6_header != NULL) && (tcp_header != NULL)) {
if (is_four_touple(current_socket, ipv6_header, tcp_header) && if (is_four_touple(current_socket, ipv6_header, tcp_header) &&
(current_socket->socket_values.tcp_control.state == SYN_RCVD)) { (current_socket->socket_values.tcp_control.state == SYN_RCVD)) {
return current_socket; return current_socket;
} }
} }
/* Connection establishment SYN ACK, check only for port and state */ /* Connection establishment SYN ACK, check only for port and state */
else { else {
if ((current_socket->socket_values.tcp_control.state == SYN_RCVD) && if ((current_socket->socket_values.tcp_control.state == SYN_RCVD) &&
(current_socket->socket_values.local_address.sin6_port == (current_socket->socket_values.local_address.sin6_port ==
listening_socket->socket_values.local_address.sin6_port)) { listening_socket->socket_values.local_address.sin6_port)) {
return current_socket; return current_socket;
} }
} }
@ -1320,7 +1320,7 @@ int destiny_socket_accept(int s, sockaddr6_t *addr, uint32_t *addrlen)
} }
socket_internal_t *new_tcp_queued_socket(ipv6_hdr_t *ipv6_header, socket_internal_t *new_tcp_queued_socket(ipv6_hdr_t *ipv6_header,
tcp_hdr_t *tcp_header) tcp_hdr_t *tcp_header)
{ {
int queued_socket_id; int queued_socket_id;
@ -1339,7 +1339,7 @@ socket_internal_t *new_tcp_queued_socket(ipv6_hdr_t *ipv6_header,
/* Foreign TCP information */ /* Foreign TCP information */
if ((tcp_header->dataOffset_reserved * 4 > TCP_HDR_LEN) && if ((tcp_header->dataOffset_reserved * 4 > TCP_HDR_LEN) &&
(*(((uint8_t *)tcp_header) + TCP_HDR_LEN) == TCP_MSS_OPTION)) { (*(((uint8_t *)tcp_header) + TCP_HDR_LEN) == TCP_MSS_OPTION)) {
current_queued_socket->socket_values.tcp_control.mss = current_queued_socket->socket_values.tcp_control.mss =
*((uint16_t *)(((uint8_t *)tcp_header) + TCP_HDR_LEN + 2)); *((uint16_t *)(((uint8_t *)tcp_header) + TCP_HDR_LEN + 2));
} }

View File

@ -72,8 +72,8 @@ typedef struct __attribute__((packed)) {
extern socket_internal_t sockets[MAX_SOCKETS]; extern socket_internal_t sockets[MAX_SOCKETS];
socket_internal_t *get_waiting_connection_socket(int socket, socket_internal_t *get_waiting_connection_socket(int socket,
ipv6_hdr_t *ipv6_header, ipv6_hdr_t *ipv6_header,
tcp_hdr_t *tcp_header); tcp_hdr_t *tcp_header);
void close_socket(socket_internal_t *current_socket); void close_socket(socket_internal_t *current_socket);
socket_internal_t *get_socket(int s); socket_internal_t *get_socket(int s);
socket_internal_t *get_udp_socket(ipv6_hdr_t *ipv6_header, socket_internal_t *get_udp_socket(ipv6_hdr_t *ipv6_header,
@ -81,7 +81,7 @@ socket_internal_t *get_udp_socket(ipv6_hdr_t *ipv6_header,
socket_internal_t *get_tcp_socket(ipv6_hdr_t *ipv6_header, socket_internal_t *get_tcp_socket(ipv6_hdr_t *ipv6_header,
tcp_hdr_t *tcp_header); tcp_hdr_t *tcp_header);
socket_internal_t *new_tcp_queued_socket(ipv6_hdr_t *ipv6_header, socket_internal_t *new_tcp_queued_socket(ipv6_hdr_t *ipv6_header,
tcp_hdr_t *tcp_header); tcp_hdr_t *tcp_header);
void print_tcp_status(int in_or_out, ipv6_hdr_t *ipv6_header, void print_tcp_status(int in_or_out, ipv6_hdr_t *ipv6_header,
tcp_hdr_t *tcp_header, socket_t *tcp_socket); tcp_hdr_t *tcp_header, socket_t *tcp_socket);
void set_tcp_cb(tcp_cb_t *tcp_control, uint32_t rcv_nxt, uint16_t rcv_wnd, void set_tcp_cb(tcp_cb_t *tcp_control, uint32_t rcv_nxt, uint16_t rcv_wnd,

View File

@ -1,5 +1,5 @@
/** /**
* Destiny TCP implementation * Destiny TCP implementation
* *
* Copyright (C) 2013 INRIA. * Copyright (C) 2013 INRIA.
* *
@ -7,10 +7,10 @@
* Public License. See the file LICENSE in the top level directory for more * Public License. See the file LICENSE in the top level directory for more
* details. * details.
* *
* @ingroup destiny * @ingroup destiny
* @{ * @{
* @file tcp.c * @file tcp.c
* @brief TCP implementation * @brief TCP implementation
* @author Oliver Gesch <oliver.gesch@googlemail.com> * @author Oliver Gesch <oliver.gesch@googlemail.com>
* @} * @}
*/ */
@ -87,7 +87,7 @@ uint8_t handle_payload(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
acknowledged_bytes = tcp_socket->socket_values.tcp_control.rcv_wnd; acknowledged_bytes = tcp_socket->socket_values.tcp_control.rcv_wnd;
tcp_socket->socket_values.tcp_control.rcv_wnd = 0; tcp_socket->socket_values.tcp_control.rcv_wnd = 0;
tcp_socket->tcp_input_buffer_end = tcp_socket->tcp_input_buffer_end + tcp_socket->tcp_input_buffer_end = tcp_socket->tcp_input_buffer_end +
tcp_socket->socket_values.tcp_control.rcv_wnd; tcp_socket->socket_values.tcp_control.rcv_wnd;
mutex_unlock(&tcp_socket->tcp_buffer_mutex); mutex_unlock(&tcp_socket->tcp_buffer_mutex);
} }
else { else {
@ -97,7 +97,7 @@ uint8_t handle_payload(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
tcp_socket->socket_values.tcp_control.rcv_wnd - tcp_payload_len; tcp_socket->socket_values.tcp_control.rcv_wnd - tcp_payload_len;
acknowledged_bytes = tcp_payload_len; acknowledged_bytes = tcp_payload_len;
tcp_socket->tcp_input_buffer_end = tcp_socket->tcp_input_buffer_end + tcp_socket->tcp_input_buffer_end = tcp_socket->tcp_input_buffer_end +
tcp_payload_len; tcp_payload_len;
mutex_unlock(&tcp_socket->tcp_buffer_mutex); mutex_unlock(&tcp_socket->tcp_buffer_mutex);
} }
@ -155,7 +155,7 @@ void handle_tcp_syn_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
if (tcp_socket->socket_values.tcp_control.state == LISTEN) { if (tcp_socket->socket_values.tcp_control.state == LISTEN) {
socket_internal_t *new_socket = new_tcp_queued_socket(ipv6_header, socket_internal_t *new_socket = new_tcp_queued_socket(ipv6_header,
tcp_header); tcp_header);
if (new_socket != NULL) { if (new_socket != NULL) {
#ifdef TCP_HC #ifdef TCP_HC
@ -312,7 +312,7 @@ void tcp_packet_handler(void)
chksum = tcp_csum(ipv6_header, tcp_header); chksum = tcp_csum(ipv6_header, tcp_header);
payload = (uint8_t *)(m_recv_ip.content.ptr + IPV6_HDR_LEN + payload = (uint8_t *)(m_recv_ip.content.ptr + IPV6_HDR_LEN +
tcp_header->dataOffset_reserved * 4); tcp_header->dataOffset_reserved * 4);
if ((chksum == 0xffff) && (tcp_socket != NULL)) { if ((chksum == 0xffff) && (tcp_socket != NULL)) {
#ifdef TCP_HC #ifdef TCP_HC
@ -321,7 +321,7 @@ void tcp_packet_handler(void)
/* Remove reserved bits from tcp flags field */ /* Remove reserved bits from tcp flags field */
uint8_t tcp_flags = tcp_header->reserved_flags & REMOVE_RESERVED; uint8_t tcp_flags = tcp_header->reserved_flags & REMOVE_RESERVED;
switch(tcp_flags) { switch (tcp_flags) {
case TCP_ACK: { case TCP_ACK: {
/* only ACK Bit set */ /* only ACK Bit set */
handle_tcp_ack_packet(ipv6_header, tcp_header, tcp_socket); handle_tcp_ack_packet(ipv6_header, tcp_header, tcp_socket);

View File

@ -7,7 +7,7 @@
* Public License. See the file LICENSE in the top level directory for more * Public License. See the file LICENSE in the top level directory for more
* details. * details.
* *
* @ingroup destiny * @ingroup destiny
* @{ * @{
* @file tcp.c * @file tcp.c
* @brief TCP data structs and prototypes * @brief TCP data structs and prototypes

View File

@ -1,5 +1,5 @@
/** /**
* Destiny TCP header compression * Destiny TCP header compression
* *
* Copyright (C) 2013 INRIA. * Copyright (C) 2013 INRIA.
* *
@ -7,10 +7,10 @@
* Public License. See the file LICENSE in the top level directory for more * Public License. See the file LICENSE in the top level directory for more
* details. * details.
* *
* @ingroup destiny * @ingroup destiny
* @{ * @{
* @file tcp_hc.c * @file tcp_hc.c
* @brief TCP HC * @brief TCP HC
* @author Oliver Gesch <oliver.gesch@googlemail.com> * @author Oliver Gesch <oliver.gesch@googlemail.com>
* @} * @}
*/ */
@ -32,7 +32,7 @@
#ifdef TCP_HC #ifdef TCP_HC
socket_internal_t *get_tcp_socket_by_context(ipv6_hdr_t *current_ipv6_header, socket_internal_t *get_tcp_socket_by_context(ipv6_hdr_t *current_ipv6_header,
uint16_t current_context) uint16_t current_context)
{ {
socket_internal_t *temp_socket; socket_internal_t *temp_socket;
@ -40,12 +40,12 @@ socket_internal_t *get_tcp_socket_by_context(ipv6_hdr_t *current_ipv6_header,
temp_socket = get_socket(i); temp_socket = get_socket(i);
if ((temp_socket != NULL) && if ((temp_socket != NULL) &&
ipv6_addr_is_equal(&temp_socket->socket_values.foreign_address.sin6_addr, ipv6_addr_is_equal(&temp_socket->socket_values.foreign_address.sin6_addr,
&current_ipv6_header->srcaddr) && &current_ipv6_header->srcaddr) &&
ipv6_addr_is_equal(&temp_socket->socket_values.local_address.sin6_addr, ipv6_addr_is_equal(&temp_socket->socket_values.local_address.sin6_addr,
&current_ipv6_header->destaddr) && &current_ipv6_header->destaddr) &&
(temp_socket->socket_values.tcp_control.tcp_context.context_id == (temp_socket->socket_values.tcp_control.tcp_context.context_id ==
current_context)) { current_context)) {
return temp_socket; return temp_socket;
} }
} }
@ -103,7 +103,7 @@ uint16_t compress_tcp_packet(socket_internal_t *current_socket,
/* Return correct header length (+3) */ /* Return correct header length (+3) */
packet_size = ((((tcp_hdr_t *)(current_tcp_packet + 3))->dataOffset_reserved) * 4) + 3 + packet_size = ((((tcp_hdr_t *)(current_tcp_packet + 3))->dataOffset_reserved) * 4) + 3 +
payload_length; payload_length;
/* Update the tcp context fields */ /* Update the tcp context fields */
update_tcp_hc_context(false, current_socket, (tcp_hdr_t *)(current_tcp_packet + 3)); update_tcp_hc_context(false, current_socket, (tcp_hdr_t *)(current_tcp_packet + 3));
@ -150,7 +150,7 @@ uint16_t compress_tcp_packet(socket_internal_t *current_socket,
/* If the 24 most significant bits haven't changed from previous /* If the 24 most significant bits haven't changed from previous
* packet, don't transmit them */ * packet, don't transmit them */
else if ((full_tcp_header.seq_nr & 0xFFFFFF00) == (tcp_context->seq_snd & else if ((full_tcp_header.seq_nr & 0xFFFFFF00) == (tcp_context->seq_snd &
0xFFFFFF00)) { 0xFFFFFF00)) {
/* Seq = (0|1) */ /* Seq = (0|1) */
tcp_hc_header |= 0x0400; tcp_hc_header |= 0x0400;
@ -188,7 +188,7 @@ uint16_t compress_tcp_packet(socket_internal_t *current_socket,
/*| Acknowledgment number handling |*/ /*| Acknowledgment number handling |*/
/*----------------------------------*/ /*----------------------------------*/
if ((IS_TCP_ACK(full_tcp_header.reserved_flags) && if ((IS_TCP_ACK(full_tcp_header.reserved_flags) &&
(tcp_cb->tcp_context.ack_snd == full_tcp_header.ack_nr))) { (tcp_cb->tcp_context.ack_snd == full_tcp_header.ack_nr))) {
tcp_context->ack_snd = tcp_context->seq_rcv; tcp_context->ack_snd = tcp_context->seq_rcv;
} }
@ -198,7 +198,7 @@ uint16_t compress_tcp_packet(socket_internal_t *current_socket,
/* If the 24 most significant bits haven't changed from previous packet, /* If the 24 most significant bits haven't changed from previous packet,
* don't transmit them */ * don't transmit them */
else if ((full_tcp_header.ack_nr & 0xFFFFFF00) == (tcp_context->ack_snd & else if ((full_tcp_header.ack_nr & 0xFFFFFF00) == (tcp_context->ack_snd &
0xFFFFFF00)) { 0xFFFFFF00)) {
/* Ack = (0|1) */ /* Ack = (0|1) */
tcp_hc_header |= 0x0100; tcp_hc_header |= 0x0100;
@ -211,7 +211,7 @@ uint16_t compress_tcp_packet(socket_internal_t *current_socket,
/* If the 16 most significant bits haven't changed from previous packet, /* If the 16 most significant bits haven't changed from previous packet,
* don't transmit them */ * don't transmit them */
else if ((full_tcp_header.ack_nr & 0xFFFF0000) == (tcp_context->ack_snd & else if ((full_tcp_header.ack_nr & 0xFFFF0000) == (tcp_context->ack_snd &
0xFFFF0000)) { 0xFFFF0000)) {
/* Ack = (1|0) */ /* Ack = (1|0) */
tcp_hc_header |= 0x0200; tcp_hc_header |= 0x0200;
@ -254,7 +254,7 @@ uint16_t compress_tcp_packet(socket_internal_t *current_socket,
/* If the 8 less significant bits haven't changed from previous packet, /* If the 8 less significant bits haven't changed from previous packet,
* don't transmit them */ * don't transmit them */
else if ((full_tcp_header.window & 0x00FF) == (tcp_context->wnd_snd & else if ((full_tcp_header.window & 0x00FF) == (tcp_context->wnd_snd &
0x00FF)) { 0x00FF)) {
/* Wnd = (1|0) */ /* Wnd = (1|0) */
tcp_hc_header |= 0x0080; tcp_hc_header |= 0x0080;
@ -415,10 +415,10 @@ socket_internal_t *decompress_tcp_packet(ipv6_hdr_t *temp_ipv6_header)
/* Full header TCP segment */ /* Full header TCP segment */
if (*(((uint8_t *)temp_ipv6_header) + IPV6_HDR_LEN) == 0x01) { if (*(((uint8_t *)temp_ipv6_header) + IPV6_HDR_LEN) == 0x01) {
switch_tcp_packet_byte_order(((tcp_hdr_t *)(((uint8_t *)temp_ipv6_header) + switch_tcp_packet_byte_order(((tcp_hdr_t *)(((uint8_t *)temp_ipv6_header) +
IPV6_HDR_LEN + 3))); IPV6_HDR_LEN + 3)));
current_socket = get_tcp_socket(temp_ipv6_header, current_socket = get_tcp_socket(temp_ipv6_header,
((tcp_hdr_t *)(((uint8_t *)temp_ipv6_header) + ((tcp_hdr_t *)(((uint8_t *)temp_ipv6_header) +
IPV6_HDR_LEN + 3))); IPV6_HDR_LEN + 3)));
if (current_socket != NULL) { if (current_socket != NULL) {
if (current_socket->socket_values.tcp_control.state == LISTEN) { if (current_socket->socket_values.tcp_control.state == LISTEN) {
@ -459,11 +459,11 @@ socket_internal_t *decompress_tcp_packet(ipv6_hdr_t *temp_ipv6_header)
uint8_t header_type = UNDEFINED; uint8_t header_type = UNDEFINED;
if (BITSET(tcp_hc_header, 15) && !BITSET(tcp_hc_header, 14) && if (BITSET(tcp_hc_header, 15) && !BITSET(tcp_hc_header, 14) &&
!BITSET(tcp_hc_header, 13)) { !BITSET(tcp_hc_header, 13)) {
header_type = MOSTLY_COMPRESSED_HEADER; header_type = MOSTLY_COMPRESSED_HEADER;
} }
else if (BITSET(tcp_hc_header, 15) && BITSET(tcp_hc_header, 14) && else if (BITSET(tcp_hc_header, 15) && BITSET(tcp_hc_header, 14) &&
!BITSET(tcp_hc_header, 13)) { !BITSET(tcp_hc_header, 13)) {
header_type = COMPRESSED_HEADER; header_type = COMPRESSED_HEADER;
} }
@ -624,7 +624,7 @@ socket_internal_t *decompress_tcp_packet(ipv6_hdr_t *temp_ipv6_header)
/* Copy TCP uncompressed header in front of payload */ /* Copy TCP uncompressed header in front of payload */
memcpy(((uint8_t *)temp_ipv6_header) + IPV6_HDR_LEN, &full_tcp_header, memcpy(((uint8_t *)temp_ipv6_header) + IPV6_HDR_LEN, &full_tcp_header,
TCP_HDR_LEN); TCP_HDR_LEN);
/* Set IPV6 header length */ /* Set IPV6 header length */
temp_ipv6_header->length = temp_ipv6_header->length - packet_size + temp_ipv6_header->length = temp_ipv6_header->length - packet_size +

View File

@ -1,5 +1,5 @@
/** /**
* Destiny TCP timer implementation * Destiny TCP timer implementation
* *
* Copyright (C) 2013 INRIA. * Copyright (C) 2013 INRIA.
* *
@ -7,10 +7,10 @@
* Public License. See the file LICENSE in the top level directory for more * Public License. See the file LICENSE in the top level directory for more
* details. * details.
* *
* @ingroup destiny * @ingroup destiny
* @{ * @{
* @file tcp_timer.c * @file tcp_timer.c
* @brief TCP timer * @brief TCP timer
* @author Oliver Gesch <oliver.gesch@googlemail.com> * @author Oliver Gesch <oliver.gesch@googlemail.com>
* @} * @}
*/ */
@ -41,21 +41,21 @@ void handle_synchro_timeout(socket_internal_t *current_socket)
vtimer_now(&now); vtimer_now(&now);
if ((current_socket->socket_values.tcp_control.no_of_retries == 0) && if ((current_socket->socket_values.tcp_control.no_of_retries == 0) &&
(timex_sub(now, (timex_sub(now,
current_socket->socket_values.tcp_control.last_packet_time).microseconds > current_socket->socket_values.tcp_control.last_packet_time).microseconds >
TCP_SYN_INITIAL_TIMEOUT)) { TCP_SYN_INITIAL_TIMEOUT)) {
current_socket->socket_values.tcp_control.no_of_retries++; current_socket->socket_values.tcp_control.no_of_retries++;
net_msg_send(&send, current_socket->recv_pid, 0, TCP_RETRY); net_msg_send(&send, current_socket->recv_pid, 0, TCP_RETRY);
} }
else if ((current_socket->socket_values.tcp_control.no_of_retries > 0) && else if ((current_socket->socket_values.tcp_control.no_of_retries > 0) &&
(timex_sub(now, (timex_sub(now,
current_socket->socket_values.tcp_control.last_packet_time).microseconds > current_socket->socket_values.tcp_control.last_packet_time).microseconds >
(current_socket->socket_values.tcp_control.no_of_retries * (current_socket->socket_values.tcp_control.no_of_retries *
TCP_SYN_TIMEOUT + TCP_SYN_INITIAL_TIMEOUT))) { TCP_SYN_TIMEOUT + TCP_SYN_INITIAL_TIMEOUT))) {
current_socket->socket_values.tcp_control.no_of_retries++; current_socket->socket_values.tcp_control.no_of_retries++;
if (current_socket->socket_values.tcp_control.no_of_retries > if (current_socket->socket_values.tcp_control.no_of_retries >
TCP_MAX_SYN_RETRIES) { TCP_MAX_SYN_RETRIES) {
net_msg_send(&send, current_socket->recv_pid, 0, TCP_TIMEOUT); net_msg_send(&send, current_socket->recv_pid, 0, TCP_TIMEOUT);
} }
else { else {
@ -77,10 +77,10 @@ void handle_established(socket_internal_t *current_socket)
uint8_t i; uint8_t i;
if ((current_socket->socket_values.tcp_control.send_nxt > if ((current_socket->socket_values.tcp_control.send_nxt >
current_socket->socket_values.tcp_control.send_una) && current_socket->socket_values.tcp_control.send_una) &&
(thread_getstatus(current_socket->send_pid) == STATUS_RECEIVE_BLOCKED)) { (thread_getstatus(current_socket->send_pid) == STATUS_RECEIVE_BLOCKED)) {
for (i = 0; i < current_socket->socket_values.tcp_control.no_of_retries; for (i = 0; i < current_socket->socket_values.tcp_control.no_of_retries;
i++) { i++) {
current_timeout *= 2; current_timeout *= 2;
} }
@ -91,7 +91,7 @@ void handle_established(socket_internal_t *current_socket)
net_msg_send(&send, current_socket->send_pid, 0, TCP_TIMEOUT); net_msg_send(&send, current_socket->send_pid, 0, TCP_TIMEOUT);
} }
else if (timex_sub(now, current_socket->socket_values.tcp_control.last_packet_time).microseconds > else if (timex_sub(now, current_socket->socket_values.tcp_control.last_packet_time).microseconds >
current_timeout) { current_timeout) {
current_socket->socket_values.tcp_control.no_of_retries++; current_socket->socket_values.tcp_control.no_of_retries++;
net_msg_send(&send, current_socket->send_pid, 0, TCP_RETRY); net_msg_send(&send, current_socket->send_pid, 0, TCP_RETRY);
} }
@ -107,7 +107,7 @@ void check_sockets(void)
current_socket = get_socket(i); current_socket = get_socket(i);
if (is_tcp_socket(i)) { if (is_tcp_socket(i)) {
switch(current_socket->socket_values.tcp_control.state) { switch (current_socket->socket_values.tcp_control.state) {
case ESTABLISHED: { case ESTABLISHED: {
handle_established(current_socket); handle_established(current_socket);
break; break;

View File

@ -1,5 +1,5 @@
/** /**
* Destiny UDP implementation * Destiny UDP implementation
* *
* Copyright (C) 2013 INRIA. * Copyright (C) 2013 INRIA.
* *
@ -7,10 +7,10 @@
* Public License. See the file LICENSE in the top level directory for more * Public License. See the file LICENSE in the top level directory for more
* details. * details.
* *
* @ingroup destiny * @ingroup destiny
* @{ * @{
* @file udp.c * @file udp.c
* @brief UDP implementation * @brief UDP implementation
* @author Oliver Gesch <oliver.gesch@googlemail.com> * @author Oliver Gesch <oliver.gesch@googlemail.com>
* @} * @}
*/ */

View File

@ -7,7 +7,7 @@
* Public License. See the file LICENSE in the top level directory for more * Public License. See the file LICENSE in the top level directory for more
* details. * details.
* *
* @ingroup destiny * @ingroup destiny
* @{ * @{
* @file udp.c * @file udp.c
* @brief UDP data structs and prototypes * @brief UDP data structs and prototypes