summaryrefslogtreecommitdiff
path: root/src/network/core/address.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-04-07 19:52:01 +0000
committerrubidium <rubidium@openttd.org>2009-04-07 19:52:01 +0000
commit6db7f15b3ad8addb7187bec3d309a4e6481ac431 (patch)
tree2250639957f67c90b1e26df923cca6dd9725ada4 /src/network/core/address.h
parent82f8badc074d24b4df618c16b23c3854c3369711 (diff)
downloadopenttd-6db7f15b3ad8addb7187bec3d309a4e6481ac431.tar.xz
(svn r15970) -Codechange: make it possible to resolve a single address into multiple sockets.
Diffstat (limited to 'src/network/core/address.h')
-rw-r--r--src/network/core/address.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/network/core/address.h b/src/network/core/address.h
index d19e7b376..4d263b3c0 100644
--- a/src/network/core/address.h
+++ b/src/network/core/address.h
@@ -10,10 +10,11 @@
#include "os_abstraction.h"
#include "config.h"
#include "../../string_func.h"
-#include "../../core/smallvec_type.hpp"
+#include "../../core/smallmap_type.hpp"
class NetworkAddress;
typedef SmallVector<NetworkAddress, 4> NetworkAddressList;
+typedef SmallMap<NetworkAddress, SOCKET, 4> SocketList;
/**
* Wrapper for (un)resolved network addresses; there's no reason to transform
@@ -38,10 +39,11 @@ private:
* @param family the type of 'protocol' (IPv4, IPv6)
* @param socktype the type of socket (TCP, UDP, etc)
* @param flags the flags to send to getaddrinfo
+ * @param sockets the list of sockets to add the sockets to
* @param func the inner working while looping over the address info
* @return the resolved socket or INVALID_SOCKET.
*/
- SOCKET Resolve(int family, int socktype, int flags, LoopProc func);
+ SOCKET Resolve(int family, int socktype, int flags, SocketList *sockets, LoopProc func);
public:
/**
* Create a network address based on a resolved IP and port
@@ -217,9 +219,10 @@ public:
* Make the given socket listen.
* @param family the type of 'protocol' (IPv4, IPv6)
* @param socktype the type of socket (TCP, UDP, etc)
- * @return the listening socket or INVALID_SOCKET.
+ * @param sockets the list of sockets to add the sockets to
+ * @return the socket (if sockets != NULL)
*/
- SOCKET Listen(int family, int socktype);
+ SOCKET Listen(int family, int socktype, SocketList *sockets = NULL);
};
#endif /* ENABLE_NETWORK */