author | Tom Henderson <tomh@tomh.org> |
Mon, 28 Sep 2015 20:27:25 -0700 | |
changeset 11676 | 05ea1489e509 |
parent 10168 | 897a43e0f9b8 |
permissions | -rw-r--r-- |
7566
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
2 |
/* |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
3 |
* Copyright (c) 2010 Hajime Tazaki |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
4 |
* |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
8 |
* |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
13 |
* |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
17 |
* |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
18 |
* Author: John Abraham <john.abraham@gatech.edu> |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
19 |
* Adapted from: ipv4-raw-test.cc |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
20 |
*/ |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
21 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
22 |
#include "ns3/test.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
23 |
#include "ns3/socket-factory.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
24 |
#include "ns3/ipv4-raw-socket-factory.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
25 |
#include "ns3/simulator.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
26 |
#include "ns3/simple-channel.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
27 |
#include "ns3/simple-net-device.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
28 |
#include "ns3/drop-tail-queue.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
29 |
#include "ns3/socket.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
30 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
31 |
#include "ns3/log.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
32 |
#include "ns3/node.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
33 |
#include "ns3/inet-socket-address.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
34 |
#include "ns3/boolean.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
35 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
36 |
#include "ns3/arp-l3-protocol.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
37 |
#include "ns3/ipv4-l3-protocol.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
38 |
#include "ns3/icmpv4-l4-protocol.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
39 |
#include "ns3/ipv4-list-routing.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
40 |
#include "ns3/ipv4-static-routing.h" |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
41 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
42 |
#include <string> |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
43 |
#include <sstream> |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
44 |
#include <limits> |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
45 |
#include <netinet/in.h> |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
46 |
#include <sys/socket.h> |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
47 |
#include <sys/types.h> |
9079
1e5921e6507d
Clean up core, network, internet, point-to-point tests that don't access private class attributes and methods in accordance to sample-test-suite.cc.
Vedran Miletić <rivanvx@gmail.com>
parents:
7704
diff
changeset
|
48 |
|
1e5921e6507d
Clean up core, network, internet, point-to-point tests that don't access private class attributes and methods in accordance to sample-test-suite.cc.
Vedran Miletić <rivanvx@gmail.com>
parents:
7704
diff
changeset
|
49 |
using namespace ns3; |
7566
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
50 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
51 |
static void |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
52 |
AddInternetStack (Ptr<Node> node) |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
53 |
{ |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
54 |
//ARP |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
55 |
Ptr<ArpL3Protocol> arp = CreateObject<ArpL3Protocol> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
56 |
node->AggregateObject (arp); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
57 |
//IPV4 |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
58 |
Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
59 |
//Routing for Ipv4 |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
60 |
Ptr<Ipv4ListRouting> ipv4Routing = CreateObject<Ipv4ListRouting> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
61 |
ipv4->SetRoutingProtocol (ipv4Routing); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
62 |
Ptr<Ipv4StaticRouting> ipv4staticRouting = CreateObject<Ipv4StaticRouting> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
63 |
ipv4Routing->AddRoutingProtocol (ipv4staticRouting, 0); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
64 |
node->AggregateObject (ipv4); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
65 |
//ICMP |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
66 |
Ptr<Icmpv4L4Protocol> icmp = CreateObject<Icmpv4L4Protocol> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
67 |
node->AggregateObject (icmp); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
68 |
// //Ipv4Raw |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
69 |
// Ptr<Ipv4UdpL4Protocol> udp = CreateObject<UdpL4Protocol> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
70 |
// node->AggregateObject(udp); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
71 |
} |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
72 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
73 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
74 |
class Ipv4HeaderTest : public TestCase |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
75 |
{ |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
76 |
Ptr<Packet> m_receivedPacket; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
77 |
Ipv4Header m_receivedHeader; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
78 |
void DoSendData_IpHdr_Dscp (Ptr<Socket> socket, std::string to, Ipv4Header::DscpType dscp,Ipv4Header::EcnType); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
79 |
void SendData_IpHdr_Dscp (Ptr<Socket> socket, std::string to, Ipv4Header::DscpType dscp, Ipv4Header::EcnType); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
80 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
81 |
public: |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
82 |
virtual void DoRun (void); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
83 |
Ipv4HeaderTest (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
84 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
85 |
void ReceivePacket (Ptr<Socket> socket, Ptr<Packet> packet, const Address &from); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
86 |
void ReceivePkt (Ptr<Socket> socket); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
87 |
}; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
88 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
89 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
90 |
Ipv4HeaderTest::Ipv4HeaderTest () |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
91 |
: TestCase ("IPv4 Header Test") |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
92 |
{ |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
93 |
} |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
94 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
95 |
void Ipv4HeaderTest::ReceivePacket (Ptr<Socket> socket, Ptr<Packet> packet, const Address &from) |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
96 |
{ |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
97 |
m_receivedPacket = packet; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
98 |
} |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
99 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
100 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
101 |
void Ipv4HeaderTest::ReceivePkt (Ptr<Socket> socket) |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
102 |
{ |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
103 |
uint32_t availableData; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
104 |
availableData = socket->GetRxAvailable (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
105 |
m_receivedPacket = socket->Recv (2, MSG_PEEK); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
106 |
NS_ASSERT (m_receivedPacket->GetSize () == 2); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
107 |
m_receivedPacket = socket->Recv (std::numeric_limits<uint32_t>::max (), 0); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
108 |
NS_ASSERT (availableData == m_receivedPacket->GetSize ()); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
109 |
m_receivedPacket->PeekHeader (m_receivedHeader); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
110 |
} |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
111 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
112 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
113 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
114 |
void |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
115 |
Ipv4HeaderTest::DoSendData_IpHdr_Dscp (Ptr<Socket> socket, std::string to, Ipv4Header::DscpType dscp, Ipv4Header::EcnType ecn) |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
116 |
{ |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
117 |
Address realTo = InetSocketAddress (Ipv4Address (to.c_str ()), 0); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
118 |
socket->SetAttribute ("IpHeaderInclude", BooleanValue (true)); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
119 |
Ptr<Packet> p = Create<Packet> (123); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
120 |
Ipv4Header ipHeader; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
121 |
ipHeader.SetSource (Ipv4Address ("10.0.0.2")); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
122 |
ipHeader.SetDestination (Ipv4Address (to.c_str ())); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
123 |
ipHeader.SetProtocol (0); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
124 |
ipHeader.SetPayloadSize (p->GetSize ()); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
125 |
ipHeader.SetTtl (255); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
126 |
ipHeader.SetDscp (dscp); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
127 |
ipHeader.SetEcn (ecn); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
128 |
p->AddHeader (ipHeader); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
129 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
130 |
NS_TEST_EXPECT_MSG_EQ (socket->SendTo (p, 0, realTo), |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
131 |
143, to); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
132 |
socket->SetAttribute ("IpHeaderInclude", BooleanValue (false)); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
133 |
} |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
134 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
135 |
void |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
136 |
Ipv4HeaderTest::SendData_IpHdr_Dscp (Ptr<Socket> socket, std::string to, Ipv4Header::DscpType dscp, Ipv4Header::EcnType ecn) |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
137 |
{ |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
138 |
m_receivedPacket = Create<Packet> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
139 |
Simulator::ScheduleWithContext (socket->GetNode ()->GetId (), Seconds (0), |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
140 |
&Ipv4HeaderTest::DoSendData_IpHdr_Dscp, this, socket, to, dscp, ecn); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
141 |
Simulator::Run (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
142 |
} |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
143 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
144 |
void |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
145 |
Ipv4HeaderTest::DoRun (void) |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
146 |
{ |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
147 |
// Create topology |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
148 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
149 |
// Receiver Node |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
150 |
Ptr<Node> rxNode = CreateObject<Node> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
151 |
AddInternetStack (rxNode); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
152 |
Ptr<SimpleNetDevice> rxDev1, rxDev2; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
153 |
{ // first interface |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
154 |
rxDev1 = CreateObject<SimpleNetDevice> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
155 |
rxDev1->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ())); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
156 |
rxNode->AddDevice (rxDev1); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
157 |
Ptr<Ipv4> ipv4 = rxNode->GetObject<Ipv4> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
158 |
uint32_t netdev_idx = ipv4->AddInterface (rxDev1); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
159 |
Ipv4InterfaceAddress ipv4Addr = Ipv4InterfaceAddress (Ipv4Address ("10.0.0.1"), Ipv4Mask (0xffff0000U)); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
160 |
ipv4->AddAddress (netdev_idx, ipv4Addr); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
161 |
ipv4->SetUp (netdev_idx); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
162 |
} |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
163 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
164 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
165 |
// Sender Node |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
166 |
Ptr<Node> txNode = CreateObject<Node> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
167 |
AddInternetStack (txNode); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
168 |
Ptr<SimpleNetDevice> txDev1; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
169 |
{ |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
170 |
txDev1 = CreateObject<SimpleNetDevice> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
171 |
txDev1->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ())); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
172 |
txNode->AddDevice (txDev1); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
173 |
Ptr<Ipv4> ipv4 = txNode->GetObject<Ipv4> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
174 |
uint32_t netdev_idx = ipv4->AddInterface (txDev1); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
175 |
Ipv4InterfaceAddress ipv4Addr = Ipv4InterfaceAddress (Ipv4Address ("10.0.0.2"), Ipv4Mask (0xffff0000U)); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
176 |
ipv4->AddAddress (netdev_idx, ipv4Addr); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
177 |
ipv4->SetUp (netdev_idx); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
178 |
} |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
179 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
180 |
// link the two nodes |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
181 |
Ptr<SimpleChannel> channel1 = CreateObject<SimpleChannel> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
182 |
rxDev1->SetChannel (channel1); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
183 |
txDev1->SetChannel (channel1); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
184 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
185 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
186 |
// Create the IPv4 Raw sockets |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
187 |
Ptr<SocketFactory> rxSocketFactory = rxNode->GetObject<Ipv4RawSocketFactory> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
188 |
Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
189 |
NS_TEST_EXPECT_MSG_EQ (rxSocket->Bind (InetSocketAddress (Ipv4Address ("0.0.0.0"), 0)), 0, "trivial"); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
190 |
rxSocket->SetRecvCallback (MakeCallback (&Ipv4HeaderTest::ReceivePkt, this)); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
191 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
192 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
193 |
Ptr<SocketFactory> txSocketFactory = txNode->GetObject<Ipv4RawSocketFactory> (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
194 |
Ptr<Socket> txSocket = txSocketFactory->CreateSocket (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
195 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
196 |
// ------ Now the tests ------------ |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
197 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
198 |
// Dscp Tests |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
199 |
std::cout << "Dscp Test\n"; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
200 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
201 |
std::vector <Ipv4Header::DscpType> vDscpTypes; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
202 |
vDscpTypes.push_back (Ipv4Header::DscpDefault); |
10168
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
203 |
vDscpTypes.push_back (Ipv4Header::DSCP_CS1); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
204 |
vDscpTypes.push_back (Ipv4Header::DSCP_AF11); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
205 |
vDscpTypes.push_back (Ipv4Header::DSCP_AF12); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
206 |
vDscpTypes.push_back (Ipv4Header::DSCP_AF13); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
207 |
vDscpTypes.push_back (Ipv4Header::DSCP_CS2); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
208 |
vDscpTypes.push_back (Ipv4Header::DSCP_AF21); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
209 |
vDscpTypes.push_back (Ipv4Header::DSCP_AF22); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
210 |
vDscpTypes.push_back (Ipv4Header::DSCP_AF23); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
211 |
vDscpTypes.push_back (Ipv4Header::DSCP_CS3); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
212 |
vDscpTypes.push_back (Ipv4Header::DSCP_AF31); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
213 |
vDscpTypes.push_back (Ipv4Header::DSCP_AF32); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
214 |
vDscpTypes.push_back (Ipv4Header::DSCP_AF33); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
215 |
vDscpTypes.push_back (Ipv4Header::DSCP_CS4); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
216 |
vDscpTypes.push_back (Ipv4Header::DSCP_AF41); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
217 |
vDscpTypes.push_back (Ipv4Header::DSCP_AF42); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
218 |
vDscpTypes.push_back (Ipv4Header::DSCP_AF43); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
219 |
vDscpTypes.push_back (Ipv4Header::DSCP_CS5); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
220 |
vDscpTypes.push_back (Ipv4Header::DSCP_EF); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
221 |
vDscpTypes.push_back (Ipv4Header::DSCP_CS6); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
222 |
vDscpTypes.push_back (Ipv4Header::DSCP_CS7); |
7566
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
223 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
224 |
for (uint32_t i = 0; i < vDscpTypes.size (); i++) |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
225 |
{ |
10168
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
226 |
SendData_IpHdr_Dscp (txSocket, "10.0.0.1", vDscpTypes [i], Ipv4Header::ECN_ECT1); |
7566
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
227 |
NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 143, "recv(hdrincl): 10.0.0.1"); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
228 |
NS_TEST_EXPECT_MSG_EQ (m_receivedHeader.GetDscp (), vDscpTypes [i], "recv(hdrincl): 10.0.0.1"); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
229 |
m_receivedHeader.Print (std::cout); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
230 |
std::cout << std::endl; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
231 |
m_receivedPacket->RemoveAllByteTags (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
232 |
m_receivedPacket = 0; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
233 |
} |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
234 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
235 |
// Ecn tests |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
236 |
std::cout << "Ecn Test\n"; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
237 |
std::vector <Ipv4Header::EcnType> vEcnTypes; |
10168
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
238 |
vEcnTypes.push_back (Ipv4Header::ECN_NotECT); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
239 |
vEcnTypes.push_back (Ipv4Header::ECN_ECT1); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
240 |
vEcnTypes.push_back (Ipv4Header::ECN_ECT0); |
897a43e0f9b8
bug 1723: name clash in ipv4-header.h from <termios.h>
Tom Henderson <tomh@tomh.org>
parents:
9266
diff
changeset
|
241 |
vEcnTypes.push_back (Ipv4Header::ECN_CE); |
7566
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
242 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
243 |
for (uint32_t i = 0; i < vEcnTypes.size (); i++) |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
244 |
{ |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
245 |
SendData_IpHdr_Dscp (txSocket, "10.0.0.1", Ipv4Header::DscpDefault, vEcnTypes [i]); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
246 |
NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 143, "recv(hdrincl): 10.0.0.1"); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
247 |
NS_TEST_EXPECT_MSG_EQ (m_receivedHeader.GetEcn (), vEcnTypes [i], "recv(hdrincl): 10.0.0.1"); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
248 |
m_receivedHeader.Print (std::cout); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
249 |
std::cout << std::endl; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
250 |
m_receivedPacket->RemoveAllByteTags (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
251 |
m_receivedPacket = 0; |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
252 |
} |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
253 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
254 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
255 |
|
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
256 |
Simulator::Destroy (); |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
257 |
} |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
258 |
//----------------------------------------------------------------------------- |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
259 |
class Ipv4HeaderTestSuite : public TestSuite |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
260 |
{ |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
261 |
public: |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
262 |
Ipv4HeaderTestSuite () : TestSuite ("ipv4-header", UNIT) |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
263 |
{ |
9266
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
9079
diff
changeset
|
264 |
AddTestCase (new Ipv4HeaderTest, TestCase::QUICK); |
7566
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
265 |
} |
aa5b5f290a0d
Bug 1186 - Ipv4Header lacks DSCP and ECN
John Abraham <john.abraham@gatech.edu>
parents:
diff
changeset
|
266 |
} g_ipv4HeaderTestSuite; |