From ba339f8b1c55dd32211e8cffbc5bea02371d7668 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 1 Jan 2007 00:16:50 +0000 Subject: [PATCH] Add port type identifiers git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6196 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/socket.h | 12 ++++++++++++ src/cmd_stats.cpp | 4 +--- src/modules/extra/m_ssl_gnutls.cpp | 3 +++ src/modules/extra/m_ssl_openssl.cpp | 3 +++ 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 pc; - for (std::vector::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); -- 2.39.5