folly/folly/io/async/AsyncServerSocket.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.
 */

#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif

#include <folly/io/async/AsyncServerSocket.h>

#include <sys/types.h>

#include <cerrno>
#include <cstring>

#include <folly/FileUtil.h>
#include <folly/GLog.h>
#include <folly/Portability.h>
#include <folly/SocketAddress.h>
#include <folly/String.h>
#include <folly/detail/SocketFastOpen.h>
#include <folly/io/async/EventBase.h>
#include <folly/io/async/NotificationQueue.h>
#include <folly/portability/Fcntl.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h>

namespace folly {

#ifndef TCP_SAVE_SYN
#define TCP_SAVE_SYN
#endif

#ifndef TCP_SAVED_SYN
#define TCP_SAVED_SYN
#endif

static constexpr bool msgErrQueueSupported =true;
#else
    false;
#endif // FOLLY_HAVE_MSG_ERRQUEUE

AsyncServerSocket::AcceptCallback::~AcceptCallback() = default;

const uint32_t AsyncServerSocket::kDefaultMaxAcceptAtOnce;
const uint32_t AsyncServerSocket::kDefaultCallbackAcceptAtOnce;
const uint32_t AsyncServerSocket::kDefaultMaxMessagesInQueue;

void AsyncServerSocket::RemoteAcceptor::start(
    EventBase* eventBase, uint32_t maxAtOnce) {}

void AsyncServerSocket::RemoteAcceptor::stop(
    EventBase* eventBase, AcceptCallback* callback) {}

AtomicNotificationQueueTaskStatus AsyncServerSocket::NewConnMessage::operator()(
    RemoteAcceptor& acceptor) noexcept {}

AtomicNotificationQueueTaskStatus AsyncServerSocket::ErrorMessage::operator()(
    RemoteAcceptor& acceptor) noexcept {}

/*
 * AsyncServerSocket::BackoffTimeout
 */
class AsyncServerSocket::BackoffTimeout : public AsyncTimeout {};

/*
 * AsyncServerSocket methods
 */

AsyncServerSocket::AsyncServerSocket(EventBase* eventBase)
    :{}

void AsyncServerSocket::setShutdownSocketSet(
    const std::weak_ptr<ShutdownSocketSet>& wNewSS) {}

AsyncServerSocket::~AsyncServerSocket() {}

int AsyncServerSocket::stopAccepting(int shutdownFlags) {}

void AsyncServerSocket::destroy() {}

void AsyncServerSocket::attachEventBase(EventBase* eventBase) {}

void AsyncServerSocket::detachEventBase() {}

void AsyncServerSocket::useExistingSockets(
    const std::vector<NetworkSocket>& fds) {}

void AsyncServerSocket::useExistingSocket(NetworkSocket fd) {}

void AsyncServerSocket::bindSocket(
    NetworkSocket fd,
    const SocketAddress& address,
    bool isExistingSocket,
    const std::string& ifName) {}

bool AsyncServerSocket::setZeroCopy(bool enable) {}

void AsyncServerSocket::bindInternal(
    const SocketAddress& address, const std::string& ifName) {}

void AsyncServerSocket::bind(const SocketAddress& address) {}

void AsyncServerSocket::bind(
    const SocketAddress& address, const std::string& ifName) {}

void AsyncServerSocket::bind(
    const std::vector<IPAddress>& ipAddresses, uint16_t port) {}

void AsyncServerSocket::bind(
    const std::vector<IPAddressIfNamePair>& addresses, uint16_t port) {}

void AsyncServerSocket::bind(uint16_t port) {}

void AsyncServerSocket::setEnableReuseAddr(bool enable) {}

void AsyncServerSocket::listen(int backlog) {}

void AsyncServerSocket::getAddress(SocketAddress* addressReturn) const {}

std::vector<SocketAddress> AsyncServerSocket::getAddresses() const {}

void AsyncServerSocket::addAcceptCallback(
    AcceptCallback* callback, EventBase* eventBase, uint32_t maxAtOnce) {}

void AsyncServerSocket::removeAcceptCallback(
    AcceptCallback* callback, EventBase* eventBase) {}

void AsyncServerSocket::startAccepting() {}

void AsyncServerSocket::pauseAccepting() {}

NetworkSocket AsyncServerSocket::createSocket(int family) {}

/**
 * Enable/Disable TOS reflection for the server socket
 * If enabled, the 'accepted' connections will reflect the
 * TOS derived from the client's connect request
 */
void AsyncServerSocket::setTosReflect(bool enable) {}

void AsyncServerSocket::setListenerTos(uint32_t tos) {}

void AsyncServerSocket::setupSocket(NetworkSocket fd, int family) {}

void AsyncServerSocket::handlerReady(
    uint16_t /* events */,
    NetworkSocket fd,
    sa_family_t addressFamily) noexcept {}

void AsyncServerSocket::dispatchSocket(
    NetworkSocket socket, SocketAddress&& address) {}

void AsyncServerSocket::dispatchError(const char* msgstr, int errnoValue) {}

void AsyncServerSocket::enterBackoff() {}

void AsyncServerSocket::backoffTimeoutExpired() {}

} // namespace folly