]> arthur.barton.de Git - ngircd-alex.git/commitdiff
New function Conn_GetIPAInfo(): get IP address of a connection
authorAlexander Barton <alex@barton.de>
Sun, 22 Jan 2012 21:35:27 +0000 (22:35 +0100)
committerAlexander Barton <alex@barton.de>
Sun, 22 Jan 2012 21:35:27 +0000 (22:35 +0100)
src/ngircd/conn.c
src/ngircd/conn.h

index 40a2af6e17f5b10f24467833b0f8ac4c9043020b..35d740051f8822a4d8976154ae399e83ceb2a3b5 100644 (file)
@@ -1226,6 +1226,20 @@ Conn_SyncServerStruct(void)
 } /* SyncServerStruct */
 
 
 } /* SyncServerStruct */
 
 
+/**
+ * Get IP address string of a connection.
+ *
+ * @param Idx Connection index.
+ * @return Pointer to a global buffer containing the IP address as string.
+ */
+GLOBAL const char *
+Conn_GetIPAInfo(CONN_ID Idx)
+{
+       assert(Idx > NONE);
+       return ng_ipaddr_tostr(&My_Connections[Idx].addr);
+}
+
+
 /**
  * Send out data of write buffer; connect new sockets.
  *
 /**
  * Send out data of write buffer; connect new sockets.
  *
index 251da2a07ddff28452d68559a35f039b6e14c676..4752ec1ede359ee4764066d0b80b578599ff6b74 100644 (file)
@@ -131,6 +131,8 @@ Conn_UsesSSL(UNUSED CONN_ID Idx)
 { return false; }
 #endif
 
 { return false; }
 #endif
 
+GLOBAL const char *Conn_GetIPAInfo PARAMS((CONN_ID Idx));
+
 GLOBAL long Conn_Count PARAMS((void));
 GLOBAL long Conn_CountMax PARAMS((void));
 GLOBAL long Conn_CountAccepted PARAMS((void));
 GLOBAL long Conn_Count PARAMS((void));
 GLOBAL long Conn_CountMax PARAMS((void));
 GLOBAL long Conn_CountAccepted PARAMS((void));