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
24{
25#ifdef _TEST_TCP_
26 double d = NETSIM_RAND_01();
27 static int c = 0;
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}
#define c
EXPORTED struct stru_NetSim_EventDetails * pstruEventDetails
Definition: Stack.h:837
#define NETSIM_RAND_01()
Definition: Stack.h:860
static PTCP_SEGMENT_HDR TCP_GET_SEGMENT_HDR(NetSim_PACKET *packet)
Definition: TCP_Header.h:107
bool pass_test()
Definition: TCP_Test.c:23
struct stru_NetSim_Packet * pPacket
Definition: Stack.h:754