diff options
Diffstat (limited to 'include/modules/httpd.h')
-rw-r--r-- | include/modules/httpd.h | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/include/modules/httpd.h b/include/modules/httpd.h index 8df3c181b..ce28e0622 100644 --- a/include/modules/httpd.h +++ b/include/modules/httpd.h @@ -1,13 +1,23 @@ /* + * Anope IRC Services * - * (C) 2012-2016 Anope Team - * Contact us at team@anope.org + * Copyright (C) 2012-2016 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. + * + * 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 ANOPE_HTTPD_H -#define ANOPE_HTTPD_H +#pragma once enum HTTPError { @@ -112,7 +122,7 @@ class HTTPPage : public Base * @param The HTTP header sent from the client to request the page * @param The HTTP header that will be sent back to the client */ - virtual bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) = 0; + virtual bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) anope_abstract; }; class HTTPClient : public ClientSocket, public BinarySocket, public Base @@ -131,8 +141,8 @@ class HTTPClient : public ClientSocket, public BinarySocket, public Base return this->clientaddr.addr(); } - virtual void SendError(HTTPError err, const Anope::string &msg) = 0; - virtual void SendReply(HTTPReply *) = 0; + virtual void SendError(HTTPError err, const Anope::string &msg) anope_abstract; + virtual void SendReply(HTTPReply *) anope_abstract; }; class HTTPProvider : public ListenSocket, public Service @@ -140,11 +150,16 @@ class HTTPProvider : public ListenSocket, public Service Anope::string ip; unsigned short port; bool ssl; + public: + static constexpr const char *NAME = "http"; + Anope::string ext_ip; std::vector<Anope::string> ext_headers; - HTTPProvider(Module *c, const Anope::string &n, const Anope::string &i, const unsigned short p, bool s) : ListenSocket(i, p, i.find(':') != Anope::string::npos), Service(c, "HTTPProvider", n), ip(i), port(p), ssl(s) { } + HTTPProvider(Module *c, const Anope::string &n, const Anope::string &i, const unsigned short p, bool s) + : ListenSocket(i, p, i.find(':') != Anope::string::npos) + , Service(c, NAME, n), ip(i), port(p), ssl(s) { } const Anope::string &GetIP() const { @@ -161,9 +176,9 @@ class HTTPProvider : public ListenSocket, public Service return this->ssl; } - virtual bool RegisterPage(HTTPPage *page) = 0; - virtual void UnregisterPage(HTTPPage *page) = 0; - virtual HTTPPage* FindPage(const Anope::string &name) = 0; + virtual bool RegisterPage(HTTPPage *page) anope_abstract; + virtual void UnregisterPage(HTTPPage *page) anope_abstract; + virtual HTTPPage* FindPage(const Anope::string &name) anope_abstract; }; namespace HTTPUtils @@ -236,5 +251,3 @@ namespace HTTPUtils return dst; } } - -#endif // ANOPE_HTTPD_H |