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