author | Tommaso Pecorella <tommaso.pecorella@unifi.it> |
Thu, 14 Nov 2013 22:43:53 +0100 | |
changeset 10405 | 45c8fceae24e |
parent 9946 | df4a7e93c13d |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7182
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
242 | 2 |
/* |
3 |
* Copyright (c) 2006 INRIA |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License version 2 as |
|
7 |
* published by the Free Software Foundation; |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 |
* |
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
|
19 |
*/ |
|
976
e82bac1816ce
ethernet Header and Trailer classes
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
524
diff
changeset
|
20 |
#ifndef ADDRESS_UTILS_H |
e82bac1816ce
ethernet Header and Trailer classes
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
524
diff
changeset
|
21 |
#define ADDRESS_UTILS_H |
242 | 22 |
|
23 |
#include "ns3/buffer.h" |
|
1167 | 24 |
#include "ipv4-address.h" |
3852 | 25 |
#include "ipv6-address.h" |
6823
a27f86fb4e55
Merge node and common modules into new network module
Tom Henderson <tomh@tomh.org>
parents:
4472
diff
changeset
|
26 |
#include "ns3/address.h" |
9946
df4a7e93c13d
Mac16Address added, Mac64Address refactored, and Mac[16,64]Address can be used in IPv6
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7385
diff
changeset
|
27 |
#include "mac64-address.h" |
1494
c2985e1cd091
rename Euixx to Macxx
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
28 |
#include "mac48-address.h" |
9946
df4a7e93c13d
Mac16Address added, Mac64Address refactored, and Mac[16,64]Address can be used in IPv6
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7385
diff
changeset
|
29 |
#include "mac16-address.h" |
242 | 30 |
|
31 |
namespace ns3 { |
|
32 |
||
10405
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
33 |
/** |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
34 |
* \brief Write an Ipv4Address to a Buffer |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
35 |
* \param i a reference to the buffer to write to |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
36 |
* \param ad the Ipv4Address |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
37 |
*/ |
242 | 38 |
void WriteTo (Buffer::Iterator &i, Ipv4Address ad); |
10405
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
39 |
|
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
40 |
/** |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
41 |
* \brief Write an Ipv4Address to a Buffer |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
42 |
* \param i a reference to the buffer to write to |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
43 |
* \param ad the Ipv6Address |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
44 |
*/ |
3852 | 45 |
void WriteTo (Buffer::Iterator &i, Ipv6Address ad); |
10405
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
46 |
|
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
47 |
/** |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
48 |
* \brief Write an Address to a Buffer |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
49 |
* \param i a reference to the buffer to write to |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
50 |
* \param ad the Address |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
51 |
*/ |
1167 | 52 |
void WriteTo (Buffer::Iterator &i, const Address &ad); |
10405
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
53 |
|
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
54 |
/** |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
55 |
* \brief Write an Mac64Address to a Buffer |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
56 |
* \param i a reference to the buffer to write to |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
57 |
* \param ad the Mac64Address |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
58 |
*/ |
9946
df4a7e93c13d
Mac16Address added, Mac64Address refactored, and Mac[16,64]Address can be used in IPv6
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7385
diff
changeset
|
59 |
void WriteTo (Buffer::Iterator &i, Mac64Address ad); |
10405
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
60 |
|
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
61 |
/** |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
62 |
* \brief Write an Mac48Address to a Buffer |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
63 |
* \param i a reference to the buffer to write to |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
64 |
* \param ad the Mac48Address |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
65 |
*/ |
1494
c2985e1cd091
rename Euixx to Macxx
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
66 |
void WriteTo (Buffer::Iterator &i, Mac48Address ad); |
10405
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
67 |
|
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
68 |
/** |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
69 |
* \brief Write an Mac16Address to a Buffer |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
70 |
* \param i a reference to the buffer to write to |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
71 |
* \param ad the Mac16Address |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
72 |
*/ |
9946
df4a7e93c13d
Mac16Address added, Mac64Address refactored, and Mac[16,64]Address can be used in IPv6
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7385
diff
changeset
|
73 |
void WriteTo (Buffer::Iterator &i, Mac16Address ad); |
242 | 74 |
|
10405
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
75 |
|
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
76 |
/** |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
77 |
* \brief Read an Ipv4Address from a Buffer |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
78 |
* \param i a reference to the buffer to read from |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
79 |
* \param ad a reference to the Ipv4Address to be read |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
80 |
*/ |
242 | 81 |
void ReadFrom (Buffer::Iterator &i, Ipv4Address &ad); |
10405
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
82 |
|
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
83 |
/** |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
84 |
* \brief Read an Ipv6Address from a Buffer |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
85 |
* \param i a reference to the buffer to read from |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
86 |
* \param ad a reference to the Ipv6Address to be read |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
87 |
*/ |
3852 | 88 |
void ReadFrom (Buffer::Iterator &i, Ipv6Address &ad); |
10405
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
89 |
|
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
90 |
/** |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
91 |
* \brief Read an Address from a Buffer |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
92 |
* \param i a reference to the buffer to read from |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
93 |
* \param ad a reference to the Address to be read |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
94 |
* \param len the length of the Address |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
95 |
*/ |
1167 | 96 |
void ReadFrom (Buffer::Iterator &i, Address &ad, uint32_t len); |
10405
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
97 |
|
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
98 |
/** |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
99 |
* \brief Read a Mac64Address from a Buffer |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
100 |
* \param i a reference to the buffer to read from |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
101 |
* \param ad a reference to the Mac64Address to be read |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
102 |
*/ |
9946
df4a7e93c13d
Mac16Address added, Mac64Address refactored, and Mac[16,64]Address can be used in IPv6
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7385
diff
changeset
|
103 |
void ReadFrom (Buffer::Iterator &i, Mac64Address &ad); |
10405
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
104 |
|
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
105 |
/** |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
106 |
* \brief Read a Mac48Address from a Buffer |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
107 |
* \param i a reference to the buffer to read from |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
108 |
* \param ad a reference to the Mac48Address to be read |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
109 |
*/ |
1494
c2985e1cd091
rename Euixx to Macxx
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
110 |
void ReadFrom (Buffer::Iterator &i, Mac48Address &ad); |
10405
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
111 |
|
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
112 |
/** |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
113 |
* \brief Read a Mac16Address from a Buffer |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
114 |
* \param i a reference to the buffer to read from |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
115 |
* \param ad a reference to the Mac16Address to be read |
45c8fceae24e
Doxygen fixes to Topology-read, Ipv6, and tcp-socket
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
9946
diff
changeset
|
116 |
*/ |
9946
df4a7e93c13d
Mac16Address added, Mac64Address refactored, and Mac[16,64]Address can be used in IPv6
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7385
diff
changeset
|
117 |
void ReadFrom (Buffer::Iterator &i, Mac16Address &ad); |
242 | 118 |
|
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
3852
diff
changeset
|
119 |
namespace addressUtils { |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
3852
diff
changeset
|
120 |
|
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
3852
diff
changeset
|
121 |
/** |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
3852
diff
changeset
|
122 |
* \brief Address family-independent test for a multicast address |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
3852
diff
changeset
|
123 |
*/ |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
3852
diff
changeset
|
124 |
bool IsMulticast (const Address &ad); |
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6823
diff
changeset
|
125 |
}; |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
3852
diff
changeset
|
126 |
|
242 | 127 |
}; |
128 |
||
976
e82bac1816ce
ethernet Header and Trailer classes
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
524
diff
changeset
|
129 |
#endif /* ADDRESS_UTILS_H */ |