| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | |
| 2 /* | |
| 3 * Copyright (c) 2009 The Georgia Institute of Technology | |
| 4 * | |
| 5 * This program is free software; you can redistribute it and/or modify | |
| 6 * it under the terms of the GNU General Public License version 2 as | |
| 7 * published by the Free Software Foundation; | |
| 8 * | |
| 9 * This program is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 * GNU General Public License for more details. | |
| 13 * | |
| 14 * You should have received a copy of the GNU General Public License | |
| 15 * along with this program; if not, write to the Free Software | |
| 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 17 * | |
| 18 * Authors: Josh Pelkey <jpelkey@gatech.edu> | |
| 19 */ | |
| 20 | |
| 21 #ifndef __IPV4_NIX_VECTOR_ROUTING_H__ | |
| 22 #define __IPV4_NIX_VECTOR_ROUTING_H__ | |
| 23 | |
| 24 #include <map> | |
| 25 | |
| 26 #include "ns3/channel.h" | |
| 27 #include "ns3/node-container.h" | |
| 28 #include "ns3/node-list.h" | |
| 29 #include "ns3/net-device-container.h" | |
| 30 #include "ns3/ipv4-routing-protocol.h" | |
| 31 #include "ns3/ipv4-route.h" | |
| 32 | |
| 33 namespace ns3 { | |
| 34 | |
| 35 typedef std::map<Ipv4Address, Ptr<NixVector> > NixMap_t; | |
| 36 typedef std::map<Ipv4Address, Ptr<Ipv4Route> > Ipv4RouteMap_t; | |
| 37 | |
| 38 class Ipv4NixVectorRouting : public Ipv4RoutingProtocol | |
| 39 { | |
| 40 public: | |
| 41 Ipv4NixVectorRouting (); | |
|
craigdo
2009/09/11 22:38:17
Needs Doxygen
jpelkey
2009/09/12 18:34:14
On 2009/09/11 22:38:17, craigdo wrote:
> Needs Dox
| |
| 42 ~Ipv4NixVectorRouting (); | |
| 43 static TypeId GetTypeId (void); | |
| 44 Ptr<NixVector> GetNixVector (Ptr<Node>, Ipv4Address); | |
| 45 Ptr<NixVector> GetNixVectorInCache (Ipv4Address); | |
| 46 Ptr<Ipv4Route> GetIpv4RouteInCache (Ipv4Address); | |
| 47 void GetAdjacentNetDevices (Ptr<NetDevice>, Ptr<Channel>, NetDeviceContainer &); | |
| 48 Ptr<Node> GetNodeByIp (Ipv4Address); | |
| 49 void SetNode (Ptr<Node>); | |
| 50 | |
| 51 private: | |
| 52 bool BuildNixVectorLocal (Ptr<NixVector> nixVector); | |
| 53 bool BuildNixVector (const std::vector< Ptr<Node> > & parentVector, uint32_t source, uint32_t dest, Ptr<NixVector> nixVector); | |
| 54 uint32_t FindTotalNeighbors (void); | |
| 55 uint32_t FindNetDeviceForNixIndex (uint32_t nodeIndex, Ipv4Address & gateway Ip); | |
| 56 | |
| 57 // Breadth first search algorithm | |
| 58 // Param1: Vector containing all nodes in the graph | |
| 59 // Param2: Source Node | |
| 60 // Param3: Dest Node | |
| 61 // Param4: (returned) Parent vector for retracing routes | |
| 62 // Returns: false if dest not found, true o.w. | |
| 63 bool BFS (uint32_t numberOfNodes, | |
| 64 Ptr<Node> source, | |
| 65 Ptr<Node> dest, | |
| 66 std::vector< Ptr<Node> > & parentVector); | |
| 67 | |
| 68 void DoDispose (void); | |
| 69 | |
| 70 // From Ipv4RoutingProtocol | |
| 71 virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr); | |
| 72 virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr< const NetDevice> idev, | |
| 73 UnicastForwardCallback ucb, MulticastForwardCallbac k mcb, | |
| 74 LocalDeliverCallback lcb, ErrorCallback ecb); | |
| 75 virtual void NotifyInterfaceUp (uint32_t interface); | |
| 76 virtual void NotifyInterfaceDown (uint32_t interface); | |
| 77 virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress addr ess); | |
| 78 virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress a ddress); | |
| 79 virtual void SetIpv4 (Ptr<Ipv4> ipv4); | |
| 80 | |
| 81 | |
| 82 NixMap_t m_nixCache; | |
| 83 Ipv4RouteMap_t m_ipv4RouteCache; | |
| 84 Ptr<Ipv4> m_ipv4; | |
| 85 Ptr<Node> m_node; | |
| 86 uint32_t m_totalNeighbors; | |
| 87 }; | |
| 88 } // namepace ns3 | |
| 89 #endif | |
| OLD | NEW |