Adding 3 new applications:udp-client, udp-server, udp-trace-client.
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ns3/assert.h"
#include "ns3/log.h"
#include "ns3/header.h"
#include "ns3/simulator.h"
#include "seq-ts-header.h"
NS_LOG_COMPONENT_DEFINE ("SeqTsHeader");
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (SeqTsHeader);
SeqTsHeader::SeqTsHeader ()
: m_seq (0),
m_ts (Simulator::Now ().GetTimeStep ())
{}
void
SeqTsHeader::SetSeq (uint32_t seq)
{
m_seq = seq;
}
uint32_t
SeqTsHeader::GetSeq (void) const
{
return m_seq;
}
Time
SeqTsHeader::GetTs (void) const
{
return TimeStep (m_ts);
}
TypeId
SeqTsHeader::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::SeqTsHeader")
.SetParent<Header> ()
.AddConstructor<SeqTsHeader> ()
;
return tid;
}
TypeId
SeqTsHeader::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
void
SeqTsHeader::Print (std::ostream &os) const
{
os << "(seq=" << m_seq << " time=" << TimeStep (m_ts).GetSeconds () << ")";
}
uint32_t
SeqTsHeader::GetSerializedSize (void) const
{
return 4+8;
}
void
SeqTsHeader::Serialize (Buffer::Iterator start) const
{
Buffer::Iterator i = start;
i.WriteHtonU32 (m_seq);
i.WriteHtonU64 (m_ts);
}
uint32_t
SeqTsHeader::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator i = start;
m_seq = i.ReadNtohU32 ();
m_ts = i.ReadNtohU64 ();
return GetSerializedSize ();
}
} // namespace ns3