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

Adds the ability to send logging output to a remote console.

#include <LogCommandParser.h>

Inheritance diagram for RakNet::LogCommandParser:

List of all members.

Classes

struct  SystemAddressAndChannel
 One of these structures is created per player. More...

Public Member Functions

void AddChannel (const char *channelName)
 All logs must be associated with a channel. This is a filter so that remote clients only get logs for a system they care about.
const char * GetName (void) const
 LogCommandParser ()
bool OnCommand (const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, const SystemAddress &systemAddress, const char *originalString)
void OnConnectionLost (const SystemAddress &systemAddress, TransportInterface *transport)
void OnNewIncomingConnection (const SystemAddress &systemAddress, TransportInterface *transport)
void OnTransportChange (TransportInterface *transport)
void SendHelp (TransportInterface *transport, const SystemAddress &systemAddress)
void WriteLog (const char *channelName, const char *format,...)
 ~LogCommandParser ()

Static Public Member Functions

static void DestroyInstance (LogCommandParser *i)
static LogCommandParserGetInstance (void)

Protected Member Functions

unsigned GetChannelIndexFromName (const char *channelName)
void PrintChannels (const SystemAddress &systemAddress, TransportInterface *transport) const
unsigned Subscribe (const SystemAddress &systemAddress, const char *channelName)
unsigned Unsubscribe (const SystemAddress &systemAddress, const char *channelName)

Protected Attributes

const char * channelNames [32]
 Names of the channels at each bit, or 0 for an unused channel.
DataStructures::List
< SystemAddressAndChannel
remoteUsers
 The list of remote users. Added to when users subscribe, removed when they disconnect or unsubscribe.
TransportInterfacetrans
 This is so I can save the current transport provider, solely so I can use it without having the user pass it to Log.

Detailed Description

Definition at line 23 of file LogCommandParser.h.


Constructor & Destructor Documentation

RakNet::LogCommandParser::LogCommandParser ( )
RakNet::LogCommandParser::~LogCommandParser ( )

Member Function Documentation

void RakNet::LogCommandParser::AddChannel ( const char *  channelName)
Parameters:
[in]channelNameA persistent string naming the channel. Don't deallocate this string.
static void RakNet::LogCommandParser::DestroyInstance ( LogCommandParser i) [static]
unsigned RakNet::LogCommandParser::GetChannelIndexFromName ( const char *  channelName) [protected]

Given the name of a channel, return the index into channelNames where it is located

Parameters:
[in]channelNameThe name of the channel
static LogCommandParser* RakNet::LogCommandParser::GetInstance ( void  ) [static]
const char* RakNet::LogCommandParser::GetName ( void  ) const [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.

Implements RakNet::CommandParserInterface.

bool RakNet::LogCommandParser::OnCommand ( const char *  command,
unsigned  numParameters,
char **  parameterList,
TransportInterface transport,
const SystemAddress systemAddress,
const char *  originalString 
) [virtual]

Given command with parameters parameterList , do whatever processing you wish.

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

Implements RakNet::CommandParserInterface.

void RakNet::LogCommandParser::OnConnectionLost ( const SystemAddress systemAddress,
TransportInterface transport 
) [virtual]

A callback for when systemAddress has disconnected, either gracefully or forcefully

Parameters:
[in]systemAddressThe player that has disconnected.
[in]transportThe transport interface that sent us this information.

Reimplemented from RakNet::CommandParserInterface.

void RakNet::LogCommandParser::OnNewIncomingConnection ( const SystemAddress systemAddress,
TransportInterface transport 
) [virtual]

A callback for when systemAddress has connected to us.

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 from RakNet::CommandParserInterface.

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

This is called every time transport interface is registered. If you want to save a copy of the TransportInterface pointer This is the place to do it

Parameters:
[in]transportThe new TransportInterface

Reimplemented from RakNet::CommandParserInterface.

void RakNet::LogCommandParser::PrintChannels ( const SystemAddress systemAddress,
TransportInterface transport 
) const [protected]

Sends the currently active channels to the user

Parameters:
[in]systemAddressThe player to send to
[in]transportThe transport interface to use to send the channels
void RakNet::LogCommandParser::SendHelp ( TransportInterface transport,
const SystemAddress systemAddress 
) [virtual]

A callback for when you are expected to send a brief description of your parser to systemAddress

Parameters:
[in]transportThe transport interface we can use to write to
[in]systemAddressThe player that requested help.

Implements RakNet::CommandParserInterface.

unsigned RakNet::LogCommandParser::Subscribe ( const SystemAddress systemAddress,
const char *  channelName 
) [protected]

Subscribe a user to a channel (or to all channels)

Parameters:
[in]systemAddressThe player to subscribe to
[in]channelNameIf 0, then subscribe from all channels. Otherwise subscribe to the named channel
unsigned RakNet::LogCommandParser::Unsubscribe ( const SystemAddress systemAddress,
const char *  channelName 
) [protected]

Unsubscribe a user from a channel (or from all channels)

Parameters:
[in]systemAddressThe player to unsubscribe to
[in]channelNameIf 0, then unsubscribe from all channels. Otherwise unsubscribe from the named channel
void RakNet::LogCommandParser::WriteLog ( const char *  channelName,
const char *  format,
  ... 
)

Write a log to a channel. Logs are not buffered, so only remote consoles connected and subscribing at the time you write will get the output.

Parameters:
[in]formatSame as RAKNET_DEBUG_PRINTF()
[in]...Same as RAKNET_DEBUG_PRINTF()

Member Data Documentation

const char* RakNet::LogCommandParser::channelNames[32] [protected]

Definition at line 110 of file LogCommandParser.h.

Definition at line 107 of file LogCommandParser.h.

Definition at line 113 of file LogCommandParser.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