diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-01 00:16:50 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-01 00:16:50 +0000 |
commit | ba339f8b1c55dd32211e8cffbc5bea02371d7668 (patch) | |
tree | bfa0ca848515ba177ae8286c8f408200017f5cc3 | |
parent | a07a3f489771508a97fd7c017830f4922ddf9d4a (diff) |
Add port type identifiers
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6196 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/socket.h | 12 | ||||
-rw-r--r-- | src/cmd_stats.cpp | 4 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 3 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 3 | ||||
-rw-r--r-- | src/socket.cpp | 2 |
5 files changed, 20 insertions, 4 deletions
diff --git a/include/socket.h b/include/socket.h index cf2b9bf5b..1e6ca56a2 100644 --- a/include/socket.h +++ b/include/socket.h @@ -150,6 +150,7 @@ class ListenSocket : public EventHandler /** The creator/owner of this object */ InspIRCd* ServerInstance; + std::string desc; public: /** Create a new listening socket */ @@ -160,6 +161,17 @@ class ListenSocket : public EventHandler /** Close the socket */ ~ListenSocket(); + /** Set descriptive text + */ + void SetDescription(const std::string &description) + { + desc = description; + } + + const std::string& GetDescription() + { + return desc; + } }; #endif diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp index 9b1893a3c..5b11d33ed 100644 --- a/src/cmd_stats.cpp +++ b/src/cmd_stats.cpp @@ -60,18 +60,16 @@ void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_lis case 'p': { std::map<int,int> pc; - for (std::vector<userrec*>::const_iterator i = ServerInstance->local_users.begin(); i != ServerInstance->local_users.end(); i++) { userrec* t = (userrec*)(*i); if (t->registered == REG_ALL) pc[t->GetPort()]++; } - for (unsigned int i = 0; i < ServerInstance->stats->BoundPortCount; i++) { results.push_back(sn+" 249 "+user->nick+" :p:"+ConvToStr(ServerInstance->Config->ports[i])+" (" + ConvToStr(pc[ServerInstance->Config->ports[i]])+" client" + - (pc[ServerInstance->Config->ports[i]] != 1 ? "s" : "") + ")"); + (pc[ServerInstance->Config->ports[i]] != 1 ? "s" : "") + "), "+ServerInstance->Config->openSockfd[i]->GetDescription()); } } break; diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 1e6208b66..e5c316035 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -140,6 +140,9 @@ class ModuleSSLGnuTLS : public Module if (ServerInstance->Config->AddIOHook(portno, this)) { listenports.push_back(portno); + for (unsigned int i = 0; i < ServerInstance->stats->BoundPortCount; i++) + if (ServerInstance->Config->ports[i]) + ServerInstance->Config->openSockfd[i]->SetDescription("ssl"); ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", portno); } else diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index bc137238a..c5b6d1c62 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -164,6 +164,9 @@ class ModuleSSLOpenSSL : public Module if (ServerInstance->Config->AddIOHook(portno, this)) { listenports.push_back(portno); + for (unsigned int i = 0; i < ServerInstance->stats->BoundPortCount; i++) + if (ServerInstance->Config->ports[i]) + ServerInstance->Config->openSockfd[i]->SetDescription("ssl"); ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", portno); } else diff --git a/src/socket.cpp b/src/socket.cpp index ee21400d3..9345af224 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -36,7 +36,7 @@ const char inverted_bits[8] = { 0x00, /* 00000000 - 0 bits - never actually used }; -ListenSocket::ListenSocket(InspIRCd* Instance, int sockfd, insp_sockaddr client, insp_sockaddr server, int port, char* addr) : ServerInstance(Instance) +ListenSocket::ListenSocket(InspIRCd* Instance, int sockfd, insp_sockaddr client, insp_sockaddr server, int port, char* addr) : ServerInstance(Instance), desc("plaintext") { this->SetFd(sockfd); Instance->Log(DEBUG,"Binding to port %s:%d",addr,port); |