chargen.h
Go to the documentation of this file.
1 /**
2  * @file chargen.h
3  * @brief Character generator 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 _CHARGEN_H
30 #define _CHARGEN_H
31 
32 //Dependencies
33 #include "core/net.h"
34 #include "core/socket.h"
35 
36 //Stack size required to run the chargen service
37 #ifndef CHARGEN_SERVICE_STACK_SIZE
38  #define CHARGEN_SERVICE_STACK_SIZE 600
39 #elif (CHARGEN_SERVICE_STACK_SIZE < 1)
40  #error CHARGEN_SERVICE_STACK_SIZE parameter is not valid
41 #endif
42 
43 //Priority at which the chargen service should run
44 #ifndef CHARGEN_SERVICE_PRIORITY
45  #define CHARGEN_SERVICE_PRIORITY OS_TASK_PRIORITY_NORMAL
46 #endif
47 
48 //Size of the buffer for input/output operations
49 #ifndef CHARGEN_BUFFER_SIZE
50  #define CHARGEN_BUFFER_SIZE 1500
51 #elif (CHARGEN_BUFFER_SIZE < 1)
52  #error CHARGEN_BUFFER_SIZE parameter is not valid
53 #endif
54 
55 //Maximum time the TCP chargen server will wait before closing the connection
56 #ifndef CHARGEN_TIMEOUT
57  #define CHARGEN_TIMEOUT 20000
58 #elif (CHARGEN_TIMEOUT < 1)
59  #error CHARGEN_TIMEOUT parameter is not valid
60 #endif
61 
62 //Chargen service port
63 #define CHARGEN_PORT 19
64 
65 //C++ guard
66 #ifdef __cplusplus
67  extern "C" {
68 #endif
69 
70 
71 /**
72  * @brief Chargen service context
73  **/
74 
75 typedef struct
76 {
80 
81 
82 //TCP chargen service related functions
84 void tcpChargenListenerTask(void *param);
85 void tcpChargenConnectionTask(void *param);
86 
87 //UDP chargen service related functions
89 void udpChargenTask(void *param);
90 
91 //C++ guard
92 #ifdef __cplusplus
93  }
94 #endif
95 
96 #endif
void tcpChargenConnectionTask(void *param)
TCP chargen service implementation.
Definition: chargen.c:200
char char_t
Definition: compiler_port.h:41
TCP/IP stack core.
void udpChargenTask(void *param)
UDP chargen service implementation.
Definition: chargen.c:346
error_t tcpChargenStart(void)
Start TCP chargen service.
Definition: chargen.c:64
Chargen service context.
Definition: chargen.h:75
#define Socket
Definition: socket.h:34
#define CHARGEN_BUFFER_SIZE
Definition: chargen.h:50
void tcpChargenListenerTask(void *param)
Task handling connection requests.
Definition: chargen.c:126
error_t
Error codes.
Definition: error.h:40
error_t udpChargenStart(void)
Start UDP chargen service.
Definition: chargen.c:277
Socket API.