X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fsocket.h;h=6e4bf9dbdc11331bfcdd34b5f3c41c2b4d93d48f;hb=507e9554d69df3e2cee60fe52b02dc160c6e1602;hp=d3a45475d8c442f8e04496ad6454d6aa073d91ce;hpb=ca749a589afc4f12de4bfb0f63591a49e3703372;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/socket.h b/include/socket.h index d3a45475d..6e4bf9dbd 100644 --- a/include/socket.h +++ b/include/socket.h @@ -99,7 +99,7 @@ namespace irc CoreExport int OpenTCPSocket(const char* addr, int socktype = SOCK_STREAM); /** Return the size of the structure for syscall passing */ - CoreExport int sa_size(irc::sockets::sockaddrs& sa); + CoreExport int sa_size(const irc::sockets::sockaddrs& sa); /** Convert an address-port pair into a binary sockaddr * @param addr The IP address, IPv4 or IPv6 @@ -133,16 +133,15 @@ namespace irc class CoreExport ListenSocketBase : public EventHandler { protected: - /** The creator/owner of this object - */ - InspIRCd* ServerInstance; /** Socket description (shown in stats p) */ std::string desc; - /** Address socket is bound to */ + /** Raw address socket is bound to */ std::string bind_addr; /** Port socket is bound to */ int bind_port; + /** Human-readable address/port socket is bound to */ + std::string bind_desc; /** The client address if the most recently connected client. * Should only be used when accepting a new client. @@ -158,7 +157,7 @@ class CoreExport ListenSocketBase : public EventHandler public: /** Create a new listening socket */ - ListenSocketBase(InspIRCd* Instance, int port, const std::string &addr); + ListenSocketBase(int port, const std::string &addr); /** Handle an I/O event */ void HandleEvent(EventType et, int errornum = 0); @@ -173,18 +172,17 @@ class CoreExport ListenSocketBase : public EventHandler } /** Get description for socket */ - const std::string& GetDescription() - { - return desc; - } + const std::string& GetDescription() { return desc; } /** Get port number for socket */ - int GetPort() { return bind_port; } + int GetPort() const { return bind_port; } /** Get IP address socket is bound to */ const std::string &GetIP() { return bind_addr; } + const std::string &GetBindDesc() { return bind_desc; } + /** Handles sockets internals crap of a connection, convenience wrapper really */ void AcceptInternal(); @@ -199,7 +197,7 @@ class CoreExport ClientListenSocket : public ListenSocketBase { virtual void OnAcceptReady(int fd); public: - ClientListenSocket(InspIRCd* Instance, int port, const std::string &addr) : ListenSocketBase(Instance, port, addr) { } + ClientListenSocket(int port, const std::string &addr) : ListenSocketBase(port, addr) { } }; #endif