A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ipv4-end-point-demux.h
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:
45  typedef std::list<Ipv4EndPoint *> EndPoints;
46  typedef std::list<Ipv4EndPoint *>::iterator EndPointsI;
47 
50 
51  EndPoints GetAllEndPoints (void);
52  bool LookupPortLocal (uint16_t port);
53  bool LookupLocal (Ipv4Address addr, uint16_t port);
54  EndPoints Lookup (Ipv4Address daddr,
55  uint16_t dport,
56  Ipv4Address saddr,
57  uint16_t sport,
58  Ptr<Ipv4Interface> incomingInterface);
59 
60  Ipv4EndPoint *SimpleLookup (Ipv4Address daddr,
61  uint16_t dport,
62  Ipv4Address saddr,
63  uint16_t sport);
64 
65  Ipv4EndPoint *Allocate (void);
66  Ipv4EndPoint *Allocate (Ipv4Address address);
67  Ipv4EndPoint *Allocate (uint16_t port);
68  Ipv4EndPoint *Allocate (Ipv4Address address, uint16_t port);
69  Ipv4EndPoint *Allocate (Ipv4Address localAddress,
70  uint16_t localPort,
71  Ipv4Address peerAddress,
72  uint16_t peerPort);
73 
74  void DeAllocate (Ipv4EndPoint *endPoint);
75 
76 private:
77  uint16_t AllocateEphemeralPort (void);
78 
79  uint16_t m_ephemeral;
80  uint16_t m_portLast;
81  uint16_t m_portFirst;
82  EndPoints m_endPoints;
83 };
84 
85 } // namespace ns3
86 
87 #endif /* IPV4_END_POINTS_H */
Demultiplexes packets to various transport layer endpoints.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:38
A representation of an internet endpoint/connection.