src/node/ipv4-end-point.cc
author Tom Henderson <tomh@tomh.org>
Sun, 18 Mar 2007 14:06:51 -0700
changeset 345 47b41507a45a
parent 238 2f09fd9cf32e
child 495 a839408950b9
permissions -rw-r--r--
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
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
 * All rights reserved.
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 *
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * 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
     7
 * 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
     8
 * published by the Free Software Foundation;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 *
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * 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
    11
 * 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
    12
 * 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
    13
 * GNU General Public License for more details.
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 *
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * 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
    16
 * 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
    17
 * 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
    18
 *
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
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
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
#include "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
namespace ns3 {
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
Ipv4EndPoint::Ipv4EndPoint (Ipv4Address address, uint16_t port)
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
  : m_localAddr (address), 
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
    m_localPort (port),
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
    m_peerAddr (Ipv4Address::GetAny ()),
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
    m_peerPort (0)
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
{}
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
Ipv4EndPoint::~Ipv4EndPoint ()
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
{}
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
Ipv4Address 
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
Ipv4EndPoint::GetLocalAddress (void)
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
  return m_localAddr;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
}
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
uint16_t 
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
Ipv4EndPoint::GetLocalPort (void)
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
{
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
  return m_localPort;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
}
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
Ipv4Address 
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
Ipv4EndPoint::GetPeerAddress (void)
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
{
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
  return m_peerAddr;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    49
}
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
uint16_t 
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    51
Ipv4EndPoint::GetPeerPort (void)
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    52
{
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
  return m_peerPort;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
}
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    55
void 
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    56
Ipv4EndPoint::SetPeer (Ipv4Address address, uint16_t port)
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    57
{
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    58
  m_peerAddr = address;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    59
  m_peerPort = port;
2f09fd9cf32e add start of udp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    60
}
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
}; // namespace ns3