A Discrete-Event Network Simulator
API
ipv6-interface-address.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007-2009 Strasbourg University
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
18  */
19 
20 #ifndef IPV6_INTERFACE_ADDRESS_H
21 #define IPV6_INTERFACE_ADDRESS_H
22 
23 #include "ns3/ipv6-address.h"
24 
25 #include <stdint.h>
26 
27 namespace ns3
28 {
29 
37 {
38  public:
43  enum State_e
44  {
53  };
54 
59  enum Scope_e
60  {
61  HOST,
64  };
65 
70 
76 
83 
90  Ipv6InterfaceAddress(Ipv6Address address, Ipv6Prefix prefix, bool onLink);
91 
97 
102 
108 
113  Ipv6Address GetAddress() const;
114 
119  Ipv6Prefix GetPrefix() const;
120 
126 
132 
138 
144 
150  bool IsInSameSubnet(Ipv6Address b) const;
151 
156  void SetNsDadUid(uint32_t uid);
157 
162  uint32_t GetNsDadUid() const;
163 
168  void SetOnLink(bool onLink);
169 
174  bool GetOnLink() const;
175 
176 #if 0
181  void StartDadTimer (Ptr<Ipv6Interface> interface);
182 
186  void StopDadTimer ();
187 #endif
188 
189  private:
194 
199 
204 
209 
213  bool m_onLink;
214 
222  friend bool operator==(const Ipv6InterfaceAddress& a, const Ipv6InterfaceAddress& b);
223 
231  friend bool operator!=(const Ipv6InterfaceAddress& a, const Ipv6InterfaceAddress& b);
232 
236  uint32_t m_nsDadUid;
237 };
238 
246 std::ostream& operator<<(std::ostream& os, const Ipv6InterfaceAddress& addr);
247 
248 /* follow Ipv4InterfaceAddress way, maybe not inline them */
249 inline bool
251 {
252  return (a.m_address == b.m_address && a.m_prefix == b.m_prefix && a.m_state == b.m_state &&
253  a.m_scope == b.m_scope);
254 }
255 
256 inline bool
258 {
259  return (a.m_address != b.m_address || a.m_prefix != b.m_prefix || a.m_state != b.m_state ||
260  a.m_scope != b.m_scope);
261 }
262 
263 } /* namespace ns3 */
264 
265 #endif /* IPV6_INTERFACE_ADDRESS_H */
Describes an IPv6 address.
Definition: ipv6-address.h:49
IPv6 address associated with an interface.
void SetScope(Ipv6InterfaceAddress::Scope_e scope)
Set the scope.
Ipv6Address m_address
The IPv6 address.
uint32_t m_nsDadUid
Last DAD probe packet UID.
friend bool operator==(const Ipv6InterfaceAddress &a, const Ipv6InterfaceAddress &b)
Equal to operator.
friend bool operator!=(const Ipv6InterfaceAddress &a, const Ipv6InterfaceAddress &b)
Not equal to operator.
void SetAddress(Ipv6Address address)
Set IPv6 address (and scope).
Ipv6Address GetAddress() const
Get the IPv6 address.
Ipv6InterfaceAddress()
Default constructor.
uint32_t GetNsDadUid() const
Get the latest DAD probe packet UID.
void SetState(Ipv6InterfaceAddress::State_e state)
Set the state.
Ipv6InterfaceAddress::Scope_e GetScope() const
Get address scope.
void SetNsDadUid(uint32_t uid)
Set the latest DAD probe packet UID.
Ipv6Prefix GetPrefix() const
Get the IPv6 prefix.
bool GetOnLink() const
Get the on-link property.
void SetOnLink(bool onLink)
Get the on-link property.
Ipv6InterfaceAddress::State_e GetState() const
Get the address state.
bool m_onLink
The address belongs to an on-link network.
State_e
State of an address associated with an interface.
@ TENTATIVE_OPTIMISTIC
Address is tentative but we are optimistic so we can send packet even if DAD is not yet finished.
@ INVALID
Invalid state (after a DAD failed)
@ HOMEADDRESS
Address is a HomeAddress.
@ DEPRECATED
Address is deprecated and should not be used.
@ TENTATIVE
Address is tentative, no packet can be sent unless DAD finished.
bool IsInSameSubnet(Ipv6Address b) const
Checks if the address is in the same subnet.
Scope_e m_scope
Scope of the address.
State_e m_state
State of the address.
Ipv6Prefix m_prefix
The IPv6 prefix.
@ LINKLOCAL
Link-local address (fe80::/64)
@ GLOBAL
Global address (2000::/3)
Describes an IPv6 prefix.
Definition: ipv6-address.h:455
address
Definition: first.py:47
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool operator!=(Callback< R, Args... > a, Callback< R, Args... > b)
Inequality test.
Definition: callback.h:678
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.h:157
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159