summaryrefslogtreecommitdiff
path: root/include/ctables.h
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:44:50 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:44:50 +0000
commit8cebe2878f3878afce6f643d93668155cb26801d (patch)
treee9e806e3ffb200801c4b627530c5b5005ec4c099 /include/ctables.h
parent5d67a5fff127bf95bca69b436ef7f645f2fe3281 (diff)
Include explicit routing information in Command, will replace CMD_LOCALONLY return value
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11601 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/ctables.h')
-rw-r--r--include/ctables.h32
1 files changed, 25 insertions, 7 deletions
diff --git a/include/ctables.h b/include/ctables.h
index 9018d9c35..b07d3f4e0 100644
--- a/include/ctables.h
+++ b/include/ctables.h
@@ -21,6 +21,7 @@ enum CmdResult
CMD_FAILURE = 0, /* Command exists, but failed */
CMD_SUCCESS = 1, /* Command exists, and succeeded */
CMD_INVALID = 2 /* Command doesnt exist at all! */
+#define CMD_LOCALONLY CMD_FAILURE
};
/** Translation types for translation of parameters to UIDs.
@@ -36,14 +37,26 @@ enum TranslateType
TR_CUSTOM /* Custom translation handled by EncodeParameter/DecodeParameter */
};
-/** For commands which should not be replicated to other
- * servers, we usually return CMD_FAILURE. this isnt readable,
- * so we define this alias for CMD_FAILURE called
- * CMD_LOCALONLY, which of course does the same thing but is
- * much more readable.
- */
-#define CMD_LOCALONLY CMD_FAILURE
+enum RouteType
+{
+ ROUTE_TYPE_LOCALONLY,
+ ROUTE_TYPE_BROADCAST,
+ ROUTE_TYPE_UNICAST
+};
+
+struct RouteDescriptor
+{
+ const RouteType type;
+ /** For unicast, the destination server's name
+ */
+ const std::string serverdest;
+ RouteDescriptor(RouteType t, const std::string d)
+ : type(t), serverdest(d) { }
+};
+#define ROUTE_LOCALONLY (RouteDescriptor(ROUTE_TYPE_LOCALONLY, ""))
+#define ROUTE_BROADCAST (RouteDescriptor(ROUTE_TYPE_BROADCAST, ""))
+#define ROUTE_UNICAST(x) (RouteDescriptor(ROUTE_TYPE_UNICAST, x))
/** A structure that defines a command. Every command available
* in InspIRCd must be defined as derived from Command.
@@ -145,6 +158,11 @@ class CoreExport Command : public Extensible
*/
virtual CmdResult Handle(const std::vector<std::string>& parameters, User* user) = 0;
+ virtual RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
+ {
+ return ROUTE_BROADCAST;
+ }
+
/** Handle an internal request from another command, the core, or a module
* @param Command ID
* @param Zero or more parameters, whos form is specified by the command ID.