NetSim Source Code Help
Loading...
Searching...
No Matches
MeshBSS.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 "IEEE802_11.h"
16#include "IEEE802_11_Phy.h"
17
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));
44 nConnectedDeviceCount*sizeof(NETSIM_ID));
45 return 0;
46}
47
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;
59 &in);
60}
61
63{
64 packet;
65 mac;
66 return true; //These information is taken care by routing protocol
67}
unsigned int NETSIM_ID
Definition: Animation.h:45
PIEEE802_11_MAC_VAR IEEE802_11_MAC(NETSIM_ID ndeviceId, NETSIM_ID nInterfaceId)
PIEEE802_11_PHY_VAR IEEE802_11_PHY(NETSIM_ID ndeviceId, NETSIM_ID nInterfaceId)
@ MESH
Definition: IEEE802_11.h:59
#define calloc(c, s)
Definition: Memory.h:29
int fn_NetSim_802_11_MeshBSS_Init(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId)
Definition: MeshBSS.c:18
void fn_NetSim_802_11_MeshBSS_UpdateReceiver(NetSim_PACKET *packet)
Definition: MeshBSS.c:48
bool isPacketforsameMeshBSS(PIEEE802_11_MAC_VAR mac, NetSim_PACKET *packet)
Definition: MeshBSS.c:62
bool isMulticastPacket(NetSim_PACKET *packet)
bool isBroadcastPacket(NetSim_PACKET *packet)
#define DEVICE_HWADDRESS(DeviceId, InterfaceId)
Definition: Stack.h:799
#define DEVICE_PHYLAYER(DeviceId, InterfaceId)
Definition: Stack.h:788
NETSIM_ID fn_NetSim_Stack_GetDeviceId_asIP(NETSIM_IPAddress ip, NETSIM_ID *nInterfaceId)
NETSIM_ID * devIdsinBSS
Definition: IEEE802_11.h:265
PNETSIM_MACADDRESS BSSId
Definition: IEEE802_11.h:261
NETSIM_ID nAPInterfaceId
Definition: IEEE802_11.h:263
IEEE802_11_BSS_TYPE BSSType
Definition: IEEE802_11.h:226
NETSIM_ID * devIfinBSS
Definition: IEEE802_11.h:266
NETSIM_IPAddress szNextHopIp
Definition: Packet.h:201
struct stru_NetSim_Packet_NetworkLayer * pstruNetworkData
Definition: Packet.h:275
NETSIM_ID nReceiverId
Definition: Packet.h:266