network.c
changeset 2859 d45695cd3e98
parent 2639 8a7342eb3a78
child 2861 c7e2c8217fed
--- a/network.c	Thu Jan 19 08:10:11 2006 +0000
+++ b/network.c	Thu Jan 19 15:58:57 2006 +0000
@@ -65,6 +65,21 @@
 	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)
 {