echo_server.h File Reference

Echo server. More...

#include "core/net.h"
#include "core/socket.h"

Go to the source code of this file.

Data Structures

struct  EchoServerSettings
 Echo server settings. More...
 
struct  EchoTcpConnection
 Echo TCP connection. More...
 
struct  EchoServerContext
 Echo server context. More...
 

Macros

#define ECHO_SERVER_SUPPORT   DISABLED
 
#define ECHO_SERVER_STACK_SIZE   500
 
#define ECHO_SERVER_PRIORITY   OS_TASK_PRIORITY_NORMAL
 
#define ECHO_SERVER_TCP_SUPPORT   ENABLED
 
#define ECHO_SERVER_MAX_TCP_CONNECTIONS   2
 
#define ECHO_SERVER_TCP_BUFFER_SIZE   512
 
#define ECHO_SERVER_UDP_SUPPORT   ENABLED
 
#define ECHO_SERVER_UDP_BUFFER_SIZE   1472
 
#define ECHO_SERVER_TIMEOUT   30000
 
#define ECHO_SERVER_TICK_INTERVAL   1000
 
#define ECHO_SERVER_PRIVATE_CONTEXT
 
#define ECHO_PORT   7
 

Enumerations

enum  EchoTcpConnectionState { ECHO_TCP_CONNECTION_STATE_CLOSED = 0, ECHO_TCP_CONNECTION_STATE_OPEN = 1 }
 TCP connection state. More...
 

Functions

void echoServerGetDefaultSettings (EchoServerSettings *settings)
 Initialize settings with default values. More...
 
error_t echoServerInit (EchoServerContext *context, const EchoServerSettings *settings)
 Initialize Echo server context. More...
 
error_t echoServerStart (EchoServerContext *context)
 Start Echo server. More...
 
error_t echoServerStop (EchoServerContext *context)
 Stop Echo server. More...
 
void echoServerTask (EchoServerContext *context)
 Echo server task. More...
 
void echoServerDeinit (EchoServerContext *context)
 Release Echo server context. More...
 

Detailed Description

Echo server.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file echo_server.h.

Macro Definition Documentation

◆ ECHO_PORT

#define ECHO_PORT   7

Definition at line 112 of file echo_server.h.

◆ ECHO_SERVER_MAX_TCP_CONNECTIONS

#define ECHO_SERVER_MAX_TCP_CONNECTIONS   2

Definition at line 66 of file echo_server.h.

◆ ECHO_SERVER_PRIORITY

#define ECHO_SERVER_PRIORITY   OS_TASK_PRIORITY_NORMAL

Definition at line 54 of file echo_server.h.

◆ ECHO_SERVER_PRIVATE_CONTEXT

#define ECHO_SERVER_PRIVATE_CONTEXT

Definition at line 108 of file echo_server.h.

◆ ECHO_SERVER_STACK_SIZE

#define ECHO_SERVER_STACK_SIZE   500

Definition at line 47 of file echo_server.h.

◆ ECHO_SERVER_SUPPORT

#define ECHO_SERVER_SUPPORT   DISABLED

Definition at line 40 of file echo_server.h.

◆ ECHO_SERVER_TCP_BUFFER_SIZE

#define ECHO_SERVER_TCP_BUFFER_SIZE   512

Definition at line 73 of file echo_server.h.

◆ ECHO_SERVER_TCP_SUPPORT

#define ECHO_SERVER_TCP_SUPPORT   ENABLED

Definition at line 59 of file echo_server.h.

◆ ECHO_SERVER_TICK_INTERVAL

#define ECHO_SERVER_TICK_INTERVAL   1000

Definition at line 101 of file echo_server.h.

◆ ECHO_SERVER_TIMEOUT

#define ECHO_SERVER_TIMEOUT   30000

Definition at line 94 of file echo_server.h.

◆ ECHO_SERVER_UDP_BUFFER_SIZE

#define ECHO_SERVER_UDP_BUFFER_SIZE   1472

Definition at line 87 of file echo_server.h.

◆ ECHO_SERVER_UDP_SUPPORT

#define ECHO_SERVER_UDP_SUPPORT   ENABLED

Definition at line 80 of file echo_server.h.

Enumeration Type Documentation

◆ EchoTcpConnectionState

TCP connection state.

Enumerator
ECHO_TCP_CONNECTION_STATE_CLOSED 
ECHO_TCP_CONNECTION_STATE_OPEN 

Definition at line 124 of file echo_server.h.

Function Documentation

◆ echoServerDeinit()

void echoServerDeinit ( EchoServerContext context)

Release Echo server context.

Parameters
[in]contextPointer to the Echo server context

Definition at line 455 of file echo_server.c.

◆ echoServerGetDefaultSettings()

void echoServerGetDefaultSettings ( EchoServerSettings settings)

Initialize settings with default values.

Parameters
[out]settingsStructure that contains Echo server settings

Definition at line 54 of file echo_server.c.

◆ echoServerInit()

error_t echoServerInit ( EchoServerContext context,
const EchoServerSettings settings 
)

Initialize Echo server context.

Parameters
[in]contextPointer to the Echo server context
[in]settingsEcho server specific settings
Returns
Error code

Definition at line 76 of file echo_server.c.

◆ echoServerStart()

error_t echoServerStart ( EchoServerContext context)

Start Echo server.

Parameters
[in]contextPointer to the Echo server context
Returns
Error code

Definition at line 126 of file echo_server.c.

◆ echoServerStop()

error_t echoServerStop ( EchoServerContext context)

Stop Echo server.

Parameters
[in]contextPointer to the Echo server context
Returns
Error code

Definition at line 263 of file echo_server.c.

◆ echoServerTask()

void echoServerTask ( EchoServerContext context)

Echo server task.

Parameters
[in]contextPointer to the Echo server context

Definition at line 322 of file echo_server.c.