A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
cid.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007,2008,2009 INRIA, UDcast
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Authors: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
7
* Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
8
* <amine.ismail@UDcast.com>
9
*/
10
11
#include "
cid.h
"
12
13
// 0 will match IR CID, -1 will match broadcast CID 0xFFFF, hence 60000
14
#define CID_UNINITIALIZED 60000
15
16
namespace
ns3
17
{
18
19
Cid::Cid
()
20
{
21
m_identifier
=
CID_UNINITIALIZED
;
22
}
23
24
Cid::Cid
(uint16_t identifier)
25
{
26
m_identifier
= identifier;
27
}
28
29
Cid::~Cid
()
30
{
31
}
32
33
uint16_t
34
Cid::GetIdentifier
()
const
35
{
36
return
m_identifier
;
37
}
38
39
bool
40
Cid::IsMulticast
()
const
41
{
42
return
m_identifier
>= 0xff00 &&
m_identifier
<= 0xfffd;
43
}
44
45
bool
46
Cid::IsBroadcast
()
const
47
{
48
return
*
this
==
Broadcast
();
49
}
50
51
bool
52
Cid::IsPadding
()
const
53
{
54
return
*
this
==
Padding
();
55
}
56
57
bool
58
Cid::IsInitialRanging
()
const
59
{
60
return
*
this
==
InitialRanging
();
61
}
62
63
Cid
64
Cid::Broadcast
()
65
{
66
return
0xffff;
67
}
68
69
Cid
70
Cid::Padding
()
71
{
72
return
0xfffe;
73
}
74
75
Cid
76
Cid::InitialRanging
()
77
{
78
return
0;
79
}
80
81
/**
82
* \brief equality operator
83
* \param lhs left hand side
84
* \param rhs right hand side
85
* \returns true if equal
86
*/
87
bool
88
operator==
(
const
Cid
& lhs,
const
Cid
& rhs)
89
{
90
return
lhs.
m_identifier
== rhs.
m_identifier
;
91
}
92
93
/**
94
* \brief inequality operator
95
* \param lhs left hand side
96
* \param rhs right hand side
97
* \returns true if not equal
98
*/
99
bool
100
operator!=
(
const
Cid
& lhs,
const
Cid
& rhs)
101
{
102
return
!(lhs == rhs);
103
}
104
105
/**
106
* \brief output stream output operator
107
* \param os output stream
108
* \param cid CID
109
* \returns output stream
110
*/
111
std::ostream&
112
operator<<
(std::ostream& os,
const
Cid
& cid)
113
{
114
os << cid.
GetIdentifier
();
115
return
os;
116
}
117
118
}
// namespace ns3
CID_UNINITIALIZED
#define CID_UNINITIALIZED
Definition
cid.cc:14
cid.h
ns3::Cid
Cid class.
Definition
cid.h:26
ns3::Cid::GetIdentifier
uint16_t GetIdentifier() const
Definition
cid.cc:34
ns3::Cid::IsInitialRanging
bool IsInitialRanging() const
Definition
cid.cc:58
ns3::Cid::~Cid
~Cid()
Definition
cid.cc:29
ns3::Cid::Cid
Cid()
Create a cid of unknown type.
Definition
cid.cc:19
ns3::Cid::InitialRanging
static Cid InitialRanging()
Definition
cid.cc:76
ns3::Cid::IsPadding
bool IsPadding() const
Definition
cid.cc:52
ns3::Cid::Padding
static Cid Padding()
Definition
cid.cc:70
ns3::Cid::IsMulticast
bool IsMulticast() const
Definition
cid.cc:40
ns3::Cid::IsBroadcast
bool IsBroadcast() const
Definition
cid.cc:46
ns3::Cid::Broadcast
static Cid Broadcast()
Definition
cid.cc:64
ns3::Cid::m_identifier
uint16_t m_identifier
identiifier
Definition
cid.h:87
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::operator!=
bool operator!=(Callback< R, Args... > a, Callback< R, Args... > b)
Inequality test.
Definition
callback.h:658
ns3::operator==
bool operator==(const EventId &a, const EventId &b)
Definition
event-id.h:155
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition
angles.cc:148
src
wimax
model
cid.cc
Generated on Fri Nov 8 2024 13:59:09 for ns-3 by
1.11.0