A Discrete-Event Network Simulator
API
olsr-repositories.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2004 Francisco J. Ros
3 * Copyright (c) 2007 INESC Porto
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 * Authors: Francisco J. Ros <fjrm@dif.um.es>
19 * Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
20 */
21
22#ifndef OLSR_REPOSITORIES_H
23#define OLSR_REPOSITORIES_H
24
25#include "ns3/ipv4-address.h"
26#include "ns3/nstime.h"
27
28#include <set>
29#include <vector>
30
31namespace ns3
32{
33namespace olsr
34{
35
39{
46};
47
48static inline bool
50{
51 return (a.ifaceAddr == b.ifaceAddr && a.mainAddr == b.mainAddr);
52}
53
54static inline std::ostream&
55operator<<(std::ostream& os, const IfaceAssocTuple& tuple)
56{
57 os << "IfaceAssocTuple(ifaceAddr=" << tuple.ifaceAddr << ", mainAddr=" << tuple.mainAddr
58 << ", time=" << tuple.time << ")";
59 return os;
60}
61
65{
76};
77
78static inline bool
79operator==(const LinkTuple& a, const LinkTuple& b)
80{
82}
83
84static inline std::ostream&
85operator<<(std::ostream& os, const LinkTuple& tuple)
86{
87 os << "LinkTuple(localIfaceAddr=" << tuple.localIfaceAddr
88 << ", neighborIfaceAddr=" << tuple.neighborIfaceAddr << ", symTime=" << tuple.symTime
89 << ", asymTime=" << tuple.asymTime << ", expTime=" << tuple.time << ")";
90 return os;
91}
92
96{
99
102 {
103 STATUS_NOT_SYM = 0, // "not symmetric"
104 STATUS_SYM = 1, // "symmetric"
106
109 uint8_t willingness;
110};
111
112static inline bool
114{
115 return (a.neighborMainAddr == b.neighborMainAddr && a.status == b.status &&
116 a.willingness == b.willingness);
117}
118
119static inline std::ostream&
120operator<<(std::ostream& os, const NeighborTuple& tuple)
121{
122 os << "NeighborTuple(neighborMainAddr=" << tuple.neighborMainAddr
123 << ", status=" << (tuple.status == NeighborTuple::STATUS_SYM ? "SYM" : "NOT_SYM")
124 << ", willingness=" << (int)tuple.willingness << ")";
125 return os;
126}
127
131{
137 Time expirationTime; // previously called 'time_'
138};
139
140static inline std::ostream&
141operator<<(std::ostream& os, const TwoHopNeighborTuple& tuple)
142{
143 os << "TwoHopNeighborTuple(neighborMainAddr=" << tuple.neighborMainAddr
144 << ", twoHopNeighborAddr=" << tuple.twoHopNeighborAddr
145 << ", expirationTime=" << tuple.expirationTime << ")";
146 return os;
147}
148
149static inline bool
151{
152 return (a.neighborMainAddr == b.neighborMainAddr &&
154}
155
159{
163 Time expirationTime; // previously called 'time_'
164};
165
166static inline bool
168{
169 return (a.mainAddr == b.mainAddr);
170}
171
172// The type "list of interface addresses"
173// typedef std::vector<nsaddr_t> addr_list_t;
174
178{
186 std::vector<Ipv4Address> ifaceList;
189};
190
191static inline bool
193{
194 return (a.address == b.address && a.sequenceNumber == b.sequenceNumber);
195}
196
200{
209};
210
211static inline bool
213{
214 return (a.destAddr == b.destAddr && a.lastAddr == b.lastAddr &&
216}
217
218static inline std::ostream&
219operator<<(std::ostream& os, const TopologyTuple& tuple)
220{
221 os << "TopologyTuple(destAddr=" << tuple.destAddr << ", lastAddr=" << tuple.lastAddr
222 << ", sequenceNumber=" << (int)tuple.sequenceNumber
223 << ", expirationTime=" << tuple.expirationTime << ")";
224 return os;
225}
226
230{
233};
234
235static inline bool
237{
238 return (a.networkAddr == b.networkAddr && a.netmask == b.netmask);
239}
240
241static inline std::ostream&
242operator<<(std::ostream& os, const Association& tuple)
243{
244 os << "Association(networkAddr=" << tuple.networkAddr << ", netmask=" << tuple.netmask << ")";
245 return os;
246}
247
251{
260};
261
262static inline bool
264{
265 return (a.gatewayAddr == b.gatewayAddr && a.networkAddr == b.networkAddr &&
266 a.netmask == b.netmask);
267}
268
269static inline std::ostream&
270operator<<(std::ostream& os, const AssociationTuple& tuple)
271{
272 os << "AssociationTuple(gatewayAddr=" << tuple.gatewayAddr
273 << ", networkAddr=" << tuple.networkAddr << ", netmask=" << tuple.netmask
274 << ", expirationTime=" << tuple.expirationTime << ")";
275 return os;
276}
277
278typedef std::set<Ipv4Address> MprSet;
279typedef std::vector<MprSelectorTuple> MprSelectorSet;
280typedef std::vector<LinkTuple> LinkSet;
281typedef std::vector<NeighborTuple> NeighborSet;
282typedef std::vector<TwoHopNeighborTuple> TwoHopNeighborSet;
283typedef std::vector<TopologyTuple> TopologySet;
284typedef std::vector<DuplicateTuple> DuplicateSet;
285typedef std::vector<IfaceAssocTuple> IfaceAssocSet;
286typedef std::vector<AssociationTuple> AssociationSet;
287typedef std::vector<Association> Associations;
288
289} // namespace olsr
290} // namespace ns3
291
292#endif /* OLSR_REPOSITORIES_H */
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:43
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:258
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
static bool operator==(const IfaceAssocTuple &a, const IfaceAssocTuple &b)
std::vector< MprSelectorTuple > MprSelectorSet
MPR Selector Set type.
std::vector< AssociationTuple > AssociationSet
Association Set type.
static std::ostream & operator<<(std::ostream &os, const PacketHeader &packet)
Definition: olsr-header.h:688
std::vector< TwoHopNeighborTuple > TwoHopNeighborSet
2-hop Neighbor Set type.
std::vector< LinkTuple > LinkSet
Link Set type.
std::vector< Association > Associations
Association Set type.
std::vector< TopologyTuple > TopologySet
Topology Set type.
std::set< Ipv4Address > MprSet
MPR Set type.
std::vector< DuplicateTuple > DuplicateSet
Duplicate Set type.
std::vector< NeighborTuple > NeighborSet
Neighbor Set type.
std::vector< IfaceAssocTuple > IfaceAssocSet
Interface Association Set type.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Definition: olsr.py:1
Ipv4Address networkAddr
IPv4 Network address.
Ipv4Mask netmask
IPv4 Network mask.
Ipv4Address networkAddr
Network Address of network reachable through gatewayAddr.
Ipv4Mask netmask
Netmask of network reachable through gatewayAddr.
Time expirationTime
Time at which this tuple expires and must be removed.
Ipv4Address gatewayAddr
Main address of the gateway.
std::vector< Ipv4Address > ifaceList
List of interfaces which the message has been received on.
Ipv4Address address
Originator address of the message.
uint16_t sequenceNumber
Message sequence number.
bool retransmitted
Indicates whether the message has been retransmitted or not.
Time expirationTime
Time at which this tuple expires and must be removed.
An Interface Association Tuple.
Ipv4Address ifaceAddr
Interface address of a node.
Time time
Time at which this tuple expires and must be removed.
Ipv4Address mainAddr
Main address of the node.
An MPR-Selector Tuple.
Ipv4Address mainAddr
Main address of a node which have selected this node as a MPR.
Time expirationTime
Time at which this tuple expires and must be removed.
Ipv4Address neighborMainAddr
Main address of a neighbor node.
enum ns3::olsr::NeighborTuple::Status status
Status of the link.
uint8_t willingness
A value between 0 and 7 specifying the node's willingness to carry traffic on behalf of other nodes.
Status
Status of the link (Symmetric or not Symmetric).
Ipv4Address destAddr
Main address of the destination.
Ipv4Address lastAddr
Main address of a node which is a neighbor of the destination.
uint16_t sequenceNumber
Sequence number.
Time expirationTime
Time at which this tuple expires and must be removed.
Ipv4Address twoHopNeighborAddr
Main address of a 2-hop neighbor with a symmetric link to nb_main_addr.
Ipv4Address neighborMainAddr
Main address of a neighbor.
Time expirationTime
Time at which this tuple expires and must be removed.