A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
cid-factory.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007,2008,2009 INRIA, UDcast
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
18 * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
19 * <amine.ismail@UDcast.com>
20 */
21
22#ifndef CONNECTION_IDENTIFIER_FACTORY_H
23#define CONNECTION_IDENTIFIER_FACTORY_H
24
25#include "cid.h"
26
27#include <stdint.h>
28
29namespace ns3
30{
31
32/**
33 * \ingroup wimax
34 * This class is used exclusively by the BS to allocate CIDs to new connections.
35 * This class uses the definitions from Table 345 in ieee-802.16-2004 to
36 * allocate cids in different integer ranges according to their type.
37 * The relative allocation of the ranges is controlled by the parameter 'm'
38 * introduced in the above-mentioned table.
39 *
40 * Note: The current implementation merely allocates cids sequentially from
41 * the start of the allowed range. A proper implementation would be able
42 * to recycle cids from previous dead connections and should instead look
43 * at a bitmap of free cids. Some other day :)
44 */
46{
47 public:
48 /**
49 * Create a cid factory with a default value for m of 0x5500.
50 */
51 CidFactory();
52 /**
53 * \brief This function returns the next basic CID.
54 * \returns the next basic CID.
55 */
57 /**
58 * \brief This function returns the next primary basic CID.
59 * \returns the next primary CID.
60 */
62 /**
63 * \brief This function returns the next Transport (or Secondary) CID.
64 * \returns the next Transport (or Secondary) CID.
65 */
67 /**
68 * \brief This function returns the next Multicast CID.
69 * \returns the next Multicast CID.
70 */
72 /**
73 * \brief This function returns the next CID for the specified type.
74 * \param type CID type
75 * \returns the next CID.
76 */
78
79 /**
80 * \brief This function determines if the CID is a transport.
81 * \param cid CID type
82 * \returns true if the CID is a transport.
83 */
84 bool IsTransport(Cid cid) const;
85 /**
86 * \brief This function determines if the CID is primary.
87 * \param cid CID type
88 * \returns true if the CID is primary.
89 */
90 bool IsPrimary(Cid cid) const;
91 /**
92 * \brief This function determines if the CID is basic.
93 * \param cid CID type
94 * \returns true if the CID is basic.
95 */
96 bool IsBasic(Cid cid) const;
97
98 /**
99 * Notify the factory that the connection associated to this
100 * cid has been killed and that this cid can be reused.
101 * \param cid CID type
102 */
103 void FreeCid(Cid cid);
104
105 private:
106 uint16_t m_m; ///< m
107
108 uint16_t m_basicIdentifier; ///< basic identifier
109 uint16_t m_primaryIdentifier; ///< primary identifier
110 uint16_t m_transportOrSecondaryIdentifier; ///< transport or secondary identifier
111 uint16_t m_multicastPollingIdentifier; ///< multicast polling identifier
112};
113
114} // namespace ns3
115
116#endif /* CONNECTION_IDENTIFIER_FACTORY_H */
This class is used exclusively by the BS to allocate CIDs to new connections.
Definition: cid-factory.h:46
uint16_t m_m
m
Definition: cid-factory.h:106
Cid Allocate(Cid::Type type)
This function returns the next CID for the specified type.
Definition: cid-factory.cc:74
uint16_t m_basicIdentifier
basic identifier
Definition: cid-factory.h:108
bool IsBasic(Cid cid) const
This function determines if the CID is basic.
Definition: cid-factory.cc:113
uint16_t m_transportOrSecondaryIdentifier
transport or secondary identifier
Definition: cid-factory.h:110
Cid AllocatePrimary()
This function returns the next primary basic CID.
Definition: cid-factory.cc:50
Cid AllocateTransportOrSecondary()
This function returns the next Transport (or Secondary) CID.
Definition: cid-factory.cc:58
uint16_t m_multicastPollingIdentifier
multicast polling identifier
Definition: cid-factory.h:111
bool IsPrimary(Cid cid) const
This function determines if the CID is primary.
Definition: cid-factory.cc:106
Cid AllocateBasic()
This function returns the next basic CID.
Definition: cid-factory.cc:42
bool IsTransport(Cid cid) const
This function determines if the CID is a transport.
Definition: cid-factory.cc:99
uint16_t m_primaryIdentifier
primary identifier
Definition: cid-factory.h:109
Cid AllocateMulticast()
This function returns the next Multicast CID.
Definition: cid-factory.cc:66
CidFactory()
Create a cid factory with a default value for m of 0x5500.
Definition: cid-factory.cc:31
void FreeCid(Cid cid)
Notify the factory that the connection associated to this cid has been killed and that this cid can b...
Definition: cid-factory.cc:120
Cid class.
Definition: cid.h:37
Type
Type enumeration.
Definition: cid.h:41
Every class exported by the ns3 library is enclosed in the ns3 namespace.