A Discrete-Event Network Simulator
API
ipv6-end-point.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_END_POINT_H
22 #define IPV6_END_POINT_H
23 
24 #include <stdint.h>
25 
26 #include "ns3/ipv6-address.h"
27 #include "ns3/callback.h"
28 #include "ns3/ipv6-header.h"
29 #include "ns3/net-device.h"
30 #include "ns3/ipv6-interface.h"
31 
32 namespace ns3
33 {
34 
35 class Header;
36 class Packet;
37 
51 {
52 public:
58  Ipv6EndPoint (Ipv6Address addr, uint16_t port);
59 
60  ~Ipv6EndPoint ();
61 
67 
72  void SetLocalAddress (Ipv6Address addr);
73 
78  uint16_t GetLocalPort ();
79 
84  void SetLocalPort (uint16_t port);
85 
91 
96  uint16_t GetPeerPort ();
97 
103  void SetPeer (Ipv6Address addr, uint16_t port);
104 
123  void BindToNetDevice (Ptr<NetDevice> netdevice);
124 
135 
140  void SetRxCallback (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, Ipv6Header header, uint16_t port, Ptr<Ipv6Interface> incomingInterface);
166 
179  void ForwardIcmp (Ipv6Address src, uint8_t ttl, uint8_t type,
180  uint8_t code, uint32_t info);
181 
186  void SetRxEnabled (bool enabled);
187 
192  bool IsRxEnabled (void);
193 
194 private:
199 
203  uint16_t m_localPort;
204 
209 
213  uint16_t m_peerPort;
214 
219 
224 
229 
234 
239 };
240 
241 } /* namespace ns3 */
242 
243 #endif /* IPV6_END_POINT_H */
244 
ns3::Ipv6EndPoint::SetLocalAddress
void SetLocalAddress(Ipv6Address addr)
Set the local address.
Definition: ipv6-end-point.cc:57
ns3::Callback
Callback template class.
Definition: callback.h:1279
ns3::Ipv6EndPoint::m_icmpCallback
Callback< void, Ipv6Address, uint8_t, uint8_t, uint8_t, uint32_t > m_icmpCallback
The ICMPv6 callback.
Definition: ipv6-end-point.h:228
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Ipv6EndPoint
A representation of an IPv6 endpoint/connection.
Definition: ipv6-end-point.h:51
ns3::Ipv6EndPoint::GetLocalAddress
Ipv6Address GetLocalAddress()
Get the local address.
Definition: ipv6-end-point.cc:52
ns3::Ipv6EndPoint::m_peerPort
uint16_t m_peerPort
The peer port.
Definition: ipv6-end-point.h:213
ns3::Ipv6EndPoint::SetLocalPort
void SetLocalPort(uint16_t port)
Set the local port.
Definition: ipv6-end-point.cc:67
ns3::Ipv6Address
Describes an IPv6 address.
Definition: ipv6-address.h:50
ns3::Ipv6EndPoint::BindToNetDevice
void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
Definition: ipv6-end-point.cc:82
ns3::Ipv6EndPoint::GetBoundNetDevice
Ptr< NetDevice > GetBoundNetDevice(void)
Returns socket's bound netdevice, if any.
Definition: ipv6-end-point.cc:88
ns3::Ipv6Header
Packet header for IPv6.
Definition: ipv6-header.h:36
ns3::Ptr< NetDevice >
ns3::Ipv6EndPoint::GetPeerAddress
Ipv6Address GetPeerAddress()
Get the peer address.
Definition: ipv6-end-point.cc:72
ns3::Ipv6EndPoint::m_destroyCallback
Callback< void > m_destroyCallback
The destroy callback.
Definition: ipv6-end-point.h:233
ns3::Ipv6EndPoint::GetLocalPort
uint16_t GetLocalPort()
Get the local port.
Definition: ipv6-end-point.cc:62
ns3::Ipv6EndPoint::Ipv6EndPoint
Ipv6EndPoint(Ipv6Address addr, uint16_t port)
Constructor.
Definition: ipv6-end-point.cc:32
ns3::Ipv6EndPoint::m_localAddr
Ipv6Address m_localAddr
The local address.
Definition: ipv6-end-point.h:198
ns3::Ipv6EndPoint::GetPeerPort
uint16_t GetPeerPort()
Get the peer port.
Definition: ipv6-end-point.cc:77
ns3::Ipv6EndPoint::m_localPort
uint16_t m_localPort
The local port.
Definition: ipv6-end-point.h:203
ns3::Ipv6EndPoint::~Ipv6EndPoint
~Ipv6EndPoint()
Definition: ipv6-end-point.cc:41
ns3::Ipv6EndPoint::IsRxEnabled
bool IsRxEnabled(void)
Checks if the endpoint can receive packets.
Definition: ipv6-end-point.cc:136
ns3::Ipv6EndPoint::m_rxEnabled
bool m_rxEnabled
true if the endpoint can receive packets.
Definition: ipv6-end-point.h:238
ns3::Ipv6EndPoint::SetPeer
void SetPeer(Ipv6Address addr, uint16_t port)
Set the peer information (address and port).
Definition: ipv6-end-point.cc:93
ns3::Ipv6EndPoint::m_peerAddr
Ipv6Address m_peerAddr
The peer address.
Definition: ipv6-end-point.h:208
ns3::Ipv6EndPoint::ForwardIcmp
void ForwardIcmp(Ipv6Address src, uint8_t ttl, uint8_t type, uint8_t code, uint32_t info)
Forward the ICMP packet to the upper level.
Definition: ipv6-end-point.cc:122
ns3::Ipv6EndPoint::SetRxCallback
void SetRxCallback(Callback< void, Ptr< Packet >, Ipv6Header, uint16_t, Ptr< Ipv6Interface > > callback)
Set the reception callback.
Definition: ipv6-end-point.cc:99
ns3::Ipv6EndPoint::SetIcmpCallback
void SetIcmpCallback(Callback< void, Ipv6Address, uint8_t, uint8_t, uint8_t, uint32_t > callback)
Set the ICMP callback.
Definition: ipv6-end-point.cc:104
ns3::Ipv6EndPoint::SetRxEnabled
void SetRxEnabled(bool enabled)
Enable or Disable the endpoint Rx capability.
Definition: ipv6-end-point.cc:131
ns3::Ipv6EndPoint::m_rxCallback
Callback< void, Ptr< Packet >, Ipv6Header, uint16_t, Ptr< Ipv6Interface > > m_rxCallback
The RX callback.
Definition: ipv6-end-point.h:223
ns3::Ipv6EndPoint::ForwardUp
void ForwardUp(Ptr< Packet > p, Ipv6Header header, uint16_t port, Ptr< Ipv6Interface > incomingInterface)
Forward the packet to the upper level.
Definition: ipv6-end-point.cc:114
ns3::Ipv6EndPoint::SetDestroyCallback
void SetDestroyCallback(Callback< void > callback)
Set the default destroy callback.
Definition: ipv6-end-point.cc:109
port
uint16_t port
Definition: dsdv-manet.cc:45
ns3::Ipv6EndPoint::m_boundnetdevice
Ptr< NetDevice > m_boundnetdevice
The NetDevice the EndPoint is bound to (if any).
Definition: ipv6-end-point.h:218