diff options
| author | Adam <Adam@anope.org> | 2015-12-31 13:01:18 -0500 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2015-12-31 13:01:18 -0500 |
| commit | 1b24c96ab07d99e5d95ec9337e7b541696b91eb3 (patch) | |
| tree | 4524a0bccec9842bc962bb96471608aab719c773 /include/modules/operserv | |
| parent | 17b7508058162a722120dd7a9d95c20b979af2e9 (diff) | |
Rename haader file names to be consistent with module names
Diffstat (limited to 'include/modules/operserv')
| -rw-r--r-- | include/modules/operserv/defcon.h | 21 | ||||
| -rw-r--r-- | include/modules/operserv/dns.h | 72 | ||||
| -rw-r--r-- | include/modules/operserv/forbid.h | 56 | ||||
| -rw-r--r-- | include/modules/operserv/ignore.h | 43 | ||||
| -rw-r--r-- | include/modules/operserv/info.h | 29 | ||||
| -rw-r--r-- | include/modules/operserv/news.h | 32 | ||||
| -rw-r--r-- | include/modules/operserv/session.h | 77 |
7 files changed, 330 insertions, 0 deletions
diff --git a/include/modules/operserv/defcon.h b/include/modules/operserv/defcon.h new file mode 100644 index 000000000..f980d5008 --- /dev/null +++ b/include/modules/operserv/defcon.h @@ -0,0 +1,21 @@ +/* + * + * (C) 2014 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + */ + +namespace Event +{ + struct CoreExport DefconLevel : Events + { + /** Called when defcon level changes + * @param level The level + */ + virtual void OnDefconLevel(int level) anope_abstract; + }; +} + +template<> struct EventName<Event::DefconLevel> { static constexpr const char *const name = "OnDefconLevel"; }; diff --git a/include/modules/operserv/dns.h b/include/modules/operserv/dns.h new file mode 100644 index 000000000..d76cd3d62 --- /dev/null +++ b/include/modules/operserv/dns.h @@ -0,0 +1,72 @@ +/* + * + * (C) 2014 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + */ + + +class DNSZone : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + + public: + virtual Anope::string GetName() anope_abstract; + virtual void SetName(const Anope::string &) anope_abstract; +}; + +static Serialize::TypeReference<DNSZone> dnszone("DNSZone"); + +class DNSServer : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + + public: + virtual DNSZone *GetZone() anope_abstract; + virtual void SetZone(DNSZone *) anope_abstract; + + virtual Anope::string GetName() anope_abstract; + virtual void SetName(const Anope::string &) anope_abstract; + + virtual unsigned int GetLimit() anope_abstract; + virtual void SetLimit(const unsigned int &) anope_abstract; + + virtual bool GetPooled() anope_abstract; + virtual void SetPool(const bool &) anope_abstract; +}; + +static Serialize::TypeReference<DNSServer> dnsserver("DNSServer"); + +class DNSZoneMembership : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + + public: + virtual DNSServer *GetServer() anope_abstract; + virtual void SetServer(DNSServer *) anope_abstract; + + virtual DNSZone *GetZone() anope_abstract; + virtual void SetZone(DNSZone *) anope_abstract; +}; + +static Serialize::TypeReference<DNSZoneMembership> dnszonemembership("DNSZoneMembership"); + +class DNSIP : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + + public: + virtual DNSServer *GetServer() anope_abstract; + virtual void SetServer(DNSServer *) anope_abstract; + + virtual Anope::string GetIP() anope_abstract; + virtual void SetIP(const Anope::string &) anope_abstract; +}; + +static Serialize::TypeReference<DNSIP> dnsip("DNSIP"); + diff --git a/include/modules/operserv/forbid.h b/include/modules/operserv/forbid.h new file mode 100644 index 000000000..9b21defec --- /dev/null +++ b/include/modules/operserv/forbid.h @@ -0,0 +1,56 @@ +/* + * + * (C) 2013-2014 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + */ + +enum ForbidType +{ + FT_NICK = 1, + FT_CHAN, + FT_EMAIL, + FT_REGISTER, + FT_SIZE +}; + +class ForbidData : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + + public: + virtual Anope::string GetMask() anope_abstract; + virtual void SetMask(const Anope::string &) anope_abstract; + + virtual Anope::string GetCreator() anope_abstract; + virtual void SetCreator(const Anope::string &) anope_abstract; + + virtual Anope::string GetReason() anope_abstract; + virtual void SetReason(const Anope::string &) anope_abstract; + + virtual time_t GetCreated() anope_abstract; + virtual void SetCreated(const time_t &) anope_abstract; + + virtual time_t GetExpires() anope_abstract; + virtual void SetExpires(const time_t &) anope_abstract; + + virtual ForbidType GetType() anope_abstract; + virtual void SetType(const ForbidType &) anope_abstract; +}; + +class ForbidService : public Service +{ + public: + ForbidService(Module *m) : Service(m, "ForbidService", "forbid") { } + + virtual ForbidData *FindForbid(const Anope::string &mask, ForbidType type) anope_abstract; + + virtual std::vector<ForbidData *> GetForbids() anope_abstract; +}; + +static ServiceReference<ForbidService> forbid_service("ForbidService", "forbid"); + +static Serialize::TypeReference<ForbidData> forbiddata("ForbidData"); + diff --git a/include/modules/operserv/ignore.h b/include/modules/operserv/ignore.h new file mode 100644 index 000000000..2326b5575 --- /dev/null +++ b/include/modules/operserv/ignore.h @@ -0,0 +1,43 @@ +/* OperServ ignore interface + * + * (C) 2003-2014 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + */ + + +class Ignore : public Serialize::Object +{ + public: + using Serialize::Object::Object; + + virtual Anope::string GetMask() anope_abstract; + virtual void SetMask(const Anope::string &) anope_abstract; + + virtual Anope::string GetCreator() anope_abstract; + virtual void SetCreator(const Anope::string &) anope_abstract; + + virtual Anope::string GetReason() anope_abstract; + virtual void SetReason(const Anope::string &) anope_abstract; + + virtual time_t GetTime() anope_abstract; + virtual void SetTime(const time_t &) anope_abstract; +}; + +static Serialize::TypeReference<Ignore> ignoretype("IgnoreData"); + +class IgnoreService : public Service +{ + protected: + IgnoreService(Module *c) : Service(c, "IgnoreService", "ignore") { } + + public: + virtual Ignore *Find(const Anope::string &mask) anope_abstract; +}; + +static ServiceReference<IgnoreService> ignore_service("IgnoreService", "ignore"); + diff --git a/include/modules/operserv/info.h b/include/modules/operserv/info.h new file mode 100644 index 000000000..6e819158d --- /dev/null +++ b/include/modules/operserv/info.h @@ -0,0 +1,29 @@ +/* + * + * (C) 2014 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + */ + +class OperInfo : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + + public: + virtual Serialize::Object *GetTarget() anope_abstract; + virtual void SetTarget(Serialize::Object *) anope_abstract; + + virtual Anope::string GetInfo() anope_abstract; + virtual void SetInfo(const Anope::string &) anope_abstract; + + virtual Anope::string GetCreator() anope_abstract; + virtual void SetCreator(const Anope::string &) anope_abstract; + + virtual time_t GetCreated() anope_abstract; + virtual void SetCreated(const time_t &) anope_abstract; +}; + +static Serialize::TypeReference<OperInfo> operinfo("OperInfo"); + diff --git a/include/modules/operserv/news.h b/include/modules/operserv/news.h new file mode 100644 index 000000000..07627b1bc --- /dev/null +++ b/include/modules/operserv/news.h @@ -0,0 +1,32 @@ +#ifndef OS_NEWS +#define OS_NEWS + +enum NewsType +{ + NEWS_LOGON, + NEWS_RANDOM, + NEWS_OPER +}; + +class NewsItem : public Serialize::Object +{ + public: + using Serialize::Object::Object; + + virtual NewsType GetNewsType() anope_abstract; + virtual void SetNewsType(const NewsType &) anope_abstract; + + virtual Anope::string GetText() anope_abstract; + virtual void SetText(const Anope::string &) anope_abstract; + + virtual Anope::string GetWho() anope_abstract; + virtual void SetWho(const Anope::string &) anope_abstract; + + virtual time_t GetTime() anope_abstract; + virtual void SetTime(const time_t &) anope_abstract; +}; + +static Serialize::TypeReference<NewsItem> newsitem("NewsItem"); + +#endif // OS_NEWS + diff --git a/include/modules/operserv/session.h b/include/modules/operserv/session.h new file mode 100644 index 000000000..b9afd196e --- /dev/null +++ b/include/modules/operserv/session.h @@ -0,0 +1,77 @@ + +#pragma once + +struct Session +{ + cidr addr; /* A cidr (sockaddrs + len) representing this session */ + unsigned int count = 1; /* Number of clients with this host */ + unsigned int hits = 0; /* Number of subsequent kills for a host */ + + Session(const sockaddrs &ip, int len) : addr(ip, len) { } +}; + +class Exception : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + + public: + + virtual Anope::string GetMask() anope_abstract; + virtual void SetMask(const Anope::string &) anope_abstract; + + virtual unsigned int GetLimit() anope_abstract; + virtual void SetLimit(unsigned int) anope_abstract; + + virtual Anope::string GetWho() anope_abstract; + virtual void SetWho(const Anope::string &) anope_abstract; + + virtual Anope::string GetReason() anope_abstract; + virtual void SetReason(const Anope::string &) anope_abstract; + + virtual time_t GetTime() anope_abstract; + virtual void SetTime(const time_t &) anope_abstract; + + virtual time_t GetExpires() anope_abstract; + virtual void SetExpires(const time_t &) anope_abstract; +}; + +static Serialize::TypeReference<Exception> exception("Exception"); + +class SessionService : public Service +{ + public: + typedef std::unordered_map<cidr, Session *, cidr::hash> SessionMap; + + SessionService(Module *m) : Service(m, "SessionService", "session") { } + + virtual Exception *FindException(User *u) anope_abstract; + + virtual Exception *FindException(const Anope::string &host) anope_abstract; + + virtual Session *FindSession(const Anope::string &ip) anope_abstract; + + virtual SessionMap &GetSessions() anope_abstract; +}; + +static ServiceReference<SessionService> session_service("SessionService", "session"); + +namespace Event +{ + struct CoreExport Exception : Events + { + /** Called after an exception has been added + * @param ex The exception + * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it + */ + virtual EventReturn OnExceptionAdd(::Exception *ex) anope_abstract; + + /** Called before an exception is deleted + * @param source The source deleting it + * @param ex The exceotion + */ + virtual void OnExceptionDel(CommandSource &source, ::Exception *ex) anope_abstract; + }; +} + +template<> struct EventName<Event::Exception> { static constexpr const char *const name = "Exception"; }; |
