2011-09-28 16:29:01 +02:00
|
|
|
/*
|
|
|
|
* destiny.c
|
|
|
|
*
|
|
|
|
* Created on: 03.09.2011
|
|
|
|
* Author: Oliver
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <thread.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "udp.h"
|
2011-10-13 04:31:07 +02:00
|
|
|
#include "tcp.h"
|
2011-09-28 16:29:01 +02:00
|
|
|
#include "socket.h"
|
2012-01-24 03:19:11 +01:00
|
|
|
#include "tcp_timer.h"
|
|
|
|
#include "destiny.h"
|
2011-09-28 16:29:01 +02:00
|
|
|
|
|
|
|
void init_transport_layer(void)
|
|
|
|
{
|
|
|
|
printf("Initiating Transport Layer packages.\n");
|
|
|
|
// SOCKETS
|
2011-10-13 04:31:07 +02:00
|
|
|
memset(sockets, 0, MAX_SOCKETS*sizeof(socket_internal_t));
|
2011-09-28 16:29:01 +02:00
|
|
|
|
|
|
|
// UDP
|
2011-10-13 04:31:07 +02:00
|
|
|
int udp_thread_pid = thread_create(udp_stack_buffer, UDP_STACK_SIZE, PRIORITY_MAIN, CREATE_STACKTEST, udp_packet_handler, "udp_packet_handler");
|
2011-12-26 02:59:58 +01:00
|
|
|
set_udp_packet_handler_pid(udp_thread_pid);
|
2011-09-28 16:29:01 +02:00
|
|
|
|
|
|
|
// TCP
|
2011-10-13 04:31:07 +02:00
|
|
|
int tcp_thread_pid = thread_create(tcp_stack_buffer, TCP_STACK_SIZE, PRIORITY_MAIN, CREATE_STACKTEST, tcp_packet_handler, "tcp_packet_handler");
|
2011-12-26 02:59:58 +01:00
|
|
|
set_tcp_packet_handler_pid(tcp_thread_pid);
|
2012-01-24 03:19:11 +01:00
|
|
|
tcp_timer_pid = thread_create(tcp_timer_stack, TCP_TIMER_STACKSIZE, PRIORITY_MAIN+1, CREATE_STACKTEST, tcp_general_timer, "tcp_general_timer");
|
|
|
|
|
2011-09-28 16:29:01 +02:00
|
|
|
}
|