NetSim Source Code Help
v14.4
All 13 Components
Loading...
Searching...
No Matches
TCP_Test.c
1
/************************************************************************************
2
* Copyright (C) 2023 *
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
}
ALL
Component 1
Part 2
TCP
TCP_Test.c
Generated by
1.13.2