• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

CommandParserInterface.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 #ifndef __COMMAND_PARSER_INTERFACE
00010 #define __COMMAND_PARSER_INTERFACE
00011 
00012 #include "RakMemoryOverride.h"
00013 #include "RakNetTypes.h"
00014 #include "DS_OrderedList.h"
00015 #include "Export.h"
00016 
00017 class TransportInterface;
00018 
00022 struct RAK_DLL_EXPORT RegisteredCommand
00023 {
00024         const char *command;
00025         const char *commandHelp;
00026         unsigned char parameterCount;
00027 };
00028 
00030 int RAK_DLL_EXPORT RegisteredCommandComp( const char* const & key, const RegisteredCommand &data );
00031 
00035 class RAK_DLL_EXPORT CommandParserInterface
00036 {
00037 public:
00038         CommandParserInterface();
00039         virtual ~CommandParserInterface();
00040 
00044         virtual const char *GetName(void) const=0;
00045 
00049         virtual void  OnNewIncomingConnection(SystemAddress systemAddress, TransportInterface *transport);
00050 
00054         virtual void OnConnectionLost(SystemAddress systemAddress, TransportInterface *transport);
00055 
00059         virtual void SendHelp(TransportInterface *transport, SystemAddress systemAddress)=0;
00060 
00068         virtual bool OnCommand(const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, SystemAddress systemAddress, const char *originalString)=0;
00069 
00074         virtual void OnTransportChange(TransportInterface *transport);
00075 
00081         virtual bool GetRegisteredCommand(const char *command, RegisteredCommand *rc);
00082 
00091         static void ParseConsoleString(char *str, const char delineator, unsigned char delineatorToggle, unsigned *numParameters, char **parameterList, unsigned parameterListLength);
00092 
00097         virtual void SendCommandList(TransportInterface *transport, SystemAddress systemAddress);
00098 
00099         static const unsigned char VARIABLE_NUMBER_OF_PARAMETERS;
00100 
00101         // Currently only takes static strings - doesn't make a copy of what you pass.
00102         // parameterCount is the number of parameters that the sender has to include with the command.
00103         // Pass 255 to parameterCount to indicate variable number of parameters
00104 
00109         virtual void RegisterCommand(unsigned char parameterCount, const char *command, const char *commandHelp);
00110 
00117         virtual void ReturnResult(bool res, const char *command, TransportInterface *transport, SystemAddress systemAddress);
00118         virtual void ReturnResult(char *res, const char *command, TransportInterface *transport, SystemAddress systemAddress);
00119         virtual void ReturnResult(SystemAddress res, const char *command, TransportInterface *transport, SystemAddress systemAddress);
00120         virtual void ReturnResult(int res, const char *command,TransportInterface *transport, SystemAddress systemAddress);
00121 
00128         virtual void ReturnResult(const char *command,TransportInterface *transport, SystemAddress systemAddress);
00129 
00130 
00136         SystemAddress IntegersToSystemAddress(int binaryAddress, int port);
00137 
00138 protected:
00139         DataStructures::OrderedList<const char*, RegisteredCommand, RegisteredCommandComp> commandList;
00140 };
00141 
00142 #endif

Generated on Thu Sep 30 2010 01:27:21 for RakNet by  doxygen 1.7.1