mikroSDK Reference Manual
tcp_misc.h
Go to the documentation of this file.
1
31#ifndef _TCP_MISC_H
32#define _TCP_MISC_H
33
34//Dependencies
35#include "core/tcp.h"
36
37//C++ guard
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42//TCP related functions
43error_t tcpSendSegment(Socket *socket, uint8_t flags, uint32_t seqNum,
44 uint32_t ackNum, size_t length, bool_t addToQueue);
45
46error_t tcpSendResetSegment(Socket *socket, uint32_t seqNum);
47
48error_t tcpRejectSegment(NetInterface *interface,
49 const IpPseudoHeader *pseudoHeader, const TcpHeader *segment, size_t length);
50
51error_t tcpAddOption(TcpHeader *segment, uint8_t kind, const void *value,
52 uint8_t length);
53
54const TcpOption *tcpGetOption(const TcpHeader *segment, uint8_t kind);
55
56uint32_t tcpGenerateInitialSeqNum(const IpAddr *localIpAddr,
57 uint16_t localPort, const IpAddr *remoteIpAddr, uint16_t remotePort);
58
59error_t tcpCheckSeqNum(Socket *socket, const TcpHeader *segment, size_t length);
60error_t tcpCheckSyn(Socket *socket, const TcpHeader *segment, size_t length);
61error_t tcpCheckAck(Socket *socket, const TcpHeader *segment, size_t length);
62
63bool_t tcpIsDuplicateSyn(Socket *socket, const IpPseudoHeader *pseudoHeader,
64 const TcpHeader *segment);
65
66bool_t tcpIsDuplicateAck(Socket *socket, const TcpHeader *segment,
67 size_t length);
68
69void tcpFastRetransmit(Socket *socket);
70void tcpFastRecovery(Socket *socket, const TcpHeader *segment, uint_t n);
71void tcpFastLossRecovery(Socket *socket, const TcpHeader *segment);
72
73void tcpProcessSegmentData(Socket *socket, const TcpHeader *segment,
74 const NetBuffer *buffer, size_t offset, size_t length);
75
76void tcpDeleteControlBlock(Socket *socket);
77
78void tcpUpdateRetransmitQueue(Socket *socket);
79void tcpFlushRetransmitQueue(Socket *socket);
80
81void tcpFlushSynQueue(Socket *socket);
82
83void tcpUpdateSackBlocks(Socket *socket, uint32_t *leftEdge, uint32_t *rightEdge);
84void tcpUpdateSendWindow(Socket *socket, const TcpHeader *segment);
85void tcpUpdateReceiveWindow(Socket *socket);
86
87bool_t tcpComputeRto(Socket *socket);
88error_t tcpRetransmitSegment(Socket *socket);
89error_t tcpNagleAlgo(Socket *socket, uint_t flags);
90
91void tcpChangeState(Socket *socket, TcpState newState);
92
93void tcpUpdateEvents(Socket *socket);
94uint_t tcpWaitForEvents(Socket *socket, uint_t eventMask, systime_t timeout);
95
96void tcpWriteTxBuffer(Socket *socket, uint32_t seqNum,
97 const uint8_t *data, size_t length);
98
99error_t tcpReadTxBuffer(Socket *socket, uint32_t seqNum,
100 NetBuffer *buffer, size_t length);
101
102void tcpWriteRxBuffer(Socket *socket, uint32_t seqNum,
103 const NetBuffer *data, size_t dataOffset, size_t length);
104
105void tcpReadRxBuffer(Socket *socket, uint32_t seqNum, uint8_t *data,
106 size_t length);
107
108void tcpDumpHeader(const TcpHeader *segment, size_t length, uint32_t iss,
109 uint32_t irs);
110
111//C++ guard
112#ifdef __cplusplus
113}
114#endif
115
116#endif
error_t
Error codes.
Definition error.h:43
uint32_t systime_t
System time.
Definition os_port_none.h:90
IP network address.
Definition ip.h:72
IP pseudo header.
Definition ip.h:91
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89
TCP (Transmission Control Protocol)
TcpState
TCP FSM states.
Definition tcp.h:267