X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fsocket.h;h=961fbd98ece7d67d45425da7726ed8e80fbc4a97;hb=74f401f1997b89783217cd636f396e35f5c2a9d0;hp=105984f7483f4209413407925e585455e0510989;hpb=61fed23a3e9a62f19c2f88208585b31356c986ef;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/socket.h b/include/socket.h index 105984f74..961fbd98e 100644 --- a/include/socket.h +++ b/include/socket.h @@ -145,7 +145,7 @@ namespace irc * It will create a new User for every valid connection * and assign it a file descriptor. */ -class CoreExport ListenSocket : public EventHandler +class CoreExport ListenSocketBase : public EventHandler { protected: /** The creator/owner of this object @@ -171,13 +171,13 @@ class CoreExport ListenSocket : public EventHandler public: /** Create a new listening socket */ - ListenSocket(InspIRCd* Instance, int port, char* addr); + ListenSocketBase(InspIRCd* Instance, int port, char* addr); /** Handle an I/O event */ void HandleEvent(EventType et, int errornum = 0); /** Close the socket */ - ~ListenSocket(); + ~ListenSocketBase(); /** Set descriptive text */ void SetDescription(const std::string &description) @@ -202,6 +202,24 @@ class CoreExport ListenSocket : public EventHandler { return bind_addr; } + + /** Handles sockets internals crap of a connection, convenience wrapper really + */ + void AcceptInternal(); + + /** Called when a new connection has successfully been accepted on this listener. + * @param ipconnectedto The IP address the connection arrived on + * @param fd The file descriptor of the new connection + * @param incomingip The IP from which the connection was made + */ + virtual void OnAcceptReady(const std::string &ipconnectedto, int fd, const std::string &incomingip) = 0; +}; + +class CoreExport ClientListenSocket : public ListenSocketBase +{ + virtual void OnAcceptReady(const std::string &ipconnectedto, int fd, const std::string &incomingip); + public: + ClientListenSocket(InspIRCd* Instance, int port, char* addr) : ListenSocketBase(Instance, port, addr) { } }; #endif