satellite-id-mapper.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Magister Solutions Ltd.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Frans Laakso <frans.laakso@magister.fi>
19  */
20 #ifndef SATELLITE_ID_MAPPER_H
21 #define SATELLITE_ID_MAPPER_H
22 
23 #include <ns3/mac48-address.h>
24 #include <ns3/object.h>
25 
26 #include <map>
27 #include <stdint.h>
28 #include <string>
29 
30 namespace ns3
31 {
32 
33 class Node;
34 class Address;
35 class Mac48Address;
36 
45 class SatIdMapper : public Object
46 {
47  public:
51  SatIdMapper();
52 
56  ~SatIdMapper();
57 
62  static TypeId GetTypeId(void);
63 
67  void DoDispose();
68 
69  /* ATTACH TO MAPS */
70 
77  uint32_t AttachMacToTraceId(Address mac);
78 
85  uint32_t AttachMacToUtId(Address mac);
86 
93  uint32_t AttachMacToUtUserId(Address mac);
94 
101  void AttachMacToSatId(Address mac, uint32_t satId);
102 
108  void AttachMacToBeamId(Address mac, uint32_t beamId);
109 
115  void AttachMacToGroupId(Address mac, uint32_t groupId);
116 
122  void AttachMacToGwId(Address mac, uint32_t gwId);
123 
130  uint32_t AttachMacToGwUserId(Address mac);
131 
137  void AttachMacToSatIdIsl(Mac48Address mac, uint32_t satId);
138 
143  void RemoveMacToSatIdIsl(Mac48Address mac);
144 
150  void UpdateMacToSatId(Address mac, uint32_t satId);
151 
157  void UpdateMacToBeamId(Address mac, uint32_t beamId);
158 
159  /* ID GETTERS */
160 
166  int32_t GetTraceIdWithMac(Address mac) const;
167 
173  int32_t GetUtIdWithMac(Address mac) const;
174 
180  int32_t GetUtUserIdWithMac(Address mac) const;
181 
187  int32_t GetSatIdWithMac(Address mac) const;
188 
194  int32_t GetBeamIdWithMac(Address mac) const;
195 
200  int32_t GetGroupIdWithMac(Address mac) const;
201 
207  int32_t GetGwIdWithMac(Address mac) const;
208 
214  int32_t GetGwUserIdWithMac(Address mac) const;
215 
221  int32_t GetSatIdWithMacIsl(Mac48Address mac) const;
222 
223  /* NODE GETTERS */
224 
230  Address GetGwMacWithNode(Ptr<Node> gwNode) const;
231 
237  Address GetSatMacWithNode(Ptr<Node> satNode) const;
238 
244  Address GetUtMacWithNode(Ptr<Node> utNode) const;
245 
251  Address GetUtUserMacWithNode(Ptr<Node> utUserNode) const;
252 
253  /* PRINT RELATED METHODS */
254 
258  void PrintTraceMap() const;
259 
265  std::string GetMacInfo(Address mac) const;
266 
270  void Reset();
271 
275  void ShowIslMap();
276 
280  void EnableMapPrint(bool enableMapPrint)
281  {
282  m_enableMapPrint = enableMapPrint;
283  }
284 
285  private:
289  uint32_t m_traceIdIndex;
290 
294  uint32_t m_utIdIndex;
295 
299  uint32_t m_utUserIdIndex;
300 
304  uint32_t m_gwUserIdIndex;
305 
309  std::map<Address, uint32_t> m_macToTraceIdMap;
310 
314  std::map<Address, uint32_t> m_macToUtIdMap;
315 
319  std::map<Address, uint32_t> m_macToUtUserIdMap;
320 
324  std::map<Address, uint32_t> m_macToSatIdMap;
325 
329  std::map<Address, uint32_t> m_macToBeamIdMap;
330 
334  std::map<Address, uint32_t> m_macToGroupIdMap;
335 
339  std::map<Address, uint32_t> m_macToGwIdMap;
340 
344  std::map<Address, uint32_t> m_macToGwUserIdMap;
345 
349  std::map<Ptr<Node>, Address> m_utNodeToGwAddressMap;
350 
355 
359  std::map<Mac48Address, uint32_t> m_macToSatIdIslMap;
360 };
361 
362 } // namespace ns3
363 
364 #endif /* SATELLITE_ID_MAPPER_H */
Class for ID-mapper.
void Reset()
Function for resetting the variables.
int32_t GetTraceIdWithMac(Address mac) const
Function for getting the trace ID with MAC.
std::map< Mac48Address, uint32_t > m_macToSatIdIslMap
Map for GW/UT MAC to associated SAT ID conversion.
~SatIdMapper()
Destructor.
int32_t GetBeamIdWithMac(Address mac) const
Function for getting the beam ID with MAC.
void UpdateMacToSatId(Address mac, uint32_t satId)
Update MAC address to the SAT ID maps.
std::map< Address, uint32_t > m_macToGroupIdMap
Map for MAC to group ID conversion.
uint32_t m_utUserIdIndex
Running UT user index number.
SatIdMapper()
Constructor.
int32_t GetUtUserIdWithMac(Address mac) const
Function for getting the UT user ID with MAC.
bool m_enableMapPrint
Is map printing enabled or not.
int32_t GetSatIdWithMac(Address mac) const
Function for getting the SAT ID with MAC.
uint32_t AttachMacToTraceId(Address mac)
Attach MAC address to the Trace ID maps and give it a running trace ID (starting from 1)
uint32_t AttachMacToGwUserId(Address mac)
Attach MAC address to the GW user ID maps and give it a running GW user ID (starting from 1)
std::map< Address, uint32_t > m_macToSatIdMap
Map for MAC to SAT ID conversion.
void PrintTraceMap() const
Function for printing out the trace map.
void EnableMapPrint(bool enableMapPrint)
Function for enabling the map prints.
void ShowIslMap()
Print the map GW/UT address to satellite ID.
std::string GetMacInfo(Address mac) const
Function for getting the IDs related to a MAC address in an info string.
Address GetSatMacWithNode(Ptr< Node > satNode) const
uint32_t AttachMacToUtUserId(Address mac)
Attach MAC address to the UT user ID maps and give it a running UT user ID (starting from 1)
std::map< Address, uint32_t > m_macToBeamIdMap
Map for MAC to beam ID conversion.
std::map< Address, uint32_t > m_macToUtUserIdMap
Map for MAC to UT user ID conversion.
uint32_t m_utIdIndex
Running UT index number.
uint32_t m_traceIdIndex
Running trace index number.
void AttachMacToGwId(Address mac, uint32_t gwId)
Attach MAC address to the GW ID maps.
void RemoveMacToSatIdIsl(Mac48Address mac)
Remove GW/UT MAC address to the satellite this node is connected.
uint32_t m_gwUserIdIndex
Running GW user index number.
std::map< Address, uint32_t > m_macToTraceIdMap
Map for MAC to trace ID conversion.
int32_t GetGwIdWithMac(Address mac) const
Function for getting the GW ID with MAC.
std::map< Address, uint32_t > m_macToGwUserIdMap
Map for MAC to GW user ID conversion.
void AttachMacToBeamId(Address mac, uint32_t beamId)
Attach MAC address to the beam ID maps.
void AttachMacToSatId(Address mac, uint32_t satId)
Attach MAC address to the SAT ID maps and give it a running SAT ID (starting from 1)
static TypeId GetTypeId(void)
NS-3 type id function.
std::map< Ptr< Node >, Address > m_utNodeToGwAddressMap
Map between UT nodes and GW address.
void DoDispose()
Do needed dispose actions.
std::map< Address, uint32_t > m_macToUtIdMap
Map for MAC to UT ID conversion.
int32_t GetSatIdWithMacIsl(Mac48Address mac) const
Function for getting the satellite ID connected to a GW/UT MAC address.
int32_t GetUtIdWithMac(Address mac) const
Function for getting the UT ID with MAC.
void UpdateMacToBeamId(Address mac, uint32_t beamId)
Update MAC address to the beam ID maps.
Address GetGwMacWithNode(Ptr< Node > gwNode) const
void AttachMacToSatIdIsl(Mac48Address mac, uint32_t satId)
Attach GW/UT MAC address to the satellite this node is connected.
std::map< Address, uint32_t > m_macToGwIdMap
Map for MAC to GW ID conversion.
uint32_t AttachMacToUtId(Address mac)
Attach MAC address to the UT ID maps and give it a running UT ID (starting from 1)
void AttachMacToGroupId(Address mac, uint32_t groupId)
Attach MAC address to the group ID maps.
int32_t GetGwUserIdWithMac(Address mac) const
Function for getting the GW user ID with MAC.
Address GetUtMacWithNode(Ptr< Node > utNode) const
Address GetUtUserMacWithNode(Ptr< Node > utUserNode) const
int32_t GetGroupIdWithMac(Address mac) const
Function for getting the group ID with MAC.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.