/usr/include/ns3.26/ns3/olsr-routing-protocol.h is in libns3-dev 3.26+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 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 | /* -*- 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>
*/
#ifndef OLSR_AGENT_IMPL_H
#define OLSR_AGENT_IMPL_H
#include "olsr-header.h"
#include "ns3/test.h"
#include "olsr-state.h"
#include "olsr-repositories.h"
#include "ns3/object.h"
#include "ns3/packet.h"
#include "ns3/node.h"
#include "ns3/socket.h"
#include "ns3/event-garbage-collector.h"
#include "ns3/random-variable-stream.h"
#include "ns3/timer.h"
#include "ns3/traced-callback.h"
#include "ns3/ipv4.h"
#include "ns3/ipv4-routing-protocol.h"
#include "ns3/ipv4-static-routing.h"
#include <vector>
#include <map>
/// Testcase for MPR computation mechanism
class OlsrMprTestCase;
namespace ns3 {
namespace olsr {
///
/// \defgroup olsr OLSR Routing
/// This section documents the API of the ns-3 OLSR module. For a generic
/// functional description, please refer to the ns-3 manual.
/// \ingroup olsr
/// An %OLSR's routing table entry.
struct RoutingTableEntry
{
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)
{
}
};
class RoutingProtocol;
///
/// \ingroup olsr
///
/// \brief OLSR routing protocol for IPv4
///
class RoutingProtocol : public Ipv4RoutingProtocol
{
public:
friend class ::OlsrMprTestCase;
/**
* \brief Get the type ID.
* \return The object TypeId.
*/
static TypeId GetTypeId (void);
RoutingProtocol ();
virtual ~RoutingProtocol ();
/**
* \brief Set the OLSR main address to the first address on the indicated interface.
*
* \param interface IPv4 interface index
*/
void SetMainInterface (uint32_t interface);
/**
* Dump the neighbor table, two-hop neighbor table, and routing table
* to logging output (NS_LOG_DEBUG log level). If logging is disabled,
* this function does nothing.
*/
void Dump (void);
/**
* Return the list of routing table entries discovered by OLSR
*/
std::vector<RoutingTableEntry> GetRoutingTableEntries () const;
/**
* Assign a fixed random variable stream number to the random variables
* used by this model. Return the number of streams (possibly zero) that
* have been assigned.
*
* \param stream first stream index to use
* \return the number of stream indices assigned by this model
*/
int64_t AssignStreams (int64_t stream);
/**
* TracedCallback signature for Packet transmit and receive events.
*
* \param [in] header
* \param [in] messages
*/
typedef void (* PacketTxRxTracedCallback)(const PacketHeader & header, const MessageList & messages);
/**
* TracedCallback signature for routing table computation.
*
* \param [in] size Final routing table size.
*/
typedef void (* TableChangeTracedCallback) (uint32_t size);
private:
std::set<uint32_t> m_interfaceExclusions; //!< Set of interfaces excluded by OSLR.
Ptr<Ipv4StaticRouting> m_routingTableAssociation; //!< Associations from an Ipv4StaticRouting instance
public:
/**
* Get the excluded interfaces.
* \returns Container of excluded interfaces.
*/
std::set<uint32_t> GetInterfaceExclusions () const
{
return m_interfaceExclusions;
}
/**
* Set the interfaces to be excluded.
* \param exceptions Container of excluded interfaces.
*/
void SetInterfaceExclusions (std::set<uint32_t> exceptions);
/**
* \brief Injects the specified (networkAddr, netmask) tuple in the list of
* local HNA associations to be sent by the node via HNA messages.
* If this tuple already exists, nothing is done.
*
* \param networkAddr The network address.
* \param netmask The network mask.
*/
void AddHostNetworkAssociation (Ipv4Address networkAddr, Ipv4Mask netmask);
/**
* \brief Removes the specified (networkAddr, netmask) tuple from the list of
* local HNA associations to be sent by the node via HNA messages.
* If this tuple does not exist, nothing is done (see "OlsrState::EraseAssociation()").
*
* \param networkAddr The network address.
* \param netmask The network mask.
*/
void RemoveHostNetworkAssociation (Ipv4Address networkAddr, Ipv4Mask netmask);
/**
* \brief Associates the specified Ipv4StaticRouting routing table
* to the OLSR routing protocol. Entries from this associated
* routing table that use non-olsr outgoing interfaces are added
* to the list of local HNA associations so that they are included
* in HNA messages sent by the node.
* If this method is called more than once, entries from the old
* association are deleted before entries from the new one are added.
* \param routingTable the Ipv4StaticRouting routing table to be associated.
*/
void SetRoutingTableAssociation (Ptr<Ipv4StaticRouting> routingTable);
/**
* \brief Returns the internal HNA table
* \returns the internal HNA table
*/
Ptr<const Ipv4StaticRouting> GetRoutingTableAssociation () const;
protected:
virtual void DoInitialize (void);
private:
std::map<Ipv4Address, RoutingTableEntry> m_table; //!< Data structure for the routing table.
Ptr<Ipv4StaticRouting> m_hnaRoutingTable; //!< Routing table for HNA routes
EventGarbageCollector m_events; //!< Running events.
uint16_t m_packetSequenceNumber; //!< Packets sequence number counter.
uint16_t m_messageSequenceNumber; //!< Messages sequence number counter.
uint16_t m_ansn; //!< Advertised Neighbor Set sequence number.
Time m_helloInterval; //!< HELLO messages' emission interval.
Time m_tcInterval; //!< TC messages' emission interval.
Time m_midInterval; //!< MID messages' emission interval.
Time m_hnaInterval; //!< HNA messages' emission interval.
uint8_t m_willingness; //!< Willingness for forwarding packets on behalf of other nodes.
OlsrState m_state; //!< Internal state with all needed data structs.
Ptr<Ipv4> m_ipv4; //!< IPv4 object the routing is linked to.
/**
* \brief Clears the routing table and frees the memory assigned to each one of its entries.
*/
void Clear ();
/**
* Returns the routing table size.
* \return The routing table size.
*/
uint32_t GetSize () const
{
return m_table.size ();
}
/**
* \brief Deletes the entry whose destination address is given.
* \param dest address of the destination node.
*/
void RemoveEntry (const Ipv4Address &dest);
/**
* \brief Adds a new entry into the routing table.
*
* If an entry for the given destination existed, it is deleted and freed.
*
* \param dest address of the destination node.
* \param next address of the next hop node.
* \param interface address of the local interface.
* \param distance distance to the destination node.
*/
void AddEntry (const Ipv4Address &dest,
const Ipv4Address &next,
uint32_t interface,
uint32_t distance);
/**
* \brief Adds a new entry into the routing table.
*
* If an entry for the given destination existed, an error is thrown.
*
* \param dest address of the destination node.
* \param next address of the next hop node.
* \param interfaceAddress address of the local interface.
* \param distance distance to the destination node.
*/
void AddEntry (const Ipv4Address &dest,
const Ipv4Address &next,
const Ipv4Address &interfaceAddress,
uint32_t distance);
/**
* \brief Looks up an entry for the specified destination address.
* \param [in] dest Destination address.
* \param [out] outEntry Holds the routing entry result, if found.
* \return true if found, false if not found.
*/
bool Lookup (const Ipv4Address &dest,
RoutingTableEntry &outEntry) const;
/**
* \brief Finds the appropriate entry which must be used in order to forward
* a data packet to a next hop (given a destination).
*
* Imagine a routing table like this: [A,B] [B,C] [C,C]; being each pair of the
* form [dest addr, next-hop addr]. In this case, if this function is invoked
* with [A,B] then pair [C,C] is returned because C is the next hop that must be used
* to forward a data packet destined to A. That is, C is a neighbor of this node,
* but B isn't. This function finds the appropriate neighbor for forwarding a packet.
*
* \param[in] entry The routing table entry which indicates the destination node
* we are interested in.
*
* \param[out] outEntry The appropriate routing table entry which indicates the next
* hop which must be used for forwarding a data packet, or NULL if there is no such entry.
*
* \return True if an entry was found, false otherwise.
*/
bool FindSendEntry (const RoutingTableEntry &entry,
RoutingTableEntry &outEntry) const;
// From Ipv4RoutingProtocol
virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p,
const Ipv4Header &header,
Ptr<NetDevice> oif,
Socket::SocketErrno &sockerr);
virtual bool RouteInput (Ptr<const Packet> p,
const Ipv4Header &header,
Ptr<const NetDevice> idev,
UnicastForwardCallback ucb,
MulticastForwardCallback mcb,
LocalDeliverCallback lcb,
ErrorCallback ecb);
virtual void NotifyInterfaceUp (uint32_t interface);
virtual void NotifyInterfaceDown (uint32_t interface);
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
void DoDispose ();
/**
* Send an OLSR message.
* \param packet The packet to be sent.
* \param containedMessages The messages contained in the packet.
*/
void SendPacket (Ptr<Packet> packet, const MessageList &containedMessages);
/**
* Increments packet sequence number and returns the new value.
* \return The packet sequence number.
*/
inline uint16_t GetPacketSequenceNumber ();
/**
* Increments message sequence number and returns the new value.
* \return The message sequence number.
*/
inline uint16_t GetMessageSequenceNumber ();
/**
* Receive an OLSR message.
* \param socket The receiving socket.
*/
void RecvOlsr (Ptr<Socket> socket);
/**
* \brief Computates MPR set of a node following \RFC{3626} hints.
*/
void MprComputation ();
/**
* \brief Creates the routing table of the node following \RFC{3626} hints.
*/
void RoutingTableComputation ();
/**
* \brief Gets the main address associated with a given interface address.
* \param iface_addr the interface address.
* \return the corresponding main address.
*/
Ipv4Address GetMainAddress (Ipv4Address iface_addr) const;
/**
* \brief Tests whether or not the specified route uses a non-OLSR outgoing interface.
* \param route The route to be tested.
* \returns True if the outgoing interface of the specified route is a non-OLSR interface, false otherwise.
*/
bool UsesNonOlsrOutgoingInterface (const Ipv4RoutingTableEntry &route);
// Timer handlers
Timer m_helloTimer; //!< Timer for the HELLO message.
/**
* \brief Sends a HELLO message and reschedules the HELLO timer.
*/
void HelloTimerExpire ();
Timer m_tcTimer; //!< Timer for the TC message.
/**
* \brief Sends a TC message (if there exists any MPR selector) and reschedules the TC timer.
*/
void TcTimerExpire ();
Timer m_midTimer; //!< Timer for the MID message.
/**
* \brief \brief Sends a MID message (if the node has more than one interface) and resets the MID timer.
*/
void MidTimerExpire ();
Timer m_hnaTimer; //!< Timer for the HNA message.
/**
* \brief Sends an HNA message (if the node has associated hosts/networks) and reschedules the HNA timer.
*/
void HnaTimerExpire ();
/**
* \brief Removes tuple if expired. Else timer is rescheduled to expire at tuple.expirationTime.
*
* The task of actually removing the tuple is left to the OLSR agent.
*
* \param address The address of the tuple.
* \param sequenceNumber The sequence number of the tuple.
*/
void DupTupleTimerExpire (Ipv4Address address, uint16_t sequenceNumber);
bool m_linkTupleTimerFirstTime; //!< Flag to indicate if it is the first time the LinkTupleTimer fires.
/**
* \brief Removes tuple_ if expired. Else if symmetric time
* has expired then it is assumed a neighbor loss and agent_->nb_loss()
* is called. In this case the timer is rescheduled to expire at
* tuple_->time(). Otherwise the timer is rescheduled to expire at
* the minimum between tuple_->time() and tuple_->sym_time().
*
* The task of actually removing the tuple is left to the OLSR agent.
*
* \param neighborIfaceAddr The tuple neighbor interface address.
*/
void LinkTupleTimerExpire (Ipv4Address neighborIfaceAddr);
/**
* \brief Removes 2_hop neighbor tuple_ if expired. Else the timer is rescheduled to expire at tuple_->time().
*
* The task of actually removing the tuple is left to the OLSR agent.
*
* \param neighborMainAddr The neighbor main address.
* \param twoHopNeighborAddr The 2-hop neighbor address.
*/
void Nb2hopTupleTimerExpire (Ipv4Address neighborMainAddr, Ipv4Address twoHopNeighborAddr);
/**
* \brief Removes MPR selector tuple_ if expired. Else the timer is rescheduled to expire at tuple_->time().
*
* The task of actually removing the tuple is left to the OLSR agent.
*
* \param mainAddr The tuple IPv4 address.
*/
void MprSelTupleTimerExpire (Ipv4Address mainAddr);
/**
* \brief Removes topology tuple_ if expired. Else the timer is rescheduled to expire at tuple_->time().
*
* The task of actually removing the tuple is left to the OLSR agent.
*
* \param destAddr The destination address.
* \param lastAddr The last address.
*/
void TopologyTupleTimerExpire (Ipv4Address destAddr, Ipv4Address lastAddr);
/**
* \brief Removes interface association tuple_ if expired. Else the timer is rescheduled to expire at tuple_->time().
*
* \param ifaceAddr The interface address.
*/
void IfaceAssocTupleTimerExpire (Ipv4Address ifaceAddr);
/**
* \brief Removes association tuple_ if expired. Else timer is rescheduled to expire at tuple_->time().
*
* \param gatewayAddr The gateway address.
* \param networkAddr The network address.
* \param netmask The network mask.
*/
void AssociationTupleTimerExpire (Ipv4Address gatewayAddr, Ipv4Address networkAddr, Ipv4Mask netmask);
/**
* Increments the ANSN counter.
*/
void IncrementAnsn ();
/// A list of pending messages which are buffered awaiting for being sent.
olsr::MessageList m_queuedMessages;
Timer m_queuedMessagesTimer; //!< timer for throttling outgoing messages
/**
* \brief OLSR's default forwarding algorithm.
*
* See \RFC{3626} for details.
*
* \param olsrMessage The %OLSR message which must be forwarded.
* \param duplicated NULL if the message has never been considered for forwarding, or a duplicate tuple in other case.
* \param localIface The address of the interface where the message was received from.
* \param senderAddress The sender IPv4 address.
*/
void ForwardDefault (olsr::MessageHeader olsrMessage,
DuplicateTuple *duplicated,
const Ipv4Address &localIface,
const Ipv4Address &senderAddress);
/**
* \brief Enques an %OLSR message which will be sent with a delay of (0, delay].
*
* This buffering system is used in order to piggyback several %OLSR messages in
* a same %OLSR packet.
*
* \param message the %OLSR message which must be sent.
* \param delay maximum delay the %OLSR message is going to be buffered.
*/
void QueueMessage (const olsr::MessageHeader &message, Time delay);
/**
* \brief Creates as many %OLSR packets as needed in order to send all buffered
* %OLSR messages.
*
* Maximum number of messages which can be contained in an %OLSR packet is
* dictated by OLSR_MAX_MSGS constant.
*/
void SendQueuedMessages ();
/**
* \brief Creates a new %OLSR HELLO message which is buffered for being sent later on.
*/
void SendHello ();
/**
* \brief Creates a new %OLSR TC message which is buffered for being sent later on.
*/
void SendTc ();
/**
* \brief Creates a new %OLSR MID message which is buffered for being sent later on.
*/
void SendMid ();
/**
* \brief Creates a new %OLSR HNA message which is buffered for being sent later on.
*/
void SendHna ();
/**
* \brief Performs all actions needed when a neighbor loss occurs.
*
* Neighbor Set, 2-hop Neighbor Set, MPR Set and MPR Selector Set are updated.
*
* \param tuple link tuple with the information of the link to the neighbor which has been lost.
*/
void NeighborLoss (const LinkTuple &tuple);
/**
* \brief Adds a duplicate tuple to the Duplicate Set.
*
* \param tuple The duplicate tuple to be added.
*/
void AddDuplicateTuple (const DuplicateTuple &tuple);
/**
* \brief Removes a duplicate tuple from the Duplicate Set.
*
* \param tuple The duplicate tuple to be removed.
*/
void RemoveDuplicateTuple (const DuplicateTuple &tuple);
/**
* Adds a link tuple.
* \param tuple Thetuple to be added.
* \param willingness The tuple willingness.
*/
void LinkTupleAdded (const LinkTuple &tuple, uint8_t willingness);
/**
* \brief Removes a link tuple from the Link Set.
*
* \param tuple The link tuple to be removed.
*/
void RemoveLinkTuple (const LinkTuple &tuple);
/**
* \brief This function is invoked when a link tuple is updated. Its aim is to
* also update the corresponding neighbor tuple if it is needed.
*
* \param tuple The link tuple which has been updated.
* \param willingness The tuple willingness.
*/
void LinkTupleUpdated (const LinkTuple &tuple, uint8_t willingness);
/**
* \brief Adds a neighbor tuple to the Neighbor Set.
*
* \param tuple The neighbor tuple to be added.
*/
void AddNeighborTuple (const NeighborTuple &tuple);
/**
* \brief Removes a neighbor tuple from the Neighbor Set.
*
* \param tuple The neighbor tuple to be removed.
*/
void RemoveNeighborTuple (const NeighborTuple &tuple);
/**
* \brief Adds a 2-hop neighbor tuple to the 2-hop Neighbor Set.
*
* \param tuple The 2-hop neighbor tuple to be added.
*/
void AddTwoHopNeighborTuple (const TwoHopNeighborTuple &tuple);
/**
* \brief Removes a 2-hop neighbor tuple from the 2-hop Neighbor Set.
*
* \param tuple The 2-hop neighbor tuple to be removed.
*/
void RemoveTwoHopNeighborTuple (const TwoHopNeighborTuple &tuple);
/**
* \brief Adds an MPR selector tuple to the MPR Selector Set.
* Advertised Neighbor Sequence Number (ANSN) is also updated.
*
* \param tuple The MPR selector tuple to be added.
*/
void AddMprSelectorTuple (const MprSelectorTuple &tuple);
/**
* \brief Removes an MPR selector tuple from the MPR Selector Set.
* Advertised Neighbor Sequence Number (ANSN) is also updated.
*
* \param tuple The MPR selector tuple to be removed.
*/
void RemoveMprSelectorTuple (const MprSelectorTuple &tuple);
/**
* \brief Adds a topology tuple to the Topology Set.
*
* \param tuple The topology tuple to be added.
*/
void AddTopologyTuple (const TopologyTuple &tuple);
/**
* \brief Removes a topology tuple to the Topology Set.
*
* \param tuple The topology tuple to be removed.
*/
void RemoveTopologyTuple (const TopologyTuple &tuple);
/**
* \brief Adds an interface association tuple to the Interface Association Set.
*
* \param tuple The interface association tuple to be added.
*/
void AddIfaceAssocTuple (const IfaceAssocTuple &tuple);
/**
* \brief Removed an interface association tuple to the Interface Association Set.
*
* \param tuple The interface association tuple to be removed.
*/
void RemoveIfaceAssocTuple (const IfaceAssocTuple &tuple);
/**
* \brief Adds a host network association tuple to the Association Set.
*
* \param tuple The host network association tuple to be added.
*/
void AddAssociationTuple (const AssociationTuple &tuple);
/**
* \brief Removes a host network association tuple to the Association Set.
*
* \param tuple The host network association tuple to be removed.
*/
void RemoveAssociationTuple (const AssociationTuple &tuple);
/**
* \brief Processes a HELLO message following \RFC{3626} specification.
*
* Link sensing and population of the Neighbor Set, 2-hop Neighbor Set and MPR
* Selector Set are performed.
*
* \param msg the %OLSR message which contains the HELLO message.
* \param receiverIface the address of the interface where the message was received from.
* \param senderIface the address of the interface where the message was sent from.
*/
void ProcessHello (const olsr::MessageHeader &msg,
const Ipv4Address &receiverIface,
const Ipv4Address &senderIface);
/**
* \brief Processes a TC message following \RFC{3626} specification.
*
* The Topology Set is updated (if needed) with the information of
* the received TC message.
*
* \param msg The %OLSR message which contains the TC message.
* \param senderIface The address of the interface where the message was sent from.
*
*/
void ProcessTc (const olsr::MessageHeader &msg,
const Ipv4Address &senderIface);
/**
* \brief Processes a MID message following \RFC{3626} specification.
*
* The Interface Association Set is updated (if needed) with the information
* of the received MID message.
*
* \param msg the %OLSR message which contains the MID message.
* \param senderIface the address of the interface where the message was sent from.
*/
void ProcessMid (const olsr::MessageHeader &msg,
const Ipv4Address &senderIface);
/**
*
* \brief Processes a HNA message following \RFC{3626} specification.
*
* The Host Network Association Set is updated (if needed) with the information
* of the received HNA message.
*
* \param msg the %OLSR message which contains the HNA message.
* \param senderIface the address of the interface where the message was sent from.
*
*/
void ProcessHna (const olsr::MessageHeader &msg,
const Ipv4Address &senderIface);
/**
* \brief Updates Link Set according to a new received HELLO message
* (following \RFC{3626} specification). Neighbor Set is also updated if needed.
* \param msg The received message.
* \param hello The received HELLO sub-message.
* \param receiverIface The interface that received the message.
* \param senderIface The sender interface.
*/
void LinkSensing (const olsr::MessageHeader &msg,
const olsr::MessageHeader::Hello &hello,
const Ipv4Address &receiverIface,
const Ipv4Address &senderIface);
/**
* \brief Updates the Neighbor Set according to the information contained in
* a new received HELLO message (following \RFC{3626}).
* \param msg The received message.
* \param hello The received HELLO sub-message.
*/
void PopulateNeighborSet (const olsr::MessageHeader &msg,
const olsr::MessageHeader::Hello &hello);
/**
* \brief Updates the 2-hop Neighbor Set according to the information contained
* in a new received HELLO message (following \RFC{3626}).
* \param msg The received message.
* \param hello The received HELLO sub-message.
*/
void PopulateTwoHopNeighborSet (const olsr::MessageHeader &msg,
const olsr::MessageHeader::Hello &hello);
/**
* \brief Updates the MPR Selector Set according to the information contained in
* a new received HELLO message (following \RFC{3626}).
* \param msg The received message.
* \param hello The received HELLO sub-message.
*/
void PopulateMprSelectorSet (const olsr::MessageHeader &msg,
const olsr::MessageHeader::Hello &hello);
int Degree (NeighborTuple const &tuple);
/// Check that address is one of my interfaces
bool IsMyOwnAddress (const Ipv4Address & a) const;
Ipv4Address m_mainAddress; //!< the node main address.
// One socket per interface, each bound to that interface's address
// (reason: for OLSR Link Sensing we need to know on which interface
// HELLO messages arrive)
std::map< Ptr<Socket>, Ipv4InterfaceAddress > m_socketAddresses; //!< Container of sockets and the interfaces they are opened onto.
/// Rx packet trace.
TracedCallback <const PacketHeader &, const MessageList &> m_rxPacketTrace;
/// Tx packet trace.
TracedCallback <const PacketHeader &, const MessageList &> m_txPacketTrace;
/// Routing table chanes challback
TracedCallback <uint32_t> m_routingTableChanged;
/// Provides uniform random variables.
Ptr<UniformRandomVariable> m_uniformRandomVariable;
};
}
} // namespace ns3
#endif /* OLSR_AGENT_IMPL_H */
|