src/internet-stack/ipv4-end-point-demux.h
changeset 3260 8c0ab08144e6
parent 2834 1aab57845b07
child 3266 1ae7df5cf87b
equal deleted inserted replaced
3259:43b3f8ecd86d 3260:8c0ab08144e6
       
     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 
       
    33 class Ipv4EndPointDemux {
       
    34 public:
       
    35   typedef std::list<Ipv4EndPoint *> EndPoints;
       
    36   typedef std::list<Ipv4EndPoint *>::iterator EndPointsI;
       
    37 
       
    38   Ipv4EndPointDemux ();
       
    39   ~Ipv4EndPointDemux ();
       
    40 
       
    41   bool LookupPortLocal (uint16_t port);
       
    42   bool LookupLocal (Ipv4Address addr, uint16_t port);
       
    43   EndPoints Lookup (Ipv4Address daddr, 
       
    44                     uint16_t dport, 
       
    45                     Ipv4Address saddr, 
       
    46                     uint16_t sport,
       
    47                     Ptr<Ipv4Interface> incomingInterface);
       
    48 
       
    49   Ipv4EndPoint *Allocate (void);
       
    50   Ipv4EndPoint *Allocate (Ipv4Address address);
       
    51   Ipv4EndPoint *Allocate (uint16_t port);
       
    52   Ipv4EndPoint *Allocate (Ipv4Address address, uint16_t port);
       
    53   Ipv4EndPoint *Allocate (Ipv4Address localAddress, 
       
    54                           uint16_t localPort,
       
    55                           Ipv4Address peerAddress, 
       
    56                           uint16_t peerPort);
       
    57 
       
    58   void DeAllocate (Ipv4EndPoint *endPoint);
       
    59 
       
    60  private:
       
    61   uint16_t AllocateEphemeralPort (void);
       
    62 
       
    63   uint16_t m_ephemeral;
       
    64   EndPoints m_endPoints;
       
    65 };
       
    66 
       
    67 } // namespace ns3
       
    68 
       
    69 #endif /* IPV4_END_POINTS_H */