diff options
Diffstat (limited to 'include/sockets.h')
-rw-r--r-- | include/sockets.h | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/include/sockets.h b/include/sockets.h index db70db18a..f46d80cbe 100644 --- a/include/sockets.h +++ b/include/sockets.h @@ -1,16 +1,23 @@ /* + * Anope IRC Services * - * (C) 2003-2017 Anope Team - * Contact us at team@anope.org + * Copyright (C) 2005-2017 Anope Team <team@anope.org> * - * Please read COPYING and README for further details. + * This file is part of Anope. Anope is free software; you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software + * Foundation, version 2. * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see see <http://www.gnu.org/licenses/>. */ -#ifndef SOCKETS_H -#define SOCKETS_H +#pragma once #ifndef _WIN32 #include <netinet/in.h> @@ -286,12 +293,12 @@ class CoreExport BufferedSocket : public virtual Socket /** Called when there is something to be received for this socket * @return true on success, false to drop this socket */ - bool ProcessRead() anope_override; + bool ProcessRead() override; /** Called when the socket is ready to be written to * @return true on success, false to drop this socket */ - bool ProcessWrite() anope_override; + bool ProcessWrite() override; /** Gets the new line from the input buffer, if any */ @@ -303,7 +310,6 @@ class CoreExport BufferedSocket : public virtual Socket protected: virtual void Write(const char *buffer, size_t l); public: - void Write(const char *message, ...); void Write(const Anope::string &message); /** Get the length of the read buffer @@ -340,19 +346,18 @@ class CoreExport BinarySocket : public virtual Socket /** Called when there is something to be received for this socket * @return true on success, false to drop this socket */ - bool ProcessRead() anope_override; + bool ProcessRead() override; /** Called when the socket is ready to be written to * @return true on success, false to drop this socket */ - bool ProcessWrite() anope_override; + bool ProcessWrite() override; /** Write data to the socket * @param buffer The data to write * @param l The length of the data; if 0 then this function returns without doing anything */ virtual void Write(const char *buffer, size_t l); - void Write(const char *message, ...); void Write(const Anope::string &message); /** Called with data from the socket @@ -377,14 +382,14 @@ class CoreExport ListenSocket : public virtual Socket /** Process what has come in from the connection * @return false to destroy this socket */ - bool ProcessRead(); + bool ProcessRead() override; /** Called when a connection is accepted * @param fd The FD for the new connection * @param addr The sockaddr for where the connection came from * @return The new socket */ - virtual ClientSocket *OnAccept(int fd, const sockaddrs &addr) = 0; + virtual ClientSocket *OnAccept(int fd, const sockaddrs &addr) anope_abstract; }; class CoreExport ConnectionSocket : public virtual Socket @@ -403,12 +408,12 @@ class CoreExport ConnectionSocket : public virtual Socket * Used to determine whether or not this socket is connected yet. * @return true to continue to call ProcessRead/ProcessWrite, false to not continue */ - bool Process() anope_override; + bool Process() override; /** Called when there is an error for this socket * @return true on success, false to drop this socket */ - void ProcessError() anope_override; + void ProcessError() override; /** Called on a successful connect */ @@ -438,12 +443,12 @@ class CoreExport ClientSocket : public virtual Socket * Used to determine whether or not this socket is connected yet. * @return true to continue to call ProcessRead/ProcessWrite, false to not continue */ - bool Process() anope_override; + bool Process() override; /** Called when there is an error for this socket * @return true on success, false to drop this socket */ - void ProcessError() anope_override; + void ProcessError() override; /** Called when a client has been accepted() successfully. */ @@ -467,7 +472,7 @@ class CoreExport Pipe : public Socket /** Called when data is to be read, reads the data then calls OnNotify */ - bool ProcessRead() anope_override; + bool ProcessRead() override; /** Write data to this pipe * @param data The data to write @@ -496,11 +501,10 @@ class CoreExport Pipe : public Socket /** Called after ProcessRead comes back from Notify(), overload to do something useful */ - virtual void OnNotify() = 0; + virtual void OnNotify() anope_abstract; }; extern CoreExport uint32_t TotalRead; extern CoreExport uint32_t TotalWritten; extern CoreExport SocketIO NormalSocketIO; -#endif // SOCKET_H |