#include <folly/io/SocketOptionMap.h>
#include <folly/io/async/AsyncUDPSocket.h>
#include <cerrno>
#include <boost/preprocessor/control/if.hpp>
#include <folly/Likely.h>
#include <folly/Utility.h>
#include <folly/io/SocketOptionMap.h>
#include <folly/io/async/EventBase.h>
#include <folly/portability/Fcntl.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h>
#include <folly/small_vector.h>
#ifndef SO_REUSEPORT
#define SO_REUSEPORT …
#endif
#if FOLLY_HAVE_VLA
#define FOLLY_HAVE_VLA_01 …
#else
#define FOLLY_HAVE_VLA_01 …
#endif
#ifdef _WIN32
#ifndef UDP_SEND_MSG_SIZE
#define UDP_SEND_MSG_SIZE …
#endif
#define UDP_GSO_SOCK_OPT_LEVEL …
#define UDP_GSO_SOCK_OPT_TYPE …
#define GSO_OPT_TYPE …
#else
#define UDP_GSO_SOCK_OPT_LEVEL …
#define UDP_GSO_SOCK_OPT_TYPE …
#define GSO_OPT_TYPE …
#endif
fsp;
namespace folly {
void AsyncUDPSocket::fromMsg(
[[maybe_unused]] ReadCallback::OnDataAvailableParams& params,
[[maybe_unused]] struct msghdr& msg) { … }
static constexpr bool msgErrQueueSupported = …true;
#else
false;
#endif
AsyncUDPSocket::AsyncUDPSocket(EventBase* evb)
: … { … }
AsyncUDPSocket::~AsyncUDPSocket() { … }
void AsyncUDPSocket::init(sa_family_t family, BindOptions bindOptions) { … }
void AsyncUDPSocket::bind(
const folly::SocketAddress& address, BindOptions bindOptions) { … }
void AsyncUDPSocket::connect(const folly::SocketAddress& address) { … }
void AsyncUDPSocket::dontFragment(bool df) { … }
void AsyncUDPSocket::setDFAndTurnOffPMTU() { … }
void AsyncUDPSocket::setErrMessageCallback(
ErrMessageCallback* errMessageCallback) { … }
void AsyncUDPSocket::setFD(NetworkSocket fd, FDOwnership ownership) { … }
bool AsyncUDPSocket::setZeroCopy(bool enable) { … }
ssize_t AsyncUDPSocket::writeGSO(
const folly::SocketAddress& address,
const std::unique_ptr<folly::IOBuf>& buf,
WriteOptions options) { … }
int AsyncUDPSocket::getZeroCopyFlags() { … }
void AsyncUDPSocket::addZeroCopyBuf(std::unique_ptr<folly::IOBuf>&& buf) { … }
ssize_t AsyncUDPSocket::writeChain(
const folly::SocketAddress& address,
std::unique_ptr<folly::IOBuf>&& buf,
WriteOptions options) { … }
ssize_t AsyncUDPSocket::write(
const folly::SocketAddress& address,
const std::unique_ptr<folly::IOBuf>& buf) { … }
ssize_t AsyncUDPSocket::writev(
const folly::SocketAddress& address,
const struct iovec* vec,
size_t iovec_len,
WriteOptions options) { … }
ssize_t AsyncUDPSocket::writevImpl(
netops::Msgheader* msg, [[maybe_unused]] WriteOptions options) { … }
ssize_t AsyncUDPSocket::writev(
const folly::SocketAddress& address,
const struct iovec* vec,
size_t iovec_len) { … }
int AsyncUDPSocket::writem(
Range<SocketAddress const*> addrs,
const std::unique_ptr<folly::IOBuf>* bufs,
size_t count) { … }
int AsyncUDPSocket::writemGSO(
Range<SocketAddress const*> addrs,
const std::unique_ptr<folly::IOBuf>* bufs,
size_t count,
const WriteOptions* options) { … }
void AsyncUDPSocket::fillMsgVec(
Range<full_sockaddr_storage*> addrs,
const std::unique_ptr<folly::IOBuf>* bufs,
size_t count,
struct mmsghdr* msgvec,
struct iovec* iov,
size_t iov_count,
const WriteOptions* options,
char* control) { … }
int AsyncUDPSocket::writeImpl(
Range<SocketAddress const*> addrs,
const std::unique_ptr<folly::IOBuf>* bufs,
size_t count,
struct mmsghdr* msgvec,
const WriteOptions* options,
char* control) { … }
ssize_t AsyncUDPSocket::recvmsg(struct msghdr* msg, int flags) { … }
int AsyncUDPSocket::recvmmsg(
struct mmsghdr* msgvec,
unsigned int vlen,
unsigned int flags,
struct timespec* timeout) { … }
void AsyncUDPSocket::resumeRead(ReadCallback* cob) { … }
void AsyncUDPSocket::pauseRead() { … }
void AsyncUDPSocket::close() { … }
void AsyncUDPSocket::handlerReady(uint16_t events) noexcept { … }
void AsyncUDPSocket::releaseZeroCopyBuf(uint32_t id) { … }
bool AsyncUDPSocket::isZeroCopyMsg([[maybe_unused]] const cmsghdr& cmsg) { … }
void AsyncUDPSocket::processZeroCopyMsg([[maybe_unused]] const cmsghdr& cmsg) { … }
size_t AsyncUDPSocket::handleErrMessages() noexcept { … }
void AsyncUDPSocket::failErrMessageRead(const AsyncSocketException& ex) { … }
void AsyncUDPSocket::handleRead() noexcept { … }
bool AsyncUDPSocket::updateRegistration() noexcept { … }
bool AsyncUDPSocket::setGSO(int val) { … }
int AsyncUDPSocket::getGSO() { … }
bool AsyncUDPSocket::setGRO(bool bVal) { … }
int AsyncUDPSocket::getTimestamping() { … }
bool AsyncUDPSocket::setTimestamping(int val) { … }
int AsyncUDPSocket::getGRO() { … }
AsyncUDPSocket::TXTime AsyncUDPSocket::getTXTime() { … }
bool AsyncUDPSocket::setTXTime(TXTime txTime) { … }
bool AsyncUDPSocket::setRxZeroChksum6([[maybe_unused]] bool bVal) { … }
bool AsyncUDPSocket::setTxZeroChksum6([[maybe_unused]] bool bVal) { … }
void AsyncUDPSocket::setTosOrTrafficClass(uint8_t tosOrTclass) { … }
void AsyncUDPSocket::applyOptions(
const SocketOptionMap& options, SocketOptionKey::ApplyPos pos) { … }
void AsyncUDPSocket::detachEventBase() { … }
void AsyncUDPSocket::attachEventBase(folly::EventBase* evb) { … }
void AsyncUDPSocket::setCmsgs(const SocketCmsgMap& cmsgs) { … }
void AsyncUDPSocket::setNontrivialCmsgs(
const SocketNontrivialCmsgMap& nontrivialCmsgs) { … }
void AsyncUDPSocket::appendCmsgs(const SocketCmsgMap& cmsgs) { … }
void AsyncUDPSocket::maybeUpdateDynamicCmsgs() noexcept { … }
void AsyncUDPSocket::appendNontrivialCmsgs(
const SocketNontrivialCmsgMap& nontrivialCmsgs) { … }
}