A Discrete-Event Network Simulator
API
ipv4-end-point-demux.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18  */
19 
20 #ifndef IPV4_END_POINT_DEMUX_H
21 #define IPV4_END_POINT_DEMUX_H
22 
23 #include "ipv4-interface.h"
24 
25 #include "ns3/ipv4-address.h"
26 
27 #include <list>
28 #include <stdint.h>
29 
30 namespace ns3
31 {
32 
33 class Ipv4EndPoint;
34 
48 {
49  public:
53  typedef std::list<Ipv4EndPoint*> EndPoints;
54 
58  typedef std::list<Ipv4EndPoint*>::iterator EndPointsI;
59 
62 
68 
74  bool LookupPortLocal(uint16_t port);
75 
83  bool LookupLocal(Ptr<NetDevice> boundNetDevice, Ipv4Address addr, uint16_t port);
84 
104  uint16_t dport,
105  Ipv4Address saddr,
106  uint16_t sport,
107  Ptr<Ipv4Interface> incomingInterface);
108 
118  uint16_t dport,
119  Ipv4Address saddr,
120  uint16_t sport);
121 
127 
134 
141  Ipv4EndPoint* Allocate(Ptr<NetDevice> boundNetDevice, uint16_t port);
142 
150  Ipv4EndPoint* Allocate(Ptr<NetDevice> boundNetDevice, Ipv4Address address, uint16_t port);
151 
161  Ipv4EndPoint* Allocate(Ptr<NetDevice> boundNetDevice,
162  Ipv4Address localAddress,
163  uint16_t localPort,
164  Ipv4Address peerAddress,
165  uint16_t peerPort);
166 
171  void DeAllocate(Ipv4EndPoint* endPoint);
172 
173  private:
178  uint16_t AllocateEphemeralPort();
179 
183  uint16_t m_ephemeral;
184 
188  uint16_t m_portLast;
189 
193  uint16_t m_portFirst;
194 
199 };
200 
201 } // namespace ns3
202 
203 #endif /* IPV4_END_POINTS_H */
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Demultiplexes packets to various transport layer endpoints.
uint16_t m_portFirst
The first ephemeral port.
std::list< Ipv4EndPoint * >::iterator EndPointsI
Iterator to the container of the IPv4 endpoints.
uint16_t AllocateEphemeralPort()
Allocate an ephemeral port.
EndPoints m_endPoints
A list of IPv4 end points.
uint16_t m_portLast
The last ephemeral port.
Ipv4EndPoint * SimpleLookup(Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport)
simple lookup for a match with all the parameters.
bool LookupLocal(Ptr< NetDevice > boundNetDevice, Ipv4Address addr, uint16_t port)
Lookup for address and port.
EndPoints GetAllEndPoints()
Get the entire list of end points registered.
uint16_t m_ephemeral
The ephemeral port.
EndPoints Lookup(Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport, Ptr< Ipv4Interface > incomingInterface)
lookup for a match with all the parameters.
bool LookupPortLocal(uint16_t port)
Lookup for port local.
void DeAllocate(Ipv4EndPoint *endPoint)
Remove a end point.
Ipv4EndPoint * Allocate()
Allocate a Ipv4EndPoint.
std::list< Ipv4EndPoint * > EndPoints
Container of the IPv4 endpoints.
A representation of an internet endpoint/connection.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
uint16_t port
Definition: dsdv-manet.cc:44
address
Definition: first.py:47
Every class exported by the ns3 library is enclosed in the ns3 namespace.