List模板改名为ArrayList
This commit is contained in:
parent
21e0b58b8e
commit
5ffe0aec26
@ -123,8 +123,8 @@ namespace hgl
|
||||
};
|
||||
};
|
||||
|
||||
int GetIPSupport(List<IPSupport> &); ///<取得本机IP支持列表
|
||||
bool CheckIPSupport(const List<IPSupport> &ips_list,uint family,uint socktype,uint protocol);
|
||||
int GetIPSupport(ArrayList<IPSupport> &); ///<取得本机IP支持列表
|
||||
bool CheckIPSupport(const ArrayList<IPSupport> &ips_list,uint family,uint socktype,uint protocol);
|
||||
bool CheckIPSupport(uint family,uint socktype,uint protocol);
|
||||
|
||||
inline bool CheckIPv4SupportTCP (){return CheckIPSupport(AF_INET,SOCK_STREAM, IPPROTO_TCP );}
|
||||
@ -328,8 +328,8 @@ namespace hgl
|
||||
static void ToString(char *str,const int,const sockaddr_in *);
|
||||
void ToString(char *str,const int)const override;
|
||||
|
||||
static int GetDomainIPList(List<in_addr> &addr_list,const char *domain,int _socktype,int _protocol); ///<取得当指定域名的IPv4地址列表
|
||||
static int GetLocalIPList(List<in_addr> &addr_list,int _socktype,int _protocol); ///<取得本机的IPv4地址列表
|
||||
static int GetDomainIPList(ArrayList<in_addr> &addr_list,const char *domain,int _socktype,int _protocol); ///<取得当指定域名的IPv4地址列表
|
||||
static int GetLocalIPList(ArrayList<in_addr> &addr_list,int _socktype,int _protocol); ///<取得本机的IPv4地址列表
|
||||
|
||||
IPAddress *CreateCopy()const override{return(new IPv4Address(this));}
|
||||
IPAddress *Create()const override{return(new IPv4Address());}
|
||||
@ -396,8 +396,8 @@ namespace hgl
|
||||
static void ToString(char *str,const int,const sockaddr_in6 *);
|
||||
void ToString(char *str,const int)const override;
|
||||
|
||||
static int GetDomainIPList(List<in6_addr> &addr_list,const char *domain,int _socktype,int _protocol); ///<取得指定域名的IPv6地址列表
|
||||
static int GetLocalIPList(List<in6_addr> &addr_list,int _socktype,int _protocol); ///<取得本机的IPv6地址列表
|
||||
static int GetDomainIPList(ArrayList<in6_addr> &addr_list,const char *domain,int _socktype,int _protocol); ///<取得指定域名的IPv6地址列表
|
||||
static int GetLocalIPList(ArrayList<in6_addr> &addr_list,int _socktype,int _protocol); ///<取得本机的IPv6地址列表
|
||||
|
||||
IPAddress *CreateCopy()const override{return(new IPv6Address(this));}
|
||||
IPAddress *Create()const override{return(new IPv6Address());}
|
||||
|
@ -18,7 +18,7 @@ namespace hgl
|
||||
};
|
||||
};//struct SocketEvent
|
||||
|
||||
using SocketEventList=List<SocketEvent>;
|
||||
using SocketEventList=ArrayList<SocketEvent>;
|
||||
}//namespace network
|
||||
}//namespace hgl
|
||||
#endif//HGL_NETWORK_SOCKET_EVENT_INCLUDE
|
||||
|
@ -98,18 +98,18 @@ namespace hgl
|
||||
return(true);
|
||||
}
|
||||
|
||||
void AddAddrToList(List<in_addr> &addr_list, const sockaddr_in *sai)
|
||||
void AddAddrToList(ArrayList<in_addr> &addr_list, const sockaddr_in *sai)
|
||||
{
|
||||
addr_list.Add(sai->sin_addr);
|
||||
}
|
||||
|
||||
void AddAddrToList(List<in6_addr> &addr_list, const sockaddr_in6 *sai)
|
||||
void AddAddrToList(ArrayList<in6_addr> &addr_list, const sockaddr_in6 *sai)
|
||||
{
|
||||
addr_list.Add(sai->sin6_addr);
|
||||
}
|
||||
|
||||
template<int FAMILY,typename InAddr,typename SockAddrIn>
|
||||
int GetIPList(List<InAddr> &addr_list,const char *addr_string, int socktype,int protocol)
|
||||
int GetIPList(ArrayList<InAddr> &addr_list,const char *addr_string, int socktype,int protocol)
|
||||
{
|
||||
struct addrinfo hints, *answer, *ptr;
|
||||
|
||||
@ -138,7 +138,7 @@ namespace hgl
|
||||
* @return -1 出错,无法获取主机名称
|
||||
* @return -2 出错,无法获取地址信息
|
||||
*/
|
||||
int GetIPSupport(List<IPSupport> &ipsl)
|
||||
int GetIPSupport(ArrayList<IPSupport> &ipsl)
|
||||
{
|
||||
char hostname[NI_MAXHOST];
|
||||
|
||||
@ -193,7 +193,7 @@ namespace hgl
|
||||
* @param protocol 协议类型
|
||||
* @return 是否支持
|
||||
*/
|
||||
bool CheckIPSupport(const List<IPSupport> &ips_list,uint family,uint socktype,uint protocol)
|
||||
bool CheckIPSupport(const ArrayList<IPSupport> &ips_list,uint family,uint socktype,uint protocol)
|
||||
{
|
||||
int count=ips_list.GetCount();
|
||||
|
||||
@ -224,7 +224,7 @@ namespace hgl
|
||||
*/
|
||||
bool CheckIPSupport(uint family,uint socktype,uint protocol)
|
||||
{
|
||||
List<IPSupport> ips_list;
|
||||
ArrayList<IPSupport> ips_list;
|
||||
|
||||
const int count=GetIPSupport(ips_list);
|
||||
|
||||
@ -308,7 +308,7 @@ namespace hgl
|
||||
* @param _protocol 协议类型(可以为IPPROTO_TCP、IPPROTO_UDP、IPPROTO_SCTP),默认为所有类型。
|
||||
* @return 地址个数,-1表示出错
|
||||
*/
|
||||
int IPv4Address::GetDomainIPList(List<in_addr> &addr_list,const char *domain,int socktype,int protocol)
|
||||
int IPv4Address::GetDomainIPList(ArrayList<in_addr> &addr_list,const char *domain,int socktype,int protocol)
|
||||
{
|
||||
return GetIPList<AF_INET,in_addr,sockaddr_in>(addr_list,domain,socktype,protocol);
|
||||
}
|
||||
@ -320,7 +320,7 @@ namespace hgl
|
||||
* @param _protocol 协议类型(可以为IPPROTO_TCP、IPPROTO_UDP、IPPROTO_SCTP),默认为所有类型。
|
||||
* @return 地址个数,-1表示出错
|
||||
*/
|
||||
int IPv4Address::GetLocalIPList(List<in_addr> &addr_list,int _socktype,int _protocol)
|
||||
int IPv4Address::GetLocalIPList(ArrayList<in_addr> &addr_list,int _socktype,int _protocol)
|
||||
{
|
||||
char hostname[NI_MAXHOST];
|
||||
|
||||
@ -398,7 +398,7 @@ namespace hgl
|
||||
* @param _protocol 协议类型(可以为IPPROTO_TCP、IPPROTO_UDP、IPPROTO_SCTP),默认为所有类型。
|
||||
* @return 地址个数,-1表示出错
|
||||
*/
|
||||
int IPv6Address::GetDomainIPList(List<in6_addr> &addr_list,const char *domain,int socktype,int protocol)
|
||||
int IPv6Address::GetDomainIPList(ArrayList<in6_addr> &addr_list,const char *domain,int socktype,int protocol)
|
||||
{
|
||||
return GetIPList<AF_INET6,in6_addr,sockaddr_in6>(addr_list,domain,socktype,protocol);
|
||||
}
|
||||
@ -410,7 +410,7 @@ namespace hgl
|
||||
* @param _protocol 协议类型(可以为IPPROTO_TCP、IPPROTO_UDP、IPPROTO_SCTP),默认为所有类型。
|
||||
* @return 地址个数,-1表示出错
|
||||
*/
|
||||
int IPv6Address::GetLocalIPList(List<in6_addr> &addr_list,int _socktype,int _protocol)
|
||||
int IPv6Address::GetLocalIPList(ArrayList<in6_addr> &addr_list,int _socktype,int _protocol)
|
||||
{
|
||||
char hostname[NI_MAXHOST];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user