/usr/include/ns3.26/ns3/ipv6-interface.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 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007-2009 Strasbourg University
*
* 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
*
* Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
*/
#ifndef IPV6_INTERFACE_H
#define IPV6_INTERFACE_H
#include <list>
#include "ns3/ptr.h"
#include "ns3/object.h"
#include "ipv6-interface-address.h"
#include "ns3/traffic-control-layer.h"
namespace ns3
{
class NetDevice;
class Packet;
class Node;
class NdiscCache;
class Ipv6InterfaceAddress;
class Ipv6Address;
class Ipv6Header;
/**
* \ingroup ipv6
*
* \brief The IPv6 representation of a network interface.
*
* By default IPv6 interfaces are created in the "down" state
* with IP "fe80::1" and a /64 prefix. Before becoming usable,
* the user must invoke SetUp on them once the final IPv6 address
* and mask has been set.
*/
class Ipv6Interface : public Object
{
public:
/**
* \brief Get the type ID
* \return type ID
*/
static TypeId GetTypeId ();
/**
* \brief Constructs an Ipv6Interface.
*/
Ipv6Interface ();
/**
* \brief Destructor.
*/
virtual ~Ipv6Interface ();
/**
* \brief Set node associated with interface.
* \param node node
*/
void SetNode (Ptr<Node> node);
/**
* \brief Set the NetDevice.
* \param device NetDevice
*/
void SetDevice (Ptr<NetDevice> device);
/**
* \brief Set the TrafficControlLayer.
* \param tc TrafficControlLayer object
*/
void SetTrafficControl (Ptr<TrafficControlLayer> tc);
/**
* \brief Get the NetDevice.
* \return the NetDevice associated with this interface
*/
virtual Ptr<NetDevice> GetDevice () const;
/**
* \brief Set the metric.
* \param metric configured routing metric (cost) of this interface
*/
void SetMetric (uint16_t metric);
/**
* \brief Get the metric
* \return the metric
*/
uint16_t GetMetric () const;
/**
* \brief Is the interface UP ?
* \return true if interface is enabled, false otherwise.
*/
bool IsUp () const;
/**
* \brief Is the interface DOWN ?
* \return true if interface is disabled, false otherwise.
*/
bool IsDown () const;
/**
* \brief Enable this interface.
*/
void SetUp ();
/**
* \brief Disable this interface.
*/
void SetDown ();
/**
* \brief If the interface allows forwarding packets.
* \return true if forwarding is enabled, false otherwise
*/
bool IsForwarding () const;
/**
* \brief Set forwarding enabled or not.
* \param forward forwarding state
*/
void SetForwarding (bool forward);
/**
* \brief Set the current hop limit.
* \param curHopLimit the value to set
*/
void SetCurHopLimit (uint8_t curHopLimit);
/**
* \brief Get the current hop limit value.
* \return current hop limit
*/
uint8_t GetCurHopLimit () const;
/**
* \brief Set the base reachable time.
* \param baseReachableTime the value to set
*/
void SetBaseReachableTime (uint16_t baseReachableTime);
/**
* \brief Get the base reachable time.
* \return base reachable time
*/
uint16_t GetBaseReachableTime () const;
/**
* \brief Set the reachable time.
* \param reachableTime value to set
*/
void SetReachableTime (uint16_t reachableTime);
/**
* \brief Get the reachable time.
* \return reachable time
*/
uint16_t GetReachableTime () const;
/**
* \brief Set the retransmission timer.
* \param retransTimer value to set
*/
void SetRetransTimer (uint16_t retransTimer);
/**
* \brief Get the retransmission timer.
* \return retransmission timer
*/
uint16_t GetRetransTimer () const;
/**
* \brief Send a packet through this interface.
* \param p packet to send
* \param hdr IPv6 header
* \param dest next hop address of packet.
*
* \note This method will eventually call the private SendTo
* method which must be implemented by subclasses.
*/
void Send (Ptr<Packet> p, const Ipv6Header & hdr, Ipv6Address dest);
/**
* \brief Add an IPv6 address.
* \param iface address to add
* \return true if address was added, false otherwise
*/
bool AddAddress (Ipv6InterfaceAddress iface);
/**
* \brief Get link-local address from IPv6 interface.
* \return link-local Ipv6InterfaceAddress, assert if not found
*/
Ipv6InterfaceAddress GetLinkLocalAddress () const;
/**
* \brief Checks if the address is a Solicited Multicast address for this interface.
* \param address the address to check.
* \return true if it is a solicited multicast address.
*/
bool IsSolicitedMulticastAddress (Ipv6Address address) const;
/**
* \brief Get an address from IPv6 interface.
* \param index index
* \return Ipv6InterfaceAddress address whose index is i
*/
Ipv6InterfaceAddress GetAddress (uint32_t index) const;
/**
* \brief Get an address which is in the same network prefix as destination.
* \param dst destination address
* \return Corresponding Ipv6InterfaceAddress or assert if not found
*/
Ipv6InterfaceAddress GetAddressMatchingDestination (Ipv6Address dst);
/**
* \brief Get number of addresses on this IPv6 interface.
* \return number of address
*/
uint32_t GetNAddresses (void) const;
/**
* \brief Remove an address from interface.
* \param index index to remove
* \return Ipv6InterfaceAddress address whose index is index
*/
Ipv6InterfaceAddress RemoveAddress (uint32_t index);
/**
* \brief Remove the given Ipv6 address from the interface.
* \param address The Ipv6 address to remove
* \returns The removed Ipv6 interface address
* \returns The null interface address if the interface did not contain the
* address or if loopback address was passed as argument
*/
Ipv6InterfaceAddress RemoveAddress (Ipv6Address address);
/**
* \brief Update state of an interface address.
* \param address IPv6 address
* \param state new state
*/
void SetState (Ipv6Address address, Ipv6InterfaceAddress::State_e state);
/**
* \brief Update NS DAD packet UID of an interface address.
* \param address IPv6 address
* \param uid packet UID
*/
void SetNsDadUid (Ipv6Address address, uint32_t uid);
/**
* \return NDISC cache used by this interface
*/
Ptr<NdiscCache> GetNdiscCache () const;
protected:
/**
* \brief Dispose this object.
*/
virtual void DoDispose ();
private:
/**
* \brief Container for the Ipv6InterfaceAddresses.
*/
typedef std::list<std::pair<Ipv6InterfaceAddress, Ipv6Address> > Ipv6InterfaceAddressList;
/**
* \brief Container Iterator for the Ipv6InterfaceAddresses.
*/
typedef std::list<std::pair<Ipv6InterfaceAddress, Ipv6Address> >::iterator Ipv6InterfaceAddressListI;
/**
* \brief Const Container Iterator for the Ipv6InterfaceAddresses.
*/
typedef std::list<std::pair<Ipv6InterfaceAddress, Ipv6Address> >::const_iterator Ipv6InterfaceAddressListCI;
/**
* \brief Initialize interface.
*/
void DoSetup ();
/**
* \brief The addresses assigned to this interface.
*/
Ipv6InterfaceAddressList m_addresses;
/**
* \brief The link-local addresses assigned to this interface.
*/
Ipv6InterfaceAddress m_linkLocalAddress;
/**
* \brief The state of this interface.
*/
bool m_ifup;
/**
* \brief Forwarding state.
*/
bool m_forwarding;
/**
* \brief The metric.
*/
uint16_t m_metric;
/**
* \brief Node associated with this interface.
*/
Ptr<Node> m_node;
/**
* \brief NetDevice associated with this interface.
*/
Ptr<NetDevice> m_device;
/**
* \brief TrafficControlLayer associated with this interface.
*/
Ptr<TrafficControlLayer> m_tc;
/**
* \brief Neighbor cache.
*/
Ptr<NdiscCache> m_ndCache;
/**
* \brief Current hop limit.
*/
uint8_t m_curHopLimit;
/**
* \brief Base value used for computing the random reachable time value (in millisecond).
*/
uint16_t m_baseReachableTime;
/**
* \brief Reachable time (in millisecond).
* The time a neighbor is considered reachable after receiving a reachability confirmation.
*/
uint16_t m_reachableTime;
/**
* \brief Retransmission timer (in millisecond).
* Time between retransmission of NS.
*/
uint16_t m_retransTimer;
};
} /* namespace ns3 */
#endif /* IPV6_INTERFACE_H */
|