NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
P2P.h
1#pragma once
2/************************************************************************************
3* Copyright (C) 2023 *
4* TETCOS, Bangalore. India *
5* *
6* Tetcos owns the intellectual property rights in the Product and its content. *
7* The copying, redistribution, reselling or publication of any or all of the *
8* Product or its content without express prior written consent of Tetcos is *
9* prohibited. Ownership and / or any other right relating to the software and all *
10* intellectual property rights therein shall remain at all times with Tetcos. *
11* *
12* This source code is licensed per the NetSim license agreement. *
13* *
14* No portion of this source code may be used as the basis for a derivative work, *
15* or used, for any purpose other than its intended use per the NetSim license *
16* agreement. *
17* *
18* This source code and the algorithms contained within it are confidential trade *
19* secrets of TETCOS and may not be used as the basis for any other software, *
20* hardware, product or service. *
21* *
22* Author: Shashi Kant Suman *
23* *
24* ----------------------------------------------------------------------------------*/
25#ifndef _NETSIM_P2P_H_
26#define _NETSIM_P2P_H_
27//For MSVC compiler. For GCC link via Linker command
28#pragma comment(lib,"Metrics.lib")
29#pragma comment(lib,"NetworkStack.lib")
30#pragma comment(lib,"Mobility.lib")
31#pragma comment(lib,"PropagationModel.lib")
32
33#include "List.h"
34#include "ErrorModel.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40 typedef struct stru_p2p_node_mac
41 {
42 bool isMacBusy;
43 }P2P_NODE_MAC, * ptrP2P_NODE_MAC;
44#define P2P_MAC(devid,ifid) ((ptrP2P_NODE_MAC)DEVICE_MACVAR(devid,ifid))
45#define P2P_MAC_SET_BUSY(d,in) (P2P_MAC(d,in)->isMacBusy = true)
46#define P2P_MAC_SET_IDLE(d,in) (P2P_MAC(d,in)->isMacBusy = false)
47#define P2P_MAC_IS_BUSY(d,in) (P2P_MAC(d,in)->isMacBusy)
48
49 /***** Default Config Parameter ****/
50#define P2P_CONNECTION_MEDIUM_DEFAULT _strdup("wired")
51#define P2P_BANDWIDTH_DEFAULT 20 //MHz
52#define P2P_CENTRAL_FREQUENCY_DEFAULT 30 //MHz
53#define P2P_TX_POWER_DEFAULT 20000 //in mW
54#define P2P_DATA_RATE_DEFAULT 10 //mbps
55#define P2P_RECEIVER_SENSITIVITY_DBM_DEFAULT -101 //dBm
56#define P2P_MODULATION_TECHNIQUE_DEFAULT _strdup("QPSK")
57#define P2P_ANTENNA_HEIGHT_DEFAULT 1
58#define P2P_ANTENNA_GAIN_DEFAULT 1
59#define P2P_D0_DEFAULT 1
60#define P2P_PL_D0_DEFAULT -30
61
62 typedef struct stru_P2P_NODE_PHY
63 {
64 bool iswireless;
65 double dBandwidth;
66 double dCenteralFrequency;
67 double dTXPower;
68 double dReceiverSensitivity;
69 PHY_MODULATION modulation;
70 double dDataRate;
71 double dAntennaHeight;
72 double dAntennaGain;
73 double d0;
74 double pld0;
75 }P2P_NODE_PHY, *ptrP2P_NODE_PHY;
76#define P2P_PHY(devid,ifid) ((ptrP2P_NODE_PHY)DEVICE_PHYVAR(devid,ifid))
77
78#define isP2PConfigured(d,i) (DEVICE_MACLAYER(d,i)->nMacProtocolId == MAC_PROTOCOL_P2P)
79#define isP2PWireless(d,i) (isP2PConfigured(d,i)?(P2P_PHY(d,i)?P2P_PHY(d,i)->iswireless:false):false)
80
81 PROPAGATION_HANDLE propagationHandle;
82
83#ifdef __cplusplus
84}
85#endif
86#endif /* _NETSIM_P2P_H_ */