X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fsocket.h;h=e1050201ae20b13b4b36d48f4ee17c00fa317d53;hb=a363c6f2bebc02ab553ee96b0e9e865e4f93e2d8;hp=556ee1a9045a4495b868b88d22ac9426dd44cdcd;hpb=77b7c4300472ff1ba5c643b75ead4be75625f96f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/socket.h b/include/socket.h index 556ee1a90..e1050201a 100644 --- a/include/socket.h +++ b/include/socket.h @@ -135,7 +135,7 @@ namespace irc * or a negative value upon failure (negative values are invalid file * descriptors) */ - CoreExport int OpenTCPSocket(char* addr, int socktype = SOCK_STREAM); + CoreExport int OpenTCPSocket(const char* addr, int socktype = SOCK_STREAM); } } @@ -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, const std::string &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) @@ -210,14 +210,17 @@ class CoreExport ListenSocket : public EventHandler /** 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); + virtual void OnAcceptReady(const std::string &ipconnectedto, int fd, const std::string &incomingip) = 0; }; -//class CoreExport ListenSocketClient : public ListenSocket -//{ -// -//} +class CoreExport ClientListenSocket : public ListenSocketBase +{ + virtual void OnAcceptReady(const std::string &ipconnectedto, int fd, const std::string &incomingip); + public: + ClientListenSocket(InspIRCd* Instance, int port, const std::string &addr) : ListenSocketBase(Instance, port, addr) { } +}; #endif