Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers discard.h Source File

discard.h

Go to the documentation of this file.
00001 /**
00002  * @file discard.h
00003  * @brief Discard 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 _DISCARD_H
00030 #define _DISCARD_H
00031 
00032 //Dependencies
00033 #include "core/net.h"
00034 #include "core/socket.h"
00035 
00036 //Stack size required to run the discard service
00037 #ifndef DISCARD_SERVICE_STACK_SIZE
00038    #define DISCARD_SERVICE_STACK_SIZE 600
00039 #elif (DISCARD_SERVICE_STACK_SIZE < 1)
00040    #error DISCARD_SERVICE_STACK_SIZE parameter is not valid
00041 #endif
00042 
00043 //Priority at which the discard service should run
00044 #ifndef DISCARD_SERVICE_PRIORITY
00045    #define DISCARD_SERVICE_PRIORITY OS_TASK_PRIORITY_NORMAL
00046 #endif
00047 
00048 //Size of the buffer for input/output operations
00049 #ifndef DISCARD_BUFFER_SIZE
00050    #define DISCARD_BUFFER_SIZE 1500
00051 #elif (DISCARD_BUFFER_SIZE < 1)
00052    #error DISCARD_BUFFER_SIZE parameter is not valid
00053 #endif
00054 
00055 //Maximum time the TCP discard server will wait before closing the connection
00056 #ifndef DISCARD_TIMEOUT
00057    #define DISCARD_TIMEOUT 20000
00058 #elif (DISCARD_TIMEOUT < 1)
00059    #error DISCARD_TIMEOUT parameter is not valid
00060 #endif
00061 
00062 //Discard service port
00063 #define DISCARD_PORT 9
00064 
00065 
00066 /**
00067  * @brief Discard service context
00068  **/
00069 
00070 typedef struct
00071 {
00072    Socket *socket;
00073    char_t buffer[DISCARD_BUFFER_SIZE];
00074 } DiscardServiceContext;
00075 
00076 
00077 //TCP discard service related functions
00078 error_t tcpDiscardStart(void);
00079 void tcpDiscardListenerTask(void *param);
00080 void tcpDiscardConnectionTask(void *param);
00081 
00082 //UDP discard service related functions
00083 error_t udpDiscardStart(void);
00084 void udpDiscardTask(void *param);
00085 
00086 #endif
00087