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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
#ifndef PACKET_SOCKET_ADDRESS_H
9
#define PACKET_SOCKET_ADDRESS_H
10
11
#include "
mac48-address.h
"
12
#include "
mac64-address.h
"
13
14
#include "ns3/address.h"
15
#include "ns3/net-device.h"
16
#include "ns3/ptr.h"
17
18
namespace
ns3
19
{
20
21
class
NetDevice;
22
23
/**
24
* @ingroup address
25
*
26
* @brief an address for a packet socket
27
*/
28
class
PacketSocketAddress
29
{
30
public
:
31
PacketSocketAddress
();
32
33
/**
34
* @brief Set the protocol
35
* @param protocol the protocol
36
*/
37
void
SetProtocol
(uint16_t protocol);
38
39
/**
40
* @brief Set the address to match all the outgoing NetDevice
41
*/
42
void
SetAllDevices
();
43
44
/**
45
* @brief Set the address to match only a specified NetDevice
46
* @param device the NetDevice index
47
*/
48
void
SetSingleDevice
(
uint32_t
device);
49
50
/**
51
* @brief Set the destination address
52
* @param address the destination address
53
*/
54
void
SetPhysicalAddress
(
const
Address
address);
55
56
/**
57
* @brief Get the protocol
58
* @return the protocol
59
*/
60
uint16_t
GetProtocol
()
const
;
61
62
/**
63
* @brief Get the device this address is bound to
64
* @return the device index
65
*/
66
uint32_t
GetSingleDevice
()
const
;
67
68
/**
69
* @brief Checks if the address is bound to a specified NetDevice
70
* @return true if the address is bound to a NetDevice
71
*/
72
bool
IsSingleDevice
()
const
;
73
74
/**
75
* @brief Get the destination address
76
* @returns The destination address
77
*/
78
Address
GetPhysicalAddress
()
const
;
79
80
/**
81
* @returns a new Address instance
82
*
83
* Convert an instance of this class to a polymorphic Address instance.
84
*/
85
operator
Address
()
const
;
86
87
/**
88
* @param address a polymorphic address
89
* @returns an Address
90
* Convert a polymorphic address to an Mac48Address instance.
91
* The conversion performs a type check.
92
*/
93
static
PacketSocketAddress
ConvertFrom
(
const
Address
& address);
94
95
/**
96
* @brief Convert an instance of this class to a polymorphic Address instance.
97
* @returns a new Address instance
98
*/
99
Address
ConvertTo
()
const
;
100
101
/**
102
* @param address address to test
103
* @returns true if the address matches, false otherwise.
104
*/
105
static
bool
IsMatchingType
(
const
Address
& address);
106
107
private
:
108
/**
109
* @brief Return the Type of address.
110
* @return type of address
111
*/
112
static
uint8_t
GetType
();
113
114
uint16_t
m_protocol
;
//!< Protocol
115
bool
m_isSingleDevice
;
//!< True if directed to a specific outgoing NetDevice
116
uint32_t
m_device
;
//!< Outgoing NetDevice index
117
Address
m_address
;
//!< Destination address
118
};
119
120
}
// namespace ns3
121
122
#endif
/* PACKET_SOCKET_ADDRESS_H */
ns3::Address
a polymophic address class
Definition
address.h:90
ns3::PacketSocketAddress
an address for a packet socket
Definition
packet-socket-address.h:29
ns3::PacketSocketAddress::PacketSocketAddress
PacketSocketAddress()
Definition
packet-socket-address.cc:18
ns3::PacketSocketAddress::ConvertTo
Address ConvertTo() const
Convert an instance of this class to a polymorphic Address instance.
Definition
packet-socket-address.cc:87
ns3::PacketSocketAddress::GetSingleDevice
uint32_t GetSingleDevice() const
Get the device this address is bound to.
Definition
packet-socket-address.cc:68
ns3::PacketSocketAddress::IsSingleDevice
bool IsSingleDevice() const
Checks if the address is bound to a specified NetDevice.
Definition
packet-socket-address.cc:61
ns3::PacketSocketAddress::GetPhysicalAddress
Address GetPhysicalAddress() const
Get the destination address.
Definition
packet-socket-address.cc:75
ns3::PacketSocketAddress::m_address
Address m_address
Destination address.
Definition
packet-socket-address.h:117
ns3::PacketSocketAddress::m_device
uint32_t m_device
Outgoing NetDevice index.
Definition
packet-socket-address.h:116
ns3::PacketSocketAddress::SetProtocol
void SetProtocol(uint16_t protocol)
Set the protocol.
Definition
packet-socket-address.cc:24
ns3::PacketSocketAddress::IsMatchingType
static bool IsMatchingType(const Address &address)
Definition
packet-socket-address.cc:137
ns3::PacketSocketAddress::SetPhysicalAddress
void SetPhysicalAddress(const Address address)
Set the destination address.
Definition
packet-socket-address.cc:47
ns3::PacketSocketAddress::m_isSingleDevice
bool m_isSingleDevice
True if directed to a specific outgoing NetDevice.
Definition
packet-socket-address.h:115
ns3::PacketSocketAddress::ConvertFrom
static PacketSocketAddress ConvertFrom(const Address &address)
Definition
packet-socket-address.cc:104
ns3::PacketSocketAddress::SetSingleDevice
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Definition
packet-socket-address.cc:39
ns3::PacketSocketAddress::GetType
static uint8_t GetType()
Return the Type of address.
Definition
packet-socket-address.cc:144
ns3::PacketSocketAddress::m_protocol
uint16_t m_protocol
Protocol.
Definition
packet-socket-address.h:114
ns3::PacketSocketAddress::SetAllDevices
void SetAllDevices()
Set the address to match all the outgoing NetDevice.
Definition
packet-socket-address.cc:31
ns3::PacketSocketAddress::GetProtocol
uint16_t GetProtocol() const
Get the protocol.
Definition
packet-socket-address.cc:54
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 Dec 3 2024 18:20:51 for ns-3 by
1.11.0