Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers tcp_misc.h Source File

tcp_misc.h

Go to the documentation of this file.
00001 /**
00002  * @file tcp_misc.h
00003  * @brief Helper functions for TCP
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 _TCP_MISC_H
00030 #define _TCP_MISC_H
00031 
00032 //Dependencies
00033 #include "core/tcp.h"
00034 
00035 //TCP related functions
00036 error_t tcpSendSegment(Socket *socket, uint8_t flags, uint32_t seqNum,
00037    uint32_t ackNum, size_t length, bool_t addToQueue);
00038 
00039 error_t tcpSendResetSegment(NetInterface *interface,
00040    IpPseudoHeader *pseudoHeader, TcpHeader *segment, size_t length);
00041 
00042 error_t tcpAddOption(TcpHeader *segment, uint8_t kind, const void *value, uint8_t length);
00043 TcpOption *tcpGetOption(TcpHeader *segment, uint8_t kind);
00044 
00045 error_t tcpCheckSequenceNumber(Socket *socket, TcpHeader *segment, size_t length);
00046 error_t tcpCheckSyn(Socket *socket, TcpHeader *segment, size_t length);
00047 error_t tcpCheckAck(Socket *socket, TcpHeader *segment, size_t length);
00048 
00049 bool_t tcpIsDuplicateAck(Socket *socket, TcpHeader *segment, size_t length);
00050 
00051 void tcpFastRetransmit(Socket *socket);
00052 void tcpFastRecovery(Socket *socket, TcpHeader *segment, uint_t n);
00053 void tcpFastLossRecovery(Socket *socket, TcpHeader *segment);
00054 
00055 void tcpProcessSegmentData(Socket *socket, TcpHeader *segment,
00056    const NetBuffer *buffer, size_t offset, size_t length);
00057 
00058 void tcpDeleteControlBlock(Socket *socket);
00059 
00060 void tcpUpdateRetransmitQueue(Socket *socket);
00061 void tcpFlushRetransmitQueue(Socket *socket);
00062 
00063 void tcpFlushSynQueue(Socket *socket);
00064 
00065 void tcpUpdateSackBlocks(Socket *socket, uint32_t *leftEdge, uint32_t *rightEdge);
00066 void tcpUpdateSendWindow(Socket *socket, TcpHeader *segment);
00067 void tcpUpdateReceiveWindow(Socket *socket);
00068 
00069 bool_t tcpComputeRto(Socket *socket);
00070 error_t tcpRetransmitSegment(Socket *socket);
00071 error_t tcpNagleAlgo(Socket *socket, uint_t flags);
00072 
00073 void tcpChangeState(Socket *socket, TcpState newState);
00074 
00075 void tcpUpdateEvents(Socket *socket);
00076 uint_t tcpWaitForEvents(Socket *socket, uint_t eventMask, systime_t timeout);
00077 
00078 void tcpWriteTxBuffer(Socket *socket, uint32_t seqNum,
00079    const uint8_t *data, size_t length);
00080 
00081 error_t tcpReadTxBuffer(Socket *socket, uint32_t seqNum,
00082    NetBuffer *buffer, size_t length);
00083 
00084 void tcpWriteRxBuffer(Socket *socket, uint32_t seqNum,
00085    const NetBuffer *data, size_t dataOffset, size_t length);
00086 
00087 void tcpReadRxBuffer(Socket *socket, uint32_t seqNum, uint8_t *data, size_t length);
00088 
00089 void tcpDumpHeader(const TcpHeader *segment, size_t length, uint32_t iss, uint32_t irs);
00090 
00091 #endif
00092