A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
udp-socket.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8
9#include "udp-socket.h"
10
11#include "ns3/boolean.h"
12#include "ns3/integer.h"
13#include "ns3/log.h"
14#include "ns3/object.h"
15#include "ns3/trace-source-accessor.h"
16#include "ns3/uinteger.h"
17
18namespace ns3
19{
20
21NS_LOG_COMPONENT_DEFINE("UdpSocket");
22
24
25TypeId
27{
28 static TypeId tid =
29 TypeId("ns3::UdpSocket")
31 .SetGroupName("Internet")
32 .AddAttribute(
33 "RcvBufSize",
34 "UdpSocket maximum receive buffer size (bytes)",
35 UintegerValue(131072),
38 .AddAttribute("IpTtl",
39 "socket-specific TTL for unicast IP packets (if non-zero)",
43 .AddAttribute(
44 "IpMulticastTtl",
45 "socket-specific TTL for multicast IP packets (if non-zero)",
49 .AddAttribute(
50 "IpMulticastIf",
51 "interface index for outgoing multicast on this socket; -1 indicates to use "
52 "default interface",
53 IntegerValue(-1),
56 .AddAttribute(
57 "IpMulticastLoop",
58 "whether outgoing multicast sent also to loopback interface",
59 BooleanValue(false),
62 .AddAttribute(
63 "MtuDiscover",
64 "If enabled, every outgoing ip packet will have the DF flag set.",
65 BooleanValue(false),
68 return tid;
69}
70
75
80
81} // namespace ns3
Hold a signed integer type.
Definition integer.h:34
A low-level Socket API based loosely on the BSD Socket API.
Definition socket.h:57
virtual void SetIpTtl(uint8_t ipTtl)
Manually set IP Time to Live field.
Definition socket.cc:499
virtual uint8_t GetIpTtl() const
Query the value of IP Time to Live field of this socket.
Definition socket.cc:506
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
~UdpSocket() override
Definition udp-socket.cc:76
virtual void SetIpMulticastIf(int32_t ipIf)=0
Set the IP multicast interface.
virtual void SetRcvBufSize(uint32_t size)=0
Set the receiving buffer size.
virtual bool GetMtuDiscover() const =0
Get the MTU discover capability.
virtual int32_t GetIpMulticastIf() const =0
Get the IP multicast interface.
virtual uint8_t GetIpMulticastTtl() const =0
Get the IP multicast TTL.
static TypeId GetTypeId()
Get the type ID.
Definition udp-socket.cc:26
virtual void SetIpMulticastLoop(bool loop)=0
Set the IP multicast loop capability.
virtual bool GetIpMulticastLoop() const =0
Get the IP multicast loop capability.
virtual void SetMtuDiscover(bool discover)=0
Set the MTU discover capability.
virtual void SetIpMulticastTtl(uint8_t ipTtl)=0
Set the IP multicast TTL.
virtual uint32_t GetRcvBufSize() const =0
Get the receiving buffer size.
Hold an unsigned integer type.
Definition uinteger.h:34
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition boolean.cc:113
Ptr< const AttributeChecker > MakeIntegerChecker()
Definition integer.h:99
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Definition integer.h:35
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition uinteger.h:35
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition boolean.h:70