NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
udp-protocol.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#include "
udp-protocol.hpp
"
27
28
namespace
nfd
{
29
namespace
udp {
30
31
ssize_t
32
computeMtu
(
const
Endpoint
& localEndpoint)
33
{
34
size_t
mtu = 0;
35
if
(localEndpoint.address().is_v4()) {
// IPv4
36
mtu = std::numeric_limits<uint16_t>::max();
// maximum Total Length
37
mtu -=
sizeof
(uint32_t) * ((1 << 4) - 1);
// maximum Internet Header Length
38
}
39
else
{
// IPv6
40
mtu = std::numeric_limits<uint16_t>::max();
// maximum Payload Length
41
}
42
mtu -=
sizeof
(uint16_t) * 4;
// size of UDP header
43
return
mtu;
44
}
45
46
}
// namespace udp
47
}
// namespace nfd
nfd::udp::computeMtu
ssize_t computeMtu(const Endpoint &localEndpoint)
computes maximum payload size in a UDP packet
Definition:
udp-protocol.cpp:32
udp-protocol.hpp
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:39
nfd::udp::Endpoint
boost::asio::ip::udp::endpoint Endpoint
Definition:
udp-protocol.hpp:34
ndnSIM
NFD
daemon
face
udp-protocol.cpp
Generated on Fri May 6 2022 12:34:13 for ndnSIM by
1.8.13