diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-11 18:38:00 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-11 18:38:00 +0000 |
commit | bfcaef8623bb3f8faf1141eb7b3805ab75ae97dd (patch) | |
tree | f26d108a63a8d311c64b400e58d5d1b7eff39bec /include | |
parent | b469531385d6d65b2f9dface80fe1ab4b9e19e15 (diff) |
Refactor port binding, warning not yet tested fully
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6982 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r-- | include/configreader.h | 13 | ||||
-rw-r--r-- | include/inspircd.h | 16 | ||||
-rw-r--r-- | include/modules.h | 2 | ||||
-rw-r--r-- | include/socket.h | 14 |
4 files changed, 17 insertions, 28 deletions
diff --git a/include/configreader.h b/include/configreader.h index eefa359c9..db4c6d3d5 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -426,11 +426,6 @@ class ServerConfig : public Extensible */ char HideKillsServer[MAXBUF]; - /** A list of IP addresses the server is listening - * on. - */ - char addrs[MAXBUF][255]; - /** The MOTD file, cached in a file_cache type. */ file_cache MOTD; @@ -453,13 +448,9 @@ class ServerConfig : public Extensible */ std::vector<std::string> module_names; - /** A list of ports which the server is listening on - */ - int ports[255]; - - /** A list of the file descriptors for the listening client ports + /** A list of the classes for listening client ports */ - ListenSocket* openSockfd[255]; + std::vector<ListenSocket*> ports; /** Boolean sets of which modules implement which functions */ diff --git a/include/inspircd.h b/include/inspircd.h index d9918aa73..71a36f9b5 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -187,24 +187,17 @@ class serverstats : public classbase /** Total bytes of data received */ double statsRecv; - /** Number of bound listening ports - */ - unsigned long BoundPortCount; - /** Cpu usage at last sample */ timeval LastCPU; - /** Time last sample was read */ timeval LastSampled; - /** The constructor initializes all the counts to zero */ serverstats() : statsAccept(0), statsRefused(0), statsUnknown(0), statsCollisions(0), statsDns(0), - statsDnsGood(0), statsDnsBad(0), statsConnects(0), statsSent(0.0), statsRecv(0.0), - BoundPortCount(0) + statsDnsGood(0), statsDnsBad(0), statsConnects(0), statsSent(0.0), statsRecv(0.0) { } }; @@ -586,13 +579,6 @@ class InspIRCd : public classbase */ int BindPorts(bool bail, int &found_ports, FailedPortList &failed_ports); - /** Returns true if this server has the given port bound to the given address - * @param port The port number - * @param addr The address - * @return True if we have a port listening on this address - */ - bool HasPort(int port, char* addr); - /** Binds a socket on an already open file descriptor * @param sockfd A valid file descriptor of an open socket * @param port The port number to bind to diff --git a/include/modules.h b/include/modules.h index fe921a540..752479014 100644 --- a/include/modules.h +++ b/include/modules.h @@ -75,7 +75,7 @@ enum MessageType { * ipv4 servers, so this value will be ten times as * high on ipv6 servers. */ -#define NATIVE_API_VERSION 11022 +#define NATIVE_API_VERSION 11023 #ifdef IPV6 #define API_VERSION (NATIVE_API_VERSION * 10) #else diff --git a/include/socket.h b/include/socket.h index 4e7d89192..88478f2e3 100644 --- a/include/socket.h +++ b/include/socket.h @@ -152,10 +152,12 @@ class ListenSocket : public EventHandler InspIRCd* ServerInstance; std::string desc; int family; + std::string bind_addr; + int bind_port; public: /** Create a new listening socket */ - ListenSocket(InspIRCd* Instance, int sockfd, irc::sockets::insp_sockaddr client, irc::sockets::insp_sockaddr server, int port, char* addr); + ListenSocket(InspIRCd* Instance, int port, char* addr); /** Handle an I/O event */ void HandleEvent(EventType et, int errornum = 0); @@ -173,6 +175,16 @@ class ListenSocket : public EventHandler { return desc; } + + int GetPort() + { + return bind_port; + } + + std::string &GetIP() + { + return bind_addr; + } }; #endif |