NetSim Source Code Help
Loading...
Searching...
No Matches
Cellular.h
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#ifndef _NETSIM_CELLULAR_H_
15#define _NETSIM_CELLULAR_H_
16#include "IP_Addressing.h"
17#include "GSM.h"
18#pragma comment(lib,"Mobility.lib")
19typedef struct stru_Cellular_VLR VLR;
30
31#define DATA_RATE 0.270 //mbps
32/// Enumeration for cellular channel types
33typedef enum
34{
39/// Enumeration for mobile station status
40typedef enum
41{
50/// Emumeration for cellular packetype
52{
65};
66#define CELLULAR_PACKET_TYPE(protocol,type) protocol*100+type
67/// Enumeration for cellular subevent
69{
72};
73#define CELLULAR_SUBEVENT(protocol,type) protocol*100+type
74/// Data structure for Visitor Location Register
76{
81};
82
83/**
84 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85 The BTS contains a channel list. It is channel list that are to be used by the
86 BTS & their associated MS. This channel list is static through out the simulation
87 and assigned by the FCA function.
88 The channel list is defined by following parameters:-
89 1. Channel Id
90 2. UpLink minimum frequency.
91 3. UpLink maximum frequency
92 4. Down link minimum frequency.
93 5. Down link maximum frequency
94 6. Time slot // This is time slot number between 0-7.
95 7. Allocation flag. // This is a flag stating that channel is free or not.
96 8. Next Channel.
97
98 NOTE:-
99 UpLink Maximum Frequency - UpLink Minimum Frequency = 200 kHz.
100 DownLink Maximum Frequency - DownLink Minimum Frequency = 200 kHz
101 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102*/
104{
107
108 /*** only for GSM ***/
114
115
117 ~~~~~~~~~~~~~~~~~~~~~~~
118 0 for unallocated
119 1 for allocated
120 ~~~~~~~~~~~~~~~~~~~~~~~
121 */
123 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
124 Id of MS for which this channel is allocated.
125 0 in case free channel.
126 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
127 */
129
131 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132 Application id for which this channel is allocated.
133 0 in case of free channel.
134 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
135 */
136
138 ~~~~~~~~~~~~~~~~~~~~~~
139 0 for RACH,pilot
140 1 for traffic channel.
141 ~~~~~~~~~~~~~~~~~~~~~~
142 */
143
144
146};
147/** Data structure for base station MAC layer */
149{
151 {
157 {
158 char* standard;
160 double dChipRate;
165 double dBTSRange;
168
169 /*Channel List*/
170 unsigned int nChannelCount;
171 unsigned int nAllocatedChannel;
172 unsigned int nFreeChannel;
173 unsigned int nRACHChannel;
174 unsigned int nTrafficChannel;
176};
177/** Data structure for Mobile switching centre */
179{
181 unsigned int nBTSCount;
182 unsigned int nMSCount;
186};
187/** Data structure for mobile station metrics */
189{
190 unsigned int nCallGenerated;
191 unsigned int nCallBlocked;
194 unsigned int nCallRequestSent;
196 unsigned int nCallAccepted;
197 unsigned int nCallRejected;
198 unsigned int nHandoverRequest;
200 unsigned int nCallDropeed;
201};
202/** Data structure for mobile station MAC layer */
204{
207
208 //For UGS Traffic
211 unsigned int nSourceFlag;
212
213 //BTS info
217
218 //Packet list
219 NetSim_PACKET**** pstruPacketList; //For each application,source,destination
221
222 //Handover info
226
227 //MS Metrics
229};
230/** Data structure for mobile station PHYSICAL layer */
232{
233 double dTxPower;
235};
236/** Data structure for base station PHYSICAL layer */
238{
239 double dTxPower;
241};
242/** Data structure for Channel request */
244{
245 unsigned int nRequestType;
249};
250/** Data structure for channel response */
252{
253 unsigned int nAllocationFlag;
255};
256/**
257Data structure for cellular packet
258*/
260{
261 unsigned int nTimeSlot;
262
264 //For fragmentation
265 unsigned int isLast;
266 unsigned int nId;
268
270};
272 unsigned int nPacketType,
273 NETSIM_ID nSourceId,
274 NETSIM_ID nDestinationId,
275 double dSize,
276 MAC_LAYER_PROTOCOL protocol);
277_declspec(dllexport) int fn_NetSim_FormCDMAChannel(NETSIM_ID nBTSId,Cellular_BS_MAC* BSMac,int nCDMA_ETA,int nCDMA_SIGMA,double dCDMA_DATARATE);
282int fn_NetSim_Cellular_MS_SendChannelRelease(Cellular_CHANNEL* channel,NETSIM_ID nMSId,NETSIM_ID nMSInterface,double time);
283int isCellularChannelAllocated(NETSIM_ID nMSId,NETSIM_ID nInterfaceId,NETSIM_ID nApplicationId);
289int fn_NetSim_Cellular_MS_SendChannelRelease(Cellular_CHANNEL* channel,NETSIM_ID nMSId,NETSIM_ID nMSInterface,double time);
298int fn_NetSim_Cellular_HandoverCall(NETSIM_ID nMSId,NETSIM_ID nMSInterface,double time);
304int fn_NetSim_Cellular_SendCallend(NETSIM_ID nMSID,NETSIM_ID nMSInterface,NETSIM_ID nDestinationId,double time);
307int fn_NetSim_Cellular_CopyPacket(NetSim_PACKET* pstruDestPacket,NetSim_PACKET* pstruSrcPacket);
308#endif
unsigned int NETSIM_ID
Definition: Animation.h:45
int fn_NetSim_Cellular_FormBurst(NetSim_PACKET *packet, Cellular_MS_MAC *MSMac)
Definition: Burst.c:22
int fn_NetSim_Cellular_AddPacketToBuffer(NetSim_PACKET *packet, NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId)
Definition: GSM.c:123
int fn_NetSim_Cellular_InitBTSList(NETSIM_ID nBTSId)
CELLULAR_CHANNEL_TYPE
Enumeration for cellular channel types.
Definition: Cellular.h:34
@ ChannelType_Pilot
Definition: Cellular.h:35
@ ChannelType_TRAFFICCHANNEL
Definition: Cellular.h:37
@ ChannelType_RACH
Definition: Cellular.h:36
NetSim_PACKET * fn_NetSim_Cellular_createPacket(double time, unsigned int nPacketType, NETSIM_ID nSourceId, NETSIM_ID nDestinationId, double dSize, MAC_LAYER_PROTOCOL protocol)
int fn_NetSim_Cellular_MoveMS(NETSIM_ID nDeviceId, NETSIM_ID nBTSId)
int fn_NetSim_Cellular_MS_ProcessCallRequest()
Definition: Cellular.c:506
int fn_NetSim_Cellular_Run()
Definition: Cellular.c:23
enum_cellular_subevent
Enumeration for cellular subevent.
Definition: Cellular.h:69
@ Subevent_DropCall
Definition: Cellular.h:70
@ Subevent_TxNextBurst
Definition: Cellular.h:71
int fn_NetSim_Cellular_HandoverCall(NETSIM_ID nMSId, NETSIM_ID nMSInterface, double time)
Definition: Handover.c:28
int fn_NetSim_Cellular_AllocateChannel(NetSim_EVENTDETAILS *pstruEventDetails, NetSim_PACKET *packet)
Definition: GSM.c:130
int fn_NetSim_Cellular_BS_AssignTimeSlot(NetSim_PACKET *packet, NETSIM_ID nBTSId)
Definition: Cellular.c:639
int fn_NetSim_Cellular_Msc_ProcessPacket()
Definition: Cellular.c:485
int fn_NetSim_Cellular_MS_PhyOut()
Definition: Cellular.c:718
int fn_NetSim_FormGSMChannel(DEVVAR_MSC *mscVar)
Definition: GSM_Channel.c:53
int fn_NetSim_Cellular_Metrics(PMETRICSWRITER metricsWriter)
int fn_NetSim_Cellular_BS_ReleaseChannel()
Definition: Cellular.c:697
int fn_NetSim_Cellular_TransmitOnwireline()
Definition: Cellular.c:434
int fn_NetSim_Cellular_allocateChannel(NetSim_PACKET *packet)
Definition: Cellular.c:233
int fn_NetSim_Cellular_MS_SendChannelRelease(Cellular_CHANNEL *channel, NETSIM_ID nMSId, NETSIM_ID nMSInterface, double time)
Definition: Cellular.c:666
int fn_NetSim_Cellular_ChannelResponseForHandover()
Definition: Handover.c:67
int fn_NetSim_Cellular_DropCall()
Definition: Handover.c:103
int fn_NetSim_Cellular_MS_ProcessCallResponse()
Definition: Cellular.c:570
int fn_NetSim_Cellular_FreePacket(NetSim_PACKET *packet)
int fn_NetSim_Cellular_InitVLRList(NETSIM_ID nMSId, NETSIM_ID nMSInterface)
int fn_NetSim_Cellular_CopyPacket(NetSim_PACKET *pstruDestPacket, NetSim_PACKET *pstruSrcPacket)
enum_cellular_packet_type
Emumeration for cellular packetype.
Definition: Cellular.h:52
@ PacketType_CallRejected
Definition: Cellular.h:59
@ PacketType_HandoverInfo
Definition: Cellular.h:63
@ PacketType_ChannelGranted
Definition: Cellular.h:55
@ PacketType_ChannelRequest
Definition: Cellular.h:53
@ PacketType_ChannelRelease
Definition: Cellular.h:60
@ PacketType_DropCall
Definition: Cellular.h:62
@ PacketType_ChannelRequestForIncoming
Definition: Cellular.h:57
@ PacketType_CallAccepted
Definition: Cellular.h:58
@ PacketType_ChannelRequestForHandover
Definition: Cellular.h:61
@ PacketType_CallEnd
Definition: Cellular.h:64
@ PacketType_ChannelUngranted
Definition: Cellular.h:56
@ PacketType_CallRequest
Definition: Cellular.h:54
int fn_NetSim_GSM_BS_PhyOut()
Definition: GSM.c:187
int fn_NetSim_Cellular_ChannelResponse(NetSim_PACKET *packet)
Definition: Cellular.c:288
int fn_NetSim_Cellular_SendCallend(NETSIM_ID nMSID, NETSIM_ID nMSInterface, NETSIM_ID nDestinationId, double time)
Definition: GSM.c:215
MS_STATUS
Enumeration for mobile station status.
Definition: Cellular.h:41
@ Status_ChannelRequestedForIncoming
Definition: Cellular.h:44
@ Status_IDLE
Definition: Cellular.h:42
@ Status_CallRequested
Definition: Cellular.h:46
@ Status_CallInProgress
Definition: Cellular.h:47
@ Status_ChannelRequestedForHandover
Definition: Cellular.h:45
@ Status_CallEnd
Definition: Cellular.h:48
@ Status_ChannelRequested
Definition: Cellular.h:43
int isCellularChannelAllocated(NETSIM_ID nMSId, NETSIM_ID nInterfaceId, NETSIM_ID nApplicationId)
Definition: GSM_Channel.c:129
int fn_NetSim_Cellular_MS_ReassembleBurst()
Definition: Burst.c:149
int fn_NetSim_FormCDMAChannel(NETSIM_ID nBTSId, Cellular_BS_MAC *BSMac, int nCDMA_ETA, int nCDMA_SIGMA, double dCDMA_DATARATE)
int fn_NetSim_Cellular_ForwardToMSC()
Definition: Cellular.c:423
#define _declspec(dllexport)
This function is used to trigger the update.
Definition: Linux.h:41
void * PMETRICSWRITER
Definition: MetricsWriter.h:27
EXPORTED struct stru_NetSim_EventDetails * pstruEventDetails
Definition: Stack.h:837
enum enum_MACProtocol MAC_LAYER_PROTOCOL
Definition: main.h:134
struct stru_Cellular_ChannelList * pstruChannelList
Definition: Cellular.h:175
struct stru_Cellular_BaseStation_Mac::stru_BS_GSM_Var GSMVar
unsigned int nTrafficChannel
Definition: Cellular.h:174
unsigned int nAllocatedChannel
Definition: Cellular.h:171
struct stru_Cellular_BaseStation_Mac::stru_BS_CDMA_Var CDMAVar
struct stru_Cellular_ChannelList * pstru_NextChannel
Definition: Cellular.h:145
CELLULAR_CHANNEL_TYPE nChannelType
Definition: Cellular.h:137
double dDownLinkMinimumFrequency
Definition: Cellular.h:111
unsigned int nAllocationFlag
Definition: Cellular.h:253
struct stru_Cellular_ChannelList * channel
Definition: Cellular.h:254
NETSIM_ID nApplicationId
Definition: Cellular.h:210
NetSim_PACKET **** pstruPacketList
Definition: Cellular.h:219
unsigned int nSourceFlag
Definition: Cellular.h:211
NETSIM_ID nBTSInterface
Definition: Cellular.h:215
NetSim_PACKET **** receivedPacketList
Definition: Cellular.h:220
NETSIM_ID nLinkId
Definition: Cellular.h:224
NETSIM_ID nBTSId
Definition: Cellular.h:214
Cellular_CHANNEL * pstruAllocatedChannel
Definition: Cellular.h:216
NETSIM_ID nNewBTS
Definition: Cellular.h:223
char * szMobilieNumber
Definition: Cellular.h:205
Cellular_MS_Metrics MSMetrics
Definition: Cellular.h:228
MS_STATUS nMSStatusFlag
Definition: Cellular.h:209
unsigned int nMSCount
Definition: Cellular.h:182
MSC_GSM * gsmVar
Definition: Cellular.h:185
unsigned int nBTSCount
Definition: Cellular.h:181
NETSIM_ID * BTSList
Definition: Cellular.h:183
unsigned int nId
Definition: Cellular.h:266
NetSim_PACKET * originalPacket
Definition: Cellular.h:267
NETSIM_ID nApplicationId
Definition: Cellular.h:263
unsigned int nTimeSlot
Definition: Cellular.h:261
unsigned int isLast
Definition: Cellular.h:265
Data structure for Visitor Location Register.
Definition: Cellular.h:76
NETSIM_ID nMSId
Definition: Cellular.h:77
NETSIM_ID nInterfaceId
Definition: Cellular.h:79
NETSIM_ID nBTSId
Definition: Cellular.h:78
NETSIM_IPAddress MSIP
Definition: Cellular.h:80
unsigned int nCallDropeed
Definition: Cellular.h:200
unsigned int nChannelRequestSent
Definition: Cellular.h:193
unsigned int nCallGenerated
Definition: Cellular.h:190
unsigned int nCallAccepted
Definition: Cellular.h:196
unsigned int nHandoverRequest
Definition: Cellular.h:198
unsigned int nCallRequestReceived
Definition: Cellular.h:195
unsigned int nCallBlocked
Definition: Cellular.h:191
unsigned int nCallRejected
Definition: Cellular.h:197
double dCallDroppingProbability
Definition: Cellular.h:199
double dCallBlockingProbability
Definition: Cellular.h:192
unsigned int nCallRequestSent
Definition: Cellular.h:194