Instrument Neutral Distributed Interface INDI 2.2.5
utils.h
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2022 Ludovic Pollet. All rights reserved.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*******************************************************************************/
18
19#include <string>
20
21void setupSigPipe();
22
23int unixSocketListen(const std::string &path);
24int unixSocketConnect(const std::string &unixAddr, bool failAllowed = false);
25void unixSocketSendFds(int fd, int count, int * fds);
26void unixSocketRecvFds(int fd, int count, int * fds);
27
28int tcpSocketListen(int port);
29int tcpSocketConnect(const std::string &unixAddr, int port, bool failAllowed = false);
30
31int socketAccept(int fd);
32
33// Return the TCP port a socket is bound to
34int tcpSocketPort(int fd);
35// Return a TCP port that is currently free on this host
36int findFreeTcpPort();
37
38// Return a name unique to this test process, so that tests can run in parallel
39std::string uniqueTestName(const std::string &prefix);
int fd
int unixSocketListen(const std::string &path)
Definition utils.cpp:71
int socketAccept(int fd)
Definition utils.cpp:144
std::string uniqueTestName(const std::string &prefix)
Definition utils.cpp:360
int unixSocketConnect(const std::string &unixAddr, bool failAllowed=false)
Definition utils.cpp:155
int findFreeTcpPort()
Definition utils.cpp:351
int tcpSocketPort(int fd)
Definition utils.cpp:340
int tcpSocketListen(int port)
Definition utils.cpp:108
int tcpSocketConnect(const std::string &unixAddr, int port, bool failAllowed=false)
Definition utils.cpp:301
void unixSocketRecvFds(int fd, int count, int *fds)
Definition utils.cpp:228
void unixSocketSendFds(int fd, int count, int *fds)
Definition utils.cpp:183
void setupSigPipe()
Definition utils.cpp:37