NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
TCB.h
1#pragma once
2/************************************************************************************
3* Copyright (C) 2023 *
4* TETCOS, Bangalore. India *
5* *
6* Tetcos owns the intellectual property rights in the Product and its content. *
7* The copying, redistribution, reselling or publication of any or all of the *
8* Product or its content without express prior written consent of Tetcos is *
9* prohibited. Ownership and / or any other right relating to the software and all *
10* intellectual property rights therein shall remain at all times with Tetcos. *
11* *
12* This source code is licensed per the NetSim license agreement. *
13* *
14* No portion of this source code may be used as the basis for a derivative work, *
15* or used, for any purpose other than its intended use per the NetSim license *
16* agreement. *
17* *
18* This source code and the algorithms contained within it are confidential trade *
19* secrets of TETCOS and may not be used as the basis for any other software, *
20* hardware, product or service. *
21* *
22* Author: Shashi Kant Suman *
23* *
24* ----------------------------------------------------------------------------------*/
25
26#ifndef _NETSIM_TCB_H_
27#define _NETSIM_TCB_H_
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32 typedef struct stru_tcp_queue_info
33 {
34 NetSim_PACKET* packet;
35 double time;
36 bool isSacked;
37 struct stru_tcp_queue_info* next;
38 }Queueinfo, *PQueueInfo;
39 typedef struct stru_tcp_queue
40 {
41 UINT size;
42 PQueueInfo queue;
43 }TCP_QUEUE, *PTCP_QUEUE;
44
46 {
47 TCP_CONNECTION_STATE tcp_state; ///< Present State of the TCP Connection.
48 TCP_CONNECTION_STATE tcp_prev_state; ///< Present State of the Connection.
49
50 TCPVARIANT variant;
51
52
53 /*Send Sequence Variables as per RFC 793 page number 18
54
55 SND.UNA - send unacknowledged
56 SND.NXT - send next
57 SND.WND - send window
58 SND.UP - send urgent pointer
59 SND.WL1 - segment sequence number used for last window update
60 SND.WL2 - segment acknowledgment number used for last window
61 update
62 ISS - initial send sequence number
63 */
65 {
66 UINT32 UNA;
67 UINT32 NXT;
68 UINT32 WND;
69 UINT32 UP;
70 UINT32 WL1;
71 UINT32 WL2;
72 }SND;
73 UINT32 ISS;
74
75 /* Receive Sequence Variables
76
77 RCV.NXT - receive next
78 RCV.WND - receive window
79 RCV.UP - receive urgent pointer
80 IRS - initial receive sequence number
81 */
83 {
84 UINT32 NXT;
85 UINT32 WND;
86 UINT32 UP;
87 }RCV;
88 UINT32 IRS;
89
90 /*Current Segment Variables
91
92 SEG.SEQ - segment sequence number
93 SEG.ACK - segment acknowledgment number
94 SEG.LEN - segment length
95 SEG.WND - segment window
96 SEG.UP - segment urgent pointer
97 SEG.PRC - segment precedence value
98 */
100 {
101 UINT SEQ;
102 UINT ACK;
103 UINT LEN;
104 UINT WND;
105 UINT UP;
106 UINT PRC;
107 }SEG;
108
109 TCP_QUEUE retransmissionQueue;
110 TCP_QUEUE outOfOrderSegment;
111
113 {
114 double RTO;
115 double SRTT;
116 double RTT_VAR;
117 }TCP_TIMER;
118#define TCP_RTO(tcb) (tcb->TCP_TIMER.RTO)
119#define TCP_SRTT(tcb) (tcb->TCP_TIMER.SRTT)
120#define TCP_RTTVAR(tcb) (tcb->TCP_TIMER.RTT_VAR)
121 bool isRTOTimerRunning;
122 UINT64 RTOEventId;
123 NetSim_PACKET* eventPacketptr;
124
125 UINT synRetries;
126
127 //Congestion algo data
128 void* congestionData;
129
130 //Congestion Algo callback
131 void(*init_congestionalgo)(PNETSIM_SOCKET);
132 void(*ack_received)(PNETSIM_SOCKET);
133 void(*rto_expired)(PNETSIM_SOCKET);
134 UINT16(*get_MSS)(PNETSIM_SOCKET);
135 UINT16(*get_WND)(PNETSIM_SOCKET);
136 void(*set_MSS)(PNETSIM_SOCKET s, UINT16);
137 UINT32(*get_RCVWND)(PNETSIM_SOCKET);
138 UINT(*get_dup_ack_count)(PNETSIM_SOCKET);
139
140 //Delayed Ack
141 TCPACKTYPE ackType;
142 double delayedAckTime;
143 double lastAckSendTime;
144 bool isAckSentLastTime;
145
146 //Time wait timer
147 double timeWaitTimer;
148 bool istimewaittimerrestarted;
149 bool isOtherTimerCancel;
150
151 //SACK
152 bool isSackPermitted;
154 {
155 UINT leftEdge[4];
156 UINT rightEdge[4];
157 }scoreboard,prevScoreboard;
158 UINT pipe;
159 UINT32 HighRxt;
160 UINT32 RescueRxt;
161 bool isSackOption; //Check whether current ack has sack option
162 UINT32 recoveryPoint;
163
164 //Send Variable
166 {
167 UINT8 Wind_Shift; //RFC 7323
168 bool TS_OK; //RFC 7323
169 }Snd;
170
171 //Receive Variable
173 {
174 UINT8 Wind_Shift; //RFC 7323
175 }Rcv;
176
177 //Window Scaling
178 bool isWindowScaling;
179
180 //Timestamp option
181 bool isTSopt;
182 UINT32 TSVal; //Received TSval
183
184 }TCB, *PTCB;
185
186#ifdef __cplusplus
187}
188#endif
189#endif //_NETSIM_TCB_H_
TCP_CONNECTION_STATE tcp_state
Present State of the TCP Connection.
Definition TCB.h:47
TCP_CONNECTION_STATE tcp_prev_state
Present State of the Connection.
Definition TCB.h:48