acl/lib_acl/include/net/acl_sane_socket.h

56 lines
1.5 KiB
C
Raw Normal View History

2014-11-19 00:25:21 +08:00
#ifndef ACL_SANE_SOCKET_INCLUDE_H
#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
/**
* ȡ<EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӶԷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ, <EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>ʽΪ: IP:PORT
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
* @param buf {char*} <EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>Ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
* @param bsize {size_t} buf <EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>С
* @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
/**
* ȡ<EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ, <EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>ʽΪ: IP:PORT
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
* @param buf {char*} <EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>Ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
* @param bsize {size_t} buf <EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>С
* @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
/**
* ȡ<EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD><EFBFBD>
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
* @return {int} -1: <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD><EFBFBD>; >= 0 <EFBFBD><EFBFBD>ʾ<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD> AF_INET <EFBFBD><EFBFBD> AF_UNIX(<EFBFBD><EFBFBD><EFBFBD><EFBFBD> UNIX ƽ̨)
*/
ACL_API int acl_getsocktype(ACL_SOCKET fd);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD>֣<EFBFBD><EFBFBD>Ǽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD><EFBFBD>
* @param sockefd {ACL_SOCKET} <EFBFBD>׽<EFBFBD><EFBFBD>־<EFBFBD><EFBFBD><EFBFBD>
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1 <EFBFBD><EFBFBD>ʾ<EFBFBD>þ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD>֣<EFBFBD>1 Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD>֣<EFBFBD>0 Ϊ<EFBFBD>Ǽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD><EFBFBD>
*/
ACL_API int acl_check_socket(ACL_SOCKET fd);
/**
* <EFBFBD>ж<EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD><EFBFBD>
* @param sockefd {ACL_SOCKET} <EFBFBD>׽<EFBFBD><EFBFBD>־<EFBFBD><EFBFBD><EFBFBD>
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ 0 <EFBFBD><EFBFBD>ʾ<EFBFBD>Ǽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD>֣<EFBFBD><EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʾΪ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD><EFBFBD>
*/
ACL_API int acl_is_listening_socket(ACL_SOCKET fd);
2014-11-19 00:25:21 +08:00
#ifdef __cplusplus
}
#endif
#endif