From 267053042e55077ff58baef17e0608ccb21927df Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Fri, 5 Jul 2013 09:37:34 +0200 Subject: [PATCH] moved buffer initialization from header to c files fixed file format --- sys/net/destiny/destiny.c | 123 +++++++++++++++++++------------------- sys/net/destiny/tcp.h | 4 -- sys/net/destiny/udp.h | 3 - 3 files changed, 63 insertions(+), 67 deletions(-) diff --git a/sys/net/destiny/destiny.c b/sys/net/destiny/destiny.c index c2f069272b..d23efee8f5 100644 --- a/sys/net/destiny/destiny.c +++ b/sys/net/destiny/destiny.c @@ -1,60 +1,63 @@ -/** - * Destiny transpor layer implementation - * - * Copyright (C) 2013 INRIA. - * - * This file subject to the terms and conditions of the GNU Lesser General - * Public License. See the file LICENSE in the top level directory for more - * details. - * - * @ingroup destiny - * @{ - * @file destiny.c - * @brief transpor layer functions - * @author Oliver Gesch - * @} - */ - -#include -#include -#include -#include -#include -#include "udp.h" -#include "tcp.h" -#include "socket.h" -#include "tcp_timer.h" -#include "destiny.h" - -void init_transport_layer(void) -{ - printf("Initializing transport layer packages. Size of socket_type: %u\n", - sizeof(socket_internal_t)); - /* SOCKETS */ - memset(sockets, 0, MAX_SOCKETS * sizeof(socket_internal_t)); - - /* UDP */ - int udp_thread_pid = thread_create(udp_stack_buffer, UDP_STACK_SIZE, - PRIORITY_MAIN, CREATE_STACKTEST, - udp_packet_handler,"udp_packet_handler"); - set_udp_packet_handler_pid(udp_thread_pid); - - /* TCP */ - timex_t now; - vtimer_now(&now); - srand(now.microseconds); -#ifdef TCP_HC - printf("TCP_HC enabled!\n"); - global_context_counter = rand(); -#endif - global_sequence_counter = rand(); - - int tcp_thread_pid = thread_create(tcp_stack_buffer, TCP_STACK_SIZE, - PRIORITY_MAIN, CREATE_STACKTEST, - tcp_packet_handler, "tcp_packet_handler"); - set_tcp_packet_handler_pid(tcp_thread_pid); - - thread_create(tcp_timer_stack, TCP_TIMER_STACKSIZE, PRIORITY_MAIN + 1, - CREATE_STACKTEST, tcp_general_timer, "tcp_general_timer"); - -} +/** + * Destiny transpor layer implementation + * + * Copyright (C) 2013 INRIA. + * + * This file subject to the terms and conditions of the GNU Lesser General + * Public License. See the file LICENSE in the top level directory for more + * details. + * + * @ingroup destiny + * @{ + * @file destiny.c + * @brief transpor layer functions + * @author Oliver Gesch + * @} + */ + +#include +#include +#include +#include +#include +#include "udp.h" +#include "tcp.h" +#include "socket.h" +#include "tcp_timer.h" +#include "destiny.h" + +char tcp_stack_buffer[TCP_STACK_SIZE]; +char udp_stack_buffer[UDP_STACK_SIZE]; + +void init_transport_layer(void) +{ + printf("Initializing transport layer packages. Size of socket_type: %u\n", + sizeof(socket_internal_t)); + /* SOCKETS */ + memset(sockets, 0, MAX_SOCKETS * sizeof(socket_internal_t)); + + /* UDP */ + int udp_thread_pid = thread_create(udp_stack_buffer, UDP_STACK_SIZE, + PRIORITY_MAIN, CREATE_STACKTEST, + udp_packet_handler,"udp_packet_handler"); + set_udp_packet_handler_pid(udp_thread_pid); + + /* TCP */ + timex_t now; + vtimer_now(&now); + srand(now.microseconds); +#ifdef TCP_HC + printf("TCP_HC enabled!\n"); + global_context_counter = rand(); +#endif + global_sequence_counter = rand(); + + int tcp_thread_pid = thread_create(tcp_stack_buffer, TCP_STACK_SIZE, + PRIORITY_MAIN, CREATE_STACKTEST, + tcp_packet_handler, "tcp_packet_handler"); + set_tcp_packet_handler_pid(tcp_thread_pid); + + thread_create(tcp_timer_stack, TCP_TIMER_STACKSIZE, PRIORITY_MAIN + 1, + CREATE_STACKTEST, tcp_general_timer, "tcp_general_timer"); + +} diff --git a/sys/net/destiny/tcp.h b/sys/net/destiny/tcp.h index 7c33c56f85..6b58a29f72 100644 --- a/sys/net/destiny/tcp.h +++ b/sys/net/destiny/tcp.h @@ -98,10 +98,6 @@ typedef struct __attribute__((packed)) tcp_h_t { uint16_t urg_pointer; } tcp_hdr_t; - -// uint8_t buffer_tcp[BUFFER_SIZE]; -char tcp_stack_buffer[TCP_STACK_SIZE]; - #ifdef TCP_HC mutex_t global_context_counter_mutex; uint8_t global_context_counter; diff --git a/sys/net/destiny/udp.h b/sys/net/destiny/udp.h index ba581ba28e..23efcade94 100644 --- a/sys/net/destiny/udp.h +++ b/sys/net/destiny/udp.h @@ -38,9 +38,6 @@ typedef struct __attribute__((packed)) udp_h_t { uint16_t checksum; } udp_hdr_t; -// uint8_t buffer_udp[BUFFER_SIZE]; -char udp_stack_buffer[UDP_STACK_SIZE]; - uint16_t udp_csum(ipv6_hdr_t *ipv6_header, udp_hdr_t *udp_header); void udp_packet_handler(void);