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 
28 namespace ns3
29 {
30 
31 class Node;
32 class Address;
33 class Mac48Address;
34 
43 class SatIdMapper : public Object
44 {
45  public:
49  SatIdMapper();
50 
54  ~SatIdMapper();
55 
60  static TypeId GetTypeId(void);
61 
65  void DoDispose();
66 
67  /* ATTACH TO MAPS */
68 
75  uint32_t AttachMacToTraceId(Address mac);
76 
83  uint32_t AttachMacToUtId(Address mac);
84 
91  uint32_t AttachMacToUtUserId(Address mac);
92 
99  void AttachMacToSatId(Address mac, uint32_t satId);
100 
106  void AttachMacToBeamId(Address mac, uint32_t beamId);
107 
113  void AttachMacToGroupId(Address mac, uint32_t groupId);
114 
120  void AttachMacToGwId(Address mac, uint32_t gwId);
121 
128  uint32_t AttachMacToGwUserId(Address mac);
129 
135  void AttachMacToSatIdIsl(Mac48Address mac, uint32_t satId);
136 
141  void RemoveMacToSatIdIsl(Mac48Address mac);
142 
143  /* ID GETTERS */
144 
150  int32_t GetTraceIdWithMac(Address mac) const;
151 
157  int32_t GetUtIdWithMac(Address mac) const;
158 
164  int32_t GetUtUserIdWithMac(Address mac) const;
165 
171  int32_t GetSatIdWithMac(Address mac) const;
172 
178  int32_t GetBeamIdWithMac(Address mac) const;
179 
184  int32_t GetGroupIdWithMac(Address mac) const;
185 
191  int32_t GetGwIdWithMac(Address mac) const;
192 
198  int32_t GetGwUserIdWithMac(Address mac) const;
199 
205  int32_t GetSatIdWithMacIsl(Mac48Address mac) const;
206 
207  /* NODE GETTERS */
208 
214  Address GetGwMacWithNode(Ptr<Node> gwNode) const;
215 
221  Address GetSatMacWithNode(Ptr<Node> satNode) const;
222 
228  Address GetUtMacWithNode(Ptr<Node> utNode) const;
229 
235  Address GetUtUserMacWithNode(Ptr<Node> utUserNode) const;
236 
237  /* PRINT RELATED METHODS */
238 
242  void PrintTraceMap() const;
243 
249  std::string GetMacInfo(Address mac) const;
250 
254  void Reset();
255 
259  void ShowIslMap();
260 
264  void EnableMapPrint(bool enableMapPrint)
265  {
266  m_enableMapPrint = enableMapPrint;
267  }
268 
269  private:
273  uint32_t m_traceIdIndex;
274 
278  uint32_t m_utIdIndex;
279 
283  uint32_t m_utUserIdIndex;
284 
288  uint32_t m_gwUserIdIndex;
289 
293  std::map<Address, uint32_t> m_macToTraceIdMap;
294 
298  std::map<Address, uint32_t> m_macToUtIdMap;
299 
303  std::map<Address, uint32_t> m_macToUtUserIdMap;
304 
308  std::map<Address, uint32_t> m_macToSatIdMap;
309 
313  std::map<Address, uint32_t> m_macToBeamIdMap;
314 
318  std::map<Address, uint32_t> m_macToGroupIdMap;
319 
323  std::map<Address, uint32_t> m_macToGwIdMap;
324 
328  std::map<Address, uint32_t> m_macToGwUserIdMap;
329 
334 
338  std::map<Mac48Address, uint32_t> m_macToSatIdIslMap;
339 };
340 
341 } // namespace ns3
342 
343 #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.
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.
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.
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.