summaryrefslogtreecommitdiff
path: root/network.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-01-19 15:58:57 +0000
committerDarkvater <darkvater@openttd.org>2006-01-19 15:58:57 +0000
commita292621b14db827595548463d9e521c59b4d1e4b (patch)
tree709cb38fd32c03459358ff86e3bdc3e81f0102b9 /network.c
parent26226f1d43d27de614fd77a1edc965809d86ddf2 (diff)
downloadopenttd-a292621b14db827595548463d9e521c59b4d1e4b.tar.xz
(svn r3407) - Feature: Kick and ban now with IP numbers.
Diffstat (limited to 'network.c')
-rw-r--r--network.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/network.c b/network.c
index 0bee0b6db..d7e4cd32d 100644
--- a/network.c
+++ b/network.c
@@ -65,6 +65,21 @@ NetworkClientInfo *NetworkFindClientInfoFromIndex(uint16 client_index)
return NULL;
}
+/** Return the CI for a given IP
+ * @param ip IP of the client we are looking for. This must be in string-format
+ * @return return a pointer to the corresponding NetworkClientInfo struct or NULL on failure */
+NetworkClientInfo *NetworkFindClientInfoFromIP(const char *ip)
+{
+ NetworkClientInfo *ci;
+ uint32 ip_number = inet_addr(ip);
+
+ for (ci = _network_client_info; ci != &_network_client_info[MAX_CLIENT_INFO]; ci++) {
+ if (ci->client_ip == ip_number) return ci;
+ }
+
+ return NULL;
+}
+
// Function that looks up the CS for a given client-index
NetworkClientState *NetworkFindClientStateFromIndex(uint16 client_index)
{