NetSim Source Code Help
Loading...
Searching...
No Matches
DelayedAck.c
Go to the documentation of this file.
1
/************************************************************************************
2
* Copyright (C) 2020 *
3
* TETCOS, Bangalore. India *
4
* *
5
* Tetcos owns the intellectual property rights in the Product and its content. *
6
* The copying, redistribution, reselling or publication of any or all of the *
7
* Product or its content without express prior written consent of Tetcos is *
8
* prohibited. Ownership and / or any other right relating to the software and all *
9
* intellectual property rights therein shall remain at all times with Tetcos. *
10
* *
11
* Author: Shashi Kant Suman *
12
* *
13
* ---------------------------------------------------------------------------------*/
14
#include "
main.h
"
15
#include "
TCP.h
"
16
17
void
set_ack_type
(
PNETSIM_SOCKET
s,
PTCP_DEV_VAR
tcp)
18
{
19
s->
tcb
->
ackType
= tcp->
ackType
;
20
s->
tcb
->
delayedAckTime
= tcp->
dDelayedAckTime
;
21
s->
tcb
->
isAckSentLastTime
=
false
;
22
}
23
24
bool
send_ack_or_not
(
PNETSIM_SOCKET
s)
25
{
26
if
(s->
tcb
->
ackType
==
TCPACKTYPE_UNDELAYED
)
27
return
true
;
28
29
if
(s->
tcb
->
lastAckSendTime
+
30
s->
tcb
->
delayedAckTime
<=
pstruEventDetails
->
dEventTime
)
31
{
32
s->
tcb
->
lastAckSendTime
=
pstruEventDetails
->
dEventTime
;
33
s->
tcb
->
isAckSentLastTime
=
true
;
34
return
true
;
35
}
36
else
37
{
38
if
(s->
tcb
->
isAckSentLastTime
)
39
{
40
s->
tcb
->
isAckSentLastTime
=
false
;
41
return
false
;
42
}
43
else
44
{
45
s->
tcb
->
lastAckSendTime
=
pstruEventDetails
->
dEventTime
;
46
s->
tcb
->
isAckSentLastTime
=
true
;
47
return
true
;
48
}
49
}
50
}
set_ack_type
void set_ack_type(PNETSIM_SOCKET s, PTCP_DEV_VAR tcp)
Definition:
DelayedAck.c:17
send_ack_or_not
bool send_ack_or_not(PNETSIM_SOCKET s)
Definition:
DelayedAck.c:24
pstruEventDetails
EXPORTED struct stru_NetSim_EventDetails * pstruEventDetails
Definition:
Stack.h:837
TCP.h
TCPACKTYPE_UNDELAYED
@ TCPACKTYPE_UNDELAYED
Definition:
TCP.h:83
main.h
stru_NetSim_EventDetails::dEventTime
double dEventTime
Definition:
Stack.h:746
stru_TCP_Socket
Definition:
TCP.h:119
stru_TCP_Socket::tcb
PTCB tcb
Definition:
TCP.h:132
stru_TCP_device_var
Definition:
TCP.h:144
stru_TCP_device_var::dDelayedAckTime
double dDelayedAckTime
Definition:
TCP.h:152
stru_TCP_device_var::ackType
TCPACKTYPE ackType
Definition:
TCP.h:150
stru_tcp_Transmission_Control_Block::delayedAckTime
double delayedAckTime
Definition:
TCB.h:141
stru_tcp_Transmission_Control_Block::ackType
TCPACKTYPE ackType
Definition:
TCB.h:140
stru_tcp_Transmission_Control_Block::isAckSentLastTime
bool isAckSentLastTime
Definition:
TCB.h:143
stru_tcp_Transmission_Control_Block::lastAckSendTime
double lastAckSendTime
Definition:
TCB.h:142
ALL
Component 1
Part 2
TCP
DelayedAck.c
Generated on Fri Dec 9 2022 10:22:45 for NetSim Source Code Help by
1.9.5