branch merge
This commit is contained in:
35
src/node/ipv4-raw-socket-factory.cc
Normal file
35
src/node/ipv4-raw-socket-factory.cc
Normal file
@@ -0,0 +1,35 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2007 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 "ipv4-raw-socket-factory.h"
|
||||
#include "ns3/uinteger.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Ipv4RawSocketFactory);
|
||||
|
||||
TypeId Ipv4RawSocketFactory::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::Ipv4RawSocketFactory")
|
||||
.SetParent<SocketFactory> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
46
src/node/ipv4-raw-socket-factory.h
Normal file
46
src/node/ipv4-raw-socket-factory.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2007 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>
|
||||
*/
|
||||
#ifndef IPV4_RAW_SOCKET_FACTORY_H
|
||||
#define IPV4_RAW_SOCKET_FACTORY_H
|
||||
|
||||
#include "socket-factory.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class Socket;
|
||||
|
||||
/**
|
||||
* \ingroup socket
|
||||
*
|
||||
* \brief API to create RAW socket instances
|
||||
*
|
||||
* This abstract class defines the API for RAW socket factory.
|
||||
*
|
||||
*/
|
||||
class Ipv4RawSocketFactory : public SocketFactory
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* IPV4_RAW_SOCKET_FACTORY_H */
|
||||
@@ -362,4 +362,57 @@ SocketIpTtlTag::Print (std::ostream &os) const
|
||||
}
|
||||
|
||||
|
||||
SocketSetDontFragmentTag::SocketSetDontFragmentTag ()
|
||||
{}
|
||||
void
|
||||
SocketSetDontFragmentTag::Enable (void)
|
||||
{
|
||||
m_dontFragment = true;
|
||||
}
|
||||
void
|
||||
SocketSetDontFragmentTag::Disable (void)
|
||||
{
|
||||
m_dontFragment = false;
|
||||
}
|
||||
bool
|
||||
SocketSetDontFragmentTag::IsEnabled (void) const
|
||||
{
|
||||
return m_dontFragment;
|
||||
}
|
||||
|
||||
TypeId
|
||||
SocketSetDontFragmentTag::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::SocketSetDontFragmentTag")
|
||||
.SetParent<Tag> ()
|
||||
.AddConstructor<SocketSetDontFragmentTag> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
TypeId
|
||||
SocketSetDontFragmentTag::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
uint32_t
|
||||
SocketSetDontFragmentTag::GetSerializedSize (void) const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
void
|
||||
SocketSetDontFragmentTag::Serialize (TagBuffer i) const
|
||||
{
|
||||
i.WriteU8 (m_dontFragment?1:0);
|
||||
}
|
||||
void
|
||||
SocketSetDontFragmentTag::Deserialize (TagBuffer i)
|
||||
{
|
||||
m_dontFragment = (i.ReadU8 () == 1)?true:false;
|
||||
}
|
||||
void
|
||||
SocketSetDontFragmentTag::Print (std::ostream &os) const
|
||||
{
|
||||
os << (m_dontFragment?"true":"false");
|
||||
}
|
||||
|
||||
}//namespace ns3
|
||||
|
||||
@@ -336,9 +336,9 @@ public:
|
||||
* not preserved.
|
||||
*
|
||||
* The flags argument is formed by or'ing one or more of the values:
|
||||
* MSG_OOB process out-of-band data
|
||||
* MSG_PEEK peek at incoming message
|
||||
* These flags are _unsupported_ as of ns-3.1.
|
||||
* MSG_OOB process out-of-band data
|
||||
* MSG_PEEK peek at incoming message
|
||||
* None of these flags are supported for now.
|
||||
*
|
||||
* Some variants of Recv() are supported as additional API,
|
||||
* including RecvFrom(), overloaded Recv() without arguments,
|
||||
@@ -555,6 +555,29 @@ private:
|
||||
uint8_t m_ttl;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief indicated whether packets should be sent out with
|
||||
* the DF flag set.
|
||||
*/
|
||||
class SocketSetDontFragmentTag : public Tag
|
||||
{
|
||||
public:
|
||||
SocketSetDontFragmentTag ();
|
||||
void Enable (void);
|
||||
void Disable (void);
|
||||
bool IsEnabled (void) const;
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (TagBuffer i) const;
|
||||
virtual void Deserialize (TagBuffer i);
|
||||
virtual void Print (std::ostream &os) const;
|
||||
private:
|
||||
bool m_dontFragment;
|
||||
};
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
#endif /* SOCKET_H */
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "ns3/object.h"
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/boolean.h"
|
||||
#include "ns3/trace-source-accessor.h"
|
||||
#include "udp-socket.h"
|
||||
|
||||
@@ -53,6 +54,11 @@ UdpSocket::GetTypeId (void)
|
||||
MakeUintegerAccessor (&UdpSocket::GetIpMulticastTtl,
|
||||
&UdpSocket::SetIpMulticastTtl),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("MtuDiscover", "If enabled, every outgoing ip packet will have the DF flag set.",
|
||||
BooleanValue (false),
|
||||
MakeBooleanAccessor (&UdpSocket::SetMtuDiscover,
|
||||
&UdpSocket::GetMtuDiscover),
|
||||
MakeBooleanChecker ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,8 @@ private:
|
||||
virtual uint32_t GetIpTtl (void) const = 0;
|
||||
virtual void SetIpMulticastTtl (uint32_t ipTtl) = 0;
|
||||
virtual uint32_t GetIpMulticastTtl (void) const = 0;
|
||||
|
||||
virtual void SetMtuDiscover (bool discover) = 0;
|
||||
virtual bool GetMtuDiscover (void) const = 0;
|
||||
};
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
@@ -34,6 +34,7 @@ def build(bld):
|
||||
'application.cc',
|
||||
'simple-channel.cc',
|
||||
'simple-net-device.cc',
|
||||
'ipv4-raw-socket-factory.cc',
|
||||
]
|
||||
|
||||
headers = bld.create_obj('ns3header')
|
||||
@@ -69,4 +70,5 @@ def build(bld):
|
||||
'application.h',
|
||||
'simple-channel.h',
|
||||
'simple-net-device.h',
|
||||
'ipv4-raw-socket-factory.h',
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user