39#ifndef ECHO_SERVER_SUPPORT
40 #define ECHO_SERVER_SUPPORT DISABLED
41#elif (ECHO_SERVER_SUPPORT != ENABLED && ECHO_SERVER_SUPPORT != DISABLED)
42 #error ECHO_SERVER_SUPPORT parameter is not valid
46#ifndef ECHO_SERVER_STACK_SIZE
47 #define ECHO_SERVER_STACK_SIZE 500
48#elif (ECHO_SERVER_STACK_SIZE < 1)
49 #error ECHO_SERVER_STACK_SIZE parameter is not valid
53#ifndef ECHO_SERVER_PRIORITY
54 #define ECHO_SERVER_PRIORITY OS_TASK_PRIORITY_NORMAL
58#ifndef ECHO_SERVER_TCP_SUPPORT
59 #define ECHO_SERVER_TCP_SUPPORT ENABLED
60#elif (ECHO_SERVER_TCP_SUPPORT != ENABLED && ECHO_SERVER_TCP_SUPPORT != DISABLED)
61 #error ECHO_SERVER_TCP_SUPPORT parameter is not valid
65#ifndef ECHO_SERVER_MAX_TCP_CONNECTIONS
66 #define ECHO_SERVER_MAX_TCP_CONNECTIONS 2
67#elif (ECHO_SERVER_MAX_TCP_CONNECTIONS < 1)
68 #error ECHO_SERVER_MAX_TCP_CONNECTIONS parameter is not valid
72#ifndef ECHO_SERVER_TCP_BUFFER_SIZE
73 #define ECHO_SERVER_TCP_BUFFER_SIZE 512
74#elif (ECHO_SERVER_TCP_BUFFER_SIZE < 1)
75 #error ECHO_SERVER_TCP_BUFFER_SIZE parameter is not valid
79#ifndef ECHO_SERVER_UDP_SUPPORT
80 #define ECHO_SERVER_UDP_SUPPORT ENABLED
81#elif (ECHO_SERVER_UDP_SUPPORT != ENABLED && ECHO_SERVER_UDP_SUPPORT != DISABLED)
82 #error ECHO_SERVER_UDP_SUPPORT parameter is not valid
86#ifndef ECHO_SERVER_UDP_BUFFER_SIZE
87 #define ECHO_SERVER_UDP_BUFFER_SIZE 1472
88#elif (ECHO_SERVER_UDP_BUFFER_SIZE < 1)
89 #error ECHO_SERVER_UDP_BUFFER_SIZE parameter is not valid
93#ifndef ECHO_SERVER_TIMEOUT
94 #define ECHO_SERVER_TIMEOUT 30000
95#elif (ECHO_SERVER_TIMEOUT < 1)
96 #error ECHO_SERVER_TIMEOUT parameter is not valid
100#ifndef ECHO_SERVER_TICK_INTERVAL
101 #define ECHO_SERVER_TICK_INTERVAL 1000
102#elif (ECHO_SERVER_TICK_INTERVAL < 100)
103 #error ECHO_SERVER_TICK_INTERVAL parameter is not valid
107#ifndef ECHO_SERVER_PRIVATE_CONTEXT
108 #define ECHO_SERVER_PRIVATE_CONTEXT
126 ECHO_TCP_CONNECTION_STATE_CLOSED = 0,
127 ECHO_TCP_CONNECTION_STATE_OPEN = 1
151 char_t buffer[ECHO_SERVER_TCP_BUFFER_SIZE];
168#if (OS_STATIC_TASK_SUPPORT == ENABLED)
170 OsStackType taskStack[ECHO_SERVER_STACK_SIZE];
172#if (ECHO_SERVER_TCP_SUPPORT == ENABLED)
176#if (ECHO_SERVER_UDP_SUPPORT == ENABLED)
178 char_t udpBuffer[ECHO_SERVER_UDP_BUFFER_SIZE];
180 ECHO_SERVER_PRIVATE_CONTEXT
EchoTcpConnectionState
TCP connection state.
Definition echo_server.h:125
error_t
Error codes.
Definition error.h:43
uint_t OsEvent
Event object.
Definition os_port_none.h:104
uint_t OsTaskId
Task identifier.
Definition os_port_none.h:97
uint32_t systime_t
System time.
Definition os_port_none.h:90
Echo server context.
Definition echo_server.h:162
bool_t running
Operational state of the Echo server.
Definition echo_server.h:164
bool_t stop
Stop request.
Definition echo_server.h:165
EchoServerSettings settings
User settings.
Definition echo_server.h:163
Socket * tcpSocket
Listening TCP socket.
Definition echo_server.h:173
OsTaskId taskId
Task identifier.
Definition echo_server.h:167
OsEvent event
Event object used to poll the sockets.
Definition echo_server.h:166
Socket * udpSocket
UDP socket.
Definition echo_server.h:177
OsTaskTcb taskTcb
Task control block.
Definition echo_server.h:169
Echo server settings.
Definition echo_server.h:136
uint16_t port
Echo server port number.
Definition echo_server.h:138
NetInterface * interface
Underlying network interface.
Definition echo_server.h:137
Echo TCP connection.
Definition echo_server.h:147
EchoTcpConnectionState state
Connection state.
Definition echo_server.h:148
size_t bufferPos
Current position in the buffer.
Definition echo_server.h:153
size_t bufferLen
Length of the buffer, in bytes.
Definition echo_server.h:152
systime_t timestamp
Time stamp.
Definition echo_server.h:150
Socket * socket
Underlying TCP socket.
Definition echo_server.h:149