discard.h
Go to the documentation of this file.
1 /**
2  * @file discard.h
3  * @brief Discard protocol
4  *
5  * @section License
6  *
7  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneTCP Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 #ifndef _DISCARD_H
30 #define _DISCARD_H
31 
32 //Dependencies
33 #include "core/net.h"
34 #include "core/socket.h"
35 
36 //Stack size required to run the discard service
37 #ifndef DISCARD_SERVICE_STACK_SIZE
38  #define DISCARD_SERVICE_STACK_SIZE 600
39 #elif (DISCARD_SERVICE_STACK_SIZE < 1)
40  #error DISCARD_SERVICE_STACK_SIZE parameter is not valid
41 #endif
42 
43 //Priority at which the discard service should run
44 #ifndef DISCARD_SERVICE_PRIORITY
45  #define DISCARD_SERVICE_PRIORITY OS_TASK_PRIORITY_NORMAL
46 #endif
47 
48 //Size of the buffer for input/output operations
49 #ifndef DISCARD_BUFFER_SIZE
50  #define DISCARD_BUFFER_SIZE 1500
51 #elif (DISCARD_BUFFER_SIZE < 1)
52  #error DISCARD_BUFFER_SIZE parameter is not valid
53 #endif
54 
55 //Maximum time the TCP discard server will wait before closing the connection
56 #ifndef DISCARD_TIMEOUT
57  #define DISCARD_TIMEOUT 20000
58 #elif (DISCARD_TIMEOUT < 1)
59  #error DISCARD_TIMEOUT parameter is not valid
60 #endif
61 
62 //Discard service port
63 #define DISCARD_PORT 9
64 
65 //C++ guard
66 #ifdef __cplusplus
67  extern "C" {
68 #endif
69 
70 
71 /**
72  * @brief Discard service context
73  **/
74 
75 typedef struct
76 {
80 
81 
82 //TCP discard service related functions
84 void tcpDiscardListenerTask(void *param);
85 void tcpDiscardConnectionTask(void *param);
86 
87 //UDP discard service related functions
89 void udpDiscardTask(void *param);
90 
91 //C++ guard
92 #ifdef __cplusplus
93  }
94 #endif
95 
96 #endif
char char_t
Definition: compiler_port.h:41
TCP/IP stack core.
error_t udpDiscardStart(void)
Start UDP discard service.
Definition: discard.c:242
error_t tcpDiscardStart(void)
Start TCP discard service.
Definition: discard.c:48
#define Socket
Definition: socket.h:34
void udpDiscardTask(void *param)
UDP discard service implementation.
Definition: discard.c:311
Discard service context.
Definition: discard.h:75
error_t
Error codes.
Definition: error.h:40
#define DISCARD_BUFFER_SIZE
Definition: discard.h:50
Socket API.
void tcpDiscardConnectionTask(void *param)
TCP discard service implementation.
Definition: discard.c:184
void tcpDiscardListenerTask(void *param)
Task handling connection requests.
Definition: discard.c:110