src/applications/radvd/radvd-interface.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.
     1 /* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
     2 /*
     3  * Copyright (c) 2009 Strasbourg University
     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  * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
    19  */
    20 
    21 #ifndef RADVD_INTERFACE_H
    22 #define RADVD_INTERFACE_H
    23 
    24 #include <list>
    25 #include "ns3/simple-ref-count.h"
    26 #include "radvd-prefix.h"
    27 
    28 namespace ns3
    29 {
    30 
    31 /**
    32  * \ingroup radvd
    33  * \class RadvdInterface
    34  * \brief Radvd interface configuration.
    35  */
    36 class RadvdInterface : public SimpleRefCount<RadvdInterface>
    37 {
    38   public:
    39     /**
    40      * \brief Constructor.
    41      * \param interface interface index
    42      */
    43     RadvdInterface (uint32_t interface);
    44 
    45     /**
    46      * \brief Constructor.
    47      * \param interface interface index
    48      * \param maxRtrAdvInterval maximum RA interval (ms)
    49      * \param minRtrAdvInterval minimum RA interval (ms)
    50      */
    51     RadvdInterface (uint32_t interface, uint32_t maxRtrAdvInterval, uint32_t minRtrAdvInterval);
    52 
    53     /**
    54      * \brief Destructor.
    55      */
    56     ~RadvdInterface ();
    57 
    58     /**
    59      * \brief Get interface index for this configuration.
    60      * \return interface index
    61      */
    62     uint32_t GetInterface () const;
    63 
    64     /**
    65      * \brief Get list of prefixes advertised for this interface.     
    66      * \return list of IPv6 prefixes
    67      */
    68     std::list <Ptr<RadvdPrefix> > GetPrefixes () const;
    69 
    70     /**
    71      * \brief Add a prefix to advertise on interface.
    72      * \param routerPrefix prefix to advertise
    73      */
    74     void AddPrefix (Ptr<RadvdPrefix> routerPrefix);
    75     
    76     /**
    77      * \brief Is send advert enabled (periodic RA and reply to RS) ?
    78      * \return send advert flag
    79      */
    80     bool IsSendAdvert () const;
    81     
    82     /**
    83      * \brief Set send advert flag.
    84      * \param sendAdvert value
    85      */
    86     void SetSendAdvert (bool sendAdvert);
    87 
    88     /**
    89      * \brief Get maximum RA interval.
    90      * \return RA interval (ms)
    91      */
    92     uint32_t GetMaxRtrAdvInterval () const;
    93 
    94     /**
    95      * \brief Get maximum RA interval.
    96      * \param maxRtrAdvInterval RA interval (ms)
    97      */
    98     void SetMaxRtrAdvInterval (uint32_t maxRtrAdvInterval);
    99 
   100     /**
   101      * \brief Get minimum RA interval 
   102      * \return RA interval (ms)
   103      */
   104     uint32_t GetMinRtrAdvInterval () const;
   105     
   106     /**
   107      * \brief Get minimum RA interval 
   108      * \param minRtrAdvInterval RA interval (ms).
   109      */
   110     void SetMinRtrAdvInterval (uint32_t minRtrAdvInterval);
   111 
   112     /**
   113      * \brief Get minimum delay between RAs.
   114      * \return minimum delay (ms)
   115      */
   116     uint32_t GetMinDelayBetweenRAs () const;
   117     
   118     /**
   119      * \brief Set minimum delay between RAs.
   120      * \param minDelayBetweenRAs minimum delay (ms)
   121      */
   122     void SetMinDelayBetweenRAs (uint32_t minDelayBetweenRAs);
   123 
   124     /**
   125      * \brief Is managed flag enabled ?
   126      * \return managed flag
   127      */
   128     bool IsManagedFlag () const;
   129     
   130     /**
   131      * \brief Set managed flag
   132      * \param managedFlag value
   133      */
   134     void SetManagedFlag (bool managedFlag);
   135 
   136     /**
   137      * \brief Is "other config" flag enabled ?
   138      * \return other config flag
   139      */
   140     bool IsOtherConfigFlag () const;
   141     
   142     /**
   143      * \brief Set "other config" flag
   144      * \param otherConfigFlag value
   145      */
   146     void SetOtherConfigFlag (bool otherConfigFlag);
   147 
   148     /**
   149      * \brief Get link MTU.
   150      * \return link MTU
   151      */
   152     uint32_t GetLinkMtu () const;
   153     
   154     /**
   155      * \brief Set link MTU.
   156      * \param linkMtu link MTU
   157      */
   158     void SetLinkMtu (uint32_t linkMtu); 
   159 
   160     /**
   161      * \brief Get reachable time.
   162      * \return reachable time
   163      */
   164     uint32_t GetReachableTime () const;
   165     
   166     /**
   167      * \brief Set reachable time.
   168      * \param reachableTime reachable time
   169      */
   170     void SetReachableTime (uint32_t reachableTime);
   171 
   172     /**
   173      * \brief Get default lifetime.
   174      * \return default lifetime
   175      */
   176     uint32_t GetDefaultLifeTime () const;
   177     
   178     /**
   179      * \brief Set default lifetime.
   180      * \param defaultLifeTime default lifetime
   181      */
   182     void SetDefaultLifeTime (uint32_t defaultLifeTime);
   183 
   184     /**
   185      * \brief Get retransmission timer.
   186      * \return retransmission timer
   187      */
   188     uint32_t GetRetransTimer () const;
   189     
   190     /**
   191      * \brief Set retransmission timer.
   192      * \param retransTimer retransmission timer
   193      */
   194     void SetRetransTimer (uint32_t retransTimer);
   195 
   196     /**
   197      * \brief Get current hop limit.
   198      * \return current hop limit for the link
   199      */
   200     uint8_t GetCurHopLimit () const;
   201     
   202     /**
   203      * \brief Set current hop limit.
   204      * \param curHopLimit current hop limit for the link
   205      */
   206     void SetCurHopLimit (uint8_t curHopLimit); 
   207 
   208     /**
   209      * \brief Get default preference.
   210      * \return default preference
   211      */
   212     uint8_t GetDefaultPreference () const;
   213     
   214     /**
   215      * \brief Set default preference.
   216      * \param defaultPreference default preference
   217      */
   218     void SetDefaultPreference (uint8_t defaultPreference);
   219 
   220     /**
   221      * \brief Is source LLA option should be included in RA ?
   222      * \return true if source address is added in RA, false otherwise
   223      */
   224     bool IsSourceLLAddress () const;
   225     
   226     /**
   227      * \brief Set flag to add or not LLA to RA.
   228      * \param sourceLLAddress value
   229      */
   230     void SetSourceLLAddress (bool sourceLLAddress);
   231 
   232     /**
   233      * \brief Is "home agent" flag enabled ?
   234      * \return "home agent" flag
   235      */
   236     bool IsHomeAgentFlag () const;
   237     
   238     /**
   239      * \brief Set "home agent" flag.
   240      * \param homeAgentFlag value
   241      */
   242     void SetHomeAgentFlag (bool homeAgentFlag);
   243 
   244     /**
   245      * \brief Is Home Agent Information option should be included in RA ?
   246      * \return true if HA information option is added in RA, false otherwise
   247      */
   248     bool IsHomeAgentInfo () const;
   249     
   250     /**
   251      * \brief Set flag to add or not HA information option to RA.
   252      * \param homeAgentFlag value
   253      */
   254     void SetHomeAgentInfo (bool homeAgentFlag);
   255     
   256     /**
   257      * \brief Get home agent lifetime.
   258      * \return home agent lifetime
   259      */
   260     uint32_t GetHomeAgentLifeTime () const;
   261     
   262     /**
   263      * \brief Set home agent lifetime.
   264      * \param homeAgentLifeTime home agent lifetime
   265      */
   266     void SetHomeAgentLifeTime (uint32_t homeAgentLifeTime);
   267     
   268     /**
   269      * \brief Get home agent preference.
   270      * \return home agent preference
   271      */
   272     uint32_t GetHomeAgentPreference () const;
   273     
   274     /**
   275      * \brief Set home agent preference.
   276      * \param homeAgentPreference home agent preference
   277      */
   278     void SetHomeAgentPreference (uint32_t homeAgentPreference);
   279 
   280     /**
   281      * \brief Is "mobile router support" flag enabled ?
   282      * \return "mobile router support" flag
   283      */
   284     bool IsMobRtrSupportFlag () const;
   285     
   286     /**
   287      * \brief Set "mobile router support" flag.
   288      * \param mobRtrSupportFlag value
   289      */
   290     void SetMobRtrSupportFlag (bool mobRtrSupportFlag);
   291     
   292     /**
   293      * \brief Is advertisement interval option should be included in RA ?
   294      * \return true if advertisement interval option is added in RA, false otherwise
   295      */
   296     bool IsIntervalOpt () const;
   297     
   298     /**
   299      * \brief Set flag to add or not advertisement interval to RA.
   300      * \param intervalOpt value
   301      */
   302     void SetIntervalOpt (bool intervalOpt);
   303 
   304   private:
   305     typedef std::list<Ptr<RadvdPrefix> > RadvdPrefixList;
   306     typedef std::list<Ptr<RadvdPrefix> >::iterator RadvdPrefixListI;
   307 
   308     /**
   309      * \brief Interface to advertise RA.
   310      */
   311     uint32_t m_interface;
   312 
   313     /**
   314      * \brief List of prefixes to advertise.
   315      */
   316     RadvdPrefixList m_prefixes;
   317 
   318     /**
   319      * \brief Flag whether or not router sends periodic RA and respond to RS.
   320      */
   321     bool m_sendAdvert;
   322 
   323     /**
   324      * \brief Maximum RA interval in milliseconds.
   325      */
   326     uint32_t m_maxRtrAdvInterval;
   327 
   328     /**
   329      * \brief Minimum RA interval in milliseconds.
   330      */
   331     uint32_t m_minRtrAdvInterval;
   332 
   333     /**
   334      * \brief Minimum delay between RA in milliseconds.
   335      */
   336     uint32_t m_minDelayBetweenRAs;
   337 
   338     /**
   339      * \brief Managed flag. If true host use the stateful protocol for address autoconfiguration.
   340      */
   341     bool m_managedFlag;
   342 
   343     /**
   344      * \brief Other configuration flag. If true host use stateful protocol for other (non-address) information.
   345      */
   346     bool m_otherConfigFlag;
   347 
   348     /**
   349      * \brief Link MTU to use.
   350      */
   351     uint32_t m_linkMtu;
   352 
   353     /**
   354      * \brief Reachable time in milliseconds.
   355      */
   356     uint32_t m_reachableTime;
   357 
   358     /**
   359      * \brief Retransmission timer in milliseconds.
   360      */
   361     uint32_t m_retransTimer;
   362 
   363     /**
   364      * \brief Current hop limit (TTL).
   365      */
   366     uint32_t m_curHopLimit;
   367 
   368     /**
   369      * \brief Default life time in seconds.
   370      */
   371     uint32_t m_defaultLifeTime;
   372 
   373     /**
   374      * \brief Preference associated with default router.
   375      * 0 = low
   376      * 1 = medium
   377      * 2 = high
   378      */
   379     uint8_t m_defaultPreference;
   380 
   381     /**
   382      * \brief Flag to add link-layer address in RA.
   383      */
   384     bool m_sourceLLAddress;
   385 
   386     /**
   387      * \brief Flag to add HA (home agent) flag in RA.
   388      */
   389     bool m_homeAgentFlag;
   390 
   391     /**
   392      * \brief Flag to add Home Agent Information option (Mobile IPv6).
   393      * Currently not implemented.
   394      */
   395     bool m_homeAgentInfo;
   396 
   397     /**
   398      * \brief Home agent lifetime in seconds. Ignored if home agent info is not set.
   399      */
   400     uint32_t m_homeAgentLifeTime;
   401 
   402     /**
   403      * \brief Home agent preference. Ignored if home agent info is not set.
   404      */
   405     uint32_t m_homeAgentPreference;
   406 
   407     /**
   408      * \brief Flag for HA to signals it supports Mobile Router registrations (NEMO Basic).
   409      */
   410     bool m_mobRtrSupportFlag;
   411 
   412     /**
   413      * \brief Flag to add Advertisement Interval option in RA.
   414      */
   415     bool m_intervalOpt;
   416 };
   417 
   418 } /* namespace ns3 */
   419 
   420 #endif /* RADVD_INTERFACE_H */
   421