acl/lib_acl/include/net/acl_ifconf.h

74 lines
2.2 KiB
C
Raw Normal View History

#ifndef ACL_IFCONF_INCLUDE_H
2014-11-19 00:25:21 +08:00
#define ACL_IFCONF_INCLUDE_H
#ifdef __cplusplus
extern "C" {
#endif
2017-06-02 14:47:24 +08:00
#include "../stdlib/acl_define.h"
#include "../stdlib/acl_argv.h"
2018-09-12 17:43:46 +08:00
#include "acl_sane_inet.h"
2014-11-19 00:25:21 +08:00
typedef struct ACL_IFADDR {
char name[256]; /* <20>ӿ<EFBFBD><D3BF><EFBFBD><EFBFBD><EFBFBD> */
#if defined(_WIN32) || defined(_WIN64)
char desc[256]; /* <20>ӿ<EFBFBD><D3BF><EFBFBD><EFBFBD><EFBFBD> */
2014-11-19 00:25:21 +08:00
#endif
char addr[128]; /* <20><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>IP<49><50>ַ */
ACL_SOCKADDR saddr; /* <20><><EFBFBD><EFBFBD> IPV4 & IPV6 <20>ĵ<EFBFBD>ַ */
2014-11-19 00:25:21 +08:00
} ACL_IFADDR;
typedef struct ACL_IFCONF {
ACL_IFADDR *addrs; /* ACL_IFADDR <20><><EFBFBD><EFBFBD> */
int length; /* ACL_IFADDR <20><><EFBFBD><EFBFBD><E9B3A4> */
2014-11-19 00:25:21 +08:00
/* for acl_iterator */
/* ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD> */
2014-11-19 00:25:21 +08:00
const ACL_IFADDR *(*iter_head)(ACL_ITER*, struct ACL_IFCONF*);
/* ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
2014-11-19 00:25:21 +08:00
const ACL_IFADDR *(*iter_next)(ACL_ITER*, struct ACL_IFCONF*);
/* ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>β<EFBFBD><CEB2><EFBFBD><EFBFBD> */
2014-11-19 00:25:21 +08:00
const ACL_IFADDR *(*iter_tail)(ACL_ITER*, struct ACL_IFCONF*);
/* ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
2014-11-19 00:25:21 +08:00
const ACL_IFADDR *(*iter_prev)(ACL_ITER*, struct ACL_IFCONF*);
} ACL_IFCONF;
/**
* <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><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {ACL_IFCONF*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD> NULL ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> acl_free_ifaddrs <EFBFBD>ͷ<EFBFBD>
2014-11-19 00:25:21 +08:00
*/
ACL_API ACL_IFCONF *acl_get_ifaddrs(void);
/**
* <EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD> acl_get_ifaddrs() <EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD> ACL_IFCONF <EFBFBD>ڴ<EFBFBD>
2014-11-19 00:25:21 +08:00
* @param ifconf {ACL_IFCONF*}
*/
ACL_API void acl_free_ifaddrs(ACL_IFCONF *ifconf);
/**
* ɨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IP<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD> IP <EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD>Ŀǰ<EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD> IPV4
* @param pattern {const char *} ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽΪ<EFBFBD><EFBFBD>xxx.xxx.xxx.xxx <EFBFBD><EFBFBD>
* xxx.xxx.xxx.xxx:port<EFBFBD><EFBFBD><EFBFBD>192.168.*.*, 192.168.*.8:80<EFBFBD><EFBFBD>10.*.0.*:81
* @return {ACL_IFCONF *} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> pattern <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж˿ڣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><EFBFBD> IP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿգ<EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> acl_free_ifaddrs
* <EFBFBD>ͷŸö<EFBFBD><EFBFBD><EFBFBD>
*/
2018-09-13 18:38:03 +08:00
ACL_API ACL_IFCONF *acl_ifconf_search(const char *pattern);
/**
* ɨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IP, <EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD>
* @param patterns {const char*}
* @param unix_path {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>ַΪ unix domain <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ, <EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>
* Ϊȫ·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ׺·<EFBFBD><EFBFBD>
* @return {ACL_ARGV*} <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><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> acl_argv_free <EFBFBD>ͷ<EFBFBD>;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾû<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>ַ
*/
ACL_API ACL_ARGV *acl_search_addrs(const char *patterns, const char *unix_path);
2014-11-19 00:25:21 +08:00
#ifdef __cplusplus
}
#endif
#endif