From 6f0fff2a5f584cb944c1e9fde05de0fe6f453ba7 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 21 Feb 2010 15:21:21 +0000 Subject: 2010-02-22 Tatsuhiro Tsujikawa Put the portion of code to get interface addresses in SocketCore::bindAddress() into newly added getInterfaceAddress(). * src/SocketCore.cc * src/SocketCore.h --- src/SocketCore.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/SocketCore.h') diff --git a/src/SocketCore.h b/src/SocketCore.h index b4b2714c..a07e264e 100644 --- a/src/SocketCore.h +++ b/src/SocketCore.h @@ -368,6 +368,10 @@ public: // We cannot use interface as an argument because it is a reserved // keyword in MSVC. static void bindAddress(const std::string& iface); + + friend void getInterfaceAddress + (std::vector >& ifAddrs, + const std::string& iface, int family); }; // Set default ai_flags. hints.ai_flags is initialized with this @@ -382,6 +386,14 @@ int callGetaddrinfo (struct addrinfo** resPtr, const char* host, const char* service, int family, int sockType, int flags, int protocol); +// Collects IP addresses of given inteface iface and stores in +// ifAddres. iface may be specified as a hostname, IP address or +// interface name like eth0. You can limit the family of IP addresses +// to collect using family argument. +void getInterfaceAddress +(std::vector >& ifAddrs, + const std::string& iface, int family = AF_UNSPEC); + } // namespace aria2 #endif // _D_SOCKET_CORE_H_ -- cgit