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
address-utils.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2006 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
#ifndef ADDRESS_UTILS_H
9
#define ADDRESS_UTILS_H
10
11
#include "
ipv4-address.h
"
12
#include "
ipv6-address.h
"
13
#include "
mac16-address.h
"
14
#include "
mac48-address.h
"
15
#include "
mac64-address.h
"
16
17
#include "ns3/address.h"
18
#include "ns3/buffer.h"
19
20
namespace
ns3
21
{
22
23
/**
24
* @brief Write an Ipv4Address to a Buffer
25
* @param i a reference to the buffer to write to
26
* @param ad the Ipv4Address
27
*/
28
void
WriteTo
(Buffer::Iterator& i, Ipv4Address ad);
29
30
/**
31
* @brief Write an Ipv4Address to a Buffer
32
* @param i a reference to the buffer to write to
33
* @param ad the Ipv6Address
34
*/
35
void
WriteTo
(Buffer::Iterator& i, Ipv6Address ad);
36
37
/**
38
* @brief Write an Address to a Buffer
39
* @param i a reference to the buffer to write to
40
* @param ad the Address
41
*/
42
void
WriteTo
(Buffer::Iterator& i,
const
Address& ad);
43
44
/**
45
* @brief Write an Mac64Address to a Buffer
46
* @param i a reference to the buffer to write to
47
* @param ad the Mac64Address
48
*/
49
void
WriteTo
(Buffer::Iterator& i, Mac64Address ad);
50
51
/**
52
* @brief Write an Mac48Address to a Buffer
53
* @param i a reference to the buffer to write to
54
* @param ad the Mac48Address
55
*/
56
void
WriteTo
(Buffer::Iterator& i, Mac48Address ad);
57
58
/**
59
* @brief Write an Mac16Address to a Buffer
60
* @param i a reference to the buffer to write to
61
* @param ad the Mac16Address
62
*/
63
void
WriteTo
(Buffer::Iterator& i, Mac16Address ad);
64
65
/**
66
* @brief Read an Ipv4Address from a Buffer
67
* @param i a reference to the buffer to read from
68
* @param ad a reference to the Ipv4Address to be read
69
*/
70
void
ReadFrom
(Buffer::Iterator& i, Ipv4Address& ad);
71
72
/**
73
* @brief Read an Ipv6Address from a Buffer
74
* @param i a reference to the buffer to read from
75
* @param ad a reference to the Ipv6Address to be read
76
*/
77
void
ReadFrom
(Buffer::Iterator& i, Ipv6Address& ad);
78
79
/**
80
* @brief Read an Address from a Buffer
81
* @param i a reference to the buffer to read from
82
* @param ad a reference to the Address to be read
83
* @param len the length of the Address
84
*/
85
void
ReadFrom
(Buffer::Iterator& i, Address& ad,
uint32_t
len);
86
87
/**
88
* @brief Read a Mac64Address from a Buffer
89
* @param i a reference to the buffer to read from
90
* @param ad a reference to the Mac64Address to be read
91
*/
92
void
ReadFrom
(Buffer::Iterator& i, Mac64Address& ad);
93
94
/**
95
* @brief Read a Mac48Address from a Buffer
96
* @param i a reference to the buffer to read from
97
* @param ad a reference to the Mac48Address to be read
98
*/
99
void
ReadFrom
(Buffer::Iterator& i, Mac48Address& ad);
100
101
/**
102
* @brief Read a Mac16Address from a Buffer
103
* @param i a reference to the buffer to read from
104
* @param ad a reference to the Mac16Address to be read
105
*/
106
void
ReadFrom
(Buffer::Iterator& i, Mac16Address& ad);
107
108
namespace
addressUtils
109
{
110
111
/**
112
* @brief Address family-independent test for a multicast address
113
* @param ad the address to test
114
* @return true if the address is a multicast address, false otherwise
115
*/
116
bool
IsMulticast
(
const
Address& ad);
117
118
/**
119
* @brief Convert IPv4/IPv6 address with port to a socket address
120
* @param address the address to convert
121
* @param port the port
122
* @return the corresponding socket address
123
*/
124
Address
ConvertToSocketAddress
(
const
Address& address, uint16_t
port
);
125
126
};
// namespace addressUtils
127
128
};
// namespace ns3
129
130
#endif
/* ADDRESS_UTILS_H */
uint32_t
port
uint16_t port
Definition
dsdv-manet.cc:33
ipv4-address.h
ipv6-address.h
mac16-address.h
mac48-address.h
mac64-address.h
ns3::addressUtils::IsMulticast
bool IsMulticast(const Address &ad)
Address family-independent test for a multicast address.
Definition
address-utils.cc:130
ns3::addressUtils::ConvertToSocketAddress
Address ConvertToSocketAddress(const Address &address, uint16_t port)
Convert IPv4/IPv6 address with port to a socket address.
Definition
address-utils.cc:160
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WriteTo
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
Definition
address-utils.cc:21
ns3::ReadFrom
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
Definition
address-utils.cc:74
src
network
utils
address-utils.h
Generated on Tue Apr 8 2025 15:27:17 for ns-3 by
1.11.0