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
Public Member Functions | List of all members
SLNet::TransportInterface Class Referenceabstract

Defines an interface that is used to send and receive null-terminated strings. More...

`#include <slikenet/TransportInterface.h>`

Inheritance diagram for SLNet::TransportInterface:

## Public Member Functions

| TransportInterface ()
virtual | ~TransportInterface ()
virtual bool | Start (unsigned short port, bool serverMode)=0
virtual void | Stop (void)=0
| Stop the transport provider. You can clear memory and shutdown threads here.
virtual void | Send (SystemAddress systemAddress, const char *data,...)=0
virtual void | CloseConnection (SystemAddress systemAddress)=0
virtual Packet * | Receive (void)=0
virtual void | DeallocatePacket (Packet *packet)=0
virtual SystemAddress | HasNewIncomingConnection (void)=0
virtual SystemAddress | HasLostConnection (void)=0
virtual CommandParserInterface * | GetCommandParser (void)=0

## Detailed Description

Defines an interface that is used to send and receive null-terminated strings.

In practice this is only used by the CommandParser system for for servers.

Definition at line 39 of file TransportInterface.h.

## Constructor & Destructor Documentation

SLNet::TransportInterface::TransportInterface | ( |  | ) |

inline

Definition at line 42 of file TransportInterface.h.

virtual SLNet::TransportInterface::~TransportInterface | ( |  | ) |

inlinevirtual

Definition at line 43 of file TransportInterface.h.

## Member Function Documentation

virtual void SLNet::TransportInterface::CloseConnection | ( | SystemAddress | systemAddress | ) |

pure virtual

Disconnect systemAddress . The binary address and port defines the SystemAddress structure.

Parameters

  [in] | systemAddress | The player/address to disconnect

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

virtual void SLNet::TransportInterface::DeallocatePacket | ( | Packet * | packet | ) |

pure virtual

Deallocate the Packet structure returned by Receive

Parameters

  [in] | The | packet to deallocate

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

virtual CommandParserInterface* SLNet::TransportInterface::GetCommandParser | ( | void |  | ) |

pure virtual

Your transport provider can itself have command parsers if the transport layer has user-modifiable features For example, your transport layer may have a password which you want remote users to be able to set or you may want to allow remote users to turn on or off command echo

Returns
  0 if you do not need a command parser - otherwise the desired derivation of CommandParserInterface

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

virtual SystemAddress SLNet::TransportInterface::HasLostConnection | ( | void |  | ) |

pure virtual

If a system loses the connection, you should queue that event and return the systemAddress/address of that player in this function.

Returns
  The SystemAddress/address of the system

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

virtual SystemAddress SLNet::TransportInterface::HasNewIncomingConnection | ( | void |  | ) |

pure virtual

If a new system connects to you, you should queue that event and return the systemAddress/address of that player in this function.

Returns
  The SystemAddress/address of the system

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

virtual Packet* SLNet::TransportInterface::Receive | ( | void |  | ) |

pure virtual

Return a string. The string should be allocated and written to Packet::data . The byte length should be written to Packet::length . The player/address should be written to Packet::systemAddress If your transport protocol adds special formatting to the data stream you should parse it out before returning it in the packet and thus only return a string in Packet::data

Returns
  The packet structure containing the result of Receive, or 0 if no data is available

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

virtual void SLNet::TransportInterface::Send | ( | SystemAddress | systemAddress,
|  | const char * | data,
|  |  | ...
| ) |  |

pure virtual

Send a null-terminated string to systemAddress If your transport method requires particular formatting of the outgoing data (e.g. you don't just send strings) you can do it here and parse it out in Receive().

Parameters

  [in] | systemAddress | The player to send the string to
  [in] | data | format specifier - same as RAKNET_DEBUG_PRINTF
  [in] | ... | format specification arguments - same as RAKNET_DEBUG_PRINTF

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

Referenced by SLNet::CommandParserInterface::ReturnResult(), and SLNet::CommandParserInterface::SendCommandList().

virtual bool SLNet::TransportInterface::Start | ( | unsigned short | port,
|  | bool | serverMode
| ) |  |

pure virtual

Start the transport provider on the indicated port.

Parameters

  [in] | port | The port to start the transport provider on
  [in] | serverMode | If true, you should allow incoming connections (I don't actually use this anywhere)

Returns
  Return true on success, false on failure.

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

virtual void SLNet::TransportInterface::Stop | ( | void |  | ) |

pure virtual

Stop the transport provider. You can clear memory and shutdown threads here.

Implemented in SLNet::RakNetTransport2, and SLNet::TelnetTransport.

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

- Source/include/slikenet/TransportInterface.h