src/node/ipv6-route.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu Nov 12 13:01:01 2009 +0100 (2009-11-12)
changeset 5505 c0ac392289c3
parent 5225 9c612cb88d6b
child 5891 09a575cdf8db
permissions -rw-r--r--
replace RefCountBase with SimpleRefCount<> to avoid duplicate refcounting implementations.
vincent@4731
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
vincent@4731
     2
/*
vincent@4731
     3
 * Copyright (c) 2007-2009 Strasbourg University
vincent@4731
     4
 *
vincent@4731
     5
 * This program is free software; you can redistribute it and/or modify
vincent@4731
     6
 * it under the terms of the GNU General Public License version 2 as
vincent@4731
     7
 * published by the Free Software Foundation;
vincent@4731
     8
 *
vincent@4731
     9
 * This program is distributed in the hope that it will be useful,
vincent@4731
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
vincent@4731
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
vincent@4731
    12
 * GNU General Public License for more details.
vincent@4731
    13
 *
vincent@4731
    14
 * You should have received a copy of the GNU General Public License
vincent@4731
    15
 * along with this program; if not, write to the Free Software
vincent@4731
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
vincent@4731
    17
 *
vincent@4731
    18
 * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
vincent@4731
    19
 */
vincent@4731
    20
vincent@4731
    21
#ifndef IPV6_ROUTE_H
vincent@4731
    22
#define IPV6_ROUTE_H
vincent@4731
    23
vincent@4731
    24
#include <list>
vincent@4731
    25
#include <vector>
vincent@4731
    26
#include <ostream>
vincent@4731
    27
mathieu@5505
    28
#include "ns3/simple-ref-count.h"
vincent@5217
    29
vincent@4731
    30
#include "ipv6-address.h"
vincent@4731
    31
vincent@4731
    32
namespace ns3
vincent@4731
    33
{
vincent@4731
    34
vincent@4731
    35
class NetDevice;
vincent@4731
    36
vincent@4731
    37
/**
vincent@4731
    38
 * \ingroup ipv6Routing
vincent@4731
    39
 * \class Ipv6Route
vincent@4731
    40
 * \brief IPv6 route cache entry.
vincent@4731
    41
 */
mathieu@5505
    42
class Ipv6Route : public SimpleRefCount<Ipv6Route>
vincent@4731
    43
{
vincent@4731
    44
  public:
vincent@4731
    45
    /**
vincent@4731
    46
     * \brief Constructor.
vincent@4731
    47
     */
vincent@4731
    48
    Ipv6Route ();
vincent@4731
    49
vincent@4731
    50
    /**
vincent@4731
    51
     * \brief Destructor.
vincent@4731
    52
     */
vincent@4731
    53
    virtual ~Ipv6Route ();
vincent@4731
    54
vincent@4731
    55
    /**
vincent@4731
    56
     * \brief Set destination address.
vincent@4731
    57
     * \param dest IPv6 destination address
vincent@4731
    58
     */
vincent@4731
    59
    void SetDestination (Ipv6Address dest);
vincent@4731
    60
vincent@4731
    61
    /**
vincent@4731
    62
     * \brief Get destination address.
vincent@4731
    63
     * \return destination address
vincent@4731
    64
     */
vincent@4731
    65
    Ipv6Address GetDestination () const;
vincent@4731
    66
vincent@4731
    67
    /**
vincent@4731
    68
     * \brief Set source address.
vincent@4731
    69
     * \param src IPv6 source address
vincent@4731
    70
     */
vincent@4731
    71
    void SetSource (Ipv6Address src);
vincent@4731
    72
vincent@4731
    73
    /**
vincent@4731
    74
     * \brief Get source address.
vincent@4731
    75
     * \return source address
vincent@4731
    76
     */
vincent@4731
    77
    Ipv6Address GetSource () const;
vincent@4731
    78
vincent@4731
    79
    /**
vincent@4731
    80
     * \brief Set gateway address.
vincent@4731
    81
     * \param gw IPv6 gateway address
vincent@4731
    82
     */
vincent@4731
    83
    void SetGateway (Ipv6Address gw);
vincent@4731
    84
vincent@4731
    85
    /**
vincent@4731
    86
     * \brief Get gateway address.
vincent@4731
    87
     * \return gateway address
vincent@4731
    88
     */
vincent@4731
    89
    Ipv6Address GetGateway () const;
vincent@4731
    90
vincent@4731
    91
    /**
vincent@4731
    92
     * \brief Set output device for outgoing packets.
vincent@4731
    93
     * \param outputDevice output device
vincent@4731
    94
     */
vincent@4731
    95
    void SetOutputDevice (Ptr<NetDevice> outputDevice);
vincent@4731
    96
vincent@4731
    97
    /**
vincent@4731
    98
     * \brief Get output device.
vincent@4731
    99
     * \return output device
vincent@4731
   100
     */
vincent@4731
   101
    Ptr<NetDevice> GetOutputDevice () const;
vincent@4731
   102
vincent@4731
   103
  private:
vincent@4731
   104
    /**
vincent@4731
   105
     * \brief Destination address.
vincent@4731
   106
     */
vincent@4731
   107
    Ipv6Address m_dest;
vincent@4731
   108
vincent@4731
   109
    /**
vincent@4731
   110
     * \brief source address.
vincent@4731
   111
     */
vincent@4731
   112
    Ipv6Address m_source;
vincent@4731
   113
vincent@4731
   114
    /**
vincent@4731
   115
     * \brief Gateway address.
vincent@4731
   116
     */
vincent@4731
   117
    Ipv6Address m_gateway;
vincent@4731
   118
vincent@4731
   119
    /**
vincent@4731
   120
     * \brief Output device.
vincent@4731
   121
     */
vincent@4731
   122
    Ptr<NetDevice> m_outputDevice;
vincent@4731
   123
};
vincent@4731
   124
vincent@4731
   125
std::ostream& operator<< (std::ostream& os, Ipv6Route const& route);
vincent@4731
   126
vincent@4731
   127
/**
vincent@4731
   128
 * \ingroup ipv6Routing
vincent@4731
   129
 * \class Ipv6MulticastRoute
vincent@4731
   130
 * \brief IPv6 multicast route entry.
vincent@4731
   131
 */
mathieu@5505
   132
class Ipv6MulticastRoute : public SimpleRefCount<Ipv6MulticastRoute>
vincent@4731
   133
{
vincent@4731
   134
  public:
vincent@4731
   135
    /**
vincent@4731
   136
     * \brief Maximum number of multicast interfaces on a router.
vincent@4731
   137
     */
vincent@4731
   138
    static const uint32_t MAX_INTERFACES = 16;
vincent@4731
   139
vincent@4731
   140
    /**
vincent@4731
   141
     * \brief Maximum Time-To-Live (TTL).
vincent@4731
   142
     */
vincent@4731
   143
    static const uint32_t MAX_TTL = 255;
vincent@4731
   144
vincent@4731
   145
    /**
vincent@4731
   146
     * \brief Constructor.
vincent@4731
   147
     */
vincent@4731
   148
    Ipv6MulticastRoute ();
vincent@4731
   149
vincent@4731
   150
    /**
vincent@4731
   151
     * \brief Destructor.
vincent@4731
   152
     */
vincent@4731
   153
    virtual ~Ipv6MulticastRoute ();
vincent@4731
   154
vincent@4731
   155
    /**
vincent@4731
   156
     * \brief Set IPv6 group.
vincent@4731
   157
     * \param group Ipv6Address of the multicast group
vincent@4731
   158
     */
vincent@4731
   159
    void SetGroup (const Ipv6Address group);
vincent@4731
   160
vincent@4731
   161
    /**
vincent@4731
   162
     * \brief Get IPv6 group.
vincent@4731
   163
     * \return Ipv6Address of the multicast group
vincent@4731
   164
     */
vincent@4731
   165
    Ipv6Address GetGroup (void) const;
vincent@4731
   166
vincent@4731
   167
    /**
vincent@4731
   168
     * \brief Set origin address.
vincent@4731
   169
     * \param origin Ipv6Address of the origin address
vincent@4731
   170
     */
vincent@4731
   171
    void SetOrigin (const Ipv6Address origin);
vincent@4731
   172
vincent@4731
   173
    /**
vincent@4731
   174
     * \brief Get source address.
vincent@4731
   175
     * \return Ipv6Address of the origin address
vincent@4731
   176
     */
vincent@4731
   177
    Ipv6Address GetOrigin (void) const;
vincent@4731
   178
vincent@4731
   179
    /**
vincent@5225
   180
     * \brief Set parent for this route.
vincent@4731
   181
     * \param iif Parent (input interface) for this route
vincent@4731
   182
     */
vincent@4731
   183
    void SetParent (uint32_t iif);
vincent@5225
   184
vincent@4731
   185
    /**
vincent@5225
   186
     * \brief Get parent for this route.
vincent@4731
   187
     * \return Parent (input interface) for this route
vincent@4731
   188
     */
vincent@4731
   189
    uint32_t GetParent (void) const;
vincent@4731
   190
vincent@4731
   191
    /**
vincent@5225
   192
     * \brief set output TTL for this route.
vincent@4731
   193
     * \param oif Outgoing interface index
vincent@4731
   194
     * \param ttl time-to-live for this route
vincent@4731
   195
     */
vincent@4731
   196
    void SetOutputTtl (uint32_t oif, uint32_t ttl);
vincent@4731
   197
vincent@4731
   198
    /**
vincent@5225
   199
     * \brief Get output TTL for this route.
vincent@4731
   200
     * \param oif outgoing interface
vincent@4731
   201
     * \return TTL for this route
vincent@4731
   202
     */
vincent@4731
   203
    uint32_t GetOutputTtl (uint32_t oif) const;
vincent@4731
   204
vincent@4731
   205
  private:
vincent@4731
   206
    /**
vincent@4731
   207
     * \brief IPv6 group.
vincent@4731
   208
     */
vincent@4731
   209
    Ipv6Address m_group;
vincent@4731
   210
vincent@4731
   211
    /**
vincent@4731
   212
     * \brief IPv6 origin (source).
vincent@4731
   213
     */
vincent@4731
   214
    Ipv6Address m_origin;
vincent@4731
   215
vincent@4731
   216
    /**
vincent@4731
   217
     * \brief Source interface.
vincent@4731
   218
     */
vincent@4731
   219
    uint32_t m_parent;
vincent@4731
   220
vincent@4731
   221
    /**
vincent@5225
   222
     * \brief TTLs.
vincent@4731
   223
     */
vincent@4731
   224
    std::vector<uint32_t> m_ttls;
vincent@4731
   225
};
vincent@4731
   226
vincent@4731
   227
std::ostream& operator<< (std::ostream& os, Ipv6MulticastRoute const& route);
vincent@4731
   228
vincent@4731
   229
} /* namespace ns3 */
vincent@4731
   230
vincent@4731
   231
#endif /* IPV6_ROUTE_H */
vincent@4731
   232