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

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# LogCommandParser Class Reference

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

`#include <LogCommandParser.h>`

Inheritance diagram for LogCommandParser:

List of all members.

## Public Member Functions
bool | OnCommand (const char *command, unsigned numParameters, char **parameterList, TransportInterface *transport, PlayerID playerId, const char *originalString)
char * | GetName (void) const
void | SendHelp (TransportInterface *transport, PlayerID playerId)
void | AddChannel (const char *channelName)
void | WriteLog (const char *channelName, const char *format,...)
void | OnNewIncomingConnection (PlayerID playerId, TransportInterface *transport)
void | OnConnectionLost (PlayerID playerId, TransportInterface *transport)
void | OnTransportChange (TransportInterface *transport)
## Protected Member Functions
void | PrintChannels (PlayerID playerId, TransportInterface *transport) const
unsigned | Unsubscribe (PlayerID playerId, const char *channelName)
unsigned | Subscribe (PlayerID playerId, const char *channelName)
unsigned | GetChannelIndexFromName (const char *channelName)
## Protected Attributes
DataStructures::List< PlayerIDAndChannel > | 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.
## Classes
struct | PlayerIDAndChannel
| One of these structures is created per player. More...

## Detailed Description

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

## Member Function Documentation

void LogCommandParser::AddChannel | ( | const char * | channelName | ) |

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

unsigned 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

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

bool LogCommandParser::OnCommand | ( | const char * | command,
|  | unsigned | numParameters,
|  | char ** | parameterList,
|  | TransportInterface * | transport,
|  | PlayerID | playerId,
|  | 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]` | playerId | 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 CommandParserInterface.

void LogCommandParser::OnConnectionLost | ( | PlayerID | playerId,
|  | TransportInterface * | transport
| ) | `[virtual]`

  | A callback for when playerId has disconnected, either gracefully or forcefully Parameters:
  `[in]` | playerId | The player that has disconnected.
  `[in]` | transport | The transport interface that sent us this information.
Reimplemented from CommandParserInterface.

void LogCommandParser::OnNewIncomingConnection | ( | PlayerID | playerId,
|  | TransportInterface * | transport
| ) | `[virtual]`

  | A callback for when playerId has connected to us. Parameters:
  `[in]` | playerId | 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 CommandParserInterface.

void 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 CommandParserInterface.

void LogCommandParser::PrintChannels | ( | PlayerID | playerId,
|  | TransportInterface * | transport
| ) | const`[protected]`

  | Sends the currently active channels to the user Parameters:
  `[in]` | playerId | The player to send to
  `[in]` | transport | The transport interface to use to send the channels

void LogCommandParser::SendHelp | ( | TransportInterface * | transport,
|  | PlayerID | playerId
| ) | `[virtual]`

  | A callback for when you are expected to send a brief description of your parser to playerId Parameters:
  `[in]` | transport | The transport interface we can use to write to
  `[in]` | playerId | The player that requested help.
Implements CommandParserInterface.

unsigned LogCommandParser::Subscribe | ( | PlayerID | playerId,
|  | const char * | channelName
| ) | `[protected]`

  | Subscribe a user to a channel (or to all channels) Parameters:
  `[in]` | playerId | The player to subscribe to
  `[in]` | channelName | If 0, then subscribe from all channels. Otherwise subscribe to the named channel

unsigned LogCommandParser::Unsubscribe | ( | PlayerID | playerId,
|  | const char * | channelName
| ) | `[protected]`

  | Unsubscribe a user from a channel (or from all channels) Parameters:
  `[in]` | playerId | The player to unsubscribe to
  `[in]` | channelName | If 0, then unsubscribe from all channels. Otherwise unsubscribe from the named channel

void 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 printf()
  `[in]` | ... | Same as printf()

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

- C:/RakNet 2.518/Include/LogCommandParser.h
- C:/RakNet 2.518/Source/LogCommandParser.cpp