32#include <sys/socket.h>
92 virtual void output(std::ostream &
os)
const = 0;
105inline static std::ostream &
129 operator bool()
const {
return (
bool)
builder; }
146 virtual bool listen(
int port);
153 void output(std::ostream &
os)
const override;
186 const std::string &_fname);
190 void output(std::ostream &
os)
const override;
194 std::string dir, std::string fname);
205 const std::string &
_name,
const std::string &_path);
207 void output(std::ostream &
os)
const override;
ListenSocketPtr build(const std::string &name) const
std::function< ListenSocketPtr(const std::string &name)> Builder
static bool parseIni(const std::string &value, ListenSocketConfig &retval)
ListenSocketConfig(Builder _builder)
ListenSocketInet(const std::string &_name, int port)
void output(std::ostream &os) const override
size_t prepSockaddrUn(sockaddr_un &addr) const override
ListenSocketUnixAbstract(const std::string &_name, const std::string &_path)
void output(std::ostream &os) const override
size_t prepSockaddrUn(sockaddr_un &addr) const override
void output(std::ostream &os) const override
ListenSocketUnixFile(const std::string &_name, const std::string &_dir, const std::string &_fname)
ListenSocketUnix(const std::string &_name)
virtual size_t prepSockaddrUn(sockaddr_un &addr) const =0
void checkPathLength(const std::string &original, size_t max_len)
ListenSocket(const std::string &_name)
virtual void output(std::ostream &os) const =0
static bool bindToLoopback
static bool listeningDisabled
The following variables are only used by socket unit tests: listeningDisabled, anyListening,...
static void loopbackOnly()
static int socketCloexec(int domain, int type, int protocol)
static bool allDisabled()
static int acceptCloexec(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
Interface for things with names.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
ListenSocketConfig listenSocketUnixAbstractConfig(std::string path)
ListenSocketConfig listenSocketInetConfig(int port)
static std::ostream & operator<<(std::ostream &os, const DummyMatRegContainer &d)
ListenSocketConfig listenSocketUnixFileConfig(std::string dir, std::string fname)
static ListenSocketConfig listenSocketEmptyConfig()
std::unique_ptr< ListenSocket > ListenSocketPtr
const std::string & name()