Shadowrun: Awakened 29 September 2011 - Build 871
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes
RakNet::CommandParserInterface Class Reference

The interface used by command parsers. More...

#include <CommandParserInterface.h>

Inheritance diagram for RakNet::CommandParserInterface:

List of all members.

Public Member Functions

 CommandParserInterface ()
virtual const char * GetName (void) const =0
virtual bool GetRegisteredCommand (const char *command, RegisteredCommand *rc)
virtual bool OnCommand (const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, const SystemAddress &systemAddress, const char *originalString)=0
 Given command with parameters parameterList , do whatever processing you wish.
virtual void OnConnectionLost (const SystemAddress &systemAddress, TransportInterface *transport)
 A callback for when systemAddress has disconnected, either gracefully or forcefully.
virtual void OnNewIncomingConnection (const SystemAddress &systemAddress, TransportInterface *transport)
 A callback for when systemAddress has connected to us.
virtual void OnTransportChange (TransportInterface *transport)
 This is called every time transport interface is registered.
virtual void RegisterCommand (unsigned char parameterCount, const char *command, const char *commandHelp)
virtual void ReturnResult (const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
 Just writes a string to the remote system when you are calling a function that has no return value.
virtual void ReturnResult (int res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
virtual void ReturnResult (SystemAddress res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
virtual void ReturnResult (char *res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
virtual void ReturnResult (bool res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
 Just writes a string to the remote system based on the result ( res ) of your operation.
virtual void SendCommandList (TransportInterface *transport, const SystemAddress &systemAddress)
virtual void SendHelp (TransportInterface *transport, const SystemAddress &systemAddress)=0
 A callback for when you are expected to send a brief description of your parser to systemAddress.
virtual ~CommandParserInterface ()

Static Public Member Functions

static void ParseConsoleString (char *str, const char delineator, unsigned char delineatorToggle, unsigned *numParameters, char **parameterList, unsigned parameterListLength)

Static Public Attributes

static const unsigned char VARIABLE_NUMBER_OF_PARAMETERS

Protected Attributes

DataStructures::OrderedList
< const char
*, RegisteredCommand,
RegisteredCommandComp > 
commandList

Detailed Description

CommandParserInterface provides a set of functions and interfaces that plug into the ConsoleServer class. Each CommandParserInterface works at the same time as other interfaces in the system.

Definition at line 38 of file CommandParserInterface.h.


Constructor & Destructor Documentation

RakNet::CommandParserInterface::CommandParserInterface ( )
virtual RakNet::CommandParserInterface::~CommandParserInterface ( ) [virtual]

Member Function Documentation

virtual const char* RakNet::CommandParserInterface::GetName ( void  ) const [pure virtual]

You are responsible for overriding this function and returning a static string, which will identifier your parser. This should return a static string

Returns:
The name that you return.

Implemented in RakNet::LogCommandParser, and RakNet::RakNetCommandParser.

virtual bool RakNet::CommandParserInterface::GetRegisteredCommand ( const char *  command,
RegisteredCommand rc 
) [virtual]
virtual bool RakNet::CommandParserInterface::OnCommand ( const char *  command,
unsigned  numParameters,
char **  parameterList,
TransportInterface transport,
const SystemAddress systemAddress,
const char *  originalString 
) [pure virtual]
Parameters:
[in]commandThe command to process
[in]numParametersHow many parameters were passed along with the command
[in]parameterListThe list of parameters. parameterList[0] is the first parameter and so on.
[in]transportThe transport interface we can use to write to
[in]systemAddressThe player that sent this command.
[in]originalStringThe string that was actually sent over the network, in case you want to do your own parsing

Implemented in RakNet::LogCommandParser, and RakNet::RakNetCommandParser.

virtual void RakNet::CommandParserInterface::OnConnectionLost ( const SystemAddress systemAddress,
TransportInterface transport 
) [virtual]
Parameters:
[in]systemAddressThe player that has disconnected.
[in]transportThe transport interface that sent us this information.

Reimplemented in RakNet::LogCommandParser.

virtual void RakNet::CommandParserInterface::OnNewIncomingConnection ( const SystemAddress systemAddress,
TransportInterface transport 
) [virtual]
Parameters:
[in]systemAddressThe player that has connected.
[in]transportThe transport interface that sent us this information. Can be used to send messages to this or other players.

Reimplemented in RakNet::LogCommandParser.

virtual void RakNet::CommandParserInterface::OnTransportChange ( TransportInterface transport) [virtual]

If you want to save a copy of the TransportInterface pointer This is the place to do it

Parameters:
[in]transportThe new TransportInterface

Reimplemented in RakNet::LogCommandParser.

static void RakNet::CommandParserInterface::ParseConsoleString ( char *  str,
const char  delineator,
unsigned char  delineatorToggle,
unsigned *  numParameters,
char **  parameterList,
unsigned  parameterListLength 
) [static]
virtual void RakNet::CommandParserInterface::RegisterCommand ( unsigned char  parameterCount,
const char *  command,
const char *  commandHelp 
) [virtual]

Registers a command.

Parameters:
[in]parameterCountHow many parameters your command requires. If you want to accept a variable number of commands, pass CommandParserInterface::VARIABLE_NUMBER_OF_PARAMETERS
[in]commandA pointer to a STATIC string that has your command. I keep a copy of the pointer here so don't deallocate the string.
[in]commandHelpA pointer to a STATIC string that has the help information for your command. I keep a copy of the pointer here so don't deallocate the string.
virtual void RakNet::CommandParserInterface::ReturnResult ( char *  res,
const char *  command,
TransportInterface transport,
const SystemAddress systemAddress 
) [virtual]
virtual void RakNet::CommandParserInterface::ReturnResult ( const char *  command,
TransportInterface transport,
const SystemAddress systemAddress 
) [virtual]

This is not necessary to call, but makes it easier to return results of function calls.

Parameters:
[in]resThe result to write
[in]commandThe command that this result came from
[in]transportThe transport interface that will be written to
[in]systemAddressThe player this result will be sent to
virtual void RakNet::CommandParserInterface::ReturnResult ( SystemAddress  res,
const char *  command,
TransportInterface transport,
const SystemAddress systemAddress 
) [virtual]
virtual void RakNet::CommandParserInterface::ReturnResult ( int  res,
const char *  command,
TransportInterface transport,
const SystemAddress systemAddress 
) [virtual]
virtual void RakNet::CommandParserInterface::ReturnResult ( bool  res,
const char *  command,
TransportInterface transport,
const SystemAddress systemAddress 
) [virtual]

This is not necessary to call, but makes it easier to return results of function calls.

Parameters:
[in]resThe result to write
[in]commandThe command that this result came from
[in]transportThe transport interface that will be written to
[in]systemAddressThe player this result will be sent to
virtual void RakNet::CommandParserInterface::SendCommandList ( TransportInterface transport,
const SystemAddress systemAddress 
) [virtual]
virtual void RakNet::CommandParserInterface::SendHelp ( TransportInterface transport,
const SystemAddress systemAddress 
) [pure virtual]
Parameters:
[in]transportThe transport interface we can use to write to
[in]systemAddressThe player that requested help.

Implemented in RakNet::LogCommandParser, and RakNet::RakNetCommandParser.


Member Data Documentation

Definition at line 134 of file CommandParserInterface.h.

Definition at line 102 of file CommandParserInterface.h.


The documentation for this class was generated from the following file:

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net