A Discrete-Event Network Simulator
API
test-epc-tft-classifier.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2018 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Authors: Nicola Baldo <nbaldo@cttc.es>
18  * Manuel Requena <manuel.requena@cttc.es>
19  */
20 
21 #include "ns3/epc-tft-classifier.h"
22 #include "ns3/ipv4-header.h"
23 #include "ns3/ipv4-l3-protocol.h"
24 #include "ns3/ipv6-header.h"
25 #include "ns3/ipv6-l3-protocol.h"
26 #include "ns3/log.h"
27 #include "ns3/packet.h"
28 #include "ns3/tcp-header.h"
29 #include "ns3/tcp-l4-protocol.h"
30 #include "ns3/test.h"
31 #include "ns3/udp-header.h"
32 #include "ns3/udp-l4-protocol.h"
33 
34 #include <iomanip>
35 
36 using namespace ns3;
37 
38 NS_LOG_COMPONENT_DEFINE("TestEpcTftClassifier");
39 
49 {
50  public:
67  std::string sa,
68  std::string da,
69  uint16_t sp,
70  uint16_t dp,
71  uint8_t tos,
72  uint32_t tftId,
73  bool useIpv6);
74 
75  ~EpcTftClassifierTestCase() override;
76 
77  private:
80  uint8_t m_tftId;
81  bool m_useIpv6;
86 
101  static std::string BuildNameString(Ptr<EpcTftClassifier> c,
103  std::string sa,
104  std::string da,
105  uint16_t sp,
106  uint16_t dp,
107  uint8_t tos,
108  uint32_t tftId,
109  bool useIpv6);
110 
111  void DoRun() override;
112 };
113 
116  std::string sa,
117  std::string da,
118  uint16_t sp,
119  uint16_t dp,
120  uint8_t tos,
121  uint32_t tftId,
122  bool useIpv6)
123  : TestCase(BuildNameString(c, d, sa, da, sp, dp, tos, tftId, useIpv6)),
124  m_c(c),
125  m_d(d),
126  m_tftId(tftId),
127  m_useIpv6(useIpv6)
128 {
129  NS_LOG_FUNCTION(this << c << d << sa << da << sp << dp << tos << tftId << useIpv6);
130 
131  if (m_useIpv6)
132  {
133  m_ipv6Header.SetSource(Ipv6Address::MakeIpv4MappedAddress(Ipv4Address(sa.c_str())));
134  m_ipv6Header.SetDestination(Ipv6Address::MakeIpv4MappedAddress(Ipv4Address(da.c_str())));
136  m_ipv6Header.SetPayloadLength(8); // Full UDP header
137  m_ipv6Header.SetNextHeader(UdpL4Protocol::PROT_NUMBER);
138  }
139  else
140  {
141  m_ipHeader.SetSource(Ipv4Address(sa.c_str()));
143  m_ipHeader.SetTos(tos);
144  m_ipHeader.SetPayloadSize(8); // Full UDP header
145  m_ipHeader.SetProtocol(UdpL4Protocol::PROT_NUMBER);
146  }
147 
150 }
151 
153 {
154 }
155 
156 std::string
159  std::string sa,
160  std::string da,
161  uint16_t sp,
162  uint16_t dp,
163  uint8_t tos,
164  uint32_t tftId,
165  bool useIpv6)
166 {
167  std::ostringstream oss;
168  oss << c << " d = " << d;
169  if (useIpv6)
170  {
171  oss << ", sa = " << Ipv6Address::MakeIpv4MappedAddress(Ipv4Address(sa.c_str()))
172  << ", da = " << Ipv6Address::MakeIpv4MappedAddress(Ipv4Address(da.c_str()));
173  }
174  else
175  {
176  oss << ", sa = " << sa << ", da = " << da;
177  }
178  oss << ", sp = " << sp << ", dp = " << dp << ", tos = 0x" << std::hex << (int)tos
179  << " --> tftId = " << tftId;
180  return oss.str();
181 }
182 
183 void
185 {
187 
188  Ptr<Packet> udpPacket = Create<Packet>();
189  udpPacket->AddHeader(m_udpHeader);
190  if (m_useIpv6)
191  {
192  udpPacket->AddHeader(m_ipv6Header);
193  }
194  else
195  {
196  udpPacket->AddHeader(m_ipHeader);
197  }
198  NS_LOG_LOGIC(this << *udpPacket);
199  uint32_t obtainedTftId =
200  m_c->Classify(udpPacket,
201  m_d,
202  m_useIpv6 ? Ipv6L3Protocol::PROT_NUMBER : Ipv4L3Protocol::PROT_NUMBER);
203  NS_TEST_ASSERT_MSG_EQ(obtainedTftId, (uint16_t)m_tftId, "bad classification of UDP packet");
204 }
205 
212 {
213  public:
215 };
216 
222 
224  : TestSuite("eps-tft-classifier", UNIT)
225 {
226  NS_LOG_FUNCTION(this);
227 
229  // Same testcases using IPv4 and IPv6 addresses
230  // IPv6 addresses are IPv4 mapped addresses, i.e. 1.2.3.4 -> 0::ffff:1.2.3.4
231  // Currently, we use the format '0::ffff:0102:0304' because
232  // the format '0::ffff:1.2.3.4' is not supported by the Ipv6Address class
234 
235  for (bool useIpv6 : {false, true})
236  {
238  // check some TFT matches
240 
241  Ptr<EpcTftClassifier> c1 = Create<EpcTftClassifier>();
242 
243  Ptr<EpcTft> tft1_1 = Create<EpcTft>();
244 
245  EpcTft::PacketFilter pf1_1_1;
246  if (useIpv6)
247  {
248  pf1_1_1.remoteIpv6Address.Set("0::ffff:0100:0000");
249  pf1_1_1.remoteIpv6Prefix = Ipv6Prefix(96 + 8);
250  pf1_1_1.localIpv6Address.Set("0::ffff:0200:0000");
251  pf1_1_1.localIpv6Prefix = Ipv6Prefix(96 + 8);
252  }
253  else
254  {
255  pf1_1_1.remoteAddress.Set("1.0.0.0");
256  pf1_1_1.remoteMask.Set(0xff000000);
257  pf1_1_1.localAddress.Set("2.0.0.0");
258  pf1_1_1.localMask.Set(0xff000000);
259  }
260  tft1_1->Add(pf1_1_1);
261 
262  EpcTft::PacketFilter pf1_1_2;
263  if (useIpv6)
264  {
265  pf1_1_2.remoteIpv6Address.Set("0::ffff:0303:0300");
266  pf1_1_2.remoteIpv6Prefix = Ipv6Prefix(96 + 24);
267  pf1_1_2.localIpv6Address.Set("0::ffff:0404:0400");
268  pf1_1_2.localIpv6Prefix = Ipv6Prefix(96 + 24);
269  }
270  else
271  {
272  pf1_1_2.remoteAddress.Set("3.3.3.0");
273  pf1_1_2.remoteMask.Set(0xffffff00);
274  pf1_1_2.localAddress.Set("4.4.4.0");
275  pf1_1_2.localMask.Set(0xffffff00);
276  }
277  tft1_1->Add(pf1_1_2);
278 
279  c1->Add(tft1_1, 1);
280 
281  Ptr<EpcTft> tft1_2 = Create<EpcTft>();
282 
283  EpcTft::PacketFilter pf1_2_1;
284  pf1_2_1.remotePortStart = 1024;
285  pf1_2_1.remotePortEnd = 1035;
286  tft1_2->Add(pf1_2_1);
287 
288  EpcTft::PacketFilter pf1_2_2;
289  pf1_2_2.localPortStart = 3456;
290  pf1_2_2.localPortEnd = 3489;
291  tft1_2->Add(pf1_2_2);
292 
293  EpcTft::PacketFilter pf1_2_3;
294  pf1_2_3.localPortStart = 7895;
295  pf1_2_3.localPortEnd = 7895;
296  tft1_2->Add(pf1_2_3);
297 
298  EpcTft::PacketFilter pf1_2_4;
299  pf1_2_4.remotePortStart = 5897;
300  pf1_2_4.remotePortEnd = 5897;
301  tft1_2->Add(pf1_2_4);
302 
303  c1->Add(tft1_2, 2);
304 
305  // --------------------------------classifier----direction-------src_addr---dst_addr--src_port--dst_port--ToS--TFT_id
306 
307  // test IP addresses
309  EpcTft::UPLINK,
310  "2.2.3.4",
311  "1.1.1.1",
312  4,
313  1234,
314  0,
315  1,
316  useIpv6),
317  TestCase::QUICK);
319  EpcTft::UPLINK,
320  "2.2.3.4",
321  "1.0.0.0",
322  2,
323  123,
324  5,
325  1,
326  useIpv6),
327  TestCase::QUICK);
329  EpcTft::UPLINK,
330  "6.2.3.4",
331  "1.1.1.1",
332  4,
333  1234,
334  0,
335  0,
336  useIpv6),
337  TestCase::QUICK);
339  EpcTft::DOWNLINK,
340  "3.3.3.4",
341  "4.4.4.1",
342  4,
343  1234,
344  0,
345  1,
346  useIpv6),
347  TestCase::QUICK);
349  EpcTft::DOWNLINK,
350  "3.3.4.4",
351  "4.4.4.1",
352  4,
353  1234,
354  0,
355  0,
356  useIpv6),
357  TestCase::QUICK);
359  EpcTft::UPLINK,
360  "3.3.3.4",
361  "4.4.2.1",
362  4,
363  1234,
364  0,
365  0,
366  useIpv6),
367  TestCase::QUICK);
368 
369  // test remote port
371  EpcTft::UPLINK,
372  "9.1.1.1",
373  "8.1.1.1",
374  4,
375  1024,
376  0,
377  2,
378  useIpv6),
379  TestCase::QUICK);
381  EpcTft::UPLINK,
382  "9.1.1.1",
383  "8.1.1.1",
384  4,
385  1025,
386  0,
387  2,
388  useIpv6),
389  TestCase::QUICK);
391  EpcTft::UPLINK,
392  "9.1.1.1",
393  "8.1.1.1",
394  4,
395  1035,
396  0,
397  2,
398  useIpv6),
399  TestCase::QUICK);
401  EpcTft::UPLINK,
402  "9.1.1.1",
403  "8.1.1.1",
404  4,
405  1234,
406  0,
407  0,
408  useIpv6),
409  TestCase::QUICK);
411  EpcTft::DOWNLINK,
412  "9.1.1.1",
413  "8.1.1.1",
414  4,
415  1024,
416  0,
417  0,
418  useIpv6),
419  TestCase::QUICK);
421  EpcTft::DOWNLINK,
422  "9.1.1.1",
423  "8.1.1.1",
424  4,
425  1025,
426  0,
427  0,
428  useIpv6),
429  TestCase::QUICK);
431  EpcTft::DOWNLINK,
432  "9.1.1.1",
433  "8.1.1.1",
434  4,
435  1035,
436  0,
437  0,
438  useIpv6),
439  TestCase::QUICK);
440 
441  // test local port
443  EpcTft::UPLINK,
444  "9.1.1.1",
445  "8.1.1.1",
446  4,
447  3456,
448  0,
449  0,
450  useIpv6),
451  TestCase::QUICK);
453  EpcTft::UPLINK,
454  "9.1.1.1",
455  "8.1.1.1",
456  4,
457  3457,
458  0,
459  0,
460  useIpv6),
461  TestCase::QUICK);
463  EpcTft::UPLINK,
464  "9.1.1.1",
465  "8.1.1.1",
466  4,
467  3489,
468  0,
469  0,
470  useIpv6),
471  TestCase::QUICK);
473  EpcTft::UPLINK,
474  "9.1.1.1",
475  "8.1.1.1",
476  3456,
477  6,
478  0,
479  2,
480  useIpv6),
481  TestCase::QUICK);
483  EpcTft::DOWNLINK,
484  "9.1.1.1",
485  "8.1.1.1",
486  3461,
487  3461,
488  0,
489  2,
490  useIpv6),
491  TestCase::QUICK);
493  EpcTft::DOWNLINK,
494  "9.1.1.1",
495  "8.1.1.1",
496  9,
497  3489,
498  0,
499  2,
500  useIpv6),
501  TestCase::QUICK);
503  EpcTft::DOWNLINK,
504  "9.1.1.1",
505  "8.1.1.1",
506  9,
507  7895,
508  0,
509  2,
510  useIpv6),
511  TestCase::QUICK);
513  EpcTft::UPLINK,
514  "9.1.1.1",
515  "8.1.1.1",
516  7895,
517  10,
518  0,
519  2,
520  useIpv6),
521  TestCase::QUICK);
523  EpcTft::UPLINK,
524  "9.1.1.1",
525  "8.1.1.1",
526  9,
527  5897,
528  0,
529  2,
530  useIpv6),
531  TestCase::QUICK);
533  EpcTft::DOWNLINK,
534  "9.1.1.1",
535  "8.1.1.1",
536  5897,
537  10,
538  0,
539  2,
540  useIpv6),
541  TestCase::QUICK);
542 
544  // check default TFT
546 
547  Ptr<EpcTftClassifier> c2 = Create<EpcTftClassifier>();
548  c2->Add(EpcTft::Default(), 1);
549 
550  // --------------------------------classifier---direction--------src_addr---dst_addr--src_port--dst_port--ToS--TFT
551  // id
552 
553  // test IP addresses
555  EpcTft::UPLINK,
556  "2.2.3.4",
557  "1.1.1.1",
558  4,
559  1234,
560  0,
561  1,
562  useIpv6),
563  TestCase::QUICK);
565  EpcTft::UPLINK,
566  "2.2.3.4",
567  "1.0.0.0",
568  2,
569  123,
570  5,
571  1,
572  useIpv6),
573  TestCase::QUICK);
575  EpcTft::UPLINK,
576  "6.2.3.4",
577  "1.1.1.1",
578  4,
579  1234,
580  0,
581  1,
582  useIpv6),
583  TestCase::QUICK);
585  EpcTft::DOWNLINK,
586  "3.3.3.4",
587  "4.4.4.1",
588  4,
589  1234,
590  0,
591  1,
592  useIpv6),
593  TestCase::QUICK);
595  EpcTft::DOWNLINK,
596  "3.3.4.4",
597  "4.4.4.1",
598  4,
599  1234,
600  0,
601  1,
602  useIpv6),
603  TestCase::QUICK);
605  EpcTft::UPLINK,
606  "3.3.3.4",
607  "4.4.2.1",
608  4,
609  1234,
610  0,
611  1,
612  useIpv6),
613  TestCase::QUICK);
614 
615  // test remote port
617  EpcTft::UPLINK,
618  "9.1.1.1",
619  "8.1.1.1",
620  4,
621  1024,
622  0,
623  1,
624  useIpv6),
625  TestCase::QUICK);
627  EpcTft::UPLINK,
628  "9.1.1.1",
629  "8.1.1.1",
630  4,
631  1025,
632  0,
633  1,
634  useIpv6),
635  TestCase::QUICK);
637  EpcTft::UPLINK,
638  "9.1.1.1",
639  "8.1.1.1",
640  4,
641  1035,
642  0,
643  1,
644  useIpv6),
645  TestCase::QUICK);
647  EpcTft::UPLINK,
648  "9.1.1.1",
649  "8.1.1.1",
650  4,
651  1234,
652  0,
653  1,
654  useIpv6),
655  TestCase::QUICK);
657  EpcTft::DOWNLINK,
658  "9.1.1.1",
659  "8.1.1.1",
660  4,
661  1024,
662  0,
663  1,
664  useIpv6),
665  TestCase::QUICK);
667  EpcTft::DOWNLINK,
668  "9.1.1.1",
669  "8.1.1.1",
670  4,
671  1025,
672  0,
673  1,
674  useIpv6),
675  TestCase::QUICK);
677  EpcTft::DOWNLINK,
678  "9.1.1.1",
679  "8.1.1.1",
680  4,
681  1035,
682  0,
683  1,
684  useIpv6),
685  TestCase::QUICK);
686 
687  // test local port
689  EpcTft::UPLINK,
690  "9.1.1.1",
691  "8.1.1.1",
692  4,
693  3456,
694  0,
695  1,
696  useIpv6),
697  TestCase::QUICK);
699  EpcTft::UPLINK,
700  "9.1.1.1",
701  "8.1.1.1",
702  4,
703  3457,
704  0,
705  1,
706  useIpv6),
707  TestCase::QUICK);
709  EpcTft::UPLINK,
710  "9.1.1.1",
711  "8.1.1.1",
712  4,
713  3489,
714  0,
715  1,
716  useIpv6),
717  TestCase::QUICK);
719  EpcTft::UPLINK,
720  "9.1.1.1",
721  "8.1.1.1",
722  3456,
723  6,
724  0,
725  1,
726  useIpv6),
727  TestCase::QUICK);
729  EpcTft::DOWNLINK,
730  "9.1.1.1",
731  "8.1.1.1",
732  3461,
733  3461,
734  0,
735  1,
736  useIpv6),
737  TestCase::QUICK);
739  EpcTft::DOWNLINK,
740  "9.1.1.1",
741  "8.1.1.1",
742  9,
743  3489,
744  0,
745  1,
746  useIpv6),
747  TestCase::QUICK);
748 
750  // check default TFT plus dedicated ones
752 
753  Ptr<EpcTftClassifier> c3 = Create<EpcTftClassifier>();
754  c3->Add(EpcTft::Default(), 1);
755  c3->Add(tft1_1, 2);
756  c3->Add(tft1_2, 3);
757 
758  // --------------------------------classifier---direction--------src_addr---dst_addr---src_port--dst_port--ToS--TFT_id
759 
760  // test IP addresses
762  EpcTft::UPLINK,
763  "2.2.3.4",
764  "1.1.1.1",
765  4,
766  1234,
767  0,
768  2,
769  useIpv6),
770  TestCase::QUICK);
772  EpcTft::UPLINK,
773  "2.2.3.4",
774  "1.0.0.0",
775  2,
776  123,
777  5,
778  2,
779  useIpv6),
780  TestCase::QUICK);
782  EpcTft::UPLINK,
783  "6.2.3.4",
784  "1.1.1.1",
785  4,
786  1234,
787  0,
788  1,
789  useIpv6),
790  TestCase::QUICK);
792  EpcTft::DOWNLINK,
793  "3.3.3.4",
794  "4.4.4.1",
795  4,
796  1234,
797  0,
798  2,
799  useIpv6),
800  TestCase::QUICK);
802  EpcTft::DOWNLINK,
803  "3.3.4.4",
804  "4.4.4.1",
805  4,
806  1234,
807  0,
808  1,
809  useIpv6),
810  TestCase::QUICK);
812  EpcTft::UPLINK,
813  "3.3.3.4",
814  "4.4.2.1",
815  4,
816  1234,
817  0,
818  1,
819  useIpv6),
820  TestCase::QUICK);
821 
822  // test remote port
824  EpcTft::UPLINK,
825  "9.1.1.1",
826  "8.1.1.1",
827  4,
828  1024,
829  0,
830  3,
831  useIpv6),
832  TestCase::QUICK);
834  EpcTft::UPLINK,
835  "9.1.1.1",
836  "8.1.1.1",
837  4,
838  1025,
839  0,
840  3,
841  useIpv6),
842  TestCase::QUICK);
844  EpcTft::UPLINK,
845  "9.1.1.1",
846  "8.1.1.1",
847  4,
848  1035,
849  0,
850  3,
851  useIpv6),
852  TestCase::QUICK);
854  EpcTft::UPLINK,
855  "9.1.1.1",
856  "8.1.1.1",
857  4,
858  1234,
859  0,
860  1,
861  useIpv6),
862  TestCase::QUICK);
864  EpcTft::DOWNLINK,
865  "9.1.1.1",
866  "8.1.1.1",
867  4,
868  1024,
869  0,
870  1,
871  useIpv6),
872  TestCase::QUICK);
874  EpcTft::DOWNLINK,
875  "9.1.1.1",
876  "8.1.1.1",
877  4,
878  1025,
879  0,
880  1,
881  useIpv6),
882  TestCase::QUICK);
884  EpcTft::DOWNLINK,
885  "9.1.1.1",
886  "8.1.1.1",
887  4,
888  1035,
889  0,
890  1,
891  useIpv6),
892  TestCase::QUICK);
893 
894  // test local port
896  EpcTft::UPLINK,
897  "9.1.1.1",
898  "8.1.1.1",
899  4,
900  3456,
901  0,
902  1,
903  useIpv6),
904  TestCase::QUICK);
906  EpcTft::UPLINK,
907  "9.1.1.1",
908  "8.1.1.1",
909  4,
910  3457,
911  0,
912  1,
913  useIpv6),
914  TestCase::QUICK);
916  EpcTft::UPLINK,
917  "9.1.1.1",
918  "8.1.1.1",
919  4,
920  3489,
921  0,
922  1,
923  useIpv6),
924  TestCase::QUICK);
926  EpcTft::UPLINK,
927  "9.1.1.1",
928  "8.1.1.1",
929  3456,
930  6,
931  0,
932  3,
933  useIpv6),
934  TestCase::QUICK);
936  EpcTft::DOWNLINK,
937  "9.1.1.1",
938  "8.1.1.1",
939  3461,
940  3461,
941  0,
942  3,
943  useIpv6),
944  TestCase::QUICK);
946  EpcTft::DOWNLINK,
947  "9.1.1.1",
948  "8.1.1.1",
949  9,
950  3489,
951  0,
952  3,
953  useIpv6),
954  TestCase::QUICK);
955 
957  // check two TFTs with different ports
959 
960  Ptr<EpcTftClassifier> c4 = Create<EpcTftClassifier>();
961  Ptr<EpcTft> tft4_1 = Create<EpcTft>();
962  tft4_1->Add(pf1_2_3);
963  c4->Add(tft4_1, 1);
964  Ptr<EpcTft> tft4_2 = Create<EpcTft>();
965  tft4_2->Add(pf1_2_4);
966  c4->Add(tft4_2, 2);
968  EpcTft::DOWNLINK,
969  "9.1.1.1",
970  "8.1.1.1",
971  9,
972  3489,
973  0,
974  0,
975  useIpv6),
976  TestCase::QUICK);
978  EpcTft::DOWNLINK,
979  "9.1.1.1",
980  "8.1.1.1",
981  9,
982  7895,
983  0,
984  1,
985  useIpv6),
986  TestCase::QUICK);
988  EpcTft::UPLINK,
989  "9.1.1.1",
990  "8.1.1.1",
991  7895,
992  10,
993  0,
994  1,
995  useIpv6),
996  TestCase::QUICK);
998  EpcTft::UPLINK,
999  "9.1.1.1",
1000  "8.1.1.1",
1001  9,
1002  5897,
1003  0,
1004  2,
1005  useIpv6),
1006  TestCase::QUICK);
1008  EpcTft::DOWNLINK,
1009  "9.1.1.1",
1010  "8.1.1.1",
1011  5897,
1012  10,
1013  0,
1014  2,
1015  useIpv6),
1016  TestCase::QUICK);
1017  }
1018 }
Test case to check the functionality of the Tft Classifier.
Ipv4Header m_ipHeader
the IPv4 header
TcpHeader m_tcpHeader
the TCP header
Ptr< EpcTftClassifier > m_c
the EPC TFT classifier
static std::string BuildNameString(Ptr< EpcTftClassifier > c, EpcTft::Direction d, std::string sa, std::string da, uint16_t sp, uint16_t dp, uint8_t tos, uint32_t tftId, bool useIpv6)
Build name string.
bool m_useIpv6
use IPv4 or IPv6 header/addresses
EpcTftClassifierTestCase(Ptr< EpcTftClassifier > c, EpcTft::Direction d, std::string sa, std::string da, uint16_t sp, uint16_t dp, uint8_t tos, uint32_t tftId, bool useIpv6)
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
UdpHeader m_udpHeader
the UDP header
EpcTft::Direction m_d
the EPC TFT direction
Ipv6Header m_ipv6Header
the IPv6 header
Epc Tft Classifier Test Suite.
uint32_t Classify(Ptr< Packet > p, EpcTft::Direction direction, uint16_t protocolNumber)
classify an IP packet
void Add(Ptr< EpcTft > tft, uint32_t id)
add a TFT to the Classifier
Direction
Indicates the direction of the traffic that is to be classified.
Definition: epc-tft.h:51
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:43
void Set(uint32_t address)
input address is in host order.
Packet header for IPv4.
Definition: ipv4-header.h:34
void SetDestination(Ipv4Address destination)
Definition: ipv4-header.cc:309
void SetPayloadSize(uint16_t size)
Definition: ipv4-header.cc:57
void SetProtocol(uint8_t num)
Definition: ipv4-header.cc:288
void SetTos(uint8_t tos)
Definition: ipv4-header.cc:85
void SetSource(Ipv4Address source)
Definition: ipv4-header.cc:295
void Set(uint32_t mask)
input mask is in host order.
Definition: ipv4-address.cc:98
void Set(const char *address)
Sets an Ipv6Address by parsing the input C-string.
Packet header for IPv6.
Definition: ipv6-header.h:36
void SetDestination(Ipv6Address dst)
Set the "Destination address" field.
Definition: ipv6-header.cc:118
void SetSource(Ipv6Address src)
Set the "Source address" field.
Definition: ipv6-header.cc:106
void SetPayloadLength(uint16_t len)
Set the "Payload length" field.
Definition: ipv6-header.cc:70
void SetTrafficClass(uint8_t traffic)
Set the "Traffic class" field.
Definition: ipv6-header.cc:46
void SetNextHeader(uint8_t next)
Set the "Next header" field.
Definition: ipv6-header.cc:82
Describes an IPv6 prefix.
Definition: ipv6-address.h:456
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:268
static void Enable()
Enable the packet metadata.
Header for the Transmission Control Protocol.
Definition: tcp-header.h:46
encapsulates test code
Definition: test.h:1060
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:305
A suite of tests to run.
Definition: test.h:1256
Packet header for UDP packets.
Definition: udp-header.h:41
void SetSourcePort(uint16_t port)
Definition: udp-header.cc:63
void SetDestinationPort(uint16_t port)
Definition: udp-header.cc:57
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
static EpcTftClassifierTestSuite g_lteTftClassifierTestSuite
Static variable for test initialization.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Definition: test.h:144
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition: epc-tft.h:71
Ipv4Address localAddress
IPv4 address of the UE.
Definition: epc-tft.h:121
Ipv6Prefix localIpv6Prefix
IPv6 address prefix of the UE.
Definition: epc-tft.h:127
uint16_t localPortEnd
end of the port number range of the UE
Definition: epc-tft.h:132
Ipv4Mask localMask
IPv4 address mask of the UE.
Definition: epc-tft.h:122
uint16_t remotePortEnd
end of the port number range of the remote host
Definition: epc-tft.h:130
Ipv6Address remoteIpv6Address
IPv6 address of the remote host.
Definition: epc-tft.h:124
Ipv4Mask remoteMask
IPv4 address mask of the remote host.
Definition: epc-tft.h:120
uint16_t remotePortStart
start of the port number range of the remote host
Definition: epc-tft.h:129
Ipv6Address localIpv6Address
IPv6 address of the UE.
Definition: epc-tft.h:126
Ipv4Address remoteAddress
IPv4 address of the remote host.
Definition: epc-tft.h:119
Ipv6Prefix remoteIpv6Prefix
IPv6 address prefix of the remote host.
Definition: epc-tft.h:125
uint16_t localPortStart
start of the port number range of the UE
Definition: epc-tft.h:131