lengyijun
1/2/2019 - 5:15 AM

bug.cc

/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */

// #include "ns3/gally-frame-default.h"

// using namespace ns3;
#include <stdlib.h>
#include <iostream>
#include "ns3/core-module.h"
#include "ns3/node.h"
//#include "ns3/gally-helper.h"
//#include "ns3/gally-simple-phy-helper.h"
//#include "ns3/gally-simple-mac-helper.h"
//#include "ns3/gamac-address.h"
//#include "ns3/gally-net-device.h"

#include "ns3/log.h"
#include "ns3/command-line.h"
#include "ns3/ptr.h"
#include "ns3/config.h"
#include "ns3/uinteger.h"
#include "ns3/string.h"
#include "ns3/pointer.h"
#include "ns3/simulator.h"
#include "ns3/object.h"

#include "ns3/ipv4-address.h"
#include "ns3/ipv4-header.h"

using namespace ns3;

int main (int argc, char *argv[])
{

	
	Packet::EnablePrinting ();
	// test address
	
	// test fragment 
	Ptr<Packet> packet= Create<Packet>();
	Ptr<Packet> packetToAdd = Create<Packet>(27);
	
	std::cout << "packet 1  " << *packet  << "size : " << packet->GetSize()<< "\n";
	Ipv4Header header = Ipv4Header ();
	
	std::cout << " header : " << header.GetSerializedSize() << "\n";
	packetToAdd->AddHeader(header);
	packet->AddAtEnd(packetToAdd);
	packet->AddPaddingAtEnd(30);
	
	std::cout << "packet : " << *packet <<"\n";
	Ptr<Packet> p1 = packetToAdd->CreateFragment(0,25);
	Ptr<Packet> p2 = packet->CreateFragment(0,29);
	
  return 0;
}