acl/lib_acl/include/net/acl_sane_socket.h

62 lines
1.8 KiB
C
Raw Normal View History

#ifndef ACL_SANE_SOCKET_INCLUDE_H
2014-11-19 00:25:21 +08:00
#define ACL_SANE_SOCKET_INCLUDE_H
#ifdef __cplusplus
extern "C" {
#endif
2017-06-02 14:47:24 +08:00
#include "../stdlib/acl_define.h"
2014-11-19 00:25:21 +08:00
2018-09-10 18:30:54 +08:00
#ifdef ACL_UNIX
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <arpa/inet.h>
#endif
2014-11-19 00:25:21 +08:00
/**
* , : IP:PORT
* @param fd {ACL_SOCKET}
* @param buf {char*}
* @param bsize {size_t} buf
2014-11-19 00:25:21 +08:00
* @return {int} 0: ok; -1: error
*/
ACL_API int acl_getpeername(ACL_SOCKET fd, char *buf, size_t bsize);
2014-11-19 00:25:21 +08:00
/**
* , : IP:PORT
* @param fd {ACL_SOCKET}
* @param buf {char*}
* @param bsize {size_t} buf
2014-11-19 00:25:21 +08:00
* @return {int} 0: ok; -1: error
*/
ACL_API int acl_getsockname(ACL_SOCKET fd, char *buf, size_t bsize);
2014-11-19 00:25:21 +08:00
/**
*
* @param fd {ACL_SOCKET}
* @return {int} -1: ; >= 0
* AF_INETAF_INET6 AF_UNIX( UNIX )
2014-11-19 00:25:21 +08:00
*/
ACL_API int acl_getsocktype(ACL_SOCKET fd);
/**
*
* @param sockefd {ACL_SOCKET}
* @return {int} -1 1 0
*/
ACL_API int acl_check_socket(ACL_SOCKET fd);
/**
*
* @param sockefd {ACL_SOCKET}
* @return {int} 0 0
*/
ACL_API int acl_is_listening_socket(ACL_SOCKET fd);
2014-11-19 00:25:21 +08:00
#ifdef __cplusplus
}
#endif
#endif