mirror of
https://gitlab.com/d3tn/ud3tn.git
synced 2026-08-14 12:43:26 +02:00
There is some common functionality that should not be copied. Signed-off-by: Felix Walter <felix.walter@d3tn.com>
22 lines
700 B
C
22 lines
700 B
C
// SPDX-License-Identifier: BSD-3-Clause OR Apache-2.0
|
|
#ifndef SOCKET_UTIL_H_INCLUDED
|
|
#define SOCKET_UTIL_H_INCLUDED
|
|
|
|
/**
|
|
* Create a new UNIX domain socket at the given path.
|
|
*
|
|
* @param path The path to the socket file.
|
|
* @return the socket file descriptor, -1 on error.
|
|
*/
|
|
int create_unix_domain_socket(const char *path);
|
|
|
|
/**
|
|
* Wait for incoming data using poll() and indicate common errors.
|
|
*
|
|
* @param socket_fd The socket to be polled.
|
|
* @param timeout The maximum number of milliseconds to wait for data.
|
|
* @return 1 if there is data to be read, 0 if the timeout passed, -1 on error.
|
|
*/
|
|
int poll_recv_timeout(const int socket_fd, const int timeout);
|
|
|
|
#endif // SOCKET_UTIL_H_INCLUDED
|