really remove obsolete epc-gtpu files

This commit is contained in:
Nicola Baldo
2012-03-29 12:55:42 +02:00
parent 11791909fb
commit b2b0fd1df5
6 changed files with 0 additions and 555 deletions

View File

@@ -1,91 +0,0 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Jaume Nin <jnin@cttc.es>
*/
#include <ns3/gtpu-tunnel-helper.h>
#include <ns3/log.h>
#include "ns3/inet-socket-address.h"
#include "ns3/mac48-address.h"
#include "ns3/epc-gtpu-tunnel-endpoint.h"
namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("GtpuTunnerHelper");
NS_OBJECT_ENSURE_REGISTERED (GtpuTunnerHelper);
GtpuTunnerHelper::GtpuTunnerHelper () : m_udpPort (2152)
{
NS_LOG_FUNCTION (this);
m_mask = "255.255.255.0";
m_ipv4.SetBase ( "100.0.0.0", m_mask);
}
GtpuTunnerHelper::~GtpuTunnerHelper ()
{
NS_LOG_FUNCTION (this);
}
TypeId
GtpuTunnerHelper::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::GtpuTunnerHelper")
.SetParent<Object> ()
.AddConstructor<GtpuTunnerHelper> ()
;
return tid;
}
void
GtpuTunnerHelper::InstallGtpu (Ptr<Node> n)
{
InstallGtpu (n, m_ipv4.NewAddress ());
}
void
GtpuTunnerHelper::InstallGtpu (Ptr<Node> n, Ipv4Address addr)
{
NS_LOG_FUNCTION (this);
// UDP socket creation and configuration
Ptr<Socket> m_socket = Socket::CreateSocket (n, TypeId::LookupByName ("ns3::UdpSocketFactory"));
m_socket->Bind (InetSocketAddress (Ipv4Address::GetAny (), m_udpPort));
// tap device creation and configuration
Ptr<VirtualNetDevice> m_tap = CreateObject<VirtualNetDevice> ();
m_tap->SetAddress (Mac48Address::Allocate ());
n->AddDevice (m_tap);
Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
uint32_t i = ipv4->AddInterface (m_tap);
ipv4->AddAddress (i, Ipv4InterfaceAddress (addr, m_mask));
ipv4->SetUp (i);
Ptr<GtpuTunnelEndpoint> tunnel = CreateObject<GtpuTunnelEndpoint> (m_tap, m_socket);
m_gtpuEndpoint[n] = tunnel;
}
void
GtpuTunnerHelper::CreateGtpuTunnel (Ptr<Node> n, Ipv4Address nAddr, Ptr<Node> m, Ipv4Address mAddr)
{
uint32_t teid = m_gtpuEndpoint[n]->CreateGtpuTunnel (mAddr);
m_gtpuEndpoint[m]->CreateGtpuTunnel (nAddr, teid);
}
} // namespace ns3

View File

@@ -1,87 +0,0 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Jaume Nin <jnin@cttc.es>
*/
#ifndef GTPU_TUNNEL_HELPER_H_
#define GTPU_TUNNEL_HELPER_H_
#include "ns3/object.h"
#include "ns3/ipv4-address.h"
#include "ns3/ipv4-address-helper.h"
#include <map>
namespace ns3 {
class Node;
class GtpuTunnelEndpoint;
/**
* Helper class to handle the creation of the EPC entities and protocols
*/
class GtpuTunnerHelper : public Object
{
public:
/**
* Constructor
*/
GtpuTunnerHelper ();
/**
* Destructor
*/
virtual ~GtpuTunnerHelper ();
/**
* Inherited from ns3::Object
*/
static TypeId GetTypeId (void);
/**
* Creates and configure the necessary instances for the node to act as a
* GTP endpoint. The IP address of the new interfaces are within 100.0.0./24
* \param n node to install GTPv1-U
*/
void InstallGtpu (Ptr<Node> n);
/**
* Creates and configure the necessary instances for the node to act as a
* GTP endpoint.
*/
void InstallGtpu (Ptr<Node> n, Ipv4Address addr);
/**
* Creates a GTPv1-U tunnel between two nodes, both of them need to have GTPv1-U installed.
* \param n First tunnel endpoint node
* \param nAddr First tunnel endpoing address
* \param m Second tunnel endpoint node
* \param mAddr Second tunnel endpoing address
*/
void CreateGtpuTunnel (Ptr<Node> n, Ipv4Address nAddr, Ptr<Node> m, Ipv4Address mAddr);
private:
uint16_t m_udpPort;
Ipv4AddressHelper m_ipv4;
Ipv4Mask m_mask;
std::map <Ptr<Node>, Ptr<GtpuTunnelEndpoint> > m_gtpuEndpoint;
};
} // namespace ns3
#endif /* GTPU_TUNNEL_HELPER_H_ */

View File

@@ -1,87 +0,0 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Jaume Nin <jnin@cttc.cat>
*/
#include "ns3/log.h"
#include "ns3/epc-gtpu-l5-protocol.h"
#include "ns3/epc-gtpu-header.h"
NS_LOG_COMPONENT_DEFINE ("GtpuL5Protocol");
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (GtpuL5Protocol);
TypeId
GtpuL5Protocol::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::GtpuL5Protocol")
.SetParent<Object> ()
.AddConstructor<GtpuL5Protocol> ()
/*.AddAttribute ("TEID", "Tunnel Endpoint Identifier of this instance.",
UintegerValue (0),
MakeUintegerAccessor (&GtpuL5Protocol::SetTeid,
&GtpuL5Protocol::GetTeid),
MakeUintegerChecker<uint32_t> ())*/
;
return tid;
}
GtpuL5Protocol::GtpuL5Protocol ()
{
NS_LOG_FUNCTION_NOARGS ();
}
GtpuL5Protocol::GtpuL5Protocol (uint32_t teid)
{
NS_LOG_FUNCTION (this);
//this.SetAttribute("TEID", teid);
m_teid = teid;
}
GtpuL5Protocol::~GtpuL5Protocol ()
{
NS_LOG_FUNCTION_NOARGS ();
}
Ptr<Packet>
GtpuL5Protocol::AddHeader (Ptr<Packet> p)
{
GtpuHeader h;
h.SetTeid (m_teid);
// From 3GPP TS 29.281 v10.0.0 Section 5.1
// Length of the payload + the non obligatory GTP-U header
h.SetLength (p->GetSize () + h.GetSerializedSize () - 8);
p->AddHeader (h);
NS_LOG_FUNCTION (this << h);
return p;
}
void
GtpuL5Protocol::RemoveHeader (Ptr<Packet> p)
{
GtpuHeader h;
p->RemoveHeader (h);
NS_LOG_DEBUG (this << h);
NS_ASSERT ( h.GetTeid () == m_teid);
}
}; // namespace ns3

View File

@@ -1,80 +0,0 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Jaume Nin <jnin@cttc.cat>
*/
#ifndef EPS_GTPU_L5_PROTOCOL_H
#define EPS_GTPU_L5_PROTOCOL_H
#include <stdint.h>
#include <ns3/object.h>
#include <ns3/packet.h>
namespace ns3 {
/**
* \ingroup lte
*
* Implementation of the GTP-U v1 protocol. Basically, given a TEID, it adds and
* removes the GTPU header of the packets going in and out of the tunnel.
*/
class GtpuL5Protocol : public Object
{
public:
static TypeId GetTypeId (void);
GtpuL5Protocol ();
GtpuL5Protocol (uint32_t teid);
virtual ~GtpuL5Protocol ();
/**
* \brief Adds the GTPv1-U header to a packet
* \param p packet to add the header
* \return packet with the header added
*/
Ptr<Packet> AddHeader (Ptr<Packet> p);
/**
* \brief Strips the GTPv1-U header of a packet and
* checks its coherence
* \param p packet to strip the header
*/
void RemoveHeader (Ptr<Packet> p);
/**
* \brief Returns the Tunnel Endpoint IDentifier of the the GTPv1-U instance
* \return the TEID
*/
uint32_t GetTeid (void);
/**
* \brief Sets the Tunnel Endpoint IDentifier of the the GTPv1-U instance
* \param teid the TEID
*/
void SetTeid (uint32_t teid);
private:
/**
* Tunnel Endpoint IDentifier
*/
uint32_t m_teid;
};
}
; // namespace ns3
#endif /* EPS_GTPU_L5_PROTOCOL_H */

View File

@@ -1,99 +0,0 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Jaume Nin <jnin@cttc.cat>
*/
#include "epc-gtpu-tunnel-endpoint.h"
#include "ns3/log.h"
#include "ns3/mac48-address.h"
#include "ns3/ipv4.h"
#include "ns3/inet-socket-address.h"
namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("GtpuTunnel");
uint16_t GtpuTunnelEndpoint::m_teidCounter = 0;
uint32_t GtpuTunnelEndpoint::m_indexCounter = 0;
TypeId
GtpuTunnelEndpoint::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::GtpuTunnel")
.SetParent<Object> ();
return tid;
}
GtpuTunnelEndpoint::GtpuTunnelEndpoint (const Ptr<VirtualNetDevice> tap, const Ptr<Socket> s)
: m_udpPort (2152)
{
NS_LOG_FUNCTION (this);
m_tap = tap;
m_tap->SetSendCallback (MakeCallback (&GtpuTunnelEndpoint::GtpuSend, this));
m_socket = s;
m_socket->SetRecvCallback (MakeCallback (&GtpuTunnelEndpoint::GtpuRecv, this));
}
uint32_t
GtpuTunnelEndpoint::CreateGtpuTunnel (Ipv4Address destination)
{
NS_LOG_FUNCTION (this);
CreateGtpuTunnel (destination, ++m_teidCounter);
return m_teidCounter;
}
void
GtpuTunnelEndpoint::CreateGtpuTunnel (Ipv4Address destination, uint32_t teid)
{
NS_LOG_FUNCTION (this);
m_gtpuMap[m_indexCounter] = CreateObject<GtpuL5Protocol> (teid);
m_dstAddrMap[m_indexCounter] = destination;
}
void
GtpuTunnelEndpoint::GtpuRecv (Ptr<Socket> socket)
{
NS_LOG_FUNCTION (this);
Ptr<Packet> packet = socket->Recv (65535, 0);
uint32_t index = 0;
m_gtpuMap[index]->RemoveHeader (packet);
m_tap->Receive (packet, 0x0800, m_tap->GetAddress (), m_tap->GetAddress (), NetDevice::PACKET_HOST);
}
bool
GtpuTunnelEndpoint::GtpuSend (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber)
{
NS_LOG_FUNCTION (this << source << dest << packet << packet->GetSize ());
// TODO: Instead of use always index 0 make use of the TFT classifier class, probably
// a mapping between the tunnel index (assigned during the tunnel creation) and the classifier
// index (assigned when the first packet is send through) should be maintained.
uint32_t index = 0;
packet = m_gtpuMap[index]->AddHeader (packet);
m_socket->SendTo (packet, 0, InetSocketAddress (m_dstAddrMap[index], m_udpPort));
return true;
}
GtpuTunnelEndpoint::~GtpuTunnelEndpoint ()
{
NS_LOG_FUNCTION_NOARGS ();
}
}; // namespace ns3

View File

@@ -1,111 +0,0 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Jaume Nin <jnin@cttc.cat>
*/
#ifndef GTPU_TUNNEL_ENDPOINT_H
#define GTPU_TUNNEL_ENDPOINT_H
#include "ns3/address.h"
#include "ns3/socket.h"
#include "ns3/virtual-net-device.h"
#include "ns3/epc-gtpu-l5-protocol.h"
#include "ns3/traced-callback.h"
#include "ns3/callback.h"
#include "ns3/ptr.h"
#include "ns3/object.h"
#include <map>
namespace ns3 {
/**
* \ingroup lte
*
* GTPv1-U endpoint for all the tunnels of a given node. It encapsulates all the tunnel logic for creating tunnels and encapsulating data through it
*/
class GtpuTunnelEndpoint : public Object
{
public:
static TypeId GetTypeId (void);
/**
* Method assigned to the send callback of the upper end of the tunnel. It adds
* the GTP header and sends it through the tunnel
*/
bool GtpuSend (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
/**
* Method assigned to the receive callback of the upper end of the tunnel. It strips
* the GTP header and sends it up to the application
*/
void GtpuRecv (Ptr<Socket> socket);
/**
* Constructor that binds the tap device to the callback methods.
* \param tap VirtualNetDevice used to tunnel the packets
* \param s Socket used to send the tunneled packets
*/
GtpuTunnelEndpoint (const Ptr<VirtualNetDevice> tap, const Ptr<Socket> s);
virtual ~GtpuTunnelEndpoint (void);
/**
* Creates a GTPv1-U tunnel between the given destination and the enpoint
* using the specified TEID.
* \param destination IP address of the other end of the tunnel
* \param teid Tunnel Endpoint IDentifier to be assigned to the tunnel
*/
void CreateGtpuTunnel (Ipv4Address destination, uint32_t teid);
/**
* Creates a GTPv1-U tunnel between the given destination and the enpoint. The
* TEID is automatically sellected.
* \param destination IP address of the other end of the tunnel
* \return teid Tunnel Endpoint IDentifier assigned to the tunnel
*/
uint32_t CreateGtpuTunnel (Ipv4Address destination);
private:
/**
* UDP socket to send and receive the packets to and from the tunnel
*/
Ptr<Socket> m_socket;
/**
* UDP port where the socket is bind, fixed by the standard as 2152
*/
uint16_t m_udpPort;
/**
* VirtualNetDevice to create the tunnel
*/
Ptr<VirtualNetDevice> m_tap;
/**
* Map holding the GTP instances of the active tunnels on this endpoint
*/
std::map<uint32_t, Ptr<GtpuL5Protocol> > m_gtpuMap;
/**
* Map holding the destination address of the active tunnels on this endpoint
*/
std::map<uint32_t, Ipv4Address> m_dstAddrMap;
static uint16_t m_teidCounter;
static uint32_t m_indexCounter;
};
} //namespace ns3
#endif /* GTPU_TUNNEL_H */