diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-12-03 14:41:08 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-12-03 14:41:08 +0000 |
| commit | 4156debe5cdb617e25f6c974c95270dc1ce345de (patch) | |
| tree | dd794abdead6be0b2e18baaf496e61af05d18d5b /src/SocketCore.h | |
| parent | 854660005dc8394ee9df5eba143b3e8d95140688 (diff) | |
2009-12-03 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added --interface option. This feature binds sockets to given
interface. You can specify interface name, IP address and
hostname.
* configure.ac
* src/OptionHandlerFactory.cc
* src/SocketCore.cc
* src/SocketCore.h
* src/main.cc
* src/message.h
* src/prefs.cc
* src/prefs.h
* src/usage_text.h
Diffstat (limited to 'src/SocketCore.h')
| -rw-r--r-- | src/SocketCore.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/SocketCore.h b/src/SocketCore.h index 896c1f63..9d06fbeb 100644 --- a/src/SocketCore.h +++ b/src/SocketCore.h @@ -92,6 +92,10 @@ private: static int _protocolFamily; + static SharedHandle<struct sockaddr_storage> _bindAddr; + + static socklen_t _bindAddrLen; + bool blocking; int secure; @@ -124,6 +128,8 @@ private: void init(); + void bind(const struct sockaddr* addr, socklen_t addrlen); + #ifdef HAVE_EPOLL void initEPOLL(); @@ -349,6 +355,13 @@ public: { _protocolFamily = protocolFamily; } + + // Bind socket to interface. interface may be specified as a + // hostname, IP address or interface name like eth0. If the given + // interface is not found or binding socket is failed, exception + // will be thrown. Set _protocolFamily before calling this function + // if you limit protocol family. + static void bindAddress(const std::string& interface); }; } // namespace aria2 |
