From b2b0fd1df5cfd640bf8153ed207809887bd52e9e Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Thu, 29 Mar 2012 12:55:42 +0200 Subject: [PATCH] really remove obsolete epc-gtpu files --- src/lte/helper/gtpu-tunnel-helper.cc | 91 ------------------ src/lte/helper/gtpu-tunnel-helper.h | 87 ----------------- src/lte/model/epc-gtpu-l5-protocol.cc | 87 ----------------- src/lte/model/epc-gtpu-l5-protocol.h | 80 ---------------- src/lte/model/epc-gtpu-tunnel-endpoint.cc | 99 ------------------- src/lte/model/epc-gtpu-tunnel-endpoint.h | 111 ---------------------- 6 files changed, 555 deletions(-) delete mode 100644 src/lte/helper/gtpu-tunnel-helper.cc delete mode 100644 src/lte/helper/gtpu-tunnel-helper.h delete mode 100644 src/lte/model/epc-gtpu-l5-protocol.cc delete mode 100644 src/lte/model/epc-gtpu-l5-protocol.h delete mode 100644 src/lte/model/epc-gtpu-tunnel-endpoint.cc delete mode 100644 src/lte/model/epc-gtpu-tunnel-endpoint.h diff --git a/src/lte/helper/gtpu-tunnel-helper.cc b/src/lte/helper/gtpu-tunnel-helper.cc deleted file mode 100644 index 4dcb6f3b7..000000000 --- a/src/lte/helper/gtpu-tunnel-helper.cc +++ /dev/null @@ -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 - */ - -#include -#include -#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 () - .AddConstructor () - ; - return tid; -} - -void -GtpuTunnerHelper::InstallGtpu (Ptr n) -{ - InstallGtpu (n, m_ipv4.NewAddress ()); -} - -void -GtpuTunnerHelper::InstallGtpu (Ptr n, Ipv4Address addr) -{ - NS_LOG_FUNCTION (this); - // UDP socket creation and configuration - Ptr m_socket = Socket::CreateSocket (n, TypeId::LookupByName ("ns3::UdpSocketFactory")); - m_socket->Bind (InetSocketAddress (Ipv4Address::GetAny (), m_udpPort)); - - // tap device creation and configuration - Ptr m_tap = CreateObject (); - m_tap->SetAddress (Mac48Address::Allocate ()); - - n->AddDevice (m_tap); - Ptr ipv4 = n->GetObject (); - uint32_t i = ipv4->AddInterface (m_tap); - ipv4->AddAddress (i, Ipv4InterfaceAddress (addr, m_mask)); - ipv4->SetUp (i); - Ptr tunnel = CreateObject (m_tap, m_socket); - m_gtpuEndpoint[n] = tunnel; -} - -void -GtpuTunnerHelper::CreateGtpuTunnel (Ptr n, Ipv4Address nAddr, Ptr m, Ipv4Address mAddr) -{ - uint32_t teid = m_gtpuEndpoint[n]->CreateGtpuTunnel (mAddr); - m_gtpuEndpoint[m]->CreateGtpuTunnel (nAddr, teid); -} - - -} // namespace ns3 diff --git a/src/lte/helper/gtpu-tunnel-helper.h b/src/lte/helper/gtpu-tunnel-helper.h deleted file mode 100644 index c4cbc99e1..000000000 --- a/src/lte/helper/gtpu-tunnel-helper.h +++ /dev/null @@ -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 - */ - -#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 - - - -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 n); - /** - * Creates and configure the necessary instances for the node to act as a - * GTP endpoint. - */ - void InstallGtpu (Ptr 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 n, Ipv4Address nAddr, Ptr m, Ipv4Address mAddr); - -private: - uint16_t m_udpPort; - Ipv4AddressHelper m_ipv4; - Ipv4Mask m_mask; - std::map , Ptr > m_gtpuEndpoint; - -}; - -} // namespace ns3 - -#endif /* GTPU_TUNNEL_HELPER_H_ */ diff --git a/src/lte/model/epc-gtpu-l5-protocol.cc b/src/lte/model/epc-gtpu-l5-protocol.cc deleted file mode 100644 index 93d383454..000000000 --- a/src/lte/model/epc-gtpu-l5-protocol.cc +++ /dev/null @@ -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 - */ - -#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 () - .AddConstructor () - /*.AddAttribute ("TEID", "Tunnel Endpoint Identifier of this instance.", - UintegerValue (0), - MakeUintegerAccessor (&GtpuL5Protocol::SetTeid, - &GtpuL5Protocol::GetTeid), - MakeUintegerChecker ())*/ - ; - 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 -GtpuL5Protocol::AddHeader (Ptr 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 p) -{ - GtpuHeader h; - p->RemoveHeader (h); - NS_LOG_DEBUG (this << h); - NS_ASSERT ( h.GetTeid () == m_teid); -} - -}; // namespace ns3 diff --git a/src/lte/model/epc-gtpu-l5-protocol.h b/src/lte/model/epc-gtpu-l5-protocol.h deleted file mode 100644 index a6049712c..000000000 --- a/src/lte/model/epc-gtpu-l5-protocol.h +++ /dev/null @@ -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 - */ - -#ifndef EPS_GTPU_L5_PROTOCOL_H -#define EPS_GTPU_L5_PROTOCOL_H - -#include -#include -#include - -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 AddHeader (Ptr p); - /** - * \brief Strips the GTPv1-U header of a packet and - * checks its coherence - * \param p packet to strip the header - */ - void RemoveHeader (Ptr 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 */ diff --git a/src/lte/model/epc-gtpu-tunnel-endpoint.cc b/src/lte/model/epc-gtpu-tunnel-endpoint.cc deleted file mode 100644 index f8065c3d9..000000000 --- a/src/lte/model/epc-gtpu-tunnel-endpoint.cc +++ /dev/null @@ -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 - */ - - -#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 (); - return tid; -} - -GtpuTunnelEndpoint::GtpuTunnelEndpoint (const Ptr tap, const Ptr 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 (teid); - m_dstAddrMap[m_indexCounter] = destination; -} - - -void -GtpuTunnelEndpoint::GtpuRecv (Ptr socket) -{ - NS_LOG_FUNCTION (this); - Ptr 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, 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 diff --git a/src/lte/model/epc-gtpu-tunnel-endpoint.h b/src/lte/model/epc-gtpu-tunnel-endpoint.h deleted file mode 100644 index 6a1279dfb..000000000 --- a/src/lte/model/epc-gtpu-tunnel-endpoint.h +++ /dev/null @@ -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 - */ - -#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 - -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, 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); - - /** - * 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 tap, const Ptr 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 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 m_tap; - /** - * Map holding the GTP instances of the active tunnels on this endpoint - */ - std::map > m_gtpuMap; - /** - * Map holding the destination address of the active tunnels on this endpoint - */ - std::map m_dstAddrMap; - - static uint16_t m_teidCounter; - static uint32_t m_indexCounter; -}; - -} //namespace ns3 - -#endif /* GTPU_TUNNEL_H */ -