Sergey Pastor / 1

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers chargen.h Source File

chargen.h

Go to the documentation of this file.
00001 /**
00002  * @file chargen.h
00003  * @brief Character generator protocol
00004  *
00005  * @section License
00006  *
00007  * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.
00008  *
00009  * This file is part of CycloneTCP Open.
00010  *
00011  * This program is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU General Public License
00013  * as published by the Free Software Foundation; either version 2
00014  * of the License, or (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software Foundation,
00023  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00024  *
00025  * @author Oryx Embedded SARL (www.oryx-embedded.com)
00026  * @version 1.7.6
00027  **/
00028 
00029 #ifndef _CHARGEN_H
00030 #define _CHARGEN_H
00031 
00032 //Dependencies
00033 #include "core/net.h"
00034 #include "core/socket.h"
00035 
00036 //Stack size required to run the chargen service
00037 #ifndef CHARGEN_SERVICE_STACK_SIZE
00038    #define CHARGEN_SERVICE_STACK_SIZE 600
00039 #elif (CHARGEN_SERVICE_STACK_SIZE < 1)
00040    #error CHARGEN_SERVICE_STACK_SIZE parameter is not valid
00041 #endif
00042 
00043 //Priority at which the chargen service should run
00044 #ifndef CHARGEN_SERVICE_PRIORITY
00045    #define CHARGEN_SERVICE_PRIORITY OS_TASK_PRIORITY_NORMAL
00046 #endif
00047 
00048 //Size of the buffer for input/output operations
00049 #ifndef CHARGEN_BUFFER_SIZE
00050    #define CHARGEN_BUFFER_SIZE 1500
00051 #elif (CHARGEN_BUFFER_SIZE < 1)
00052    #error CHARGEN_BUFFER_SIZE parameter is not valid
00053 #endif
00054 
00055 //Maximum time the TCP chargen server will wait before closing the connection
00056 #ifndef CHARGEN_TIMEOUT
00057    #define CHARGEN_TIMEOUT 20000
00058 #elif (CHARGEN_TIMEOUT < 1)
00059    #error CHARGEN_TIMEOUT parameter is not valid
00060 #endif
00061 
00062 //Chargen service port
00063 #define CHARGEN_PORT 19
00064 
00065 
00066 /**
00067  * @brief Chargen service context
00068  **/
00069 
00070 typedef struct
00071 {
00072    Socket *socket;
00073    char_t buffer[CHARGEN_BUFFER_SIZE];
00074 } ChargenServiceContext;
00075 
00076 
00077 //TCP chargen service related functions
00078 error_t tcpChargenStart(void);
00079 void tcpChargenListenerTask(void *param);
00080 void tcpChargenConnectionTask(void *param);
00081 
00082 //UDP chargen service related functions
00083 error_t udpChargenStart(void);
00084 void udpChargenTask(void *param);
00085 
00086 #endif
00087