about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2010-05-22 16:35:02 +0200
committerAlexander Barton <alex@barton.de>2010-06-25 00:33:00 +0200
commit60eac5e952ef4096557d63e323e34498cc88928f (patch)
treed53018292b970a36b04f0638494f4ed2e682e938 /src
parent139d6303e73079f48adfe37be2b88efed31e47df (diff)
downloadngircd-60eac5e952ef4096557d63e323e34498cc88928f.tar.gz
ngircd-60eac5e952ef4096557d63e323e34498cc88928f.zip
New function Conn_IPA(): get client IP address as string
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/conn-func.c10
-rw-r--r--src/ngircd/conn-func.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/ngircd/conn-func.c b/src/ngircd/conn-func.c
index 196325ee..15bc7cc2 100644
--- a/src/ngircd/conn-func.c
+++ b/src/ngircd/conn-func.c
@@ -273,6 +273,16 @@ Conn_RecvBytes( CONN_ID Idx )
 	return My_Connections[Idx].bytes_in;
 } /* Conn_RecvBytes */
 
+/**
+ * Return the remote IP address of this connection as string.
+ */
+GLOBAL const char *
+Conn_IPA(CONN_ID Idx)
+{
+	assert (Idx > NONE);
+	return ng_ipaddr_tostr(&My_Connections[Idx].addr);
+}
+
 
 GLOBAL void
 Conn_ResetWCounter( void )
diff --git a/src/ngircd/conn-func.h b/src/ngircd/conn-func.h
index 9a1859d3..d504592f 100644
--- a/src/ngircd/conn-func.h
+++ b/src/ngircd/conn-func.h
@@ -39,6 +39,7 @@ GLOBAL long Conn_SendMsg PARAMS(( CONN_ID Idx ));
 GLOBAL long Conn_RecvMsg PARAMS(( CONN_ID Idx ));
 GLOBAL long Conn_SendBytes PARAMS(( CONN_ID Idx ));
 GLOBAL long Conn_RecvBytes PARAMS(( CONN_ID Idx ));
+GLOBAL const char *Conn_IPA PARAMS(( CONN_ID Idx ));
 
 GLOBAL void Conn_SetPenalty PARAMS(( CONN_ID Idx, time_t Seconds ));
 GLOBAL void Conn_ResetPenalty PARAMS(( CONN_ID Idx ));