mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
moved buffer initialization from header to c files
fixed file format
This commit is contained in:
parent
40b3078b7e
commit
267053042e
@ -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 <oliver.gesch@googlemail.com>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <thread.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <vtimer.h>
|
||||
#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 <oliver.gesch@googlemail.com>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <thread.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <vtimer.h>
|
||||
#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");
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user