2014-11-19 00:25:21 +08:00
|
|
|
|
#ifndef ACL_IFCONF_INCLUDE_H
|
|
|
|
|
#define ACL_IFCONF_INCLUDE_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-02 14:47:24 +08:00
|
|
|
|
#include "../stdlib/acl_define.h"
|
2017-06-20 14:07:45 +08:00
|
|
|
|
#include "../stdlib/acl_argv.h"
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
typedef struct ACL_IFADDR {
|
|
|
|
|
char *name; /* <20>ӿ<EFBFBD><D3BF><EFBFBD><EFBFBD><EFBFBD> */
|
2015-06-29 17:33:11 +08:00
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
2014-11-19 00:25:21 +08:00
|
|
|
|
char *desc; /* <20>ӿ<EFBFBD><D3BF><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
#endif
|
|
|
|
|
char ip[32]; /* <20><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>IP<49><50>ַ */
|
|
|
|
|
unsigned int addr; /* <20><><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD> 32 λ IP <20><>ַ */
|
|
|
|
|
} ACL_IFADDR;
|
|
|
|
|
|
|
|
|
|
typedef struct ACL_IFCONF {
|
|
|
|
|
ACL_IFADDR *addrs; /* ACL_IFADDR <20><><EFBFBD><EFBFBD> */
|
|
|
|
|
int length; /* ACL_IFADDR <20><><EFBFBD>鳤<EFBFBD><E9B3A4> */
|
|
|
|
|
|
|
|
|
|
/* for acl_iterator */
|
|
|
|
|
|
|
|
|
|
/* ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD> */
|
|
|
|
|
const ACL_IFADDR *(*iter_head)(ACL_ITER*, struct ACL_IFCONF*);
|
|
|
|
|
/* ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
const ACL_IFADDR *(*iter_next)(ACL_ITER*, struct ACL_IFCONF*);
|
|
|
|
|
/* ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>β<EFBFBD><CEB2><EFBFBD><EFBFBD> */
|
|
|
|
|
const ACL_IFADDR *(*iter_tail)(ACL_ITER*, struct ACL_IFCONF*);
|
|
|
|
|
/* ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
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*}
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_IFCONF *acl_get_ifaddrs(void);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD> acl_get_ifaddrs() <EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD> ACL_IFCONF <EFBFBD>ڴ<EFBFBD>
|
|
|
|
|
* @param ifconf {ACL_IFCONF*}
|
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_free_ifaddrs(ACL_IFCONF *ifconf);
|
|
|
|
|
|
2017-06-20 14:07:45 +08:00
|
|
|
|
/**
|
|
|
|
|
* ɨ<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_ARGV *} <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><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> acl_argv_free
|
|
|
|
|
* <EFBFBD>ͷŸö<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_ARGV *acl_ifconf_search(const char *pattern);
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|