src/internet-stack/ipv6-l3-protocol.h
changeset 5891 09a575cdf8db
parent 5793 da33f0c8ade4
child 6273 8d70de29d514
equal deleted inserted replaced
5890:9c48446a0946 5891:09a575cdf8db
    55  * around the Ipv6Header as an explicit parameter and not as part of
    55  * around the Ipv6Header as an explicit parameter and not as part of
    56  * the packet.
    56  * the packet.
    57  */
    57  */
    58 class Ipv6L3Protocol : public Ipv6
    58 class Ipv6L3Protocol : public Ipv6
    59 {
    59 {
    60   public:
    60 public:
    61     /** 
    61   /** 
    62      * \brief Get the type ID of this class.
    62    * \brief Get the type ID of this class.
    63      * \return type ID
    63    * \return type ID
    64      */
    64    */
    65     static TypeId GetTypeId ();
    65   static TypeId GetTypeId ();
    66 
    66 
    67     /**
    67   /**
    68      * \brief The protocol number for IPv6 (0x86DD).
    68    * \brief The protocol number for IPv6 (0x86DD).
    69      */
    69    */
    70     static const uint16_t PROT_NUMBER;
    70   static const uint16_t PROT_NUMBER;
    71 
    71 
    72     /**
    72   /**
    73      * \enum DropReason
    73    * \enum DropReason
    74      * \brief Reason why a packet has been dropped.
    74    * \brief Reason why a packet has been dropped.
    75      */
    75    */
    76     enum DropReason 
    76   enum DropReason 
    77       {
    77   {
    78         DROP_TTL_EXPIRED = 1, /**< Packet TTL has expired */
    78     DROP_TTL_EXPIRED = 1, /**< Packet TTL has expired */
    79         DROP_NO_ROUTE, /**< No route to host */
    79     DROP_NO_ROUTE, /**< No route to host */
    80         DROP_INTERFACE_DOWN, /**< Interface is down so can not send packet */
    80     DROP_INTERFACE_DOWN, /**< Interface is down so can not send packet */
    81         DROP_ROUTE_ERROR, /**< Route error */
    81     DROP_ROUTE_ERROR, /**< Route error */
    82         DROP_UNKNOWN_PROTOCOL, /**< Unkown L4 protocol */
    82     DROP_UNKNOWN_PROTOCOL, /**< Unkown L4 protocol */
    83       };
    83   };
    84     
    84 
    85     /**
    85   /**
    86      * \brief Constructor.
    86    * \brief Constructor.
    87      */
    87    */
    88     Ipv6L3Protocol ();
    88   Ipv6L3Protocol ();
    89 
    89 
    90     /**
    90   /**
    91      * \brief Destructor.
    91    * \brief Destructor.
    92      */
    92    */
    93     virtual ~Ipv6L3Protocol ();
    93   virtual ~Ipv6L3Protocol ();
    94     
    94 
    95     /**
    95   /**
    96      * \brief Set node for this stack.
    96    * \brief Set node for this stack.
    97      * \param node node to set
    97    * \param node node to set
    98      */
    98    */
    99     void SetNode (Ptr<Node> node);
    99   void SetNode (Ptr<Node> node);
   100 
   100 
   101     /**
   101   /**
   102      * \brief Add an L4 protocol.
   102    * \brief Add an L4 protocol.
   103      * \param protocol L4 protocol
   103    * \param protocol L4 protocol
   104      */
   104    */
   105     void Insert (Ptr<Ipv6L4Protocol> protocol);
   105   void Insert (Ptr<Ipv6L4Protocol> protocol);
   106 
   106 
   107     /**
   107   /**
   108      * \brief Remove an L4 protocol.
   108    * \brief Remove an L4 protocol.
   109      * \param protocol L4 protocol to remove
   109    * \param protocol L4 protocol to remove
   110      */
   110    */
   111     void Remove (Ptr<Ipv6L4Protocol> protocol);
   111   void Remove (Ptr<Ipv6L4Protocol> protocol);
   112 
   112 
   113     /**
   113   /**
   114      * \brief Get L4 protocol by protocol number.
   114    * \brief Get L4 protocol by protocol number.
   115      * \param protocolNumber protocol number
   115    * \param protocolNumber protocol number
   116      * \return corresponding Ipv6L4Protocol or 0 if not found
   116    * \return corresponding Ipv6L4Protocol or 0 if not found
   117      */
   117    */
   118     Ptr<Ipv6L4Protocol> GetProtocol (int protocolNumber) const;
   118   Ptr<Ipv6L4Protocol> GetProtocol (int protocolNumber) const;
   119 
   119 
   120     /**
   120   /**
   121      * \brief Create raw IPv6 socket.
   121    * \brief Create raw IPv6 socket.
   122      * \return newly raw socket
   122    * \return newly raw socket
   123      */
   123    */
   124     Ptr<Socket> CreateRawSocket ();
   124   Ptr<Socket> CreateRawSocket ();
   125 
   125 
   126     /**
   126   /**
   127      * \brief Remove raw IPv6 socket.
   127    * \brief Remove raw IPv6 socket.
   128      * \param socket socket to remove
   128    * \param socket socket to remove
   129      */
   129    */
   130     void DeleteRawSocket (Ptr<Socket> socket);
   130   void DeleteRawSocket (Ptr<Socket> socket);
   131 
   131 
   132     /**
   132   /**
   133      * \brief Set the default TTL.
   133    * \brief Set the default TTL.
   134      * \param ttl TTL to set
   134    * \param ttl TTL to set
   135      */
   135    */
   136     void SetDefaultTtl (uint8_t ttl);
   136   void SetDefaultTtl (uint8_t ttl);
   137 
   137 
   138     /**
   138   /**
   139      * \brief Receive method when a packet arrive in the stack.
   139    * \brief Receive method when a packet arrive in the stack.
   140      * This method removes IPv6 header and forward up to L4 protocol.
   140    * This method removes IPv6 header and forward up to L4 protocol.
   141      *
   141    *
   142      * \param device network device
   142    * \param device network device
   143      * \param p the packet
   143    * \param p the packet
   144      * \param protocol next header value
   144    * \param protocol next header value
   145      * \param from address of the correspondant
   145    * \param from address of the correspondant
   146      * \param to address of the destination
   146    * \param to address of the destination
   147      * \param packetType type of the packet
   147    * \param packetType type of the packet
   148      */
   148    */
   149     void Receive (Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType);
   149   void Receive (Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType);
   150 
   150 
   151     /**
   151   /**
   152      * \brief Higher-level layers call this method to send a packet
   152    * \brief Higher-level layers call this method to send a packet
   153      * down the stack to the MAC and PHY layers.
   153    * down the stack to the MAC and PHY layers.
   154      *
   154    *
   155      * \param packet packet to send
   155    * \param packet packet to send
   156      * \param source source address of packet
   156    * \param source source address of packet
   157      * \param destination address of packet
   157    * \param destination address of packet
   158      * \param protocol number of packet
   158    * \param protocol number of packet
   159      * \param route route to take
   159    * \param route route to take
   160      */
   160    */
   161     void Send (Ptr<Packet> packet, Ipv6Address source, Ipv6Address destination, uint8_t protocol, Ptr<Ipv6Route> route);
   161   void Send (Ptr<Packet> packet, Ipv6Address source, Ipv6Address destination, uint8_t protocol, Ptr<Ipv6Route> route);
   162    
   162 
   163     /**
   163   /**
   164      * \brief Set routing protocol for this stack.
   164    * \brief Set routing protocol for this stack.
   165      * \param routingProtocol IPv6 routing protocol to set
   165    * \param routingProtocol IPv6 routing protocol to set
   166      */
   166    */
   167     void SetRoutingProtocol (Ptr<Ipv6RoutingProtocol> routingProtocol);
   167   void SetRoutingProtocol (Ptr<Ipv6RoutingProtocol> routingProtocol);
   168 
   168 
   169     /**
   169   /**
   170      * \brief Get current routing protocol used.
   170    * \brief Get current routing protocol used.
   171      * \return routing protocol
   171    * \return routing protocol
   172      */
   172    */
   173     Ptr<Ipv6RoutingProtocol> GetRoutingProtocol () const;
   173   Ptr<Ipv6RoutingProtocol> GetRoutingProtocol () const;
   174 
   174 
   175     /**
   175   /**
   176      * \brief Add IPv6 interface for a device.
   176    * \brief Add IPv6 interface for a device.
   177      * \param device net device
   177    * \param device net device
   178      * \return interface index
   178    * \return interface index
   179      */
   179    */
   180     uint32_t AddInterface (Ptr<NetDevice> device);
   180   uint32_t AddInterface (Ptr<NetDevice> device);
   181 
   181 
   182     /**
   182   /**
   183      * \brief Get an interface.
   183    * \brief Get an interface.
   184      * \param i interface index
   184    * \param i interface index
   185      * \return IPv6 interface pointer
   185    * \return IPv6 interface pointer
   186      */
   186    */
   187     Ptr<Ipv6Interface> GetInterface (uint32_t i) const;
   187   Ptr<Ipv6Interface> GetInterface (uint32_t i) const;
   188     
   188 
   189     /**
   189   /**
   190      * \brief Get current number of interface on this stack.
   190    * \brief Get current number of interface on this stack.
   191      * \return number of interface registered
   191    * \return number of interface registered
   192      */
   192    */
   193     uint32_t GetNInterfaces () const;
   193   uint32_t GetNInterfaces () const;
   194 
   194 
   195     /**
   195   /**
   196      * \brief Get interface index which has specified IPv6 address
   196    * \brief Get interface index which has specified IPv6 address
   197      * \param addr IPv6 address
   197    * \param addr IPv6 address
   198      * \return interface index or -1 if not found
   198    * \return interface index or -1 if not found
   199      */
   199    */
   200     int32_t GetInterfaceForAddress (Ipv6Address addr) const;
   200   int32_t GetInterfaceForAddress (Ipv6Address addr) const;
   201 
   201 
   202     /**
   202   /**
   203      * \brief Get interface index which match specified address/prefix.
   203    * \brief Get interface index which match specified address/prefix.
   204      * \param addr IPv6 address
   204    * \param addr IPv6 address
   205      * \param mask IPv6 prefix (mask)
   205    * \param mask IPv6 prefix (mask)
   206      * \return interface index or -1 if not found
   206    * \return interface index or -1 if not found
   207      */
   207    */
   208     int32_t GetInterfaceForPrefix (Ipv6Address addr, Ipv6Prefix mask) const;
   208   int32_t GetInterfaceForPrefix (Ipv6Address addr, Ipv6Prefix mask) const;
   209 
   209 
   210     /**
   210   /**
   211      * \brief Get interface index which is on a specified net device.
   211    * \brief Get interface index which is on a specified net device.
   212      * \param device net device
   212    * \param device net device
   213      */
   213    */
   214     int32_t GetInterfaceForDevice (Ptr<const NetDevice> device) const;
   214   int32_t GetInterfaceForDevice (Ptr<const NetDevice> device) const;
   215 
   215 
   216     /**
   216   /**
   217      * \brief Add an address on interface.
   217    * \brief Add an address on interface.
   218      * \param i interface index
   218    * \param i interface index
   219      * \param address to add
   219    * \param address to add
   220      */
   220    */
   221     bool AddAddress (uint32_t i, Ipv6InterfaceAddress address);
   221   bool AddAddress (uint32_t i, Ipv6InterfaceAddress address);
   222 
   222 
   223     /**
   223   /**
   224      * \brief Get an address.
   224    * \brief Get an address.
   225      * \param interfaceIndex interface index
   225    * \param interfaceIndex interface index
   226      * \param addressIndex address index on the interface
   226    * \param addressIndex address index on the interface
   227      * \return Ipv6InterfaceAddress or assert if not found
   227    * \return Ipv6InterfaceAddress or assert if not found
   228      */
   228    */
   229     Ipv6InterfaceAddress GetAddress (uint32_t interfaceIndex, uint32_t addressIndex) const;
   229   Ipv6InterfaceAddress GetAddress (uint32_t interfaceIndex, uint32_t addressIndex) const;
   230 
   230 
   231     /**
   231   /**
   232      * \brief Get number of address for an interface.
   232    * \brief Get number of address for an interface.
   233      * \param interface interface index
   233    * \param interface interface index
   234      * \return number of address
   234    * \return number of address
   235      */
   235    */
   236     uint32_t GetNAddresses (uint32_t interface) const;
   236   uint32_t GetNAddresses (uint32_t interface) const;
   237 
   237 
   238     /**
   238   /**
   239      * \brief Remove an address from an interface.
   239    * \brief Remove an address from an interface.
   240      * \param interfaceIndex interface index
   240    * \param interfaceIndex interface index
   241      * \param addressIndex address index on the interface
   241    * \param addressIndex address index on the interface
   242      */
   242    */
   243     bool RemoveAddress (uint32_t interfaceIndex, uint32_t addressIndex);
   243   bool RemoveAddress (uint32_t interfaceIndex, uint32_t addressIndex);
   244     
   244 
   245     /**
   245   /**
   246      * \brief Set metric for an interface.
   246    * \brief Set metric for an interface.
   247      * \param i index
   247    * \param i index
   248      * \param metric
   248    * \param metric
   249      */
   249    */
   250     void SetMetric (uint32_t i, uint16_t metric);
   250   void SetMetric (uint32_t i, uint16_t metric);
   251 
   251 
   252     /**
   252   /**
   253      * \brief Get metric for an interface.
   253    * \brief Get metric for an interface.
   254      * \param i index
   254    * \param i index
   255      * \return metric
   255    * \return metric
   256      */
   256    */
   257     uint16_t GetMetric (uint32_t i) const;
   257   uint16_t GetMetric (uint32_t i) const;
   258 
   258 
   259     /**
   259   /**
   260      * \brief Get MTU for an interface.
   260    * \brief Get MTU for an interface.
   261      * \param i index
   261    * \param i index
   262      * \return MTU
   262    * \return MTU
   263      */
   263    */
   264     uint16_t GetMtu (uint32_t i) const;
   264   uint16_t GetMtu (uint32_t i) const;
   265 
   265 
   266     /**
   266   /**
   267      * \brief Is specified interface up ?
   267    * \brief Is specified interface up ?
   268      * \param i interface index
   268    * \param i interface index
   269      */
   269    */
   270     bool IsUp (uint32_t i) const;
   270   bool IsUp (uint32_t i) const;
   271 
   271 
   272     /**
   272   /**
   273      * \brief Set an interface up.
   273    * \brief Set an interface up.
   274      * \param i interface index
   274    * \param i interface index
   275      */
   275    */
   276     void SetUp (uint32_t i);
   276   void SetUp (uint32_t i);
   277 
   277 
   278     /**
   278   /**
   279      * \brief set an interface down.
   279    * \brief set an interface down.
   280      * \param i interface index
   280    * \param i interface index
   281      */
   281    */
   282     void SetDown (uint32_t i);
   282   void SetDown (uint32_t i);
   283 
   283 
   284     /**
   284   /**
   285      * \brief Is interface allows forwarding ?
   285    * \brief Is interface allows forwarding ?
   286      * \param i interface index
   286    * \param i interface index
   287      */
   287    */
   288     bool IsForwarding (uint32_t i) const;
   288   bool IsForwarding (uint32_t i) const;
   289 
   289 
   290     /**
   290   /**
   291      * \brief Enable or disable forwarding on interface
   291    * \brief Enable or disable forwarding on interface
   292      * \param i interface index
   292    * \param i interface index
   293      * \param val true = enable forwarding, false = disable
   293    * \param val true = enable forwarding, false = disable
   294      */
   294    */
   295     void SetForwarding (uint32_t i, bool val);
   295   void SetForwarding (uint32_t i, bool val);
   296 
   296 
   297     /**
   297   /**
   298      * \brief Get device by index.
   298    * \brief Get device by index.
   299      * \param i device index on this stack
   299    * \param i device index on this stack
   300      * \return NetDevice pointer
   300    * \return NetDevice pointer
   301      */
   301    */
   302     Ptr<NetDevice> GetNetDevice (uint32_t i);
   302   Ptr<NetDevice> GetNetDevice (uint32_t i);
   303     
   303 
   304     /**
   304   /**
   305      * \brief Get ICMPv6 protocol.
   305    * \brief Get ICMPv6 protocol.
   306      * \return Icmpv6L4Protocol pointer
   306    * \return Icmpv6L4Protocol pointer
   307      */
   307    */
   308     Ptr<Icmpv6L4Protocol> GetIcmpv6 () const;
   308   Ptr<Icmpv6L4Protocol> GetIcmpv6 () const;
   309 
   309 
   310     /**
   310   /**
   311      * \brief Add an autoconfigured address with RA information.
   311    * \brief Add an autoconfigured address with RA information.
   312      * \param interface interface index
   312    * \param interface interface index
   313      * \param network network prefix
   313    * \param network network prefix
   314      * \param mask network mask
   314    * \param mask network mask
   315      * \param flags flags of the prefix information option (home agent, ...)
   315    * \param flags flags of the prefix information option (home agent, ...)
   316      * \param validTime valid time of the prefix
   316    * \param validTime valid time of the prefix
   317      * \param preferredTime preferred time of the prefix
   317    * \param preferredTime preferred time of the prefix
   318      * \param defaultRouter default router address
   318    * \param defaultRouter default router address
   319      */
   319    */
   320     void AddAutoconfiguredAddress (uint32_t interface, Ipv6Address network, Ipv6Prefix mask, uint8_t flags, uint32_t validTime, uint32_t preferredTime, Ipv6Address defaultRouter = Ipv6Address::GetZero ());
   320   void AddAutoconfiguredAddress (uint32_t interface, Ipv6Address network, Ipv6Prefix mask, uint8_t flags, uint32_t validTime, uint32_t preferredTime, Ipv6Address defaultRouter = Ipv6Address::GetZero ());
   321 
   321 
   322     /**
   322   /**
   323      * \brief Remove an autoconfigured address.
   323    * \brief Remove an autoconfigured address.
   324      *
   324    *
   325      * Typically it is used when an autoconfigured address expires.
   325    * Typically it is used when an autoconfigured address expires.
   326      * \param interface interface index
   326    * \param interface interface index
   327      * \param network network prefix
   327    * \param network network prefix
   328      * \param mask network mask
   328    * \param mask network mask
   329      * \param defaultRouter gateway
   329    * \param defaultRouter gateway
   330      */
   330    */
   331     void RemoveAutoconfiguredAddress (uint32_t interface, Ipv6Address network, Ipv6Prefix mask, Ipv6Address defaultRouter);
   331   void RemoveAutoconfiguredAddress (uint32_t interface, Ipv6Address network, Ipv6Prefix mask, Ipv6Address defaultRouter);
   332 
   332 
   333     /**
   333   /**
   334      * \brief Register the IPv6 Extensions.
   334    * \brief Register the IPv6 Extensions.
   335      */
   335    */
   336     virtual void RegisterExtensions ();
   336   virtual void RegisterExtensions ();
   337 
   337 
   338     /**
   338   /**
   339      * \brief Register the IPv6 Options.
   339    * \brief Register the IPv6 Options.
   340      */
   340    */
   341     virtual void RegisterOptions ();
   341   virtual void RegisterOptions ();
   342 
   342 
   343   protected:
   343 protected:
   344     /**
   344   /**
   345      * \brief Dispose object.
   345    * \brief Dispose object.
   346      */
   346    */
   347     virtual void DoDispose ();
   347   virtual void DoDispose ();
   348 
   348 
   349     /**
   349   /**
   350      * \brief Notify other components connected to the node that a new stack member is now connected.
   350    * \brief Notify other components connected to the node that a new stack member is now connected.
   351      *
   351    *
   352      * This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
   352    * This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
   353      */
   353    */
   354     virtual void NotifyNewAggregate ();
   354   virtual void NotifyNewAggregate ();
   355 
   355 
   356   private:
   356 private:
   357     /* for unit-tests */
   357   /* for unit-tests */
   358     friend class Ipv6L3ProtocolTestCase;
   358   friend class Ipv6L3ProtocolTestCase;
   359     friend class Ipv6ExtensionLooseRouting;
   359   friend class Ipv6ExtensionLooseRouting;
   360 
   360 
   361     typedef std::list<Ptr<Ipv6Interface> > Ipv6InterfaceList;
   361   typedef std::list<Ptr<Ipv6Interface> > Ipv6InterfaceList;
   362     typedef std::list<Ptr<Ipv6RawSocketImpl> > SocketList;
   362   typedef std::list<Ptr<Ipv6RawSocketImpl> > SocketList;
   363     typedef std::list<Ptr<Ipv6L4Protocol> > L4List_t;
   363   typedef std::list<Ptr<Ipv6L4Protocol> > L4List_t;
   364 
   364 
   365     typedef std::list< Ptr<Ipv6AutoconfiguredPrefix> > Ipv6AutoconfiguredPrefixList;
   365   typedef std::list< Ptr<Ipv6AutoconfiguredPrefix> > Ipv6AutoconfiguredPrefixList;
   366     typedef std::list< Ptr<Ipv6AutoconfiguredPrefix> >::iterator Ipv6AutoconfiguredPrefixListI;
   366   typedef std::list< Ptr<Ipv6AutoconfiguredPrefix> >::iterator Ipv6AutoconfiguredPrefixListI;
   367 
   367 
   368     /**
   368   /**
   369      * \brief Callback to trace TX (transmission) packets.
   369    * \brief Callback to trace TX (transmission) packets.
   370      */ 
   370    */ 
   371     TracedCallback<Ptr<const Packet>, uint32_t> m_txTrace;
   371   TracedCallback<Ptr<const Packet>, uint32_t> m_txTrace;
   372     
   372 
   373     /**
   373   /**
   374      * \brief Callback to trace RX (reception) packets.
   374    * \brief Callback to trace RX (reception) packets.
   375      */ 
   375    */ 
   376     TracedCallback<Ptr<const Packet>, uint32_t> m_rxTrace;
   376   TracedCallback<Ptr<const Packet>, uint32_t> m_rxTrace;
   377     
   377 
   378     /**
   378   /**
   379      * \brief Callback to trace drop packets.
   379    * \brief Callback to trace drop packets.
   380      */ 
   380    */ 
   381     TracedCallback<const Ipv6Header &, Ptr<const Packet>, DropReason, uint32_t> m_dropTrace;
   381   TracedCallback<const Ipv6Header &, Ptr<const Packet>, DropReason, uint32_t> m_dropTrace;
   382 
   382 
   383     /**
   383   /**
   384      * \brief Copy constructor.
   384    * \brief Copy constructor.
   385      * \param o object to copy
   385    * \param o object to copy
   386      */
   386    */
   387     Ipv6L3Protocol (const Ipv6L3Protocol& o);
   387   Ipv6L3Protocol (const Ipv6L3Protocol& o);
   388     
   388 
   389     /**
   389   /**
   390      * \brief Copy constructor.
   390    * \brief Copy constructor.
   391      * \param o object to copy
   391    * \param o object to copy
   392      */
   392    */
   393     Ipv6L3Protocol &operator = (const Ipv6L3Protocol& o);
   393   Ipv6L3Protocol &operator = (const Ipv6L3Protocol& o);
   394 
   394 
   395     /**
   395   /**
   396      * \brief Construct an IPv6 header.
   396    * \brief Construct an IPv6 header.
   397      * \param src source IPv6 address
   397    * \param src source IPv6 address
   398      * \param dst destination IPv6 address
   398    * \param dst destination IPv6 address
   399      * \param protocol L4 protocol
   399    * \param protocol L4 protocol
   400      * \param payloadSize payload size
   400    * \param payloadSize payload size
   401      * \param ttl TTL
   401    * \param ttl TTL
   402      * \return newly created IPv6 header
   402    * \return newly created IPv6 header
   403      */
   403    */
   404     Ipv6Header BuildHeader (Ipv6Address src, Ipv6Address dst, uint8_t protocol,
   404   Ipv6Header BuildHeader (Ipv6Address src, Ipv6Address dst, uint8_t protocol,
   405                             uint16_t payloadSize, uint8_t ttl);
   405                           uint16_t payloadSize, uint8_t ttl);
   406 
   406 
   407     /**
   407   /**
   408      * \brief Send packet with route.
   408    * \brief Send packet with route.
   409      * \param route route 
   409    * \param route route 
   410      * \param packet packet to send
   410    * \param packet packet to send
   411      * \param ipHeader IPv6 header to add to the packet
   411    * \param ipHeader IPv6 header to add to the packet
   412      */
   412    */
   413     void SendRealOut (Ptr<Ipv6Route> route, Ptr<Packet> packet, Ipv6Header const& ipHeader);
   413   void SendRealOut (Ptr<Ipv6Route> route, Ptr<Packet> packet, Ipv6Header const& ipHeader);
   414 
   414 
   415     /**
   415   /**
   416      * \brief Forward a packet.
   416    * \brief Forward a packet.
   417      * \param rtentry route 
   417    * \param rtentry route 
   418      * \param p packet to forward
   418    * \param p packet to forward
   419      * \param header IPv6 header to add to the packet
   419    * \param header IPv6 header to add to the packet
   420      */
   420    */
   421     void IpForward (Ptr<Ipv6Route> rtentry, Ptr<const Packet> p, const Ipv6Header& header);
   421   void IpForward (Ptr<Ipv6Route> rtentry, Ptr<const Packet> p, const Ipv6Header& header);
   422 
   422 
   423     /**
   423   /**
   424      * \brief Forward a packet in multicast.
   424    * \brief Forward a packet in multicast.
   425      * \param mrtentry route 
   425    * \param mrtentry route 
   426      * \param p packet to forward
   426    * \param p packet to forward
   427      * \param header IPv6 header to add to the packet
   427    * \param header IPv6 header to add to the packet
   428      */
   428    */
   429     void IpMulticastForward (Ptr<Ipv6MulticastRoute> mrtentry, Ptr<const Packet> p, const Ipv6Header& header);
   429   void IpMulticastForward (Ptr<Ipv6MulticastRoute> mrtentry, Ptr<const Packet> p, const Ipv6Header& header);
   430 
   430 
   431     /**
   431   /**
   432      * \brief Deliver a packet.
   432    * \brief Deliver a packet.
   433      * \param p packet delivered
   433    * \param p packet delivered
   434      * \param ip IPv6 header
   434    * \param ip IPv6 header
   435      * \param iif input interface packet was received
   435    * \param iif input interface packet was received
   436      */
   436    */
   437     void LocalDeliver (Ptr<const Packet> p, Ipv6Header const& ip, uint32_t iif);
   437   void LocalDeliver (Ptr<const Packet> p, Ipv6Header const& ip, uint32_t iif);
   438     
   438 
   439     /**
   439   /**
   440      * \brief Fallback when no route is found.
   440    * \brief Fallback when no route is found.
   441      * \param p packet
   441    * \param p packet
   442      * \param ipHeader IPv6 header
   442    * \param ipHeader IPv6 header
   443      * \param sockErrno error number
   443    * \param sockErrno error number
   444      */
   444    */
   445     void RouteInputError (Ptr<const Packet> p, const Ipv6Header& ipHeader, Socket::SocketErrno sockErrno);
   445   void RouteInputError (Ptr<const Packet> p, const Ipv6Header& ipHeader, Socket::SocketErrno sockErrno);
   446 
   446 
   447     /**
   447   /**
   448      * \brief Add an IPv6 interface to the stack.
   448    * \brief Add an IPv6 interface to the stack.
   449      * \param interface interface to add
   449    * \param interface interface to add
   450      * \return index of newly added interface
   450    * \return index of newly added interface
   451      */
   451    */
   452     uint32_t AddIpv6Interface (Ptr<Ipv6Interface> interface);
   452   uint32_t AddIpv6Interface (Ptr<Ipv6Interface> interface);
   453 
   453 
   454     /**
   454   /**
   455      * \brief Setup loopback interface.
   455    * \brief Setup loopback interface.
   456      */
   456    */
   457     void SetupLoopback ();
   457   void SetupLoopback ();
   458 
   458 
   459     /**
   459   /**
   460      * \brief Set IPv6 forwarding state.
   460    * \brief Set IPv6 forwarding state.
   461      * \param forward IPv6 forwarding enabled or not
   461    * \param forward IPv6 forwarding enabled or not
   462      */
   462    */
   463     virtual void SetIpForward (bool forward);
   463   virtual void SetIpForward (bool forward);
   464 
   464 
   465     /**
   465   /**
   466      * \brief Get IPv6 forwarding state.
   466    * \brief Get IPv6 forwarding state.
   467      * \return forwarding state (enabled or not)
   467    * \return forwarding state (enabled or not)
   468      */
   468    */
   469     virtual bool GetIpForward () const;
   469   virtual bool GetIpForward () const;
   470 
   470 
   471     /**
   471   /**
   472      * \brief Node attached to stack.
   472    * \brief Node attached to stack.
   473      */
   473    */
   474     Ptr<Node> m_node;
   474   Ptr<Node> m_node;
   475 
   475 
   476     /**
   476   /**
   477      * \brief Forwarding packets (i.e. router mode) state.
   477    * \brief Forwarding packets (i.e. router mode) state.
   478      */
   478    */
   479     bool m_ipForward;
   479   bool m_ipForward;
   480 
   480 
   481     /**
   481   /**
   482      * \brief List of transport protocol.
   482    * \brief List of transport protocol.
   483      */
   483    */
   484     L4List_t m_protocols;
   484   L4List_t m_protocols;
   485 
   485 
   486     /**
   486   /**
   487      * \brief List of IPv6 interfaces.
   487    * \brief List of IPv6 interfaces.
   488      */
   488    */
   489     Ipv6InterfaceList m_interfaces;
   489   Ipv6InterfaceList m_interfaces;
   490 
   490 
   491     /**
   491   /**
   492      * \brief Number of IPv6 interfaces managed by the stack.
   492    * \brief Number of IPv6 interfaces managed by the stack.
   493      */
   493    */
   494     uint32_t m_nInterfaces;
   494   uint32_t m_nInterfaces;
   495 
   495 
   496     /**
   496   /**
   497      * \brief Default TTL for outgoing packets.
   497    * \brief Default TTL for outgoing packets.
   498      */
   498    */
   499     uint8_t m_defaultTtl;
   499   uint8_t m_defaultTtl;
   500 
   500 
   501     /**
   501   /**
   502      * \brief Routing protocol.
   502    * \brief Routing protocol.
   503      */
   503    */
   504     Ptr<Ipv6RoutingProtocol> m_routingProtocol;
   504   Ptr<Ipv6RoutingProtocol> m_routingProtocol;
   505 
   505 
   506     /**
   506   /**
   507      * \brief List of IPv6 raw sockets.
   507    * \brief List of IPv6 raw sockets.
   508      */
   508    */
   509     SocketList m_sockets;
   509   SocketList m_sockets;
   510 
   510 
   511     /**
   511   /**
   512      * \brief List of IPv6 prefix received from RA.
   512    * \brief List of IPv6 prefix received from RA.
   513      */
   513    */
   514     Ipv6AutoconfiguredPrefixList m_prefixes;
   514   Ipv6AutoconfiguredPrefixList m_prefixes;
   515 };
   515 };
   516 
   516 
   517 } /* namespace ns3 */
   517 } /* namespace ns3 */
   518 
   518 
   519 #endif /* IPV6_L3_PROTOCOL_H */
   519 #endif /* IPV6_L3_PROTOCOL_H */