A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
44 public:
48  typedef std::list<Ipv4EndPoint *> EndPoints;
49 
53  typedef std::list<Ipv4EndPoint *>::iterator EndPointsI;
54 
57 
63 
69  bool LookupPortLocal (uint16_t port);
70 
77  bool LookupLocal (Ipv4Address addr, uint16_t port);
78 
98  uint16_t dport,
99  Ipv4Address saddr,
100  uint16_t sport,
101  Ptr<Ipv4Interface> incomingInterface);
102 
112  uint16_t dport,
113  Ipv4Address saddr,
114  uint16_t sport);
115 
120  Ipv4EndPoint *Allocate (void);
121 
128 
134  Ipv4EndPoint *Allocate (uint16_t port);
135 
143 
152  Ipv4EndPoint *Allocate (Ipv4Address localAddress,
153  uint16_t localPort,
154  Ipv4Address peerAddress,
155  uint16_t peerPort);
156 
161  void DeAllocate (Ipv4EndPoint *endPoint);
162 
163 private:
164 
169  uint16_t AllocateEphemeralPort (void);
170 
174  uint16_t m_ephemeral;
175 
179  uint16_t m_portLast;
180 
184  uint16_t m_portFirst;
185 
190 };
191 
192 } // namespace ns3
193 
194 #endif /* IPV4_END_POINTS_H */
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:44
Demultiplexes packets to various transport layer endpoints.
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(Ipv4Address addr, uint16_t port)
Lookup for address and port.
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.
tuple address
Definition: first.py:37
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.