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 
89  uint16_t dport,
90  Ipv4Address saddr,
91  uint16_t sport,
92  Ptr<Ipv4Interface> incomingInterface);
93 
103  uint16_t dport,
104  Ipv4Address saddr,
105  uint16_t sport);
106 
111  Ipv4EndPoint *Allocate (void);
112 
119 
125  Ipv4EndPoint *Allocate (uint16_t port);
126 
134 
143  Ipv4EndPoint *Allocate (Ipv4Address localAddress,
144  uint16_t localPort,
145  Ipv4Address peerAddress,
146  uint16_t peerPort);
147 
152  void DeAllocate (Ipv4EndPoint *endPoint);
153 
154 private:
155 
160  uint16_t AllocateEphemeralPort (void);
161 
165  uint16_t m_ephemeral;
166 
170  uint16_t m_portLast;
171 
175  uint16_t m_portFirst;
176 
181 };
182 
183 } // namespace ns3
184 
185 #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:38
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.