A Discrete-Event Network Simulator
API
udp-socket.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #include "ns3/object.h"
22 #include "ns3/log.h"
23 #include "ns3/uinteger.h"
24 #include "ns3/integer.h"
25 #include "ns3/boolean.h"
26 #include "ns3/trace-source-accessor.h"
27 #include "udp-socket.h"
28 
29 namespace ns3 {
30 
31 NS_LOG_COMPONENT_DEFINE ("UdpSocket");
32 
33 NS_OBJECT_ENSURE_REGISTERED (UdpSocket);
34 
35 TypeId
37 {
38  static TypeId tid = TypeId ("ns3::UdpSocket")
39  .SetParent<Socket> ()
40  .SetGroupName ("Internet")
41  .AddAttribute ("RcvBufSize",
42  "UdpSocket maximum receive buffer size (bytes)",
43  UintegerValue (131072),
46  MakeUintegerChecker<uint32_t> ())
47  .AddAttribute ("IpTtl",
48  "socket-specific TTL for unicast IP packets (if non-zero)",
49  UintegerValue (0),
52  MakeUintegerChecker<uint8_t> ())
53  .AddAttribute ("IpMulticastTtl",
54  "socket-specific TTL for multicast IP packets (if non-zero)",
55  UintegerValue (0),
58  MakeUintegerChecker<uint8_t> ())
59  .AddAttribute ("IpMulticastIf",
60  "interface index for outgoing multicast on this socket; -1 indicates to use default interface",
61  IntegerValue (-1),
64  MakeIntegerChecker<int32_t> ())
65  .AddAttribute ("IpMulticastLoop",
66  "whether outgoing multicast sent also to loopback interface",
67  BooleanValue (false),
71  .AddAttribute ("MtuDiscover", "If enabled, every outgoing ip packet will have the DF flag set.",
72  BooleanValue (false),
76  ;
77  return tid;
78 }
79 
81 {
82  NS_LOG_FUNCTION (this);
83 }
84 
86 {
87  NS_LOG_FUNCTION (this);
88 }
89 
90 } // namespace ns3
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition: boolean.h:37
ns3::MakeIntegerAccessor
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: integer.h:45
ns3::UdpSocket::SetMtuDiscover
virtual void SetMtuDiscover(bool discover)=0
Set the MTU discover capability.
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::IntegerValue
Hold a signed integer type.
Definition: integer.h:44
ns3::UdpSocket::GetIpMulticastLoop
virtual bool GetIpMulticastLoop(void) const =0
Get the IP multicast loop capability.
ns3::UdpSocket::UdpSocket
UdpSocket(void)
Definition: udp-socket.cc:80
ns3::UdpSocket::GetIpMulticastIf
virtual int32_t GetIpMulticastIf(void) const =0
Get the IP multicast interface.
ns3::MakeBooleanAccessor
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: boolean.h:85
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::Socket::GetIpTtl
virtual uint8_t GetIpTtl(void) const
Query the value of IP Time to Live field of this socket.
Definition: socket.cc:520
ns3::UdpSocket::SetIpMulticastLoop
virtual void SetIpMulticastLoop(bool loop)=0
Set the IP multicast loop capability.
ns3::UdpSocket::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: udp-socket.cc:36
ns3::Socket::SetIpTtl
virtual void SetIpTtl(uint8_t ipTtl)
Manually set IP Time to Live field.
Definition: socket.cc:513
ns3::Socket
A low-level Socket API based loosely on the BSD Socket API.
Definition: socket.h:67
ns3::MakeBooleanChecker
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
ns3::UdpSocket::GetMtuDiscover
virtual bool GetMtuDiscover(void) const =0
Get the MTU discover capability.
ns3::UdpSocket::SetIpMulticastTtl
virtual void SetIpMulticastTtl(uint8_t ipTtl)=0
Set the IP multicast TTL.
ns3::UdpSocket::SetRcvBufSize
virtual void SetRcvBufSize(uint32_t size)=0
Set the receiving buffer size.
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::UdpSocket::GetIpMulticastTtl
virtual uint8_t GetIpMulticastTtl(void) const =0
Get the IP multicast TTL.
ns3::UintegerValue
Hold an unsigned integer type.
Definition: uinteger.h:44
udp-socket.h
ns3::MakeUintegerAccessor
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: uinteger.h:45
ns3::UdpSocket::GetRcvBufSize
virtual uint32_t GetRcvBufSize(void) const =0
Get the receiving buffer size.
ns3::UdpSocket::~UdpSocket
virtual ~UdpSocket(void)
Definition: udp-socket.cc:85
ns3::UdpSocket::SetIpMulticastIf
virtual void SetIpMulticastIf(int32_t ipIf)=0
Set the IP multicast interface.