Choco OS  V.0.16.9.0
Join to the chocolate world
oc_tcp_connection.c File Reference

The file with source for the TCP connection interface. More...

#include <oc_tcp.h>
#include <oc_thread.h>
#include <oc_ktime.h>
#include <oc_mutex.h>
#include <oc_math.h>
#include <oc_dynamic_config.h>
#include <oc_semaphore.h>
#include <oc_event.h>
#include <oc_intman.h>
#include <oc_netifman.h>
#include <oc_queue.h>

Go to the source code of this file.

Data Structures

struct  PacketFlags_t
 
struct  Segment_t
 
struct  Tcp_Connection_t
 stores TCP connection data More...
 

Functions

static oC_ErrorCode_t SendPredefinedPacket (oC_Tcp_Connection_t Connection, PredefinedPacket_t PredefinedPacket, oC_Time_t Timeout)
 simply sends one of standard (predefined) packets
 
static oC_ErrorCode_t WaitForPredefinedPacket (oC_Tcp_Connection_t Connection, PredefinedPacket_t PredefinedPacket, oC_Time_t Timeout)
 waits for one of predefined packets
 
static oC_ErrorCode_t ReadConnectionDataFromPacket (oC_Tcp_Connection_t Connection, Packet_t Packet)
 reads connection data from the given packet
 
static oC_ErrorCode_t SendSegment (oC_Tcp_Connection_t Connection, Segment_t *Segment, oC_Time_t Timeout)
 sends data segment by using TCP connection
 
static bool PacketFilterFunction (oC_Net_Packet_t *ReceivedPacket, const void *Parameter, oC_Netif_t Netif)
 the function for filtering packets
 
static void ReceiveThread (oC_Tcp_Connection_t Connection)
 thread for receiving data
 
oC_Tcp_Connection_t oC_Tcp_Connection_New (const oC_Tcp_Connection_Config_t *Config)
 allocates memory for a new TCP connection object More...
 
static oC_ErrorCode_t PreparePacketToSend (oC_Tcp_Connection_t Connection, Packet_t Packet, const PacketFlags_t *Flags, const uint8_t *Data, oC_MemorySize_t *Size)
 initializes Packet to send via TCP connection
 
static oC_ErrorCode_t SendPacket (oC_Tcp_Connection_t Connection, Packet_t Packet, oC_Time_t Timeout)
 sends packet via TCP connection
 
static oC_ErrorCode_t PrepareAndSendPacket (oC_Tcp_Connection_t Connection, Packet_t Packet, const PacketFlags_t *Flags, const uint8_t *Data, oC_MemorySize_t *Size, uint32_t *outSequenceNumber, oC_Time_t Timeout)
 prepares and sends TCP packet
 
static oC_ErrorCode_t ReceivePacket (oC_Tcp_Connection_t Connection, Packet_t Packet, oC_Time_t Timeout)
 receives packet via TCP connection
 
static oC_ErrorCode_t WaitForAcknowledge (oC_Tcp_Connection_t Connection, uint32_t AcknowledgeNumber, oC_Time_t Timeout)
 waits for the acknowledge of the given packet
 
static void SaveReceivedSegmentInQueue (oC_Tcp_Connection_t Connection)
 saves data from the queue
 
static void AnalyzeReceivedPacket (oC_Tcp_Connection_t Connection, Packet_t Packet)
 analyzes received data
 
static void CalculateBaudRate (oC_Tcp_Connection_t Connection)
 calculates current Baud Rate of TCP connection
 

Detailed Description


Author
Patryk Kubiak - (Created on: 22.01.2017 16:22:18)
Note
Copyright (C) 2017 Patryk Kubiak patry.nosp@m.k.ku.nosp@m.biak@.nosp@m.choc.nosp@m.oos.o.nosp@m.rg
           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 St, Fifth Floor, Boston, MA  02110-1301  USA

Definition in file oc_tcp_connection.c.