diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-02-21 15:21:21 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-02-21 15:21:21 +0000 |
| commit | 6f0fff2a5f584cb944c1e9fde05de0fe6f453ba7 (patch) | |
| tree | 31c051b5a4fe9c5425dddff62d2e32c3d840df46 /src/SocketCore.h | |
| parent | 8f9af67b9932c05ae778a05f53b78a9a79539221 (diff) | |
2010-02-22 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Put the portion of code to get interface addresses in
SocketCore::bindAddress() into newly added getInterfaceAddress().
* src/SocketCore.cc
* src/SocketCore.h
Diffstat (limited to 'src/SocketCore.h')
| -rw-r--r-- | src/SocketCore.h | 12 |
1 files changed, 12 insertions, 0 deletions
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<std::pair<struct sockaddr_storage, socklen_t> >& 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<std::pair<struct sockaddr_storage, socklen_t> >& ifAddrs, + const std::string& iface, int family = AF_UNSPEC); + } // namespace aria2 #endif // _D_SOCKET_CORE_H_ |
