/usr/include/ns3/olsr-repositories.h is in libns3-dev 3.13+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2004 Francisco J. Ros
* Copyright (c) 2007 INESC Porto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Francisco J. Ros <fjrm@dif.um.es>
* Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
*/
///
/// \brief Here are defined all data structures needed by an OLSR node.
///
#ifndef OLSR_REPOSITORIES_H
#define OLSR_REPOSITORIES_H
#include <set>
#include <vector>
#include "ns3/ipv4-address.h"
#include "ns3/nstime.h"
namespace ns3 { namespace olsr {
/// An Interface Association Tuple.
struct IfaceAssocTuple
{
/// Interface address of a node.
Ipv4Address ifaceAddr;
/// Main address of the node.
Ipv4Address mainAddr;
/// Time at which this tuple expires and must be removed.
Time time;
};
static inline bool
operator == (const IfaceAssocTuple &a, const IfaceAssocTuple &b)
{
return (a.ifaceAddr == b.ifaceAddr
&& a.mainAddr == b.mainAddr);
}
static inline std::ostream&
operator << (std::ostream &os, const IfaceAssocTuple &tuple)
{
os << "IfaceAssocTuple(ifaceAddr=" << tuple.ifaceAddr
<< ", mainAddr=" << tuple.mainAddr
<< ", time=" << tuple.time << ")";
return os;
}
/// A Link Tuple.
struct LinkTuple
{
/// Interface address of the local node.
Ipv4Address localIfaceAddr;
/// Interface address of the neighbor node.
Ipv4Address neighborIfaceAddr;
/// The link is considered bidirectional until this time.
Time symTime;
/// The link is considered unidirectional until this time.
Time asymTime;
/// Time at which this tuple expires and must be removed.
Time time;
};
static inline bool
operator == (const LinkTuple &a, const LinkTuple &b)
{
return (a.localIfaceAddr == b.localIfaceAddr
&& a.neighborIfaceAddr == b.neighborIfaceAddr);
}
static inline std::ostream&
operator << (std::ostream &os, const LinkTuple &tuple)
{
os << "LinkTuple(localIfaceAddr=" << tuple.localIfaceAddr
<< ", neighborIfaceAddr=" << tuple.neighborIfaceAddr
<< ", symTime=" << tuple.symTime
<< ", asymTime=" << tuple.asymTime
<< ", expTime=" << tuple.time
<< ")";
return os;
}
/// A Neighbor Tuple.
struct NeighborTuple
{
/// Main address of a neighbor node.
Ipv4Address neighborMainAddr;
/// Neighbor Type and Link Type at the four less significative digits.
enum Status {
STATUS_NOT_SYM = 0, // "not symmetric"
STATUS_SYM = 1, // "symmetric"
} status;
/// A value between 0 and 7 specifying the node's willingness to carry traffic on behalf of other nodes.
uint8_t willingness;
};
static inline bool
operator == (const NeighborTuple &a, const NeighborTuple &b)
{
return (a.neighborMainAddr == b.neighborMainAddr
&& a.status == b.status
&& a.willingness == b.willingness);
}
static inline std::ostream&
operator << (std::ostream &os, const NeighborTuple &tuple)
{
os << "NeighborTuple(neighborMainAddr=" << tuple.neighborMainAddr
<< ", status=" << (tuple.status == NeighborTuple::STATUS_SYM ? "SYM" : "NOT_SYM")
<< ", willingness=" << (int) tuple.willingness << ")";
return os;
}
/// A 2-hop Tuple.
struct TwoHopNeighborTuple
{
/// Main address of a neighbor.
Ipv4Address neighborMainAddr;
/// Main address of a 2-hop neighbor with a symmetric link to nb_main_addr.
Ipv4Address twoHopNeighborAddr;
/// Time at which this tuple expires and must be removed.
Time expirationTime; // previously called 'time_'
};
static inline std::ostream&
operator << (std::ostream &os, const TwoHopNeighborTuple &tuple)
{
os << "TwoHopNeighborTuple(neighborMainAddr=" << tuple.neighborMainAddr
<< ", twoHopNeighborAddr=" << tuple.twoHopNeighborAddr
<< ", expirationTime=" << tuple.expirationTime
<< ")";
return os;
}
static inline bool
operator == (const TwoHopNeighborTuple &a, const TwoHopNeighborTuple &b)
{
return (a.neighborMainAddr == b.neighborMainAddr
&& a.twoHopNeighborAddr == b.twoHopNeighborAddr);
}
/// An MPR-Selector Tuple.
struct MprSelectorTuple
{
/// Main address of a node which have selected this node as a MPR.
Ipv4Address mainAddr;
/// Time at which this tuple expires and must be removed.
Time expirationTime; // previously called 'time_'
};
static inline bool
operator == (const MprSelectorTuple &a, const MprSelectorTuple &b)
{
return (a.mainAddr == b.mainAddr);
}
/// The type "list of interface addresses"
//typedef std::vector<nsaddr_t> addr_list_t;
/// A Duplicate Tuple
struct DuplicateTuple
{
/// Originator address of the message.
Ipv4Address address;
/// Message sequence number.
uint16_t sequenceNumber;
/// Indicates whether the message has been retransmitted or not.
bool retransmitted;
/// List of interfaces which the message has been received on.
std::vector<Ipv4Address> ifaceList;
/// Time at which this tuple expires and must be removed.
Time expirationTime;
};
static inline bool
operator == (const DuplicateTuple &a, const DuplicateTuple &b)
{
return (a.address == b.address
&& a.sequenceNumber == b.sequenceNumber);
}
/// A Topology Tuple
struct TopologyTuple
{
/// Main address of the destination.
Ipv4Address destAddr;
/// Main address of a node which is a neighbor of the destination.
Ipv4Address lastAddr;
/// Sequence number.
uint16_t sequenceNumber;
/// Time at which this tuple expires and must be removed.
Time expirationTime;
};
static inline bool
operator == (const TopologyTuple &a, const TopologyTuple &b)
{
return (a.destAddr == b.destAddr
&& a.lastAddr == b.lastAddr
&& a.sequenceNumber == b.sequenceNumber);
}
static inline std::ostream&
operator << (std::ostream &os, const TopologyTuple &tuple)
{
os << "TopologyTuple(destAddr=" << tuple.destAddr
<< ", lastAddr=" << tuple.lastAddr
<< ", sequenceNumber=" << (int) tuple.sequenceNumber
<< ", expirationTime=" << tuple.expirationTime
<< ")";
return os;
}
/// Association
struct Association
{
Ipv4Address networkAddr;
Ipv4Mask netmask;
};
static inline bool
operator == (const Association &a, const Association &b)
{
return (a.networkAddr == b.networkAddr
&& a.netmask == b.netmask);
}
static inline std::ostream&
operator << (std::ostream &os, const Association &tuple)
{
os << "Association(networkAddr=" << tuple.networkAddr
<< ", netmask=" << tuple.netmask
<< ")";
return os;
}
/// An Association Tuple
struct AssociationTuple
{
/// Main address of the gateway.
Ipv4Address gatewayAddr;
/// Network Address of network reachable through gatewayAddr
Ipv4Address networkAddr;
/// Netmask of network reachable through gatewayAddr
Ipv4Mask netmask;
/// Time at which this tuple expires and must be removed
Time expirationTime;
};
static inline bool
operator == (const AssociationTuple &a, const AssociationTuple &b)
{
return (a.gatewayAddr == b.gatewayAddr
&& a.networkAddr == b.networkAddr
&& a.netmask == b.netmask);
}
static inline std::ostream&
operator << (std::ostream &os, const AssociationTuple &tuple)
{
os << "AssociationTuple(gatewayAddr=" << tuple.gatewayAddr
<< ", networkAddr=" << tuple.networkAddr
<< ", netmask=" << tuple.netmask
<< ", expirationTime=" << tuple.expirationTime
<< ")";
return os;
}
typedef std::set<Ipv4Address> MprSet; ///< MPR Set type.
typedef std::vector<MprSelectorTuple> MprSelectorSet; ///< MPR Selector Set type.
typedef std::vector<LinkTuple> LinkSet; ///< Link Set type.
typedef std::vector<NeighborTuple> NeighborSet; ///< Neighbor Set type.
typedef std::vector<TwoHopNeighborTuple> TwoHopNeighborSet; ///< 2-hop Neighbor Set type.
typedef std::vector<TopologyTuple> TopologySet; ///< Topology Set type.
typedef std::vector<DuplicateTuple> DuplicateSet; ///< Duplicate Set type.
typedef std::vector<IfaceAssocTuple> IfaceAssocSet; ///< Interface Association Set type.
typedef std::vector<AssociationTuple> AssociationSet; ///< Association Set type.
typedef std::vector<Association> Associations; ///< Association Set type.
}} // namespace ns3, olsr
#endif /* OLSR_REPOSITORIES_H */
|