]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Add port type identifiers
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 1 Jan 2007 00:16:50 +0000 (00:16 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 1 Jan 2007 00:16:50 +0000 (00:16 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6196 e03df62e-2008-0410-955e-edbf42e46eb7

include/socket.h
src/cmd_stats.cpp
src/modules/extra/m_ssl_gnutls.cpp
src/modules/extra/m_ssl_openssl.cpp
src/socket.cpp

index cf2b9bf5bcab1a680d5af5b1a7704b1db2245965..1e6ca56a2b4b23ac4634753a6efc0d05133d3dfb 100644 (file)
@@ -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
index 9b1893a3ce1fa828ea3e1257fa2364712e853dc0..5b11d33ed18a64ea9e8adb22e89c5c213d73f92d 100644 (file)
@@ -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;
index 1e6208b660e96ab38977a8d624c5ec9bcf761071..e5c3160352f63af5c9cddc79234dd905b7a8dc82 100644 (file)
@@ -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
index bc137238ae251bceed7f1d91bfd3647367646869..c5b6d1c62a794ef4c650b43bd724315934c06a30 100644 (file)
@@ -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
index ee21400d37b3db2cf4d0100382276609dac4136b..9345af22486453b33b6008bbd42f6736bc250660 100644 (file)
@@ -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);