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
packet-socket-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 PACKET_SOCKET_ADDRESS_H
20
#define PACKET_SOCKET_ADDRESS_H
21
22
#include "
mac48-address.h
"
23
#include "
mac64-address.h
"
24
25
#include "ns3/address.h"
26
#include "ns3/net-device.h"
27
#include "ns3/ptr.h"
28
29
namespace
ns3
30
{
31
32
class
NetDevice;
33
34
/**
35
* \ingroup address
36
*
37
* \brief an address for a packet socket
38
*/
39
class
PacketSocketAddress
40
{
41
public
:
42
PacketSocketAddress
();
43
44
/**
45
* \brief Set the protocol
46
* \param protocol the protocol
47
*/
48
void
SetProtocol
(uint16_t protocol);
49
50
/**
51
* \brief Set the address to match all the outgoing NetDevice
52
*/
53
void
SetAllDevices
();
54
55
/**
56
* \brief Set the address to match only a specified NetDevice
57
* \param device the NetDevice index
58
*/
59
void
SetSingleDevice
(
uint32_t
device);
60
61
/**
62
* \brief Set the destination address
63
* \param address the destination address
64
*/
65
void
SetPhysicalAddress
(
const
Address
address);
66
67
/**
68
* \brief Get the protocol
69
* \return the protocol
70
*/
71
uint16_t
GetProtocol
()
const
;
72
73
/**
74
* \brief Get the device this address is bound to
75
* \return the device index
76
*/
77
uint32_t
GetSingleDevice
()
const
;
78
79
/**
80
* \brief Checks if the address is bound to a specified NetDevice
81
* \return true if the address is bound to a NetDevice
82
*/
83
bool
IsSingleDevice
()
const
;
84
85
/**
86
* \brief Get the destination address
87
* \returns The destination address
88
*/
89
Address
GetPhysicalAddress
()
const
;
90
91
/**
92
* \returns a new Address instance
93
*
94
* Convert an instance of this class to a polymorphic Address instance.
95
*/
96
operator
Address
()
const
;
97
98
/**
99
* \param address a polymorphic address
100
* \returns an Address
101
* Convert a polymorphic address to an Mac48Address instance.
102
* The conversion performs a type check.
103
*/
104
static
PacketSocketAddress
ConvertFrom
(
const
Address
& address);
105
106
/**
107
* \brief Convert an instance of this class to a polymorphic Address instance.
108
* \returns a new Address instance
109
*/
110
Address
ConvertTo
()
const
;
111
112
/**
113
* \param address address to test
114
* \returns true if the address matches, false otherwise.
115
*/
116
static
bool
IsMatchingType
(
const
Address
& address);
117
118
private
:
119
/**
120
* \brief Return the Type of address.
121
* \return type of address
122
*/
123
static
uint8_t
GetType
();
124
125
uint16_t
m_protocol
;
//!< Protocol
126
bool
m_isSingleDevice
;
//!< True if directed to a specific outgoing NetDevice
127
uint32_t
m_device
;
//!< Outgoing NetDevice index
128
Address
m_address
;
//!< Destination address
129
};
130
131
}
// namespace ns3
132
133
#endif
/* PACKET_SOCKET_ADDRESS_H */
ns3::Address
a polymophic address class
Definition:
address.h:101
ns3::PacketSocketAddress
an address for a packet socket
Definition:
packet-socket-address.h:40
ns3::PacketSocketAddress::PacketSocketAddress
PacketSocketAddress()
Definition:
packet-socket-address.cc:29
ns3::PacketSocketAddress::ConvertTo
Address ConvertTo() const
Convert an instance of this class to a polymorphic Address instance.
Definition:
packet-socket-address.cc:98
ns3::PacketSocketAddress::GetSingleDevice
uint32_t GetSingleDevice() const
Get the device this address is bound to.
Definition:
packet-socket-address.cc:79
ns3::PacketSocketAddress::IsSingleDevice
bool IsSingleDevice() const
Checks if the address is bound to a specified NetDevice.
Definition:
packet-socket-address.cc:72
ns3::PacketSocketAddress::GetPhysicalAddress
Address GetPhysicalAddress() const
Get the destination address.
Definition:
packet-socket-address.cc:86
ns3::PacketSocketAddress::m_address
Address m_address
Destination address.
Definition:
packet-socket-address.h:128
ns3::PacketSocketAddress::m_device
uint32_t m_device
Outgoing NetDevice index.
Definition:
packet-socket-address.h:127
ns3::PacketSocketAddress::SetProtocol
void SetProtocol(uint16_t protocol)
Set the protocol.
Definition:
packet-socket-address.cc:35
ns3::PacketSocketAddress::IsMatchingType
static bool IsMatchingType(const Address &address)
Definition:
packet-socket-address.cc:148
ns3::PacketSocketAddress::SetPhysicalAddress
void SetPhysicalAddress(const Address address)
Set the destination address.
Definition:
packet-socket-address.cc:58
ns3::PacketSocketAddress::m_isSingleDevice
bool m_isSingleDevice
True if directed to a specific outgoing NetDevice.
Definition:
packet-socket-address.h:126
ns3::PacketSocketAddress::ConvertFrom
static PacketSocketAddress ConvertFrom(const Address &address)
Definition:
packet-socket-address.cc:115
ns3::PacketSocketAddress::SetSingleDevice
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Definition:
packet-socket-address.cc:50
ns3::PacketSocketAddress::GetType
static uint8_t GetType()
Return the Type of address.
Definition:
packet-socket-address.cc:155
ns3::PacketSocketAddress::m_protocol
uint16_t m_protocol
Protocol.
Definition:
packet-socket-address.h:125
ns3::PacketSocketAddress::SetAllDevices
void SetAllDevices()
Set the address to match all the outgoing NetDevice.
Definition:
packet-socket-address.cc:42
ns3::PacketSocketAddress::GetProtocol
uint16_t GetProtocol() const
Get the protocol.
Definition:
packet-socket-address.cc:65
uint32_t
mac48-address.h
mac64-address.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
network
utils
packet-socket-address.h
Generated on Tue May 28 2024 23:38:46 for ns-3 by
1.9.6