NetSim Source Code Help
Loading...
Searching...
No Matches
TCP_Test.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
#include "
TCP_Header.h
"
17
18
/*
19
* This file is used for testing the TCP working in NetSim.
20
* Work based on drop probability and burst drop.
21
*/
22
23
bool
pass_test
()
24
{
25
#ifdef _TEST_TCP_
26
double
d =
NETSIM_RAND_01
();
27
static
int
c
= 0;
28
PTCP_SEGMENT_HDR
hdr =
TCP_GET_SEGMENT_HDR
(
pstruEventDetails
->
pPacket
);
29
if
(!isAckDrop && hdr->
Ack
== 1)
30
return
true
;
31
32
if
(burstDrop)
33
{
34
if
(
c
&&
c
< burstDropSize)
35
{
36
c
++;
37
return
false
;
38
}
39
else
40
{
41
c
= 0;
42
}
43
}
44
if
(d < dropProbability)
45
{
46
if
(burstDrop)
47
c
= 1;
48
return
false
;
49
}
50
else
51
return
true
;
52
#endif
53
return
true
;
54
}
c
#define c
Definition:
LTENR_PropagationModel.c:34
pstruEventDetails
EXPORTED struct stru_NetSim_EventDetails * pstruEventDetails
Definition:
Stack.h:837
NETSIM_RAND_01
#define NETSIM_RAND_01()
Definition:
Stack.h:860
TCP.h
TCP_Header.h
TCP_GET_SEGMENT_HDR
static PTCP_SEGMENT_HDR TCP_GET_SEGMENT_HDR(NetSim_PACKET *packet)
Definition:
TCP_Header.h:107
pass_test
bool pass_test()
Definition:
TCP_Test.c:23
main.h
stru_NetSim_EventDetails::pPacket
struct stru_NetSim_Packet * pPacket
Definition:
Stack.h:754
stru_tcp_header
Definition:
TCP_Header.h:85
stru_tcp_header::Ack
UINT32 Ack
Definition:
TCP_Header.h:95
ALL
Component 1
Part 2
TCP
TCP_Test.c
Generated on Fri Dec 9 2022 10:22:45 for NetSim Source Code Help by
1.9.5