diff options
| author | Alexander Barton <alex@barton.de> | 2012-01-22 22:35:27 +0100 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2012-01-22 22:35:27 +0100 |
| commit | 6a308fcb42eae1de168699ed432b49b610073ede (patch) | |
| tree | 99bd584377c8a8185e40d9ccf1e4bea8c43232c7 | |
| parent | 1537c791320086df83b8fbecb057e70c7120ea12 (diff) | |
| download | ngircd-6a308fcb42eae1de168699ed432b49b610073ede.tar.gz ngircd-6a308fcb42eae1de168699ed432b49b610073ede.zip | |
New function Conn_GetIPAInfo(): get IP address of a connection
| -rw-r--r-- | src/ngircd/conn.c | 14 | ||||
| -rw-r--r-- | src/ngircd/conn.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 40a2af6e..35d74005 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -1227,6 +1227,20 @@ Conn_SyncServerStruct(void) /** + * 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. * * @param Idx Connection index. diff --git a/src/ngircd/conn.h b/src/ngircd/conn.h index 251da2a0..4752ec1e 100644 --- a/src/ngircd/conn.h +++ b/src/ngircd/conn.h @@ -131,6 +131,8 @@ Conn_UsesSSL(UNUSED CONN_ID Idx) { 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)); |