A Discrete-Event Network Simulator
API
ipv6-interface-address.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007-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 IPV6_INTERFACE_ADDRESS_H
22 #define IPV6_INTERFACE_ADDRESS_H
23 
24 #include <stdint.h>
25 
26 #include "ns3/ipv6-address.h"
27 
28 namespace ns3
29 {
30 
38 {
39 public:
44  enum State_e
45  {
53  };
54 
59  enum Scope_e
60  {
61  HOST,
64  };
65 
70 
76 
83 
89 
94 
100 
105  Ipv6Address GetAddress () const;
106 
111  Ipv6Prefix GetPrefix () const;
112 
118 
124 
130 
136 
142  bool IsInSameSubnet (Ipv6Address b) const;
143 
148  void SetNsDadUid (uint32_t uid);
149 
154  uint32_t GetNsDadUid () const;
155 
156 #if 0
157 
161  void StartDadTimer (Ptr<Ipv6Interface> interface);
162 
166  void StopDadTimer ();
167 #endif
168 
169 private:
174 
179 
184 
189 
197  friend bool operator == (Ipv6InterfaceAddress const& a, Ipv6InterfaceAddress const& b);
198 
206  friend bool operator != (Ipv6InterfaceAddress const& a, Ipv6InterfaceAddress const& b);
207 
211  uint32_t m_nsDadUid;
212 };
213 
221 std::ostream& operator<< (std::ostream& os, const Ipv6InterfaceAddress &addr);
222 
223 /* follow Ipv4InterfaceAddress way, maybe not inline them */
225 {
226  return (a.m_address == b.m_address && a.m_prefix == b.m_prefix &&
227  a.m_state == b.m_state && a.m_scope == b.m_scope);
228 }
229 
231 {
232  return (a.m_address != b.m_address || a.m_prefix != b.m_prefix ||
233  a.m_state != b.m_state || a.m_scope != b.m_scope);
234 }
235 
236 } /* namespace ns3 */
237 
238 #endif /* IPV6_INTERFACE_ADDRESS_H */
239 
State_e m_state
State of the address.
void SetScope(Ipv6InterfaceAddress::Scope_e scope)
Set the scope.
uint32_t GetNsDadUid() const
Get the latest DAD probe packet UID.
friend bool operator!=(Ipv6InterfaceAddress const &a, Ipv6InterfaceAddress const &b)
Not equal to operator.
void SetNsDadUid(uint32_t uid)
Set the latest DAD probe packet UID.
IPv6 address associated with an interface.
uint32_t m_nsDadUid
Last DAD probe packet UID.
Ipv6Address GetAddress() const
Get the IPv6 address.
Ipv6InterfaceAddress()
Default constructor.
Ipv6Address m_address
The IPv6 address.
Link-local address (fe80::/64)
Address is tentative but we are optimistic so we can send packet even if DAD is not yet finished...
void SetState(Ipv6InterfaceAddress::State_e state)
Set the state.
Ipv6Prefix GetPrefix() const
Get the IPv6 prefix.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
bool IsInSameSubnet(Ipv6Address b) const
Checks if the address is in the same subnet.
bool operator!=(Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > a, Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > b)
Inequality test.
Definition: callback.h:1471
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ipv6InterfaceAddress::State_e GetState() const
Get the address state.
friend bool operator==(Ipv6InterfaceAddress const &a, Ipv6InterfaceAddress const &b)
Equal to operator.
State_e
State of an address associated with an interface.
Describes an IPv6 address.
Definition: ipv6-address.h:49
Address is tentative, no packet can be sent unless DAD finished.
void SetAddress(Ipv6Address address)
Set IPv6 address (and scope).
Ipv6InterfaceAddress::Scope_e GetScope() const
Get address scope.
Ipv6Prefix m_prefix
The IPv6 prefix.
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.h:135
Invalid state (after a DAD failed)
Describes an IPv6 prefix.
Definition: ipv6-address.h:428
Scope_e m_scope
Scope of the address.
tuple address
Definition: first.py:37
Address is deprecated and should not be used.