aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/os_socket.h
blob: 0d6f8749176d0b25a3bdaed809efac882d98eabf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * Copyright 2019 Intel Corporation
 * SPDX-License-Identifier: MIT
 *
 * Socket operations helpers
 */

#ifndef _OS_SOCKET_H_
#define _OS_SOCKET_H_

#include <stdio.h>
#include <stdbool.h>
#ifdef _MSC_VER
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif

#ifdef __cplusplus
extern "C" {
#endif

int os_socket_accept(int s);

int os_socket_listen_abstract(const char *path, int count);

ssize_t os_socket_recv(int socket, void *buffer, size_t length, int flags);
ssize_t os_socket_send(int socket, const void *buffer, size_t length, int flags);

void os_socket_block(int s, bool block);
void os_socket_close(int s);

#ifdef __cplusplus
}
#endif

#endif /* _OS_SOCKET_H_ */