src/internet-stack/ipv4-end-point.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 09 Jun 2008 15:40:22 -0700
changeset 3260 8c0ab08144e6
parent 2834 src/internet-node/ipv4-end-point.h@1aab57845b07
child 3266 1ae7df5cf87b
permissions -rw-r--r--
bug 186: internet-node directory must be renamed to internet-stack
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
238
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2005 INRIA
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 */
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
#ifndef IPV4_END_POINT_H
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
#define IPV4_END_POINT_H
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include <stdint.h>
524
082ffdd8fbd7 move code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 495
diff changeset
    25
#include "ns3/ipv4-address.h"
495
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    26
#include "ns3/callback.h"
238
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
namespace ns3 {
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
class Header;
495
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    31
class Packet;
238
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
class Ipv4EndPoint {
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
public:
2365
89da0ca7c55e undoes 2326:eec07777d1a2 because localInterface is no longer needed (see bug 136)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2326
diff changeset
    35
  Ipv4EndPoint (Ipv4Address address, uint16_t port);
238
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
  ~Ipv4EndPoint ();
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
  Ipv4Address GetLocalAddress (void);
1317
82629189efff Fold the two patches for bu6 69 together, building on the bug 65 patch
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
    39
  void SetLocalAddress (Ipv4Address address);
238
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
  uint16_t GetLocalPort (void);
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
  Ipv4Address GetPeerAddress (void);
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
  uint16_t GetPeerPort (void);
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
  void SetPeer (Ipv4Address address, uint16_t port);
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1317
diff changeset
    46
  void SetRxCallback (Callback<void,Ptr<Packet>, Ipv4Address, uint16_t> callback);
495
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    47
  void SetDestroyCallback (Callback<void> callback);
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    48
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1317
diff changeset
    49
  void ForwardUp (Ptr<Packet> p, Ipv4Address saddr, uint16_t sport);
495
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    50
238
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    51
private:
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    52
  Ipv4Address m_localAddr;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
  uint16_t m_localPort;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
  Ipv4Address m_peerAddr;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    55
  uint16_t m_peerPort;
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1317
diff changeset
    56
  Callback<void,Ptr<Packet>, Ipv4Address, uint16_t> m_rxCallback;
495
a839408950b9 rework the socket/udp layer to remove the Ipv4EndPointDemux template
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 238
diff changeset
    57
  Callback<void> m_destroyCallback;
238
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    58
};
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    59
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    60
}; // namespace ns3
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    61
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    62
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    63
#endif /* IPV4_END_POINT_H */