--- a/src/olsr/examples/olsr-hna.cc Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/examples/olsr-hna.cc Fri May 13 14:58:13 2011 -0400
@@ -81,7 +81,7 @@
{
socket->Send (Create<Packet> (pktSize));
Simulator::Schedule (pktInterval, &GenerateTraffic,
- socket, pktSize,pktCount-1, pktInterval);
+ socket, pktSize,pktCount-1, pktInterval);
}
else
{
@@ -111,7 +111,7 @@
cmd.AddValue ("verbose", "turn on all WifiNetDevice log components", verbose);
cmd.AddValue ("assocMethod1", "Use SetRoutingTableAssociation () method", assocMethod1);
cmd.AddValue ("assocMethod2", "Use AddHostNetworkAssociation () method", assocMethod2);
-
+
cmd.Parse (argc, argv);
// Convert to time object
Time interPacketInterval = Seconds (interval);
@@ -156,7 +156,7 @@
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode",StringValue(phyMode),
- "ControlMode",StringValue(phyMode));
+ "ControlMode",StringValue(phyMode));
// Set it to adhoc mode
wifiMac.SetType ("ns3::AdhocWifiMac");
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, olsrNodes);
@@ -214,7 +214,7 @@
// Obtain olsr::RoutingProtocol instance of gateway node
// (namely, node B) and add the required association
- Ptr<Ipv4> stack = olsrNodes.Get (1) -> GetObject<Ipv4> ();
+ Ptr<Ipv4> stack = olsrNodes.Get (1)->GetObject<Ipv4> ();
Ptr<Ipv4RoutingProtocol> rp_Gw = (stack->GetRoutingProtocol ());
Ptr<Ipv4ListRouting> lrp_Gw = DynamicCast<Ipv4ListRouting> (rp_Gw);
--- a/src/olsr/examples/simple-point-to-point-olsr.cc Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/examples/simple-point-to-point-olsr.cc Fri May 13 14:58:13 2011 -0400
@@ -67,7 +67,7 @@
Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210));
Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("448kb/s"));
- //DefaultValue::Bind ("DropTailQueue::m_maxPackets", 30);
+ //DefaultValue::Bind ("DropTailQueue::m_maxPackets", 30);
// Allow the user to override any of the defaults and the above
// DefaultValue::Bind ()s at run-time, via command-line arguments
@@ -109,8 +109,8 @@
p2p.SetChannelAttribute ("Delay", StringValue ("10ms"));
NetDeviceContainer nd32 = p2p.Install (n32);
NetDeviceContainer nd34 = p2p.Install (n34);
-
- // Later, we add IP addresses.
+
+ // Later, we add IP addresses.
NS_LOG_INFO ("Assign IP Addresses.");
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
@@ -118,7 +118,7 @@
ipv4.SetBase ("10.1.2.0", "255.255.255.0");
Ipv4InterfaceContainer i12 = ipv4.Assign (nd12);
-
+
ipv4.SetBase ("10.1.3.0", "255.255.255.0");
Ipv4InterfaceContainer i32 = ipv4.Assign (nd32);
--- a/src/olsr/helper/olsr-helper.cc Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/helper/olsr-helper.cc Fri May 13 14:58:13 2011 -0400
@@ -51,7 +51,7 @@
{
std::set<uint32_t> interfaces;
interfaces.insert (interface);
-
+
m_interfaceExclusions.insert (std::make_pair (node, std::set<uint32_t> (interfaces) ));
}
else
--- a/src/olsr/helper/olsr-helper.h Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/helper/olsr-helper.h Fri May 13 14:58:13 2011 -0400
@@ -59,12 +59,12 @@
*/
OlsrHelper* Copy (void) const;
- /**
- * \param node the node for which an exception is to be defined
- * \param interface an interface of node on which OLSR is not to be installed
- *
- * This method allows the user to specify an interface on which OLSR is not to be installed on
- */
+ /**
+ * \param node the node for which an exception is to be defined
+ * \param interface an interface of node on which OLSR is not to be installed
+ *
+ * This method allows the user to specify an interface on which OLSR is not to be installed on
+ */
void ExcludeInterface (Ptr<Node> node, uint32_t interface);
/**
--- a/src/olsr/model/olsr-header.cc Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/model/olsr-header.cc Fri May 13 14:58:13 2011 -0400
@@ -46,7 +46,7 @@
SecondsToEmf (double seconds)
{
int a, b = 0;
-
+
// find the largest integer 'b' such that: T/C >= 2^b
for (b = 0; (seconds/OLSR_C) >= (1 << b); ++b)
;
@@ -72,7 +72,7 @@
NS_ASSERT (b >= 0 && b < 16);
// the field will be a byte holding the value a*16+b
- return (uint8_t) ((a << 4) | b);
+ return (uint8_t)((a << 4) | b);
}
///
@@ -97,10 +97,12 @@
NS_OBJECT_ENSURE_REGISTERED (PacketHeader);
PacketHeader::PacketHeader ()
-{}
+{
+}
PacketHeader::~PacketHeader ()
-{}
+{
+}
TypeId
PacketHeader::GetTypeId (void)
@@ -108,7 +110,7 @@
static TypeId tid = TypeId ("ns3::olsr::PacketHeader")
.SetParent<Header> ()
.AddConstructor<PacketHeader> ()
- ;
+ ;
return tid;
}
TypeId
@@ -153,10 +155,12 @@
MessageHeader::MessageHeader ()
: m_messageType (MessageHeader::MessageType (0))
-{}
+{
+}
MessageHeader::~MessageHeader ()
-{}
+{
+}
TypeId
MessageHeader::GetTypeId (void)
@@ -164,7 +168,7 @@
static TypeId tid = TypeId ("ns3::olsr::MessageHeader")
.SetParent<Header> ()
.AddConstructor<MessageHeader> ()
- ;
+ ;
return tid;
}
TypeId
@@ -304,12 +308,12 @@
this->interfaceAddresses.clear ();
NS_ASSERT (messageSize % IPV4_ADDRESS_SIZE == 0);
-
+
int numAddresses = messageSize / IPV4_ADDRESS_SIZE;
this->interfaceAddresses.erase (this->interfaceAddresses.begin(),
this->interfaceAddresses.end ());
for (int n = 0; n < numAddresses; ++n)
- this->interfaceAddresses.push_back (Ipv4Address (i.ReadNtohU32 ()));
+ this->interfaceAddresses.push_back (Ipv4Address (i.ReadNtohU32 ()));
return GetSerializedSize ();
}
@@ -345,7 +349,7 @@
i.WriteU16 (0); // Reserved
i.WriteU8 (this->hTime);
i.WriteU8 (this->willingness);
-
+
for (std::vector<LinkMessage>::const_iterator iter = this->linkMessages.begin ();
iter != this->linkMessages.end (); iter++)
{
@@ -359,7 +363,7 @@
// next "Link Code" field (or - if there are no more link types
// - the end of the message).
i.WriteHtonU16 (4 + lm.neighborInterfaceAddresses.size () * IPV4_ADDRESS_SIZE);
-
+
for (std::vector<Ipv4Address>::const_iterator neigh_iter = lm.neighborInterfaceAddresses.begin ();
neigh_iter != lm.neighborInterfaceAddresses.end (); neigh_iter++)
{
@@ -376,13 +380,13 @@
NS_ASSERT (messageSize >= 4);
this->linkMessages.clear ();
-
+
uint16_t helloSizeLeft = messageSize;
-
+
i.ReadNtohU16 (); // Reserved
this->hTime = i.ReadU8 ();
this->willingness = i.ReadU8 ();
-
+
helloSizeLeft -= 4;
while (helloSizeLeft)
@@ -445,7 +449,7 @@
this->ansn = i.ReadNtohU16 ();
i.ReadNtohU16 (); // Reserved
-
+
NS_ASSERT ((messageSize - 4) % IPV4_ADDRESS_SIZE == 0);
int numAddresses = (messageSize - 4) / IPV4_ADDRESS_SIZE;
this->neighborAddresses.clear ();
@@ -494,10 +498,11 @@
{
Ipv4Address address (i.ReadNtohU32 ());
Ipv4Mask mask (i.ReadNtohU32 ());
- this->associations.push_back ((Association) {address, mask});
+ this->associations.push_back ((Association) { address, mask});
}
return messageSize;
}
-}} // namespace olsr, ns3
+}
+} // namespace olsr, ns3
--- a/src/olsr/model/olsr-header.h Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/model/olsr-header.h Fri May 13 14:58:13 2011 -0400
@@ -94,7 +94,7 @@
uint16_t m_packetLength;
uint16_t m_packetSequenceNumber;
-public:
+public:
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
@@ -189,7 +189,7 @@
// {
// return m_messageSize;
// }
-
+
private:
MessageType m_messageType;
uint8_t m_vTime;
@@ -199,7 +199,7 @@
uint16_t m_messageSequenceNumber;
uint16_t m_messageSize;
-public:
+public:
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
@@ -431,7 +431,7 @@
return m_message.hna;
}
-
+
};
@@ -464,7 +464,8 @@
}
-}} // namespace olsr, ns3
+}
+} // namespace olsr, ns3
#endif /* OLSR_HEADER_H */
--- a/src/olsr/model/olsr-repositories.h Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/model/olsr-repositories.h Fri May 13 14:58:13 2011 -0400
@@ -39,266 +39,266 @@
/// 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;
-};
+ 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 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;
-}
+ 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;
-};
+ 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 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;
-}
+ 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;
-};
+ 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 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;
-}
+ 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_'
-};
+ 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 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);
-}
+ 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_'
-};
+ 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);
-}
+ 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;
-};
+ 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);
-}
+ 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;
-};
+ 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 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;
-}
+ 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;
-};
+ 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 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;
-}
+ 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;
-};
+ 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 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;
-}
+ 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.
+ 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
+ }}; // namespace ns3, olsr
#endif /* __OLSR_REPOSITORIES_H__ */
--- a/src/olsr/model/olsr-routing-protocol.cc Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/model/olsr-routing-protocol.cc Fri May 13 14:58:13 2011 -0400
@@ -68,76 +68,76 @@
///
/// We only use this value in order to define OLSR_NEIGHB_HOLD_TIME.
///
-#define OLSR_REFRESH_INTERVAL Seconds (2)
+#define OLSR_REFRESH_INTERVAL Seconds (2)
/********** Holding times **********/
/// Neighbor holding time.
-#define OLSR_NEIGHB_HOLD_TIME Time (3 * OLSR_REFRESH_INTERVAL)
+#define OLSR_NEIGHB_HOLD_TIME Time (3 * OLSR_REFRESH_INTERVAL)
/// Top holding time.
-#define OLSR_TOP_HOLD_TIME Time (3 * m_tcInterval)
+#define OLSR_TOP_HOLD_TIME Time (3 * m_tcInterval)
/// Dup holding time.
-#define OLSR_DUP_HOLD_TIME Seconds (30)
+#define OLSR_DUP_HOLD_TIME Seconds (30)
/// MID holding time.
-#define OLSR_MID_HOLD_TIME Time (3 * m_midInterval)
+#define OLSR_MID_HOLD_TIME Time (3 * m_midInterval)
/// HNA holding time.
#define OLSR_HNA_HOLD_TIME Time (3 * m_hnaInterval)
/********** Link types **********/
/// Unspecified link type.
-#define OLSR_UNSPEC_LINK 0
+#define OLSR_UNSPEC_LINK 0
/// Asymmetric link type.
-#define OLSR_ASYM_LINK 1
+#define OLSR_ASYM_LINK 1
/// Symmetric link type.
-#define OLSR_SYM_LINK 2
+#define OLSR_SYM_LINK 2
/// Lost link type.
-#define OLSR_LOST_LINK 3
+#define OLSR_LOST_LINK 3
/********** Neighbor types **********/
/// Not neighbor type.
-#define OLSR_NOT_NEIGH 0
+#define OLSR_NOT_NEIGH 0
/// Symmetric neighbor type.
-#define OLSR_SYM_NEIGH 1
+#define OLSR_SYM_NEIGH 1
/// Asymmetric neighbor type.
-#define OLSR_MPR_NEIGH 2
+#define OLSR_MPR_NEIGH 2
/********** Willingness **********/
/// Willingness for forwarding packets from other nodes: never.
-#define OLSR_WILL_NEVER 0
+#define OLSR_WILL_NEVER 0
/// Willingness for forwarding packets from other nodes: low.
-#define OLSR_WILL_LOW 1
+#define OLSR_WILL_LOW 1
/// Willingness for forwarding packets from other nodes: medium.
-#define OLSR_WILL_DEFAULT 3
+#define OLSR_WILL_DEFAULT 3
/// Willingness for forwarding packets from other nodes: high.
-#define OLSR_WILL_HIGH 6
+#define OLSR_WILL_HIGH 6
/// Willingness for forwarding packets from other nodes: always.
-#define OLSR_WILL_ALWAYS 7
+#define OLSR_WILL_ALWAYS 7
/********** Miscellaneous constants **********/
/// Maximum allowed jitter.
-#define OLSR_MAXJITTER (m_helloInterval.GetSeconds () / 4)
+#define OLSR_MAXJITTER (m_helloInterval.GetSeconds () / 4)
/// Maximum allowed sequence number.
-#define OLSR_MAX_SEQ_NUM 65535
+#define OLSR_MAX_SEQ_NUM 65535
/// Random number between [0-OLSR_MAXJITTER] used to jitter OLSR packet transmission.
#define JITTER (Seconds (UniformVariable().GetValue (0, OLSR_MAXJITTER)))
#define OLSR_PORT_NUMBER 698
/// Maximum number of messages per packet.
-#define OLSR_MAX_MSGS 64
+#define OLSR_MAX_MSGS 64
/// Maximum number of hellos per message (4 possible link types * 3 possible nb types).
-#define OLSR_MAX_HELLOS 12
+#define OLSR_MAX_HELLOS 12
/// Maximum number of addresses advertised on a message.
-#define OLSR_MAX_ADDRS 64
+#define OLSR_MAX_ADDRS 64
namespace ns3 {
@@ -185,8 +185,8 @@
.AddTraceSource ("Tx", "Send OLSR packet.",
MakeTraceSourceAccessor (&RoutingProtocol::m_txPacketTrace))
.AddTraceSource ("RoutingTableChanged", "The OLSR routing table has changed.",
- MakeTraceSourceAccessor (&RoutingProtocol::m_routingTableChanged))
- ;
+ MakeTraceSourceAccessor (&RoutingProtocol::m_routingTableChanged))
+ ;
return tid;
}
@@ -197,14 +197,15 @@
m_helloTimer (Timer::CANCEL_ON_DESTROY),
m_tcTimer (Timer::CANCEL_ON_DESTROY),
m_midTimer (Timer::CANCEL_ON_DESTROY),
- m_hnaTimer (Timer::CANCEL_ON_DESTROY),
+ m_hnaTimer (Timer::CANCEL_ON_DESTROY),
m_queuedMessagesTimer (Timer::CANCEL_ON_DESTROY)
{
m_hnaRoutingTable = Create<Ipv4StaticRouting> ();
}
RoutingProtocol::~RoutingProtocol ()
-{}
+{
+}
void
RoutingProtocol::SetIpv4 (Ptr<Ipv4> ipv4)
@@ -225,7 +226,7 @@
m_linkTupleTimerFirstTime = true;
m_ipv4 = ipv4;
-
+
m_hnaRoutingTable->SetIpv4 (ipv4);
}
@@ -252,24 +253,24 @@
*os << "Destination\t\tNextHop\t\tInterface\tDistance\n";
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator iter = m_table.begin ();
- iter != m_table.end (); iter++)
+ iter != m_table.end (); iter++)
{
*os << iter->first << "\t\t";
*os << iter->second.nextAddr << "\t\t";
if (Names::FindName (m_ipv4->GetNetDevice (iter->second.interface)) != "")
- {
- *os << Names::FindName (m_ipv4->GetNetDevice (iter->second.interface)) << "\t\t";
- }
- else
- {
- *os << iter->second.interface << "\t\t";
- }
+ {
+ *os << Names::FindName (m_ipv4->GetNetDevice (iter->second.interface)) << "\t\t";
+ }
+ else
+ {
+ *os << iter->second.interface << "\t\t";
+ }
*os << iter->second.distance << "\t";
*os << "\n";
}
- // Also print the HNA routing table
- *os << " HNA Routing Table:\n";
- m_hnaRoutingTable->PrintRoutingTable (stream);
+ // Also print the HNA routing table
+ *os << " HNA Routing Table:\n";
+ m_hnaRoutingTable->PrintRoutingTable (stream);
}
void RoutingProtocol::DoStart ()
@@ -334,14 +335,14 @@
}
if(canRunOlsr)
- {
+ {
HelloTimerExpire ();
TcTimerExpire ();
MidTimerExpire ();
- HnaTimerExpire ();
+ HnaTimerExpire ();
NS_LOG_DEBUG ("OLSR on node " << m_mainAddress << " started");
- }
+ }
}
void RoutingProtocol::SetMainInterface (uint32_t interface)
@@ -368,12 +369,12 @@
Ipv4Address receiverIfaceAddr = m_socketAddresses[socket].GetLocal ();
NS_ASSERT (receiverIfaceAddr != Ipv4Address ());
NS_LOG_DEBUG ("OLSR node " << m_mainAddress << " received a OLSR packet from "
- << senderIfaceAddr << " to " << receiverIfaceAddr);
-
+ << senderIfaceAddr << " to " << receiverIfaceAddr);
+
// All routing messages are sent from and to port RT_PORT,
// so we check it.
NS_ASSERT (inetSourceAddr.GetPort () == OLSR_PORT_NUMBER);
-
+
Ptr<Packet> packet = receivedPacket;
olsr::PacketHeader olsrPacketHeader;
@@ -382,13 +383,13 @@
uint32_t sizeLeft = olsrPacketHeader.GetPacketLength () - olsrPacketHeader.GetSerializedSize ();
MessageList messages;
-
+
while (sizeLeft)
{
MessageHeader messageHeader;
if (packet->RemoveHeader (messageHeader) == 0)
NS_ASSERT (false);
-
+
sizeLeft -= messageHeader.GetSerializedSize ();
NS_LOG_DEBUG ("Olsr Msg received with type "
@@ -418,8 +419,8 @@
// If the message has been processed it must not be processed again
bool do_forwarding = true;
DuplicateTuple *duplicated = m_state.FindDuplicateTuple
- (messageHeader.GetOriginatorAddress (),
- messageHeader.GetMessageSequenceNumber ());
+ (messageHeader.GetOriginatorAddress (),
+ messageHeader.GetMessageSequenceNumber ());
// Get main address of the peer, which may be different from the packet source address
// const IfaceAssocTuple *ifaceAssoc = m_state.FindIfaceAssocTuple (inetSourceAddr.GetIpv4 ());
@@ -432,7 +433,7 @@
// {
// peerMainAddress = inetSourceAddr.GetIpv4 () ;
// }
-
+
if (duplicated == NULL)
{
switch (messageHeader.GetMessageType ())
@@ -466,14 +467,14 @@
default:
NS_LOG_DEBUG ("OLSR message type " <<
- int (messageHeader.GetMessageType ()) <<
- " not implemented");
+ int (messageHeader.GetMessageType ()) <<
+ " not implemented");
}
}
else
{
NS_LOG_DEBUG ("OLSR message is duplicated, not reading it.");
-
+
// If the message has been considered for forwarding, it should
// not be retransmitted again
for (std::vector<Ipv4Address>::const_iterator it = duplicated->ifaceList.begin ();
@@ -486,7 +487,7 @@
}
}
}
-
+
if (do_forwarding)
{
// HELLO messages are never forwarded.
@@ -539,7 +540,7 @@
{
// first gather all 2-hop neighbors to be removed
std::set<Ipv4Address> toRemove;
- for (TwoHopNeighborSet::iterator twoHopNeigh = N2.begin (); twoHopNeigh != N2.end (); twoHopNeigh ++)
+ for (TwoHopNeighborSet::iterator twoHopNeigh = N2.begin (); twoHopNeigh != N2.end (); twoHopNeigh++)
{
if (twoHopNeigh->neighborMainAddr == neighborMainAddr)
{
@@ -555,7 +556,7 @@
}
else
{
- twoHopNeigh ++;
+ twoHopNeigh++;
}
}
}
@@ -568,12 +569,12 @@
RoutingProtocol::MprComputation()
{
NS_LOG_FUNCTION (this);
-
+
// MPR computation should be done for each interface. See section 8.3.1
// (RFC 3626) for details.
MprSet mprSet;
-
+
// N is the subset of neighbors of the node, which are
// neighbor "of the interface I"
NeighborSet N;
@@ -604,7 +605,7 @@
}
// excluding:
- // (i) the nodes only reachable by members of N with willingness WILL_NEVER
+ // (i) the nodes only reachable by members of N with willingness WILL_NEVER
bool ok = false;
for (NeighborSet::const_iterator neigh = N.begin ();
neigh != N.end (); neigh++)
@@ -627,7 +628,7 @@
{
continue;
}
-
+
// excluding:
// (iii) all the symmetric neighbors: the nodes for which there exists a symmetric
// link to this node on some interface.
@@ -677,7 +678,7 @@
CoverTwoHopNeighbors (neighbor->neighborMainAddr, N2);
}
}
-
+
// 2. Calculate D(y), where y is a member of N, for all nodes in N.
// (we do this later)
@@ -700,9 +701,9 @@
if (onlyOne)
{
NS_LOG_LOGIC ("Neighbor " << twoHopNeigh->neighborMainAddr
- << " is the only that can reach 2-hop neigh. "
- << twoHopNeigh->twoHopNeighborAddr
- << " => select as MPR.");
+ << " is the only that can reach 2-hop neigh. "
+ << twoHopNeigh->twoHopNeighborAddr
+ << " => select as MPR.");
mprSet.insert (twoHopNeigh->neighborMainAddr);
@@ -777,7 +778,7 @@
rs.insert (r);
reachability[r].push_back (&nb_tuple);
}
-
+
// 4.2. Select as a MPR the node with highest N_willingness among
// the nodes in N with non-zero reachability. In case of
// multiple choice select the node which provides
@@ -827,7 +828,7 @@
{
mprSet.insert (max->neighborMainAddr);
CoverTwoHopNeighbors (max->neighborMainAddr, N2);
- NS_LOG_LOGIC (N2.size () << " 2-hop neighbors left to cover!");
+ NS_LOG_LOGIC (N2.size () << " 2-hop neighbors left to cover!");
}
}
@@ -863,7 +864,7 @@
{
const IfaceAssocTuple *tuple =
m_state.FindIfaceAssocTuple (iface_addr);
-
+
if (tuple != NULL)
return tuple->mainAddr;
else
@@ -877,7 +878,7 @@
RoutingProtocol::RoutingTableComputation ()
{
NS_LOG_DEBUG (Simulator::Now ().GetSeconds () << " s: Node " << m_mainAddress
- << ": RoutingTableComputation begin...");
+ << ": RoutingTableComputation begin...");
// 1. All the entries from the routing table are removed.
Clear ();
@@ -900,12 +901,12 @@
{
LinkTuple const &link_tuple = *it2;
NS_LOG_DEBUG ("Looking at link tuple: " << link_tuple
- << (link_tuple.time >= Simulator::Now ()? "" : " (expired)"));
+ << (link_tuple.time >= Simulator::Now () ? "" : " (expired)"));
if ((GetMainAddress (link_tuple.neighborIfaceAddr) == nb_tuple.neighborMainAddr)
&& link_tuple.time >= Simulator::Now ())
{
NS_LOG_LOGIC ("Link tuple matches neighbor " << nb_tuple.neighborMainAddr
- << " => adding routing table entry to neighbor");
+ << " => adding routing table entry to neighbor");
lt = &link_tuple;
AddEntry (link_tuple.neighborIfaceAddr,
link_tuple.neighborIfaceAddr,
@@ -919,9 +920,9 @@
else
{
NS_LOG_LOGIC ("Link tuple: linkMainAddress= " << GetMainAddress (link_tuple.neighborIfaceAddr)
- << "; neighborMainAddr = " << nb_tuple.neighborMainAddr
- << "; expired=" << int (link_tuple.time < Simulator::Now ())
- << " => IGNORE");
+ << "; neighborMainAddr = " << nb_tuple.neighborMainAddr
+ << "; expired=" << int (link_tuple.time < Simulator::Now ())
+ << " => IGNORE");
}
}
@@ -945,7 +946,7 @@
}
}
}
-
+
// 3. for each node in N2, i.e., a 2-hop neighbor which is not a
// neighbor node or the node itself, and such that there exist at
// least one entry in the 2-hop neighbor set where
@@ -994,7 +995,7 @@
<< ", which was not found in the Neighbor Set.");
continue;
}
-
+
// one selects one 2-hop tuple and creates one entry in the routing table with:
// R_dest_addr = the main address of the 2-hop neighbor;
// R_next_addr = the R_next_addr of the entry in the
@@ -1012,9 +1013,9 @@
{
NS_LOG_LOGIC ("Adding routing entry for two-hop neighbor.");
AddEntry (nb2hop_tuple.twoHopNeighborAddr,
- entry.nextAddr,
- entry.interface,
- 2);
+ entry.nextAddr,
+ entry.interface,
+ 2);
}
else
{
@@ -1023,11 +1024,11 @@
<< " not found in the routing table)");
}
}
-
+
for (uint32_t h = 2; ; h++)
{
bool added = false;
-
+
// 3.1. For each topology entry in the topology table, if its
// T_dest_addr does not correspond to R_dest_addr of any
// route entry in the routing table AND its T_last_addr
@@ -1067,12 +1068,12 @@
{
NS_LOG_LOGIC ("NOT adding routing table entry based on the topology tuple: "
"have_destAddrEntry=" << have_destAddrEntry
- << " have_lastAddrEntry=" << have_lastAddrEntry
- << " lastAddrEntry.distance=" << (int) lastAddrEntry.distance
- << " (h=" << h << ")");
+ << " have_lastAddrEntry=" << have_lastAddrEntry
+ << " lastAddrEntry.distance=" << (int) lastAddrEntry.distance
+ << " (h=" << h << ")");
}
}
-
+
if (!added)
break;
}
@@ -1116,35 +1117,35 @@
{
AssociationTuple const &tuple = *it;
- // Test if HNA associations received from other gateways
- // are also announced by this node. In such a case, no route
- // is created for this association tuple (go to the next one).
- bool goToNextAssociationTuple = false;
- const Associations &localHnaAssociations = m_state.GetAssociations ();
- NS_LOG_DEBUG ("Nb local associations: " << localHnaAssociations.size ());
- for (Associations::const_iterator assocIterator = localHnaAssociations.begin ();
- assocIterator != localHnaAssociations.end (); assocIterator++)
- {
- Association const &localHnaAssoc = *assocIterator;
- if (localHnaAssoc.networkAddr == tuple.networkAddr && localHnaAssoc.netmask == tuple.netmask)
- {
- NS_LOG_DEBUG ("HNA association received from another GW is part of local HNA associations: no route added for network "
- << tuple.networkAddr << "/" << tuple.netmask);
- goToNextAssociationTuple = true;
- }
- }
- if (goToNextAssociationTuple)
+ // Test if HNA associations received from other gateways
+ // are also announced by this node. In such a case, no route
+ // is created for this association tuple (go to the next one).
+ bool goToNextAssociationTuple = false;
+ const Associations &localHnaAssociations = m_state.GetAssociations ();
+ NS_LOG_DEBUG ("Nb local associations: " << localHnaAssociations.size ());
+ for (Associations::const_iterator assocIterator = localHnaAssociations.begin ();
+ assocIterator != localHnaAssociations.end (); assocIterator++)
+ {
+ Association const &localHnaAssoc = *assocIterator;
+ if (localHnaAssoc.networkAddr == tuple.networkAddr && localHnaAssoc.netmask == tuple.netmask)
{
- continue;
+ NS_LOG_DEBUG ("HNA association received from another GW is part of local HNA associations: no route added for network "
+ << tuple.networkAddr << "/" << tuple.netmask);
+ goToNextAssociationTuple = true;
}
-
+ }
+ if (goToNextAssociationTuple)
+ {
+ continue;
+ }
+
RoutingTableEntry gatewayEntry;
-
+
bool gatewayEntryExists = Lookup (tuple.gatewayAddr, gatewayEntry);
bool addRoute = false;
-
+
uint32_t routeIndex = 0;
-
+
for (routeIndex = 0; routeIndex < m_hnaRoutingTable->GetNRoutes (); routeIndex++)
{
Ipv4RoutingTableEntry route = m_hnaRoutingTable->GetRoute (routeIndex);
@@ -1154,7 +1155,7 @@
break;
}
}
-
+
if (routeIndex == m_hnaRoutingTable->GetNRoutes ())
{
addRoute = true;
@@ -1164,7 +1165,7 @@
m_hnaRoutingTable->RemoveRoute(routeIndex);
addRoute = true;
}
-
+
if(addRoute && gatewayEntryExists)
{
m_hnaRoutingTable->AddNetworkRouteTo (tuple.networkAddr,
@@ -1172,7 +1173,7 @@
gatewayEntry.nextAddr,
gatewayEntry.interface,
gatewayEntry.distance);
-
+
}
}
@@ -1193,11 +1194,11 @@
///
void
RoutingProtocol::ProcessHello (const olsr::MessageHeader &msg,
- const Ipv4Address &receiverIface,
- const Ipv4Address &senderIface)
+ const Ipv4Address &receiverIface,
+ const Ipv4Address &senderIface)
{
NS_LOG_FUNCTION (msg << receiverIface << senderIface);
-
+
const olsr::MessageHeader::Hello &hello = msg.GetHello ();
LinkSensing (msg, hello, receiverIface, senderIface);
@@ -1256,7 +1257,7 @@
///
void
RoutingProtocol::ProcessTc (const olsr::MessageHeader &msg,
- const Ipv4Address &senderIface)
+ const Ipv4Address &senderIface)
{
const olsr::MessageHeader::Tc &tc = msg.GetTc ();
Time now = Simulator::Now ();
@@ -1268,8 +1269,8 @@
return;
// 2. If there exist some tuple in the topology set where:
- // T_last_addr == originator address AND
- // T_seq > ANSN,
+ // T_last_addr == originator address AND
+ // T_seq > ANSN,
// then further processing of this TC message MUST NOT be
// performed.
const TopologyTuple *topologyTuple =
@@ -1290,10 +1291,10 @@
{
const Ipv4Address &addr = *i;
// 4.1. If there exist some tuple in the topology set where:
- // T_dest_addr == advertised neighbor main address, AND
- // T_last_addr == originator address,
+ // T_dest_addr == advertised neighbor main address, AND
+ // T_last_addr == originator address,
// then the holding time of that tuple MUST be set to:
- // T_time = current time + validity time.
+ // T_time = current time + validity time.
TopologyTuple *topologyTuple =
m_state.FindTopologyTuple (addr, msg.GetOriginatorAddress ());
@@ -1351,11 +1352,11 @@
///
void
RoutingProtocol::ProcessMid (const olsr::MessageHeader &msg,
- const Ipv4Address &senderIface)
+ const Ipv4Address &senderIface)
{
const olsr::MessageHeader::Mid &mid = msg.GetMid ();
Time now = Simulator::Now ();
-
+
NS_LOG_DEBUG ("Node " << m_mainAddress << " ProcessMid from " << senderIface);
// 1. If the sender interface of this message is not in the symmetric
// 1-hop neighborhood of this node, the message MUST be discarded.
@@ -1430,26 +1431,26 @@
///
void
RoutingProtocol::ProcessHna (const olsr::MessageHeader &msg,
- const Ipv4Address &senderIface)
+ const Ipv4Address &senderIface)
{
const olsr::MessageHeader::Hna &hna = msg.GetHna ();
Time now = Simulator::Now ();
-
+
// 1. If the sender interface of this message is not in the symmetric
// 1-hop neighborhood of this node, the message MUST be discarded.
const LinkTuple *link_tuple = m_state.FindSymLinkTuple (senderIface, now);
if (link_tuple == NULL)
return;
-
+
// 2. Otherwise, for each (network address, netmask) pair in the
// message:
-
+
for (std::vector<olsr::MessageHeader::Hna::Association>::const_iterator it = hna.associations.begin();
it != hna.associations.end() ; it++)
{
AssociationTuple *tuple = m_state.FindAssociationTuple(msg.GetOriginatorAddress(),it->address,it->mask);
-
+
// 2.1 if an entry in the association set already exists, where:
// A_gateway_addr == originator address
// A_network_addr == network address
@@ -1460,7 +1461,7 @@
{
tuple->expirationTime = now + msg.GetVTime ();
}
-
+
// 2.2 otherwise, a new tuple MUST be recorded with:
// A_gateway_addr = originator address
// A_network_addr = network address
@@ -1475,13 +1476,13 @@
now + msg.GetVTime ()
};
AddAssociationTuple (assocTuple);
-
+
//Schedule Association Tuple deletion
Simulator::Schedule (DELAY (assocTuple.expirationTime),
&RoutingProtocol::AssociationTupleTimerExpire, this,
assocTuple.gatewayAddr,assocTuple.networkAddr,assocTuple.netmask);
}
-
+
}
}
@@ -1498,12 +1499,12 @@
///
void
RoutingProtocol::ForwardDefault (olsr::MessageHeader olsrMessage,
- DuplicateTuple *duplicated,
- const Ipv4Address &localIface,
- const Ipv4Address &senderAddress)
+ DuplicateTuple *duplicated,
+ const Ipv4Address &localIface,
+ const Ipv4Address &senderAddress)
{
Time now = Simulator::Now ();
-
+
// If the sender interface address is not in the symmetric
// 1-hop neighborhood the message must not be forwarded
const LinkTuple *linkTuple = m_state.FindSymLinkTuple (senderAddress, now);
@@ -1584,7 +1585,7 @@
void
RoutingProtocol::SendPacket (Ptr<Packet> packet,
- const MessageList &containedMessages)
+ const MessageList &containedMessages)
{
NS_LOG_DEBUG ("OLSR node " << m_mainAddress << " sending a OLSR packet");
@@ -1598,8 +1599,8 @@
m_txPacketTrace (header, containedMessages);
// Send it
- for (std::map<Ptr<Socket> , Ipv4InterfaceAddress>::const_iterator i =
- m_socketAddresses.begin (); i != m_socketAddresses.end (); i++)
+ for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator i =
+ m_socketAddresses.begin (); i != m_socketAddresses.end (); i++)
{
Ipv4Address bcast = i->second.GetLocal ().GetSubnetDirectedBroadcast (i->second.GetMask ());
i->first->SendTo (packet, 0, InetSocketAddress (bcast, OLSR_PORT_NUMBER));
@@ -1656,7 +1657,7 @@
RoutingProtocol::SendHello ()
{
NS_LOG_FUNCTION (this);
-
+
olsr::MessageHeader msg;
Time now = Simulator::Now ();
@@ -1671,7 +1672,7 @@
hello.willingness = m_willingness;
std::vector<olsr::MessageHeader::Hello::LinkMessage>
- &linkMessages = hello.linkMessages;
+ &linkMessages = hello.linkMessages;
const LinkSet &links = m_state.GetLinks ();
for (LinkSet::const_iterator link_tuple = links.begin ();
@@ -1684,7 +1685,7 @@
}
uint8_t link_type, nb_type = 0xff;
-
+
// Establishes link type
if (link_tuple->symTime >= now)
{
@@ -1703,7 +1704,7 @@
{
nb_type = OLSR_MPR_NEIGH;
NS_LOG_DEBUG ("I consider neighbor " << GetMainAddress (link_tuple->neighborIfaceAddr)
- << " to be MPR_NEIGH.");
+ << " to be MPR_NEIGH.");
}
else
{
@@ -1717,14 +1718,14 @@
if (nb_tuple->status == NeighborTuple::STATUS_SYM)
{
NS_LOG_DEBUG ("I consider neighbor " << GetMainAddress (link_tuple->neighborIfaceAddr)
- << " to be SYM_NEIGH.");
+ << " to be SYM_NEIGH.");
nb_type = OLSR_SYM_NEIGH;
}
else if (nb_tuple->status == NeighborTuple::STATUS_NOT_SYM)
{
nb_type = OLSR_NOT_NEIGH;
NS_LOG_DEBUG ("I consider neighbor " << GetMainAddress (link_tuple->neighborIfaceAddr)
- << " to be NOT_NEIGH.");
+ << " to be NOT_NEIGH.");
}
else
{
@@ -1744,19 +1745,19 @@
olsr::MessageHeader::Hello::LinkMessage linkMessage;
linkMessage.linkCode = (link_type & 0x03) | ((nb_type << 2) & 0x0f);
linkMessage.neighborInterfaceAddresses.push_back
- (link_tuple->neighborIfaceAddr);
+ (link_tuple->neighborIfaceAddr);
std::vector<Ipv4Address> interfaces =
m_state.FindNeighborInterfaces (link_tuple->neighborIfaceAddr);
linkMessage.neighborInterfaceAddresses.insert
- (linkMessage.neighborInterfaceAddresses.end (),
- interfaces.begin (), interfaces.end ());
+ (linkMessage.neighborInterfaceAddresses.end (),
+ interfaces.begin (), interfaces.end ());
linkMessages.push_back (linkMessage);
}
NS_LOG_DEBUG ("OLSR HELLO message size: " << int (msg.GetSerializedSize ())
- << " (with " << int (linkMessages.size ()) << " link messages)");
+ << " (with " << int (linkMessages.size ()) << " link messages)");
QueueMessage (msg, JITTER);
}
@@ -1767,7 +1768,7 @@
RoutingProtocol::SendTc ()
{
NS_LOG_FUNCTION (this);
-
+
olsr::MessageHeader msg;
msg.SetVTime (OLSR_TOP_HOLD_TIME);
@@ -1775,10 +1776,10 @@
msg.SetTimeToLive (255);
msg.SetHopCount (0);
msg.SetMessageSequenceNumber (GetMessageSequenceNumber ());
-
+
olsr::MessageHeader::Tc &tc = msg.GetTc ();
tc.ansn = m_ansn;
-
+
for (MprSelectorSet::const_iterator mprsel_tuple = m_state.GetMprSelectors ().begin();
mprsel_tuple != m_state.GetMprSelectors ().end(); mprsel_tuple++)
{
@@ -1821,7 +1822,7 @@
}
if (mid.interfaceAddresses.size () == 0)
return;
-
+
msg.SetVTime (OLSR_MID_HOLD_TIME);
msg.SetOriginatorAddress (m_mainAddress);
msg.SetTimeToLive (255);
@@ -1846,23 +1847,23 @@
msg.SetHopCount (0);
msg.SetMessageSequenceNumber (GetMessageSequenceNumber ());
olsr::MessageHeader::Hna &hna = msg.GetHna ();
-
+
std::vector<olsr::MessageHeader::Hna::Association> &associations = hna.associations;
-
+
// Add all local HNA associations to the HNA message
const Associations &localHnaAssociations = m_state.GetAssociations ();
for (Associations::const_iterator it = localHnaAssociations.begin ();
- it != localHnaAssociations.end (); it++)
- {
- olsr::MessageHeader::Hna::Association assoc = {it->networkAddr, it->netmask};
- associations.push_back (assoc);
+ it != localHnaAssociations.end (); it++)
+ {
+ olsr::MessageHeader::Hna::Association assoc = { it->networkAddr, it->netmask};
+ associations.push_back (assoc);
}
// If there is no HNA associations to send, return without queuing the message
if (associations.size () == 0)
{
return;
}
-
+
// Else, queue the message to be sent later on
QueueMessage (msg, JITTER);
}
@@ -1890,7 +1891,7 @@
}
// If the tuple does not already exist, add it to the list of local HNA associations.
NS_LOG_INFO ("Adding HNA association for network " << networkAddr << "/" << netmask << ".");
- m_state.InsertAssociation ( (Association) {networkAddr, netmask} );
+ m_state.InsertAssociation ( (Association) { networkAddr, netmask} );
}
///
@@ -1902,7 +1903,7 @@
RoutingProtocol::RemoveHostNetworkAssociation (Ipv4Address networkAddr, Ipv4Mask netmask)
{
NS_LOG_INFO ("Removing HNA association for network " << networkAddr << "/" << netmask << ".");
- m_state.EraseAssociation ( (Association) {networkAddr, netmask} );
+ m_state.EraseAssociation ( (Association) { networkAddr, netmask} );
}
///
@@ -1948,7 +1949,7 @@
Ipv4RoutingTableEntry route = m_routingTableAssociation->GetRoute (i);
Ipv4Address destNetworkAddress = route.GetDestNetwork ();
Ipv4Mask destNetmask = route.GetDestNetworkMask ();
-
+
// If the outgoing interface for this route is a non-olsr interface,
if (UsesNonOlsrOutgoingInterface (route))
{
@@ -1979,16 +1980,16 @@
/// specification). Neighbor Set is also updated if needed.
void
RoutingProtocol::LinkSensing (const olsr::MessageHeader &msg,
- const olsr::MessageHeader::Hello &hello,
- const Ipv4Address &receiverIface,
- const Ipv4Address &senderIface)
+ const olsr::MessageHeader::Hello &hello,
+ const Ipv4Address &receiverIface,
+ const Ipv4Address &senderIface)
{
Time now = Simulator::Now ();
bool updated = false;
bool created = false;
NS_LOG_DEBUG ("@" << now.GetSeconds () << ": Olsr node " << m_mainAddress
- << ": LinkSensing(receiverIface=" << receiverIface
- << ", senderIface=" << senderIface << ") BEGIN");
+ << ": LinkSensing(receiverIface=" << receiverIface
+ << ", senderIface=" << senderIface << ") BEGIN");
NS_ASSERT (msg.GetVTime () > Seconds (0));
LinkTuple *link_tuple = m_state.FindLinkTuple (senderIface);
@@ -2053,7 +2054,7 @@
NS_LOG_LOGIC ("HELLO link code is invalid => IGNORING");
continue;
}
-
+
for (std::vector<Ipv4Address>::const_iterator neighIfaceAddr =
linkMessage->neighborInterfaceAddresses.begin ();
neighIfaceAddr != linkMessage->neighborInterfaceAddresses.end ();
@@ -2085,7 +2086,7 @@
else
{
NS_LOG_DEBUG (" \\-> *neighIfaceAddr (" << *neighIfaceAddr
- << " != receiverIface (" << receiverIface << ") => IGNORING!");
+ << " != receiverIface (" << receiverIface << ") => IGNORING!");
}
}
NS_LOG_DEBUG ("Link tuple updated: " << int (updated));
@@ -2106,7 +2107,7 @@
link_tuple->neighborIfaceAddr));
}
NS_LOG_DEBUG ("@" << now.GetSeconds () << ": Olsr node " << m_mainAddress
- << ": LinkSensing END");
+ << ": LinkSensing END");
}
///
@@ -2114,7 +2115,7 @@
/// HELLO message (following RFC 3626).
void
RoutingProtocol::PopulateNeighborSet (const olsr::MessageHeader &msg,
- const olsr::MessageHeader::Hello &hello)
+ const olsr::MessageHeader::Hello &hello)
{
NeighborTuple *nb_tuple = m_state.FindNeighborTuple (msg.GetOriginatorAddress ());
if (nb_tuple != NULL)
@@ -2129,7 +2130,7 @@
/// received HELLO message (following RFC 3626).
void
RoutingProtocol::PopulateTwoHopNeighborSet (const olsr::MessageHeader &msg,
- const olsr::MessageHeader::Hello &hello)
+ const olsr::MessageHeader::Hello &hello)
{
Time now = Simulator::Now ();
@@ -2144,8 +2145,8 @@
NS_LOG_LOGIC ("Link tuple ignored: "
"GetMainAddress (link_tuple->neighborIfaceAddr) != msg.GetOriginatorAddress ()");
NS_LOG_LOGIC ("(GetMainAddress(" << link_tuple->neighborIfaceAddr << "): "
- << GetMainAddress (link_tuple->neighborIfaceAddr)
- << "; msg.GetOriginatorAddress (): " << msg.GetOriginatorAddress ());
+ << GetMainAddress (link_tuple->neighborIfaceAddr)
+ << "; msg.GetOriginatorAddress (): " << msg.GetOriginatorAddress ());
continue;
}
@@ -2162,7 +2163,7 @@
int neighborType = (linkMessage->linkCode >> 2) & 0x3;
#ifdef NS3_LOG_ENABLE
const char *neighborTypeNames[3] = { "NOT_NEIGH", "SYM_NEIGH", "MPR_NEIGH" };
- const char *neighborTypeName = ((neighborType < 3)?
+ const char *neighborTypeName = ((neighborType < 3) ?
neighborTypeNames[neighborType]
: "(invalid value)");
NS_LOG_DEBUG ("Looking at Link Message from HELLO message: neighborType="
@@ -2193,7 +2194,7 @@
TwoHopNeighborTuple *nb2hop_tuple =
m_state.FindTwoHopNeighborTuple (msg.GetOriginatorAddress (), nb2hop_addr);
NS_LOG_LOGIC ("Adding the 2-hop neighbor"
- << (nb2hop_tuple? " (refreshing existing entry)" : ""));
+ << (nb2hop_tuple ? " (refreshing existing entry)" : ""));
if (nb2hop_tuple == NULL)
{
TwoHopNeighborTuple new_nb2hop_tuple;
@@ -2241,10 +2242,10 @@
/// received HELLO message (following RFC 3626).
void
RoutingProtocol::PopulateMprSelectorSet (const olsr::MessageHeader &msg,
- const olsr::MessageHeader::Hello &hello)
+ const olsr::MessageHeader::Hello &hello)
{
NS_LOG_FUNCTION (this);
-
+
Time now = Simulator::Now ();
typedef std::vector<olsr::MessageHeader::Hello::LinkMessage> LinkMessageVec;
@@ -2256,7 +2257,7 @@
if (nt == OLSR_MPR_NEIGH)
{
NS_LOG_DEBUG ("Processing a link message with neighbor type MPR_NEIGH");
-
+
for (std::vector<Ipv4Address>::const_iterator nb_iface_addr =
linkMessage->neighborInterfaceAddresses.begin ();
nb_iface_addr != linkMessage->neighborInterfaceAddresses.end ();
@@ -2265,7 +2266,7 @@
if (GetMainAddress (*nb_iface_addr) == m_mainAddress)
{
NS_LOG_DEBUG ("Adding entry to mpr selector set for neighbor " << *nb_iface_addr);
-
+
// We must create a new entry into the mpr selector set
MprSelectorTuple *existing_mprsel_tuple =
m_state.FindMprSelectorTuple (msg.GetOriginatorAddress ());
@@ -2279,9 +2280,9 @@
// Schedules mpr selector tuple deletion
m_events.Track (Simulator::Schedule
- (DELAY (mprsel_tuple.expirationTime),
- &RoutingProtocol::MprSelTupleTimerExpire, this,
- mprsel_tuple.mainAddr));
+ (DELAY (mprsel_tuple.expirationTime),
+ &RoutingProtocol::MprSelTupleTimerExpire, this,
+ mprsel_tuple.mainAddr));
}
else
{
@@ -2305,27 +2306,27 @@
///
void
OLSR::mac_failed(Ptr<Packet> p) {
- double now = Simulator::Now ();
- struct hdr_ip* ih = HDR_IP(p);
- struct hdr_cmn* ch = HDR_CMN(p);
+ double now = Simulator::Now ();
+ struct hdr_ip* ih = HDR_IP(p);
+ struct hdr_cmn* ch = HDR_CMN(p);
- debug("%f: Node %d MAC Layer detects a breakage on link to %d\n",
- now,
- OLSR::node_id(ra_addr()),
- OLSR::node_id(ch->next_hop()));
+ debug("%f: Node %d MAC Layer detects a breakage on link to %d\n",
+ now,
+ OLSR::node_id(ra_addr()),
+ OLSR::node_id(ch->next_hop()));
- if ((u_int32_t)ih->daddr() == IP_BROADCAST) {
- drop(p, DROP_RTR_MAC_CALLBACK);
- return;
- }
+ if ((u_int32_t)ih->daddr() == IP_BROADCAST) {
+ drop(p, DROP_RTR_MAC_CALLBACK);
+ return;
+ }
- OLSR_link_tuple* link_tuple = state_.find_link_tuple(ch->next_hop());
- if (link_tuple != NULL) {
- link_tuple->lost_time() = now + OLSR_NEIGHB_HOLD_TIME;
- link_tuple->time() = now + OLSR_NEIGHB_HOLD_TIME;
- nb_loss(link_tuple);
- }
- drop(p, DROP_RTR_MAC_CALLBACK);
+ OLSR_link_tuple* link_tuple = state_.find_link_tuple(ch->next_hop());
+ if (link_tuple != NULL) {
+ link_tuple->lost_time() = now + OLSR_NEIGHB_HOLD_TIME;
+ link_tuple->time() = now + OLSR_NEIGHB_HOLD_TIME;
+ nb_loss(link_tuple);
+ }
+ drop(p, DROP_RTR_MAC_CALLBACK);
}
#endif
@@ -2348,7 +2349,7 @@
LinkTupleUpdated (tuple, OLSR_WILL_DEFAULT);
m_state.EraseTwoHopNeighborTuples (GetMainAddress (tuple.neighborIfaceAddr));
m_state.EraseMprSelectorTuples (GetMainAddress (tuple.neighborIfaceAddr));
-
+
MprComputation ();
RoutingTableComputation ();
}
@@ -2361,11 +2362,11 @@
void
RoutingProtocol::AddDuplicateTuple (const DuplicateTuple &tuple)
{
- /*debug("%f: Node %d adds dup tuple: addr = %d seq_num = %d\n",
- Simulator::Now (),
- OLSR::node_id(ra_addr()),
- OLSR::node_id(tuple->addr()),
- tuple->seq_num());*/
+ /*debug("%f: Node %d adds dup tuple: addr = %d seq_num = %d\n",
+ Simulator::Now (),
+ OLSR::node_id(ra_addr()),
+ OLSR::node_id(tuple->addr()),
+ tuple->seq_num());*/
m_state.InsertDuplicateTuple (tuple);
}
@@ -2439,7 +2440,7 @@
NeighborTuple *nb_tuple =
m_state.FindNeighborTuple (GetMainAddress (tuple.neighborIfaceAddr));
-
+
if (nb_tuple == NULL)
{
LinkTupleAdded (tuple, willingness);
@@ -2471,13 +2472,13 @@
{
nb_tuple->status = NeighborTuple::STATUS_SYM;
NS_LOG_DEBUG (*nb_tuple << "->status = STATUS_SYM; changed:"
- << int (statusBefore != nb_tuple->status));
+ << int (statusBefore != nb_tuple->status));
}
else
{
nb_tuple->status = NeighborTuple::STATUS_NOT_SYM;
NS_LOG_DEBUG (*nb_tuple << "->status = STATUS_NOT_SYM; changed:"
- << int (statusBefore != nb_tuple->status));
+ << int (statusBefore != nb_tuple->status));
}
}
else
@@ -2499,7 +2500,7 @@
// OLSR::node_id(ra_addr()),
// OLSR::node_id(tuple->neighborMainAddr),
// ((tuple->status() == OLSR_STATUS_SYM) ? "sym" : "not_sym"));
-
+
m_state.InsertNeighborTuple (tuple);
IncrementAnsn ();
}
@@ -2535,7 +2536,7 @@
// OLSR::node_id(ra_addr()),
// OLSR::node_id(tuple->neighborMainAddr),
// OLSR::node_id(tuple->twoHopNeighborAddr));
-
+
m_state.InsertTwoHopNeighborTuple (tuple);
}
@@ -2576,7 +2577,7 @@
// Simulator::Now (),
// OLSR::node_id(ra_addr()),
// OLSR::node_id(tuple->main_addr()));
-
+
m_state.InsertMprSelectorTuple (tuple);
IncrementAnsn ();
}
@@ -2595,7 +2596,7 @@
// Simulator::Now (),
// OLSR::node_id(ra_addr()),
// OLSR::node_id(tuple->main_addr()));
-
+
m_state.EraseMprSelectorTuple (tuple);
IncrementAnsn ();
}
@@ -2995,7 +2996,7 @@
///
bool
RoutingProtocol::Lookup (Ipv4Address const &dest,
- RoutingTableEntry &outEntry) const
+ RoutingTableEntry &outEntry) const
{
// Get the iterator at "dest" position
std::map<Ipv4Address, RoutingTableEntry>::const_iterator it =
@@ -3025,7 +3026,7 @@
///
bool
RoutingProtocol::FindSendEntry (RoutingTableEntry const &entry,
- RoutingTableEntry &outEntry) const
+ RoutingTableEntry &outEntry) const
{
outEntry = entry;
while (outEntry.destAddr != outEntry.nextAddr)
@@ -3038,12 +3039,12 @@
Ptr<Ipv4Route>
RoutingProtocol::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr)
-{
+{
NS_LOG_FUNCTION (this << " " << m_ipv4->GetObject<Node> ()->GetId() << " " << header.GetDestination () << " " << oif);
Ptr<Ipv4Route> rtentry;
RoutingTableEntry entry1, entry2;
bool found = false;
-
+
if (Lookup (header.GetDestination (), entry1) != 0)
{
bool foundSendEntry = FindSendEntry (entry1, entry2);
@@ -3058,10 +3059,10 @@
// if the caller specifies the oif; we just enforce that
// that the found route matches the requested outbound interface
NS_LOG_DEBUG ("Olsr node " << m_mainAddress
- << ": RouteOutput for dest=" << header.GetDestination ()
- << " Route interface " << interfaceIdx
- << " does not match requested output interface "
- << m_ipv4->GetInterfaceForDevice (oif));
+ << ": RouteOutput for dest=" << header.GetDestination ()
+ << " Route interface " << interfaceIdx
+ << " does not match requested output interface "
+ << m_ipv4->GetInterfaceForDevice (oif));
sockerr = Socket::ERROR_NOROUTETOHOST;
return rtentry;
}
@@ -3070,54 +3071,54 @@
// the source address is the interface address that matches
// the destination address (when multiple are present on the
// outgoing interface, one is selected via scoping rules)
- NS_ASSERT (m_ipv4);
+ NS_ASSERT (m_ipv4);
uint32_t numOifAddresses = m_ipv4->GetNAddresses (interfaceIdx);
NS_ASSERT (numOifAddresses > 0);
Ipv4InterfaceAddress ifAddr;
if (numOifAddresses == 1) {
- ifAddr = m_ipv4->GetAddress (interfaceIdx, 0);
- } else {
- NS_FATAL_ERROR ("XXX Not implemented yet: IP aliasing and OLSR");
- }
+ ifAddr = m_ipv4->GetAddress (interfaceIdx, 0);
+ } else {
+ NS_FATAL_ERROR ("XXX Not implemented yet: IP aliasing and OLSR");
+ }
rtentry->SetSource (ifAddr.GetLocal ());
rtentry->SetGateway (entry2.nextAddr);
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
sockerr = Socket::ERROR_NOTERROR;
NS_LOG_DEBUG ("Olsr node " << m_mainAddress
- << ": RouteOutput for dest=" << header.GetDestination ()
- << " --> nextHop=" << entry2.nextAddr
- << " interface=" << entry2.interface);
+ << ": RouteOutput for dest=" << header.GetDestination ()
+ << " --> nextHop=" << entry2.nextAddr
+ << " interface=" << entry2.interface);
NS_LOG_DEBUG ("Found route to " << rtentry->GetDestination () << " via nh " << rtentry->GetGateway () << " with source addr " << rtentry->GetSource () << " and output dev " << rtentry->GetOutputDevice());
found = true;
}
else
{
rtentry = m_hnaRoutingTable->RouteOutput (p, header, oif, sockerr);
-
+
if (rtentry)
{
found = true;
NS_LOG_DEBUG ("Found route to " << rtentry->GetDestination () << " via nh " << rtentry->GetGateway () << " with source addr " << rtentry->GetSource () << " and output dev " << rtentry->GetOutputDevice());
}
}
-
+
if (!found)
{
NS_LOG_DEBUG ("Olsr node " << m_mainAddress
- << ": RouteOutput for dest=" << header.GetDestination ()
- << " No route to host");
+ << ": RouteOutput for dest=" << header.GetDestination ()
+ << " No route to host");
sockerr = Socket::ERROR_NOROUTETOHOST;
}
return rtentry;
}
bool RoutingProtocol::RouteInput (Ptr<const Packet> p,
- const Ipv4Header &header, Ptr<const NetDevice> idev,
- UnicastForwardCallback ucb, MulticastForwardCallback mcb,
- LocalDeliverCallback lcb, ErrorCallback ecb)
-{
+ const Ipv4Header &header, Ptr<const NetDevice> idev,
+ UnicastForwardCallback ucb, MulticastForwardCallback mcb,
+ LocalDeliverCallback lcb, ErrorCallback ecb)
+{
NS_LOG_FUNCTION (this << " " << m_ipv4->GetObject<Node> ()->GetId() << " " << header.GetDestination ());
-
+
Ipv4Address dst = header.GetDestination ();
Ipv4Address origin = header.GetSource ();
@@ -3126,7 +3127,7 @@
{
return true;
}
-
+
// Local delivery
NS_ASSERT (m_ipv4->GetInterfaceForDevice (idev) >= 0);
uint32_t iif = m_ipv4->GetInterfaceForDevice (idev);
@@ -3148,7 +3149,7 @@
return false;
}
}
-
+
// Forwarding
Ptr<Ipv4Route> rtentry;
RoutingTableEntry entry1, entry2;
@@ -3168,19 +3169,19 @@
NS_ASSERT (numOifAddresses > 0);
Ipv4InterfaceAddress ifAddr;
if (numOifAddresses == 1) {
- ifAddr = m_ipv4->GetAddress (interfaceIdx, 0);
- } else {
- NS_FATAL_ERROR ("XXX Not implemented yet: IP aliasing and OLSR");
- }
+ ifAddr = m_ipv4->GetAddress (interfaceIdx, 0);
+ } else {
+ NS_FATAL_ERROR ("XXX Not implemented yet: IP aliasing and OLSR");
+ }
rtentry->SetSource (ifAddr.GetLocal ());
rtentry->SetGateway (entry2.nextAddr);
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
-
+
NS_LOG_DEBUG ("Olsr node " << m_mainAddress
- << ": RouteInput for dest=" << header.GetDestination ()
- << " --> nextHop=" << entry2.nextAddr
- << " interface=" << entry2.interface);
-
+ << ": RouteInput for dest=" << header.GetDestination ()
+ << " --> nextHop=" << entry2.nextAddr
+ << " interface=" << entry2.interface);
+
ucb (rtentry, p, header);
return true;
}
@@ -3192,19 +3193,19 @@
}
else
{
-
+
#ifdef NS3_LOG_ENABLE
NS_LOG_DEBUG ("Olsr node " << m_mainAddress
- << ": RouteInput for dest=" << header.GetDestination ()
- << " --> NOT FOUND; ** Dumping routing table...");
-
+ << ": RouteInput for dest=" << header.GetDestination ()
+ << " --> NOT FOUND; ** Dumping routing table...");
+
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator iter = m_table.begin ();
- iter != m_table.end (); iter++)
- {
- NS_LOG_DEBUG ("dest=" << iter->first << " --> next=" << iter->second.nextAddr
- << " via interface " << iter->second.interface);
- }
-
+ iter != m_table.end (); iter++)
+ {
+ NS_LOG_DEBUG ("dest=" << iter->first << " --> next=" << iter->second.nextAddr
+ << " via interface " << iter->second.interface);
+ }
+
NS_LOG_DEBUG ("** Routing table dump end.");
#endif // NS3_LOG_ENABLE
@@ -3238,9 +3239,9 @@
///
void
RoutingProtocol::AddEntry (Ipv4Address const &dest,
- Ipv4Address const &next,
- uint32_t interface,
- uint32_t distance)
+ Ipv4Address const &next,
+ uint32_t interface,
+ uint32_t distance)
{
NS_LOG_FUNCTION (this << dest << next << interface << distance << m_mainAddress);
@@ -3257,9 +3258,9 @@
void
RoutingProtocol::AddEntry (Ipv4Address const &dest,
- Ipv4Address const &next,
- Ipv4Address const &interfaceAddress,
- uint32_t distance)
+ Ipv4Address const &next,
+ Ipv4Address const &interfaceAddress,
+ uint32_t distance)
{
NS_LOG_FUNCTION (this << dest << next << interfaceAddress << distance << m_mainAddress);
@@ -3298,8 +3299,8 @@
bool
RoutingProtocol::IsMyOwnAddress (const Ipv4Address & a) const
{
- for (std::map<Ptr<Socket> , Ipv4InterfaceAddress>::const_iterator j =
- m_socketAddresses.begin (); j != m_socketAddresses.end (); ++j)
+ for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j =
+ m_socketAddresses.begin (); j != m_socketAddresses.end (); ++j)
{
Ipv4InterfaceAddress iface = j->second;
if (a == iface.GetLocal ())
@@ -3314,18 +3315,18 @@
RoutingProtocol::Dump (void)
{
Time now = Simulator::Now ();
-
+
#ifdef NS3_LOG_ENABLE
NS_LOG_DEBUG ("Dumping for node with main address " << m_mainAddress);
NS_LOG_DEBUG (" Neighbor set");
for (NeighborSet::const_iterator iter = m_state.GetNeighbors ().begin ();
- iter != m_state.GetNeighbors ().end (); iter++)
+ iter != m_state.GetNeighbors ().end (); iter++)
{
NS_LOG_DEBUG (" " << *iter);
}
NS_LOG_DEBUG (" Two-hop neighbor set");
for (TwoHopNeighborSet::const_iterator iter = m_state.GetTwoHopNeighbors ().begin ();
- iter != m_state.GetTwoHopNeighbors ().end (); iter++)
+ iter != m_state.GetTwoHopNeighbors ().end (); iter++)
{
if (now < iter->expirationTime)
{
@@ -3341,6 +3342,7 @@
#endif //NS3_LOG_ENABLE
}
-}} // namespace olsr, ns3
-
-
+}
+} // namespace olsr, ns3
+
+
--- a/src/olsr/model/olsr-routing-protocol.h Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/model/olsr-routing-protocol.h Fri May 13 14:58:13 2011 -0400
@@ -51,14 +51,14 @@
/// An %OLSR's routing table entry.
struct RoutingTableEntry
{
- Ipv4Address destAddr; ///< Address of the destination node.
- Ipv4Address nextAddr; ///< Address of the next hop.
+ Ipv4Address destAddr; ///< Address of the destination node.
+ Ipv4Address nextAddr; ///< Address of the next hop.
uint32_t interface; ///< Interface index
uint32_t distance; ///< Distance in hops to the destination.
RoutingTableEntry () : // default values
- destAddr (), nextAddr (),
- interface (0), distance (0) {};
+ destAddr (), nextAddr (),
+ interface (0), distance (0) {};
};
class RoutingProtocol;
@@ -105,9 +105,9 @@
public:
std::set<uint32_t> GetInterfaceExclusions () const
- {
- return m_interfaceExclusions;
- }
+ {
+ return m_interfaceExclusions;
+ }
void SetInterfaceExclusions (std::set<uint32_t> exceptions);
/// Inject Association to be sent in HNA message
@@ -133,7 +133,7 @@
uint16_t m_messageSequenceNumber;
/// Advertised Neighbor Set sequence number.
uint16_t m_ansn;
-
+
/// HELLO messages' emission interval.
Time m_helloInterval;
/// TC messages' emission interval.
@@ -299,6 +299,7 @@
};
-}} // namespace ns3
+}
+} // namespace ns3
#endif
--- a/src/olsr/model/olsr-state.cc Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/model/olsr-state.cc Fri May 13 14:58:13 2011 -0400
@@ -100,7 +100,7 @@
os << "]";
return os.str ();
}
-
+
/********** Neighbor Set Manipulation **********/
@@ -198,7 +198,7 @@
{
return &(*it);
}
- }
+ }
return NULL;
}
@@ -493,14 +493,14 @@
OlsrState::FindAssociationTuple (const Ipv4Address &gatewayAddr, const Ipv4Address &networkAddr, const Ipv4Mask &netmask)
{
for (AssociationSet::iterator it = m_associationSet.begin ();
- it != m_associationSet.end (); it++)
+ it != m_associationSet.end (); it++)
{
if (it->gatewayAddr == gatewayAddr and it->networkAddr == networkAddr and it->netmask == netmask)
{
return &(*it);
}
}
- return NULL;
+ return NULL;
}
void
--- a/src/olsr/model/olsr-state.h Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/model/olsr-state.h Fri May 13 14:58:13 2011 -0400
@@ -35,24 +35,24 @@
class OlsrState
{
// friend class Olsr;
-
+
protected:
- LinkSet m_linkSet; ///< Link Set (RFC 3626, section 4.2.1).
- NeighborSet m_neighborSet; ///< Neighbor Set (RFC 3626, section 4.3.1).
- TwoHopNeighborSet m_twoHopNeighborSet; ///< 2-hop Neighbor Set (RFC 3626, section 4.3.2).
- TopologySet m_topologySet; ///< Topology Set (RFC 3626, section 4.4).
- MprSet m_mprSet; ///< MPR Set (RFC 3626, section 4.3.3).
- MprSelectorSet m_mprSelectorSet; ///< MPR Selector Set (RFC 3626, section 4.3.4).
- DuplicateSet m_duplicateSet; ///< Duplicate Set (RFC 3626, section 3.4).
- IfaceAssocSet m_ifaceAssocSet; ///< Interface Association Set (RFC 3626, section 4.1).
+ LinkSet m_linkSet; ///< Link Set (RFC 3626, section 4.2.1).
+ NeighborSet m_neighborSet; ///< Neighbor Set (RFC 3626, section 4.3.1).
+ TwoHopNeighborSet m_twoHopNeighborSet; ///< 2-hop Neighbor Set (RFC 3626, section 4.3.2).
+ TopologySet m_topologySet; ///< Topology Set (RFC 3626, section 4.4).
+ MprSet m_mprSet; ///< MPR Set (RFC 3626, section 4.3.3).
+ MprSelectorSet m_mprSelectorSet; ///< MPR Selector Set (RFC 3626, section 4.3.4).
+ DuplicateSet m_duplicateSet; ///< Duplicate Set (RFC 3626, section 3.4).
+ IfaceAssocSet m_ifaceAssocSet; ///< Interface Association Set (RFC 3626, section 4.1).
AssociationSet m_associationSet; ///< Association Set (RFC 3626, section12.2). Associations obtained from HNA messages generated by other nodes.
- Associations m_associations; ///< The node's local Host Network Associations that will be advertised using HNA messages.
+ Associations m_associations; ///< The node's local Host Network Associations that will be advertised using HNA messages.
public:
OlsrState ()
{}
-
+
// MPR selector
const MprSelectorSet & GetMprSelectors () const
{
@@ -160,9 +160,9 @@
return m_associations;
}
- AssociationTuple* FindAssociationTuple (const Ipv4Address &gatewayAddr,\
- const Ipv4Address &networkAddr,\
- const Ipv4Mask &netmask);
+ AssociationTuple* FindAssociationTuple (const Ipv4Address &gatewayAddr, \
+ const Ipv4Address &networkAddr, \
+ const Ipv4Mask &netmask);
void EraseAssociationTuple (const AssociationTuple &tuple);
void InsertAssociationTuple (const AssociationTuple &tuple);
void EraseAssociation (const Association &tuple);
--- a/src/olsr/test/bug780-test.cc Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/test/bug780-test.cc Fri May 13 14:58:13 2011 -0400
@@ -44,7 +44,7 @@
/// Set to true to rewrite reference traces, leave false to run regression tests
namespace
{
- const bool WRITE_VECTORS = false;
+const bool WRITE_VECTORS = false;
}
@@ -79,14 +79,14 @@
{
SeedManager::SetSeed(123);
CreateNodes ();
-
+
Simulator::Stop (m_time);
Simulator::Run ();
Simulator::Destroy ();
-
+
if (!WRITE_VECTORS)
{
- CheckResults ();
+ CheckResults ();
}
}
@@ -116,8 +116,8 @@
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
- "DataMode",StringValue(phyMode),
- "ControlMode",StringValue(phyMode));
+ "DataMode",StringValue(phyMode),
+ "ControlMode",StringValue(phyMode));
//set the tx range to 300
wifiPhy.Set ("TxPowerStart",DoubleValue (-0.1615));
@@ -143,7 +143,7 @@
Ptr<ListPositionAllocator> positionAlloc_Adhoc =
CreateObject<ListPositionAllocator>();
double distance = 0.0;
- for (uint32_t i = 0;i <= adhocNodes.GetN();i++)
+ for (uint32_t i = 0; i <= adhocNodes.GetN(); i++)
{
positionAlloc_Adhoc->Add(Vector(distance,0.0,0.0));
distance += 250.0;
@@ -156,7 +156,7 @@
//At 50 sec node 3 moves towards node 2
Simulator::Schedule (Seconds (50.0), &SetVelocity, adhocNodes.Get(2),Vector(-5.0,0.0,0.0));
//AT 100 sec set node 3 with zero velocity
- Simulator::Schedule (Seconds (100.0), &SetVelocity, adhocNodes.Get(2) ,Vector(0.0,0.0,0.0));
+ Simulator::Schedule (Seconds (100.0), &SetVelocity, adhocNodes.Get(2),Vector(0.0,0.0,0.0));
//Move node2 away from node 3
Simulator::Schedule (Seconds (100.0), &SetVelocity, adhocNodes.Get(1),Vector(5.0,0.0,0.0));
//AT 150 sec set node 2 with zero velocity
@@ -185,11 +185,11 @@
// File naming conventions are hard-coded here.
os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-0.pcap";
os2 << GetTempDir () << PREFIX << "-" << i << "-0.pcap";
-
+
uint32_t sec(0), usec(0);
bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec);
NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str()
- << " differ starting from " << sec << " s " << usec << " us");
+ << " differ starting from " << sec << " s " << usec << " us");
}
}
--- a/src/olsr/test/hello-regression-test.cc Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/test/hello-regression-test.cc Fri May 13 14:58:13 2011 -0400
@@ -56,12 +56,12 @@
{
SeedManager::SetSeed(12345);
CreateNodes ();
-
+
Simulator::Stop (m_time);
Simulator::Run ();
Simulator::Destroy ();
-
- if (!WRITE_VECTORS) CheckResults ();
+
+ if (!WRITE_VECTORS) CheckResults ();
}
void
@@ -98,11 +98,11 @@
// File naming conventions are hard-coded here.
os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-1.pcap";
os2 << GetTempDir () << PREFIX << "-" << i << "-1.pcap";
-
+
uint32_t sec(0), usec(0);
bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec);
NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str()
- << " differ starting from " << sec << " s " << usec << " us");
+ << " differ starting from " << sec << " s " << usec << " us");
}
}
--- a/src/olsr/test/hello-regression-test.h Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/test/hello-regression-test.h Fri May 13 14:58:13 2011 -0400
@@ -37,7 +37,7 @@
*
* Expected trace (5 seconds):
\verbatim
- 1 2
+ 1 2
|------>| HELLO (empty) src = 10.1.1.1
|<------| HELLO (empty) src = 10.1.1.2
|------>| HELLO (Link type: Asymmetric link, Neighbor address: 10.1.1.2) src = 10.1.1.1
--- a/src/olsr/test/olsr-header-test-suite.cc Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/test/olsr-header-test-suite.cc Fri May 13 14:58:13 2011 -0400
@@ -32,7 +32,8 @@
OlsrEmfTestCase::OlsrEmfTestCase ()
: TestCase ("Check Emf olsr time conversion")
-{}
+{
+}
void
OlsrEmfTestCase::DoRun (void)
{
@@ -54,7 +55,8 @@
OlsrMidTestCase::OlsrMidTestCase ()
: TestCase ("Check Mid olsr messages")
-{}
+{
+}
void
OlsrMidTestCase::DoRun (void)
{
@@ -66,7 +68,7 @@
olsr::MessageHeader::Mid &mid1 = msg1.GetMid ();
olsr::MessageHeader msg2;
olsr::MessageHeader::Mid &mid2 = msg2.GetMid ();
-
+
// MID message #1
{
std::vector<Ipv4Address> &addresses = mid1.interfaceAddresses;
@@ -97,13 +99,13 @@
// Build an OLSR packet header
hdr.SetPacketLength (hdr.GetSerializedSize () + msg1.GetSerializedSize () + msg2.GetSerializedSize ());
hdr.SetPacketSequenceNumber (123);
-
+
// Now add all the headers in the correct order
packet.AddHeader (msg2);
packet.AddHeader (msg1);
packet.AddHeader (hdr);
- }
+ }
{
olsr::PacketHeader hdr;
@@ -112,9 +114,9 @@
uint32_t sizeLeft = hdr.GetPacketLength () - hdr.GetSerializedSize ();
{
olsr::MessageHeader msg1;
-
+
packet.RemoveHeader (msg1);
-
+
NS_TEST_ASSERT_MSG_EQ (msg1.GetTimeToLive (), 255, "XXX");
NS_TEST_ASSERT_MSG_EQ (msg1.GetOriginatorAddress (), Ipv4Address ("11.22.33.44"), "XXX");
NS_TEST_ASSERT_MSG_EQ (msg1.GetVTime (), Seconds (9), "XXX");
@@ -133,7 +135,7 @@
olsr::MessageHeader msg2;
packet.RemoveHeader (msg2);
-
+
NS_TEST_ASSERT_MSG_EQ (msg2.GetTimeToLive (), 254, "XXX");
NS_TEST_ASSERT_MSG_EQ (msg2.GetOriginatorAddress (), Ipv4Address ("12.22.33.44"), "XXX");
NS_TEST_ASSERT_MSG_EQ (msg2.GetVTime (), Seconds (10), "XXX");
@@ -159,7 +161,8 @@
OlsrHelloTestCase::OlsrHelloTestCase ()
: TestCase ("Check Hello olsr messages")
-{}
+{
+}
void
OlsrHelloTestCase::DoRun (void)
{
@@ -176,7 +179,7 @@
lm1.neighborInterfaceAddresses.push_back (Ipv4Address ("1.2.3.4"));
lm1.neighborInterfaceAddresses.push_back (Ipv4Address ("1.2.3.5"));
helloIn.linkMessages.push_back (lm1);
-
+
olsr::MessageHeader::Hello::LinkMessage lm2;
lm2.linkCode = 3;
lm2.neighborInterfaceAddresses.push_back (Ipv4Address ("2.2.3.4"));
@@ -189,11 +192,11 @@
olsr::MessageHeader msgOut;
packet.RemoveHeader (msgOut);
olsr::MessageHeader::Hello &helloOut = msgOut.GetHello ();
-
+
NS_TEST_ASSERT_MSG_EQ (helloOut.GetHTime (), Seconds (7), "XXX");
NS_TEST_ASSERT_MSG_EQ (helloOut.willingness, 66, "XXX");
NS_TEST_ASSERT_MSG_EQ (helloOut.linkMessages.size (), 2, "XXX");
-
+
NS_TEST_ASSERT_MSG_EQ (helloOut.linkMessages[0].linkCode, 2, "XXX");
NS_TEST_ASSERT_MSG_EQ (helloOut.linkMessages[0].neighborInterfaceAddresses[0],
Ipv4Address ("1.2.3.4"), "XXX");
@@ -218,26 +221,27 @@
OlsrTcTestCase::OlsrTcTestCase ()
: TestCase ("Check Tc olsr messages")
-{}
+{
+}
void
OlsrTcTestCase::DoRun (void)
{
Packet packet;
olsr::MessageHeader msgIn;
olsr::MessageHeader::Tc &tcIn = msgIn.GetTc ();
-
+
tcIn.ansn = 0x1234;
tcIn.neighborAddresses.push_back (Ipv4Address ("1.2.3.4"));
tcIn.neighborAddresses.push_back (Ipv4Address ("1.2.3.5"));
packet.AddHeader (msgIn);
-
+
olsr::MessageHeader msgOut;
packet.RemoveHeader (msgOut);
olsr::MessageHeader::Tc &tcOut = msgOut.GetTc ();
-
+
NS_TEST_ASSERT_MSG_EQ (tcOut.ansn, 0x1234, "XXX");
NS_TEST_ASSERT_MSG_EQ (tcOut.neighborAddresses.size (), 2, "XXX");
-
+
NS_TEST_ASSERT_MSG_EQ (tcOut.neighborAddresses[0],
Ipv4Address ("1.2.3.4"), "XXX");
NS_TEST_ASSERT_MSG_EQ (tcOut.neighborAddresses[1],
@@ -255,7 +259,8 @@
OlsrHnaTestCase::OlsrHnaTestCase ()
: TestCase ("Check Hna olsr messages")
-{}
+{
+}
void
OlsrHnaTestCase::DoRun (void)
@@ -263,29 +268,29 @@
Packet packet;
olsr::MessageHeader msgIn;
olsr::MessageHeader::Hna &hnaIn = msgIn.GetHna ();
-
+
hnaIn.associations.push_back ((olsr::MessageHeader::Hna::Association)
{ Ipv4Address ("1.2.3.4"), Ipv4Mask ("255.255.255.0")});
hnaIn.associations.push_back ((olsr::MessageHeader::Hna::Association)
- {Ipv4Address ("1.2.3.5"), Ipv4Mask ("255.255.0.0")});
+ { Ipv4Address ("1.2.3.5"), Ipv4Mask ("255.255.0.0")});
packet.AddHeader (msgIn);
-
+
olsr::MessageHeader msgOut;
packet.RemoveHeader (msgOut);
olsr::MessageHeader::Hna &hnaOut = msgOut.GetHna ();
-
+
NS_TEST_ASSERT_MSG_EQ (hnaOut.associations.size (), 2, "XXX");
-
+
NS_TEST_ASSERT_MSG_EQ (hnaOut.associations[0].address,
- Ipv4Address ("1.2.3.4"), "XXX");
+ Ipv4Address ("1.2.3.4"), "XXX");
NS_TEST_ASSERT_MSG_EQ (hnaOut.associations[0].mask,
- Ipv4Mask ("255.255.255.0"), "XXX");
+ Ipv4Mask ("255.255.255.0"), "XXX");
NS_TEST_ASSERT_MSG_EQ (hnaOut.associations[1].address,
- Ipv4Address ("1.2.3.5"), "XXX");
+ Ipv4Address ("1.2.3.5"), "XXX");
NS_TEST_ASSERT_MSG_EQ (hnaOut.associations[1].mask,
- Ipv4Mask ("255.255.0.0"), "XXX");
-
+ Ipv4Mask ("255.255.0.0"), "XXX");
+
NS_TEST_ASSERT_MSG_EQ (packet.GetSize (), 0, "All bytes in packet were not read");
}
--- a/src/olsr/test/olsr-routing-protocol-test-suite.cc Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/test/olsr-routing-protocol-test-suite.cc Fri May 13 14:58:13 2011 -0400
@@ -27,15 +27,15 @@
/********** Willingness **********/
/// Willingness for forwarding packets from other nodes: never.
-#define OLSR_WILL_NEVER 0
+#define OLSR_WILL_NEVER 0
/// Willingness for forwarding packets from other nodes: low.
-#define OLSR_WILL_LOW 1
+#define OLSR_WILL_LOW 1
/// Willingness for forwarding packets from other nodes: medium.
-#define OLSR_WILL_DEFAULT 3
+#define OLSR_WILL_DEFAULT 3
/// Willingness for forwarding packets from other nodes: high.
-#define OLSR_WILL_HIGH 6
+#define OLSR_WILL_HIGH 6
/// Willingness for forwarding packets from other nodes: always.
-#define OLSR_WILL_ALWAYS 7
+#define OLSR_WILL_ALWAYS 7
namespace ns3 {
namespace olsr {
@@ -87,9 +87,9 @@
tuple.neighborMainAddr = Ipv4Address ("10.0.0.3");
tuple.twoHopNeighborAddr = Ipv4Address ("10.0.0.4");
protocol->m_state.InsertTwoHopNeighborTuple (tuple);
-
+
protocol->MprComputation ();
- NS_TEST_EXPECT_MSG_EQ (state.GetMprSet ().size (), 1 , "An only address must be chosen.");
+ NS_TEST_EXPECT_MSG_EQ (state.GetMprSet ().size (), 1, "An only address must be chosen.");
/*
* 1 -- 2 -- 5
* | |
@@ -103,7 +103,7 @@
protocol->MprComputation ();
MprSet mpr = state.GetMprSet ();
- NS_TEST_EXPECT_MSG_EQ (mpr.size (), 1 , "An only address must be chosen.");
+ NS_TEST_EXPECT_MSG_EQ (mpr.size (), 1, "An only address must be chosen.");
NS_TEST_EXPECT_MSG_EQ ((mpr.find ("10.0.0.2") != mpr.end ()), true, "Node 1 must select node 2 as MPR");
/*
* 1 -- 2 -- 5
@@ -120,7 +120,7 @@
protocol->MprComputation ();
mpr = state.GetMprSet ();
- NS_TEST_EXPECT_MSG_EQ (mpr.size (), 2 , "An only address must be chosen.");
+ NS_TEST_EXPECT_MSG_EQ (mpr.size (), 2, "An only address must be chosen.");
NS_TEST_EXPECT_MSG_EQ ((mpr.find ("10.0.0.2") != mpr.end ()), true, "Node 1 must select node 2 as MPR");
NS_TEST_EXPECT_MSG_EQ ((mpr.find ("10.0.0.3") != mpr.end ()), true, "Node 1 must select node 3 as MPR");
/*
@@ -140,7 +140,7 @@
protocol->MprComputation ();
mpr = state.GetMprSet ();
- NS_TEST_EXPECT_MSG_EQ (mpr.size (), 3 , "An only address must be chosen.");
+ NS_TEST_EXPECT_MSG_EQ (mpr.size (), 3, "An only address must be chosen.");
NS_TEST_EXPECT_MSG_EQ ((mpr.find ("10.0.0.7") != mpr.end ()), true, "Node 1 must select node 7 as MPR");
/*
* 7 <- WILL_ALWAYS
@@ -163,7 +163,7 @@
protocol->MprComputation ();
mpr = state.GetMprSet ();
- NS_TEST_EXPECT_MSG_EQ (mpr.size (), 3 , "An only address must be chosen.");
+ NS_TEST_EXPECT_MSG_EQ (mpr.size (), 3, "An only address must be chosen.");
NS_TEST_EXPECT_MSG_EQ ((mpr.find ("10.0.0.9") == mpr.end ()), true, "Node 1 must NOT select node 8 as MPR");
}
@@ -179,6 +179,7 @@
AddTestCase (new OlsrMprTestCase ());
}
-}} // namespace olsr, ns3
+}
+} // namespace olsr, ns3
--- a/src/olsr/test/tc-regression-test.h Fri May 13 14:57:56 2011 -0400
+++ b/src/olsr/test/tc-regression-test.h Fri May 13 14:58:13 2011 -0400
@@ -37,38 +37,38 @@
*
* Expected trace (20 seconds, note random b-cast jitter):
\verbatim
- 1 2 3
+ 1 2 3
|<------|------>| HELLO (empty) src = 10.1.1.2
| |<------|------> HELLO (empty) src = 10.1.1.3
<------|------>| | HELLO (empty) src = 10.1.1.1
<------|------>| | HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.2) src = 10.1.1.1
| |<------|------> HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.2) src = 10.1.1.3
|<------|------>| HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.3; Link Type: Asymmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
- |<------|------>| HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.3; Link Type: Asymmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
+ |<------|------>| HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.3; Link Type: Asymmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
<------|------>| | HELLO (Link Type: Symmetric, Neighbor: 10.1.1.2) src = 10.1.1.1
| |<------|------> HELLO (Link Type: Symmetric, Neighbor: 10.1.1.2) src = 10.1.1.3
- |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
+ |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
<------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
| |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
- |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
+ |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
<------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
| |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
- |<======|======>| TC (10.1.1.3; 10.1.1.1) + HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
+ |<======|======>| TC (10.1.1.3; 10.1.1.1) + HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
| |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
<------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
- |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
+ |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
<------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
| |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
<------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
| |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
- |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
- |<======|======>| TC (10.1.1.3; 10.1.1.1) src = 10.1.1.2
+ |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
+ |<======|======>| TC (10.1.1.3; 10.1.1.1) src = 10.1.1.2
| |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
<------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
- |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
+ |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
<------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
| |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
- |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
+ |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
\endverbatim
*/
class TcRegressionTest : public TestCase