folly/folly/io/async/fdsock/AsyncFdSocket.cpp

/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <limits>
#include <fmt/core.h>

#include "AsyncFdSocket.h"

namespace folly {

AsyncFdSocket::AsyncFdSocket(EventBase* evb)
    :{}
#else
{
}
#endif

AsyncFdSocket::AsyncFdSocket(
    EventBase* evb,
    const folly::SocketAddress& address,
    uint32_t connectTimeout)
    :{}

AsyncFdSocket::AsyncFdSocket(
    EventBase* evb, NetworkSocket fd, const folly::SocketAddress* peerAddress)
    :{}
#else
{
}
#endif

AsyncFdSocket::AsyncFdSocket(
    AsyncFdSocket::DoesNotMoveFdSocketState, AsyncSocket* sock)
    :{}
#else
{
}
#endif

AsyncFdSocket::AsyncFdSocket(
    AsyncFdSocket::DoesNotMoveFdSocketState tag, AsyncSocket::UniquePtr sock)
    :{}

void AsyncFdSocket::writeChainWithFds(
    WriteCallback* callback,
    std::unique_ptr<folly::IOBuf> buf,
    SocketFds socketFds,
    WriteFlags flags) {}

// The callbacks aren't defined on Windows -- the CMSG macros don't compile
#if !defined(_WIN32)

void AsyncFdSocket::setUpCallbacks() noexcept {}

void AsyncFdSocket::swapFdReadStateWith(AsyncFdSocket* other) {}

void AsyncFdSocket::releaseIOBuf(
    std::unique_ptr<folly::IOBuf> buf, ReleaseIOBufCallback* callback) {}

std::pair<
    size_t,
    AsyncFdSocket::FdSendMsgParamsCallback::WriteTagToFds::iterator>
AsyncFdSocket::FdSendMsgParamsCallback::getCmsgSizeAndFds(
    const AsyncSocket::WriteRequestTag& writeTag) noexcept {}

void AsyncFdSocket::FdSendMsgParamsCallback::getAncillaryData(
    folly::WriteFlags,
    void* data,
    const WriteRequestTag& writeTag,
    const bool /*byteEventsEnabled*/) noexcept {}

uint32_t AsyncFdSocket::FdSendMsgParamsCallback::getAncillaryDataSize(
    folly::WriteFlags,
    const WriteRequestTag& writeTag,
    const bool /*byteEventsEnabled*/) noexcept {}

void AsyncFdSocket::FdSendMsgParamsCallback::wroteBytes(
    const WriteRequestTag& writeTag) noexcept {}

bool AsyncFdSocket::FdSendMsgParamsCallback::registerFdsForWriteTag(
    WriteRequestTag writeTag, SocketFds::ToSend&& fds) {}

void AsyncFdSocket::FdSendMsgParamsCallback::destroyFdsForWriteTag(
    WriteRequestTag writeTag) noexcept {}

namespace {

// Logs and returns `false` on error.
bool receiveFdsFromCMSG(
    const struct ::cmsghdr& cmsg, std::vector<folly::File>* fds) noexcept {}

// Logs and returns `false` on error.
bool receiveFds(struct ::msghdr& msg, std::vector<folly::File>* fds) noexcept {}

} // namespace

void AsyncFdSocket::enqueueFdsFromAncillaryData(struct ::msghdr& msg) noexcept {}

SocketFds::SeqNum AsyncFdSocket::addSeqNum(
    SocketFds::SeqNum a, SocketFds::SeqNum b) noexcept {}

#endif // !Windows

SocketFds AsyncFdSocket::popNextReceivedFds() {}

SocketFds::SeqNum AsyncFdSocket::injectSocketSeqNumIntoFdsToSend(
    SocketFds* fds) {}

} // namespace folly