A Discrete-Event Network Simulator
API
ipv4-end-point-demux.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #ifndef IPV4_END_POINT_DEMUX_H
22 #define IPV4_END_POINT_DEMUX_H
23 
24 #include <stdint.h>
25 #include <list>
26 #include "ns3/ipv4-address.h"
27 #include "ipv4-interface.h"
28 
29 namespace ns3 {
30 
31 class Ipv4EndPoint;
32 
46 public:
50  typedef std::list<Ipv4EndPoint *> EndPoints;
51 
55  typedef std::list<Ipv4EndPoint *>::iterator EndPointsI;
56 
59 
65 
71  bool LookupPortLocal (uint16_t port);
72 
80  bool LookupLocal (Ptr<NetDevice> boundNetDevice, Ipv4Address addr, uint16_t port);
81 
100  EndPoints Lookup (Ipv4Address daddr,
101  uint16_t dport,
102  Ipv4Address saddr,
103  uint16_t sport,
104  Ptr<Ipv4Interface> incomingInterface);
105 
115  uint16_t dport,
116  Ipv4Address saddr,
117  uint16_t sport);
118 
123  Ipv4EndPoint *Allocate (void);
124 
131 
138  Ipv4EndPoint *Allocate (Ptr<NetDevice> boundNetDevice, uint16_t port);
139 
147  Ipv4EndPoint *Allocate (Ptr<NetDevice> boundNetDevice, Ipv4Address address, uint16_t port);
148 
158  Ipv4EndPoint *Allocate (Ptr<NetDevice> boundNetDevice,
159  Ipv4Address localAddress, uint16_t localPort,
160  Ipv4Address peerAddress, uint16_t peerPort);
161 
166  void DeAllocate (Ipv4EndPoint *endPoint);
167 
168 private:
169 
174  uint16_t AllocateEphemeralPort (void);
175 
179  uint16_t m_ephemeral;
180 
184  uint16_t m_portLast;
185 
189  uint16_t m_portFirst;
190 
195 };
196 
197 } // namespace ns3
198 
199 #endif /* IPV4_END_POINTS_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
EndPoints GetAllEndPoints(void)
Get the entire list of end points registered.
uint16_t m_ephemeral
The ephemeral port.
bool LookupPortLocal(uint16_t port)
Lookup for port local.
uint16_t m_portFirst
The first ephemeral port.
uint16_t port
Definition: dsdv-manet.cc:45
Demultiplexes packets to various transport layer endpoints.
bool LookupLocal(Ptr< NetDevice > boundNetDevice, Ipv4Address addr, uint16_t port)
Lookup for address and port.
uint16_t m_portLast
The last ephemeral port.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
address
Definition: first.py:37
Ipv4EndPoint * SimpleLookup(Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport)
simple lookup for a match with all the parameters.
EndPoints Lookup(Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport, Ptr< Ipv4Interface > incomingInterface)
lookup for a match with all the parameters.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
std::list< Ipv4EndPoint * > EndPoints
Container of the IPv4 endpoints.
std::list< Ipv4EndPoint * >::iterator EndPointsI
Iterator to the container of the IPv4 endpoints.
void DeAllocate(Ipv4EndPoint *endPoint)
Remove a end point.
EndPoints m_endPoints
A list of IPv4 end points.
uint16_t AllocateEphemeralPort(void)
Allocate an ephemeral port.
A representation of an internet endpoint/connection.
Ipv4EndPoint * Allocate(void)
Allocate a Ipv4EndPoint.