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 {
83 }
84 
86 {
88 }
89 
90 } // namespace ns3
AttributeValue implementation for Boolean.
Definition: boolean.h:36
virtual uint8_t GetIpMulticastTtl(void) const =0
Get the IP multicast TTL.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
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:84
virtual void SetIpMulticastTtl(uint8_t ipTtl)=0
Set the IP multicast TTL.
Hold a signed integer type.
Definition: integer.h:44
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
virtual bool GetIpMulticastLoop(void) const =0
Get the IP multicast loop capability.
virtual uint8_t GetIpTtl(void) const
Query the value of IP Time to Live field of this socket.
Definition: socket.cc:520
static TypeId GetTypeId(void)
Get the type ID.
Definition: udp-socket.cc:36
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
virtual void SetIpMulticastIf(int32_t ipIf)=0
Set the IP multicast interface.
A low-level Socket API based loosely on the BSD Socket API.
Definition: socket.h:66
Hold an unsigned integer type.
Definition: uinteger.h:44
virtual int32_t GetIpMulticastIf(void) const =0
Get the IP multicast interface.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
virtual void SetRcvBufSize(uint32_t size)=0
Set the receiving buffer size.
virtual uint32_t GetRcvBufSize(void) const =0
Get the receiving buffer size.
virtual bool GetMtuDiscover(void) const =0
Get the MTU discover capability.
virtual ~UdpSocket(void)
Definition: udp-socket.cc:85
virtual void SetIpMulticastLoop(bool loop)=0
Set the IP multicast loop capability.
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
virtual void SetMtuDiscover(bool discover)=0
Set the MTU discover capability.
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:915
virtual void SetIpTtl(uint8_t ipTtl)
Manually set IP Time to Live field.
Definition: socket.cc:513