A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
mac64-address.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007 INRIA
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
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
*/
19
#ifndef MAC64_ADDRESS_H
20
#define MAC64_ADDRESS_H
21
22
#include "
ipv4-address.h
"
23
#include "
ipv6-address.h
"
24
25
#include "ns3/attribute-helper.h"
26
#include "ns3/attribute.h"
27
28
#include <ostream>
29
#include <stdint.h>
30
31
namespace
ns3
32
{
33
34
class
Address;
35
45
class
Mac64Address
46
{
47
public
:
48
Mac64Address
() =
default
;
54
Mac64Address
(
const
char
* str);
55
61
Mac64Address
(uint64_t addr);
62
68
void
CopyFrom
(
const
uint8_t buffer[8]);
74
void
CopyTo
(uint8_t buffer[8])
const
;
80
operator
Address
()
const
;
89
static
Mac64Address
ConvertFrom
(
const
Address
&
address
);
95
Address
ConvertTo
()
const
;
96
102
uint64_t
ConvertToInt
()
const
;
103
108
static
bool
IsMatchingType
(
const
Address
&
address
);
113
static
Mac64Address
Allocate
();
114
128
static
void
ResetAllocationIndex
();
129
130
private
:
135
static
uint8_t
GetType
();
136
144
friend
bool
operator==
(
const
Mac64Address
& a,
const
Mac64Address
& b);
145
153
friend
bool
operator!=
(
const
Mac64Address
& a,
const
Mac64Address
& b);
154
162
friend
bool
operator<
(
const
Mac64Address
& a,
const
Mac64Address
& b);
163
171
friend
std::ostream&
operator<<
(std::ostream& os,
const
Mac64Address
&
address
);
172
180
friend
std::istream&
operator>>
(std::istream& is,
Mac64Address
&
address
);
181
182
static
uint64_t
m_allocationIndex
;
183
uint8_t
m_address
[8]{0};
184
};
185
191
ATTRIBUTE_HELPER_HEADER
(
Mac64Address
);
192
193
inline
bool
194
operator==
(
const
Mac64Address
& a,
const
Mac64Address
& b)
195
{
196
return
memcmp(a.
m_address
, b.
m_address
, 8) == 0;
197
}
198
199
inline
bool
200
operator!=
(
const
Mac64Address
& a,
const
Mac64Address
& b)
201
{
202
return
memcmp(a.
m_address
, b.
m_address
, 8) != 0;
203
}
204
205
inline
bool
206
operator<
(
const
Mac64Address
& a,
const
Mac64Address
& b)
207
{
208
return
memcmp(a.
m_address
, b.
m_address
, 8) < 0;
209
}
210
211
std::ostream&
operator<<
(std::ostream& os,
const
Mac64Address
&
address
);
212
std::istream&
operator>>
(std::istream& is,
Mac64Address
&
address
);
213
214
}
// namespace ns3
215
216
#endif
/* MAC64_ADDRESS_H */
ns3::Address
a polymophic address class
Definition:
address.h:101
ns3::Mac64Address
an EUI-64 address
Definition:
mac64-address.h:46
ns3::Mac64Address::m_address
uint8_t m_address[8]
Address value.
Definition:
mac64-address.h:183
ns3::Mac64Address::operator>>
friend std::istream & operator>>(std::istream &is, Mac64Address &address)
Stream extraction operator.
Definition:
mac64-address.cc:194
ns3::Mac64Address::ConvertTo
Address ConvertTo() const
Definition:
mac64-address.cc:113
ns3::Mac64Address::ConvertToInt
uint64_t ConvertToInt() const
Definition:
mac64-address.cc:120
ns3::Mac64Address::IsMatchingType
static bool IsMatchingType(const Address &address)
Definition:
mac64-address.cc:91
ns3::Mac64Address::Allocate
static Mac64Address Allocate()
Allocate a new Mac64Address.
Definition:
mac64-address.cc:137
ns3::Mac64Address::CopyFrom
void CopyFrom(const uint8_t buffer[8])
Definition:
mac64-address.cc:77
ns3::Mac64Address::operator!=
friend bool operator!=(const Mac64Address &a, const Mac64Address &b)
Not equal to operator.
Definition:
mac64-address.h:200
ns3::Mac64Address::operator==
friend bool operator==(const Mac64Address &a, const Mac64Address &b)
Equal to operator.
Definition:
mac64-address.h:194
ns3::Mac64Address::operator<<
friend std::ostream & operator<<(std::ostream &os, const Mac64Address &address)
Stream insertion operator.
Definition:
mac64-address.cc:175
ns3::Mac64Address::CopyTo
void CopyTo(uint8_t buffer[8]) const
Definition:
mac64-address.cc:84
ns3::Mac64Address::ConvertFrom
static Mac64Address ConvertFrom(const Address &address)
Definition:
mac64-address.cc:103
ns3::Mac64Address::ResetAllocationIndex
static void ResetAllocationIndex()
Reset the Mac64Address allocation index.
Definition:
mac64-address.cc:160
ns3::Mac64Address::GetType
static uint8_t GetType()
Return the Type of address.
Definition:
mac64-address.cc:167
ns3::Mac64Address::Mac64Address
Mac64Address()=default
ns3::Mac64Address::operator<
friend bool operator<(const Mac64Address &a, const Mac64Address &b)
Less than operator.
Definition:
mac64-address.h:206
ns3::Mac64Address::m_allocationIndex
static uint64_t m_allocationIndex
Address allocation index.
Definition:
mac64-address.h:182
ipv4-address.h
ipv6-address.h
first.address
address
Definition:
first.py:47
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:678
ns3::operator==
bool operator==(const EventId &a, const EventId &b)
Definition:
event-id.h:157
ns3::ATTRIBUTE_HELPER_HEADER
ATTRIBUTE_HELPER_HEADER(ValueClassTest)
ns3::operator<
bool operator<(const EventId &a, const EventId &b)
Definition:
event-id.h:170
ns3::operator>>
std::istream & operator>>(std::istream &is, Angles &a)
Definition:
angles.cc:183
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition:
angles.cc:159
src
network
utils
mac64-address.h
Generated on Sun Mar 3 2024 17:11:06 for ns-3 by
1.9.1