NetSim Source Code Help
Loading...
Searching...
No Matches
UDP.h
Go to the documentation of this file.
1/************************************************************************************
2* Copyright (C) 2021 *
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* This source code is licensed per the NetSim license agreement. *
12* *
13* No portion of this source code may be used as the basis for a derivative work, *
14* or used, for any purpose other than its intended use per the NetSim license *
15* agreement. *
16* *
17* This source code and the algorithms contained within it are confidential trade *
18* secrets of TETCOS and may not be used as the basis for any other software, *
19* hardware, product or service. *
20* *
21* Author: Shashi Kant Suman *
22* *
23* ----------------------------------------------------------------------------------*/
24
25/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
26 * *
27 * THIS FILES CONTAINS UDP DATASTUCTURE WHICH HAS VARIABLES THAT ARE PROVIDED FOR USERS.*
28 * *
29 * BY MAKING USE OF THESE VARIABLES THE USER CAN CREATE THEIR OWN PROJECT IN UDP *
30 * *
31 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
32
33#define _CRT_SECURE_NO_DEPRECATE
34#ifndef _UDP_H_
35#define _UDP_H_
36/// UDP Over heads in bytes
37#define TRANSPORT_UDP_OVERHEADS 8
38#define isUDPConfigured(d) (DEVICE_TRXLayer(d) && DEVICE_TRXLayer(d)->isUDP)
39
40/** Typedef declaration of structures */
43
44/** UDP Metrics - sepecific to NetSim */
46{
50 unsigned short int usnSourcePort;
51 unsigned short int usnDestinationPort;
55};
56
57/** User Datagram Header Format as per RFC 768 28 August 1980 */
59{
60 unsigned short int usnSourcePort;
61 unsigned short int usnDestinationPort;
62 unsigned short int usnLength;
63 unsigned short int usnChecksum;
64};
65
66
69
70/****************** NetWorkStack DLL functions declarations *****************************************/
71/** Function for configuring UDP parameters*/
72_declspec(dllexport) int fn_NetSim_UDP_Configure(void** var);
74/** Function for Intializing UDP protocol */
75_declspec (dllexport) int fn_NetSim_UDP_Init();
77/** Function to run UDP protocol */
78_declspec (dllexport) int fn_NetSim_UDP_Run();
79/// Function to free the UDP protocol variable and Unload the primitives
80_declspec(dllexport) int fn_NetSim_UDP_Finish();
82/// Return the subevent name with respect to the subevent number for writting event trace
83_declspec (dllexport) char *fn_NetSim_UDP_Trace(int nSubEvent);
84char *fn_NetSim_UDP_Trace_F(int nSubEvent);
85/// Function to free the allocated memory for the UDP packet
88/// Function to copy the UDP packet from source to destination
91/// Function to write UDP Metrics into Metrics.txt
92_declspec(dllexport) int fn_NetSim_UDP_Metrics(PMETRICSWRITER metricsWriter);
96
97#endif
unsigned int NETSIM_ID
Definition: Animation.h:45
#define _declspec(dllexport)
This function is used to trigger the update.
Definition: Linux.h:41
void * PMETRICSWRITER
Definition: MetricsWriter.h:27
int fn_NetSim_UDP_Check_ApplicationMetrics(NETSIM_ID, NETSIM_ID, NETSIM_ID, NETSIM_IPAddress, NETSIM_IPAddress, UDP_METRICS **)
int fn_NetSim_UDP_Create_ApplicationMetrics(NETSIM_ID, unsigned short, unsigned short, NETSIM_IPAddress, NETSIM_IPAddress, UDP_METRICS **)
int fn_NetSim_UDP_Send_User_Datagram()
int fn_NetSim_UDP_Metrics_F(PMETRICSWRITER metricsWriter)
int fn_NetSim_UDP_FreePacket_F(NetSim_PACKET *)
int fn_NetSim_UDP_Configure_F(void **var)
int fn_NetSim_UDP_Run()
Definition: UDP.c:32
int fn_NetSim_UDP_Init()
Definition: UDP.c:71
int fn_NetSim_UDP_Metrics(PMETRICSWRITER metricsWriter)
Function to write UDP Metrics into Metrics.txt.
Definition: UDP.c:126
int fn_NetSim_UDP_CopyPacket_F(NetSim_PACKET *, NetSim_PACKET *)
int fn_NetSim_UDP_FreePacket(NetSim_PACKET *)
Function to free the allocated memory for the UDP packet.
Definition: UDP.c:114
int fn_NetSim_UDP_CopyPacket(NetSim_PACKET *, NetSim_PACKET *)
Function to copy the UDP packet from source to destination.
Definition: UDP.c:121
char * fn_NetSim_UDP_Trace_F(int nSubEvent)
int fn_NetSim_UDP_Receive_User_Datagram()
int fn_NetSim_UDP_Finish()
Function to free the UDP protocol variable and Unload the primitives.
Definition: UDP.c:79
int fn_NetSim_UDP_Configure(void **var)
Definition: UDP.c:63
char * fn_NetSim_UDP_Trace(int nSubEvent)
Return the subevent name with respect to the subevent number for writting event trace.
Definition: UDP.c:109
int fn_NetSim_UDP_Init_F()
int fn_NetSim_UDP_Finish_F()
unsigned short int usnSourcePort
Definition: UDP.h:50
NETSIM_ID nDevice_ID
Definition: UDP.h:47
NETSIM_IPAddress szDestIP
Definition: UDP.h:49
NETSIM_IPAddress szSrcIP
Definition: UDP.h:48
int nDataGramsSent
Definition: UDP.h:52
struct stru_UDP_Metrics * pstruNextUPD_Metrics
Definition: UDP.h:54
int nDataGramsReceived
Definition: UDP.h:53
unsigned short int usnDestinationPort
Definition: UDP.h:51
unsigned short int usnSourcePort
Definition: UDP.h:60
unsigned short int usnLength
Definition: UDP.h:62
unsigned short int usnChecksum
Definition: UDP.h:63
unsigned short int usnDestinationPort
Definition: UDP.h:61