1 /* 2 * Copyright 2019 Intel Corporation 3 * SPDX-License-Identifier: MIT 4 * 5 * Socket operations helpers 6 */ 7 8 #ifndef _OS_SOCKET_H_ 9 #define _OS_SOCKET_H_ 10 11 #include <stdio.h> 12 #include <stdbool.h> 13 #ifdef _MSC_VER 14 #include <BaseTsd.h> 15 typedef SSIZE_T ssize_t; 16 #else 17 #include <unistd.h> 18 #endif 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 int os_socket_accept(int s); 25 26 int os_socket_listen_abstract(const char *path, int count); 27 28 ssize_t os_socket_recv(int socket, void *buffer, size_t length, int flags); 29 ssize_t os_socket_send(int socket, const void *buffer, size_t length, int flags); 30 31 void os_socket_block(int s, bool block); 32 void os_socket_close(int s); 33 34 #ifdef __cplusplus 35 } 36 #endif 37 38 #endif /* _OS_SOCKET_H_ */ 39