src/node/ipv4-route.h
changeset 236 5673656dc2e7
child 633 ecedbcb39fb7
equal deleted inserted replaced
235:190d5bef3254 236:5673656dc2e7
       
     1 /* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
       
     2 /*
       
     3  * Copyright (c) 2005 INRIA
       
     4  * All rights reserved.
       
     5  *
       
     6  * This program is free software; you can redistribute it and/or modify
       
     7  * it under the terms of the GNU General Public License version 2 as
       
     8  * published by the Free Software Foundation;
       
     9  *
       
    10  * This program is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    13  * GNU General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License
       
    16  * along with this program; if not, write to the Free Software
       
    17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    18  *
       
    19  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
       
    20  */
       
    21 #ifndef IPV4_ROUTE_H
       
    22 #define IPV4_ROUTE_H
       
    23 
       
    24 #include <list>
       
    25 #include <ostream>
       
    26 
       
    27 #include "ipv4-address.h"
       
    28 
       
    29 namespace ns3 {
       
    30 
       
    31 class Ipv4Route {
       
    32 public:
       
    33   Ipv4Route ();
       
    34   Ipv4Route (Ipv4Route const &route);
       
    35 
       
    36   bool IsHost (void) const;
       
    37   Ipv4Address GetDest (void) const;
       
    38 
       
    39   bool IsNetwork (void) const;
       
    40   Ipv4Address GetDestNetwork (void) const;
       
    41   Ipv4Mask GetDestNetworkMask (void) const;
       
    42 
       
    43   bool IsDefault (void) const;
       
    44 
       
    45   bool IsGateway (void) const;
       
    46   Ipv4Address GetGateway (void) const;
       
    47 
       
    48   uint32_t GetInterface (void) const;
       
    49 
       
    50   static Ipv4Route CreateHostRouteTo (Ipv4Address dest, 
       
    51 				      Ipv4Address nextHop, 
       
    52 				      uint32_t interface);
       
    53   static Ipv4Route CreateHostRouteTo (Ipv4Address dest, 
       
    54 				      uint32_t interface);
       
    55   static Ipv4Route CreateNetworkRouteTo (Ipv4Address network, 
       
    56 					 Ipv4Mask networkMask, 
       
    57 					 Ipv4Address nextHop, 
       
    58 					 uint32_t interface);
       
    59   static Ipv4Route CreateNetworkRouteTo (Ipv4Address network, 
       
    60 					 Ipv4Mask networkMask, 
       
    61 					 uint32_t interface);
       
    62   static Ipv4Route CreateDefaultRoute (Ipv4Address nextHop, 
       
    63 				       uint32_t interface);
       
    64   
       
    65 private:
       
    66   Ipv4Route (Ipv4Address network,
       
    67 	     Ipv4Mask mask,
       
    68 	     Ipv4Address gateway,
       
    69 	     uint32_t interface);
       
    70   Ipv4Route (Ipv4Address dest,
       
    71 	     Ipv4Mask mask,
       
    72 	     uint32_t interface);
       
    73   Ipv4Route (Ipv4Address dest,
       
    74 	     Ipv4Address gateway,
       
    75 	     uint32_t interface);
       
    76   Ipv4Route (Ipv4Address dest,
       
    77 	     uint32_t interface);
       
    78 
       
    79   Ipv4Address m_dest;
       
    80   Ipv4Mask m_destNetworkMask;
       
    81   Ipv4Address m_gateway;
       
    82   uint32_t m_interface;
       
    83 };
       
    84 
       
    85 std::ostream& operator<< (std::ostream& os, Ipv4Route const& route);
       
    86 
       
    87 }//namespace ns3
       
    88 
       
    89 #endif /* IPV4_ROUTE_H */