NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
MeshBSS.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 "IEEE802_11.h"
16#include "IEEE802_11_Phy.h"
17
18int fn_NetSim_802_11_MeshBSS_Init(NETSIM_ID nDeviceId,NETSIM_ID nInterfaceId)
19{
20 int nConnectedDeviceCount;
21 NETSIM_ID nDevId, nIntefId;
22 PIEEE802_11_MAC_VAR mac=IEEE802_11_MAC(nDeviceId,nInterfaceId);
23 PIEEE802_11_PHY_VAR phy=IEEE802_11_PHY(nDeviceId,nInterfaceId);
24 phy; //for debug
25
26 NetSim_LINKS* pstruLink;
27 pstruLink = DEVICE_PHYLAYER(nDeviceId,nInterfaceId)->pstruNetSimLinks;
28 nDevId=pstruLink->puniDevList.pstruMP2MP.anDevIds[0];
29 nIntefId=pstruLink->puniDevList.pstruMP2MP.anDevInterfaceIds[0];
30
31 nConnectedDeviceCount = pstruLink->puniDevList.pstruMP2MP.nConnectedDeviceCount;
32
33 mac->BSSType=MESH;
34 mac->BSSId= DEVICE_HWADDRESS(nDevId,nIntefId);
35 mac->nBSSId = nDevId;
36 mac->nAPInterfaceId= nIntefId;
37 mac->devIdsinBSS=(NETSIM_ID*)calloc(nConnectedDeviceCount,sizeof* mac->devIdsinBSS);
38 mac->devIfinBSS=(NETSIM_ID*)calloc(nConnectedDeviceCount,sizeof* mac->devIfinBSS);
39 mac->devIdsinBSS[0]=nDevId;
40 mac->devIfinBSS[0]=nIntefId;
41 memcpy(mac->devIdsinBSS,pstruLink->puniDevList.pstruMP2MP.anDevIds,
42 nConnectedDeviceCount*sizeof(NETSIM_ID));
43 memcpy(mac->devIfinBSS,pstruLink->puniDevList.pstruMP2MP.anDevInterfaceIds,
44 nConnectedDeviceCount*sizeof(NETSIM_ID));
45 return 0;
46}
47
48void fn_NetSim_802_11_MeshBSS_UpdateReceiver(NetSim_PACKET* packet)
49{
50 if (isBroadcastPacket(packet))
51 return;
52 if (isMulticastPacket(packet))
53 return;
54 if(packet->nReceiverId)
55 return; //These information is updated by routing protocol
56
57 NETSIM_ID in;
58 packet->nReceiverId = fn_NetSim_Stack_GetDeviceId_asIP(packet->pstruNetworkData->szNextHopIp,
59 &in);
60}
61
62bool isPacketforsameMeshBSS(PIEEE802_11_MAC_VAR mac,NetSim_PACKET* packet)
63{
64 packet;
65 mac;
66 return true; //These information is taken care by routing protocol
67}