A Discrete-Event Network Simulator
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
20namespace 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 */
28void 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 */
35void 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 */
42void 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 */
49void 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 */
56void 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 */
63void 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 */
70void 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 */
77void 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 */
85void 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 */
92void 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 */
99void 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 */
106void ReadFrom(Buffer::Iterator& i, Mac16Address& ad);
107
108namespace addressUtils
109{
110
111/**
112 * \brief Address family-independent test for a multicast address
113 */
114bool IsMulticast(const Address& ad);
115}; // namespace addressUtils
116
117}; // namespace ns3
118
119#endif /* ADDRESS_UTILS_H */
bool IsMulticast(const Address &ad)
Address family-independent test for a multicast address.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.