SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::LogCommandParser Class Reference

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

`#include <slikenet/LogCommandParser.h>`

Inheritance diagram for SLNet::LogCommandParser:

## Classes

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

## Public Member Functions

| LogCommandParser ()
| ~LogCommandParser ()
bool | OnCommand (const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, const SystemAddress &systemAddress, const char *originalString)
const char * | GetName (void) const
void | SendHelp (TransportInterface *transport, const SystemAddress &systemAddress)
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.
void | WriteLog (const char *channelName, const char *format,...)
void | OnNewIncomingConnection (const SystemAddress &systemAddress, TransportInterface *transport)
void | OnConnectionLost (const SystemAddress &systemAddress, TransportInterface *transport)
void | OnTransportChange (TransportInterface *transport)
Public Member Functions inherited from SLNet::CommandParserInterface
| CommandParserInterface ()
virtual | ~CommandParserInterface ()
virtual bool | GetRegisteredCommand (const char *command, RegisteredCommand *rc)
virtual void | SendCommandList (TransportInterface *transport, const SystemAddress &systemAddress)
virtual void | RegisterCommand (unsigned char parameterCount, const char *command, const char *commandHelp)
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 | ReturnResult (char *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 (int res, const char *command, TransportInterface *transport, const SystemAddress &systemAddress)
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.

## Protected Member Functions

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

## Protected Attributes

DataStructures::List < SystemAddressAndChannel > | remoteUsers
| The list of remote users. Added to when users subscribe, removed when they disconnect or unsubscribe.
const char * | channelNames [32]
| Names of the channels at each bit, or 0 for an unused channel.
TransportInterface * | trans
| This is so I can save the current transport provider, solely so I can use it without having the user pass it to Log.
Protected Attributes inherited from SLNet::CommandParserInterface
DataStructures::OrderedList < const char *, RegisteredCommand, RegisteredCommandComp > | commandList

## Additional Inherited Members

Static Public Member Functions inherited from SLNet::CommandParserInterface
static void | ParseConsoleString (char *str, const char delineator, unsigned char delineatorToggle, unsigned *numParameters, char **parameterList, unsigned parameterListLength)
Static Public Attributes inherited from SLNet::CommandParserInterface
static const unsigned char | VARIABLE_NUMBER_OF_PARAMETERS =255

## Detailed Description

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

Definition at line 35 of file LogCommandParser.h.

## Class Documentation

struct SLNet::LogCommandParser::SystemAddressAndChannel

One of these structures is created per player.

Definition at line 109 of file LogCommandParser.h.

Class Members
unsigned | channels | Bitwise representations of the channels subscribed to. If bit 0 is set, then we subscribe to channelNames[0] and so on.
SystemAddress | systemAddress | The ID of the player.

## Constructor & Destructor Documentation

SLNet::LogCommandParser::LogCommandParser | ( |  | ) |

SLNet::LogCommandParser::~LogCommandParser | ( |  | ) |

## Member Function Documentation

void SLNet::LogCommandParser::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.

Parameters

  [in] | channelName | A persistent string naming the channel. Don't deallocate this string.

unsigned SLNet::LogCommandParser::GetChannelIndexFromName | ( | const char * | channelName | ) |

protected

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

Parameters

  [in] | channelName | The name of the channel

const char* SLNet::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 SLNet::CommandParserInterface.

bool SLNet::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] | command | The command to process
  [in] | numParameters | How many parameters were passed along with the command
  [in] | parameterList | The list of parameters. parameterList[0] is the first parameter and so on.
  [in] | transport | The transport interface we can use to write to
  [in] | systemAddress | The player that sent this command.
  [in] | originalString | The string that was actually sent over the network, in case you want to do your own parsing

Implements SLNet::CommandParserInterface.

void SLNet::LogCommandParser::OnConnectionLost | ( | const SystemAddress & | systemAddress,
|  | TransportInterface * | transport
| ) |  |

virtual

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

Parameters

  [in] | systemAddress | The player that has disconnected.
  [in] | transport | The transport interface that sent us this information.

Reimplemented from SLNet::CommandParserInterface.

void SLNet::LogCommandParser::OnNewIncomingConnection | ( | const SystemAddress & | systemAddress,
|  | TransportInterface * | transport
| ) |  |

virtual

A callback for when systemAddress has connected to us.

Parameters

  [in] | systemAddress | The player that has connected.
  [in] | transport | The transport interface that sent us this information. Can be used to send messages to this or other players.

Reimplemented from SLNet::CommandParserInterface.

void SLNet::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] | transport | The new TransportInterface

Reimplemented from SLNet::CommandParserInterface.

void SLNet::LogCommandParser::PrintChannels | ( | const SystemAddress & | systemAddress,
|  | TransportInterface * | transport
| ) |  | const

protected

Sends the currently active channels to the user

Parameters

  [in] | systemAddress | The player to send to
  [in] | transport | The transport interface to use to send the channels

void SLNet::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] | transport | The transport interface we can use to write to
  [in] | systemAddress | The player that requested help.

Implements SLNet::CommandParserInterface.

unsigned SLNet::LogCommandParser::Subscribe | ( | const SystemAddress & | systemAddress,
|  | const char * | channelName
| ) |  |

protected

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

Parameters

  [in] | systemAddress | The player to subscribe to
  [in] | channelName | If 0, then subscribe from all channels. Otherwise subscribe to the named channel

unsigned SLNet::LogCommandParser::Unsubscribe | ( | const SystemAddress & | systemAddress,
|  | const char * | channelName
| ) |  |

protected

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

Parameters

  [in] | systemAddress | The player to unsubscribe to
  [in] | channelName | If 0, then unsubscribe from all channels. Otherwise unsubscribe from the named channel

void SLNet::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] | format | Same as RAKNET_DEBUG_PRINTF()
  [in] | ... | Same as RAKNET_DEBUG_PRINTF()

## Member Data Documentation

const char* SLNet::LogCommandParser::channelNames[32]

protected

Names of the channels at each bit, or 0 for an unused channel.

Definition at line 122 of file LogCommandParser.h.

DataStructures::List<SystemAddressAndChannel> SLNet::LogCommandParser::remoteUsers

protected

The list of remote users. Added to when users subscribe, removed when they disconnect or unsubscribe.

Definition at line 119 of file LogCommandParser.h.

TransportInterface* SLNet::LogCommandParser::trans

protected

This is so I can save the current transport provider, solely so I can use it without having the user pass it to Log.

Definition at line 125 of file LogCommandParser.h.

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

- Source/include/slikenet/LogCommandParser.h