A Discrete-Event Network Simulator
API
ipv6-end-point.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_END_POINT_H
21 #define IPV6_END_POINT_H
22 
23 #include "ns3/callback.h"
24 #include "ns3/ipv6-address.h"
25 #include "ns3/ipv6-header.h"
26 #include "ns3/ipv6-interface.h"
27 #include "ns3/net-device.h"
28 
29 #include <stdint.h>
30 
31 namespace ns3
32 {
33 
34 class Header;
35 class Packet;
36 
50 {
51  public:
57  Ipv6EndPoint(Ipv6Address addr, uint16_t port);
58 
59  ~Ipv6EndPoint();
60 
66 
71  void SetLocalAddress(Ipv6Address addr);
72 
77  uint16_t GetLocalPort() const;
78 
83  void SetLocalPort(uint16_t port);
84 
90 
95  uint16_t GetPeerPort() const;
96 
102  void SetPeer(Ipv6Address addr, uint16_t port);
103 
122  void BindToNetDevice(Ptr<NetDevice> netdevice);
123 
134 
139  void SetRxCallback(
140  Callback<void, Ptr<Packet>, Ipv6Header, uint16_t, Ptr<Ipv6Interface>> callback);
141 
147 
152  void SetDestroyCallback(Callback<void> callback);
153 
165  void ForwardUp(Ptr<Packet> p,
166  Ipv6Header header,
167  uint16_t port,
168  Ptr<Ipv6Interface> incomingInterface);
169 
182  void ForwardIcmp(Ipv6Address src, uint8_t ttl, uint8_t type, uint8_t code, uint32_t info);
183 
188  void SetRxEnabled(bool enabled);
189 
194  bool IsRxEnabled() const;
195 
196  private:
201 
205  uint16_t m_localPort;
206 
211 
215  uint16_t m_peerPort;
216 
221 
226 
231 
236 
241 };
242 
243 } /* namespace ns3 */
244 
245 #endif /* IPV6_END_POINT_H */
Callback template class.
Definition: callback.h:443
Describes an IPv6 address.
Definition: ipv6-address.h:50
A representation of an IPv6 endpoint/connection.
uint16_t m_peerPort
The peer port.
Ipv6Address GetLocalAddress()
Get the local address.
void ForwardUp(Ptr< Packet > p, Ipv6Header header, uint16_t port, Ptr< Ipv6Interface > incomingInterface)
Forward the packet to the upper level.
uint16_t GetLocalPort() const
Get the local port.
void SetPeer(Ipv6Address addr, uint16_t port)
Set the peer information (address and port).
Callback< void, Ipv6Address, uint8_t, uint8_t, uint8_t, uint32_t > m_icmpCallback
The ICMPv6 callback.
Ptr< NetDevice > GetBoundNetDevice()
Returns socket's bound netdevice, if any.
Callback< void, Ptr< Packet >, Ipv6Header, uint16_t, Ptr< Ipv6Interface > > m_rxCallback
The RX callback.
Ipv6Address m_peerAddr
The peer address.
void SetIcmpCallback(Callback< void, Ipv6Address, uint8_t, uint8_t, uint8_t, uint32_t > callback)
Set the ICMP callback.
void SetLocalPort(uint16_t port)
Set the local port.
bool m_rxEnabled
true if the endpoint can receive packets.
void SetRxCallback(Callback< void, Ptr< Packet >, Ipv6Header, uint16_t, Ptr< Ipv6Interface >> callback)
Set the reception callback.
Callback< void > m_destroyCallback
The destroy callback.
Ipv6EndPoint(Ipv6Address addr, uint16_t port)
Constructor.
Ipv6Address m_localAddr
The local address.
void SetLocalAddress(Ipv6Address addr)
Set the local address.
Ipv6Address GetPeerAddress()
Get the peer address.
void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
void SetRxEnabled(bool enabled)
Enable or Disable the endpoint Rx capability.
void ForwardIcmp(Ipv6Address src, uint8_t ttl, uint8_t type, uint8_t code, uint32_t info)
Forward the ICMP packet to the upper level.
Ptr< NetDevice > m_boundnetdevice
The NetDevice the EndPoint is bound to (if any).
uint16_t m_localPort
The local port.
bool IsRxEnabled() const
Checks if the endpoint can receive packets.
uint16_t GetPeerPort() const
Get the peer port.
void SetDestroyCallback(Callback< void > callback)
Set the default destroy callback.
Packet header for IPv6.
Definition: ipv6-header.h:36
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
uint16_t port
Definition: dsdv-manet.cc:45
Every class exported by the ns3 library is enclosed in the ns3 namespace.