A Discrete-Event Network Simulator
API
cid.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 CID_H
23 #define CID_H
24 
25 #include <ostream>
26 #include <stdint.h>
27 
28 namespace ns3
29 {
30 
36 class Cid
37 {
38  public:
40  enum Type
41  {
42  BROADCAST = 1,
48  PADDING
49  };
50 
52  Cid();
58  Cid(uint16_t cid);
59  ~Cid();
63  uint16_t GetIdentifier() const;
67  bool IsMulticast() const;
71  bool IsBroadcast() const;
75  bool IsPadding() const;
79  bool IsInitialRanging() const;
83  static Cid Broadcast();
87  static Cid Padding();
91  static Cid InitialRanging();
92 
93  private:
95  friend class CidFactory;
97  friend bool operator==(const Cid& lhs, const Cid& rhs);
98  uint16_t m_identifier;
99 };
100 
101 bool operator==(const Cid& lhs, const Cid& rhs);
102 bool operator!=(const Cid& lhs, const Cid& rhs);
103 
104 std::ostream& operator<<(std::ostream& os, const Cid& cid);
105 
106 } // namespace ns3
107 
108 #endif /* CID_H */
This class is used exclusively by the BS to allocate CIDs to new connections.
Definition: cid-factory.h:46
Cid class.
Definition: cid.h:37
Type
Type enumeration.
Definition: cid.h:41
@ PRIMARY
Definition: cid.h:45
@ BROADCAST
Definition: cid.h:42
@ TRANSPORT
Definition: cid.h:46
@ MULTICAST
Definition: cid.h:47
@ BASIC
Definition: cid.h:44
@ PADDING
Definition: cid.h:48
@ INITIAL_RANGING
Definition: cid.h:43
uint16_t GetIdentifier() const
Definition: cid.cc:45
bool IsInitialRanging() const
Definition: cid.cc:69
~Cid()
Definition: cid.cc:40
Cid()
Create a cid of unknown type.
Definition: cid.cc:30
static Cid InitialRanging()
Definition: cid.cc:87
bool IsPadding() const
Definition: cid.cc:63
static Cid Padding()
Definition: cid.cc:81
friend bool operator==(const Cid &lhs, const Cid &rhs)
equality operator
Definition: cid.cc:99
bool IsMulticast() const
Definition: cid.cc:51
bool IsBroadcast() const
Definition: cid.cc:57
static Cid Broadcast()
Definition: cid.cc:75
uint16_t m_identifier
identiifier
Definition: cid.h:98
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool operator!=(Callback< R, Args... > a, Callback< R, Args... > b)
Inequality test.
Definition: callback.h:678
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.h:157
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159