src/lte/model/epc-tft.cc
author Nicola Baldo <nbaldo@cttc.es>
Mon, 04 Feb 2013 18:47:25 +0100
changeset 9653 382d27da8905
parent 8463 cc818aa536a5
child 10411 f5916669dbe7
permissions -rw-r--r--
merged lena-dev with ns-3-dev
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8353
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
     2
/*
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
     3
 * Copyright (c) 2011 CTTC
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
     4
 *
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
     8
 *
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    12
 * GNU General Public License for more details.
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    13
 *
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    17
 *
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    18
 * Author: Nicola Baldo <nbaldo@cttc.es>
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    19
 */
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    20
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    21
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    22
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    23
8463
cc818aa536a5 renamed LteTft --> EpcTft
Nicola Baldo <nbaldo@cttc.es>
parents: 8407
diff changeset
    24
#include "epc-tft.h"
8353
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    25
#include "ns3/abort.h"
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    26
#include "ns3/log.h"
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    27
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    28
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    29
namespace ns3 {
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    30
8463
cc818aa536a5 renamed LteTft --> EpcTft
Nicola Baldo <nbaldo@cttc.es>
parents: 8407
diff changeset
    31
NS_LOG_COMPONENT_DEFINE ("EpcTft");
8353
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    32
8463
cc818aa536a5 renamed LteTft --> EpcTft
Nicola Baldo <nbaldo@cttc.es>
parents: 8407
diff changeset
    33
std::ostream& operator<< (std::ostream& os, EpcTft::Direction& d)
8355
aa22d091a8f3 more tests for the TFT
Nicola Baldo <nbaldo@cttc.es>
parents: 8353
diff changeset
    34
{
aa22d091a8f3 more tests for the TFT
Nicola Baldo <nbaldo@cttc.es>
parents: 8353
diff changeset
    35
 switch (d)
aa22d091a8f3 more tests for the TFT
Nicola Baldo <nbaldo@cttc.es>
parents: 8353
diff changeset
    36
    {
8463
cc818aa536a5 renamed LteTft --> EpcTft
Nicola Baldo <nbaldo@cttc.es>
parents: 8407
diff changeset
    37
    case EpcTft::DOWNLINK:
8355
aa22d091a8f3 more tests for the TFT
Nicola Baldo <nbaldo@cttc.es>
parents: 8353
diff changeset
    38
      os << "DOWNLINK";
aa22d091a8f3 more tests for the TFT
Nicola Baldo <nbaldo@cttc.es>
parents: 8353
diff changeset
    39
      break;
8463
cc818aa536a5 renamed LteTft --> EpcTft
Nicola Baldo <nbaldo@cttc.es>
parents: 8407
diff changeset
    40
    case EpcTft::UPLINK:
8355
aa22d091a8f3 more tests for the TFT
Nicola Baldo <nbaldo@cttc.es>
parents: 8353
diff changeset
    41
      os << "UPLINK";
aa22d091a8f3 more tests for the TFT
Nicola Baldo <nbaldo@cttc.es>
parents: 8353
diff changeset
    42
      break;
aa22d091a8f3 more tests for the TFT
Nicola Baldo <nbaldo@cttc.es>
parents: 8353
diff changeset
    43
    default:
aa22d091a8f3 more tests for the TFT
Nicola Baldo <nbaldo@cttc.es>
parents: 8353
diff changeset
    44
      os << "BIDIRECTIONAL";
aa22d091a8f3 more tests for the TFT
Nicola Baldo <nbaldo@cttc.es>
parents: 8353
diff changeset
    45
      break;
aa22d091a8f3 more tests for the TFT
Nicola Baldo <nbaldo@cttc.es>
parents: 8353
diff changeset
    46
    }
aa22d091a8f3 more tests for the TFT
Nicola Baldo <nbaldo@cttc.es>
parents: 8353
diff changeset
    47
  return os;
aa22d091a8f3 more tests for the TFT
Nicola Baldo <nbaldo@cttc.es>
parents: 8353
diff changeset
    48
}
aa22d091a8f3 more tests for the TFT
Nicola Baldo <nbaldo@cttc.es>
parents: 8353
diff changeset
    49
aa22d091a8f3 more tests for the TFT
Nicola Baldo <nbaldo@cttc.es>
parents: 8353
diff changeset
    50
8463
cc818aa536a5 renamed LteTft --> EpcTft
Nicola Baldo <nbaldo@cttc.es>
parents: 8407
diff changeset
    51
std::ostream& operator<< (std::ostream& os, EpcTft::PacketFilter& f)
8353
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    52
{
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    53
  os << " direction: " << f.direction
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    54
     << " remoteAddress: "  << f.remoteAddress 
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    55
     << " remoteMask: "  << f.remoteMask 
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    56
     << " localAddress: "  << f.localAddress 
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    57
     << " localMask: "  << f.localMask 
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    58
     << " remotePortStart: "   << f.remotePortStart
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    59
     << " remotePortEnd: "   << f.remotePortEnd 
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    60
     << " localPortStart: "   << f.localPortStart 
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    61
     << " localPortEnd: "   << f.localPortEnd 
8407
00c8cadf4a98 minor changes in logging
Nicola Baldo <nbaldo@cttc.es>
parents: 8380
diff changeset
    62
     << " typeOfService: 0x" << std::hex << (uint16_t) f.typeOfService << std::dec
00c8cadf4a98 minor changes in logging
Nicola Baldo <nbaldo@cttc.es>
parents: 8380
diff changeset
    63
     << " typeOfServiceMask: 0x" << std::hex << (uint16_t) f.typeOfServiceMask << std::dec;  
8353
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    64
  return os;
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    65
}
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    66
8463
cc818aa536a5 renamed LteTft --> EpcTft
Nicola Baldo <nbaldo@cttc.es>
parents: 8407
diff changeset
    67
EpcTft::PacketFilter::PacketFilter ()
8353
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    68
  : precedence (255),
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    69
    direction (BIDIRECTIONAL),
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    70
    remoteMask ("0.0.0.0"),
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    71
    localMask ("0.0.0.0"),
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    72
    remotePortStart (0),
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    73
    remotePortEnd (65535), 
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    74
    localPortStart (0),
8407
00c8cadf4a98 minor changes in logging
Nicola Baldo <nbaldo@cttc.es>
parents: 8380
diff changeset
    75
    localPortEnd (65535),
00c8cadf4a98 minor changes in logging
Nicola Baldo <nbaldo@cttc.es>
parents: 8380
diff changeset
    76
    typeOfService (0),  
8353
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    77
    typeOfServiceMask (0)
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    78
{
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    79
  NS_LOG_FUNCTION (this);
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    80
}
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    81
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    82
bool 
8463
cc818aa536a5 renamed LteTft --> EpcTft
Nicola Baldo <nbaldo@cttc.es>
parents: 8407
diff changeset
    83
EpcTft::PacketFilter::Matches (Direction d,
8353
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    84
			       Ipv4Address ra, 
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    85
			       Ipv4Address la, 
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    86
			       uint16_t rp,
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    87
			       uint16_t lp,
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    88
			       uint8_t tos)
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    89
{
8407
00c8cadf4a98 minor changes in logging
Nicola Baldo <nbaldo@cttc.es>
parents: 8380
diff changeset
    90
  NS_LOG_FUNCTION (this << d << ra << la << rp << lp << (uint16_t) tos);
8353
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    91
  if (d & direction)
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    92
    {
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    93
      NS_LOG_LOGIC ("d matches");
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    94
      if (remoteMask.IsMatch (remoteAddress, ra))
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    95
	{
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    96
	  NS_LOG_LOGIC ("ra matches");
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    97
	  if (localMask.IsMatch (localAddress, la))
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    98
	    {
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
    99
	      NS_LOG_LOGIC ("ls matches");
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   100
	      if (rp >= remotePortStart)
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   101
		{
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   102
		  NS_LOG_LOGIC ("rps matches");
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   103
		  if (rp <= remotePortEnd)
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   104
		    {
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   105
		      NS_LOG_LOGIC ("rpe matches");
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   106
		      if (lp >= localPortStart)
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   107
			{
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   108
			  NS_LOG_LOGIC ("lps matches");
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   109
			  if (lp <= localPortEnd)
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   110
			    {
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   111
			      NS_LOG_LOGIC ("lpe matches");
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   112
			      if ((tos & typeOfServiceMask) == (typeOfService & typeOfServiceMask))
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   113
				{
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   114
				  NS_LOG_LOGIC ("tos matches --> have match!");
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   115
				  return true;
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   116
				}
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   117
			    }
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   118
			}
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   119
		    }
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   120
		}
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   121
	    }
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   122
	  else
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   123
	    {
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   124
	      NS_LOG_LOGIC ("la doesn't match: la=" << la << " f.la=" << localAddress << " f.lmask=" << localMask);
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   125
	    }
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   126
	}
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   127
      else
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   128
	{
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   129
	  NS_LOG_LOGIC ("ra doesn't match: ra=" << ra << " f.ra=" << remoteAddress << " f.rmask=" << remoteMask);
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   130
	}
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   131
    }
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   132
  else
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   133
    {
8407
00c8cadf4a98 minor changes in logging
Nicola Baldo <nbaldo@cttc.es>
parents: 8380
diff changeset
   134
      NS_LOG_LOGIC ("d doesn't match: d=0x" << std::hex << d << " f.d=0x" << std::hex << direction << std::dec);
8353
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   135
    }
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   136
  return false;      
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   137
}
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   138
8380
f615b30c26e1 S1-U working in downlink
Nicola Baldo <nbaldo@cttc.es>
parents: 8355
diff changeset
   139
8463
cc818aa536a5 renamed LteTft --> EpcTft
Nicola Baldo <nbaldo@cttc.es>
parents: 8407
diff changeset
   140
Ptr<EpcTft> 
cc818aa536a5 renamed LteTft --> EpcTft
Nicola Baldo <nbaldo@cttc.es>
parents: 8407
diff changeset
   141
EpcTft::Default ()
8380
f615b30c26e1 S1-U working in downlink
Nicola Baldo <nbaldo@cttc.es>
parents: 8355
diff changeset
   142
{
8463
cc818aa536a5 renamed LteTft --> EpcTft
Nicola Baldo <nbaldo@cttc.es>
parents: 8407
diff changeset
   143
  Ptr<EpcTft> tft = Create<EpcTft> ();
cc818aa536a5 renamed LteTft --> EpcTft
Nicola Baldo <nbaldo@cttc.es>
parents: 8407
diff changeset
   144
  EpcTft::PacketFilter defaultPacketFilter;
8380
f615b30c26e1 S1-U working in downlink
Nicola Baldo <nbaldo@cttc.es>
parents: 8355
diff changeset
   145
  tft->Add (defaultPacketFilter);
f615b30c26e1 S1-U working in downlink
Nicola Baldo <nbaldo@cttc.es>
parents: 8355
diff changeset
   146
  return tft;
f615b30c26e1 S1-U working in downlink
Nicola Baldo <nbaldo@cttc.es>
parents: 8355
diff changeset
   147
}
f615b30c26e1 S1-U working in downlink
Nicola Baldo <nbaldo@cttc.es>
parents: 8355
diff changeset
   148
f615b30c26e1 S1-U working in downlink
Nicola Baldo <nbaldo@cttc.es>
parents: 8355
diff changeset
   149
8463
cc818aa536a5 renamed LteTft --> EpcTft
Nicola Baldo <nbaldo@cttc.es>
parents: 8407
diff changeset
   150
EpcTft::EpcTft ()
8353
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   151
  : m_numFilters (0)
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   152
{
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   153
  NS_LOG_FUNCTION (this);
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   154
}
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   155
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   156
uint8_t 
8463
cc818aa536a5 renamed LteTft --> EpcTft
Nicola Baldo <nbaldo@cttc.es>
parents: 8407
diff changeset
   157
EpcTft::Add (PacketFilter f)
8353
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   158
{
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   159
  NS_LOG_FUNCTION (this << f);
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   160
  NS_ABORT_IF (m_numFilters >= 16);
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   161
  
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   162
  std::list<PacketFilter>::iterator it;
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   163
  for (it = m_filters.begin ();
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   164
       (it != m_filters.end ()) && (it->precedence <= f.precedence);
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   165
       ++it)
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   166
    {
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   167
    }  
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   168
  m_filters.insert (it, f);  
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   169
  ++m_numFilters;
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   170
  return (m_numFilters - 1);
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   171
}
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   172
    
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   173
bool 
8463
cc818aa536a5 renamed LteTft --> EpcTft
Nicola Baldo <nbaldo@cttc.es>
parents: 8407
diff changeset
   174
EpcTft::Matches (Direction direction,
8353
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   175
		 Ipv4Address remoteAddress, 
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   176
		 Ipv4Address localAddress, 
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   177
		 uint16_t remotePort,
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   178
		 uint16_t localPort,
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   179
		 uint8_t typeOfService)
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   180
{
8407
00c8cadf4a98 minor changes in logging
Nicola Baldo <nbaldo@cttc.es>
parents: 8380
diff changeset
   181
  NS_LOG_FUNCTION (this << direction << remoteAddress << localAddress << std::dec << remotePort << localPort << (uint16_t) typeOfService);
8353
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   182
  for (std::list<PacketFilter>::iterator it = m_filters.begin ();
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   183
       it != m_filters.end ();
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   184
       ++it)
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   185
    {
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   186
      if (it->Matches (direction, remoteAddress, localAddress, remotePort, localPort, typeOfService))
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   187
	{
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   188
	  return true;
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   189
	}
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   190
    }  
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   191
  return false;
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   192
}
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   193
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   194
ffba8013fd1d TFT classifier working with minimal test
Nicola Baldo <nbaldo@cttc.es>
parents:
diff changeset
   195
} // namespace ns3