Main Page Modules Namespaces C++ Classes Compound List File List Index
TNL: Zap::GameNetInterface Class Reference

# Zap::GameNetInterface Class Reference

`#include <gameNetInterface.h>`

Inheritance diagram for Zap::GameNetInterface:

## Public Types

enum | PacketType { Ping = FirstValidInfoPacketId, PingResponse, Query, QueryResponse
}
| PacketType is encoded as the first byte of each packet. More...

## Public Member Functions

| GameNetInterface (const Address &bindAddress, Game *theGame)
void | handleInfoPacket (const Address &remoteAddress, U8 packetType, BitStream *stream)
| Handles all packets that don't fall into the category of connection handshake or game data.
void | sendPing (const Address &theAddress, const Nonce &clientNonce)
void | sendQuery (const Address &theAddress, const Nonce &clientNonce, U32 identityToken)
void | processPacket (const Address &sourceAddress, BitStream *pStream)
| Processes a single packet, and dispatches either to handleInfoPacket or to the NetConnection associated with the remote address.
void | banHost (const Address &bannedAddress, U32 bannedMilliseconds)
void | checkBanlistTimeouts (U32 timeElapsed)
bool | isHostBanned (const Address &theAddress)

## Private Types

typedef NetInterface | Parent

## Private Attributes

Game * | mGame
Vector< BannedHost > | mBanList

## Data Structures

struct | BannedHost

## Member Typedef Documentation

typedef NetInterface Zap::GameNetInterface::Parent`[private]`

## Member Enumeration Documentation

enum Zap::GameNetInterface::PacketType

PacketType is encoded as the first byte of each packet.

Subclasses of NetInterface can add custom, non-connected data packet types starting at FirstValidInfoPacketId, and overriding handleInfoPacket to process them.

Packets that arrive with the high bit of the first byte set (i.e. the first unsigned byte is greater than 127), are assumed to be connected protocol packets, and are dispatched to the appropriate connection for further processing.

Enumerator:

  Ping |
  PingResponse |
  Query |
  QueryResponse |

Reimplemented from TNL::NetInterface.

## Constructor & Destructor Documentation

Zap::GameNetInterface::GameNetInterface | ( | const Address & | bindAddress,
|  | Game * | theGame |
| ) |  |  |

## Member Function Documentation

void Zap::GameNetInterface::handleInfoPacket | ( | const Address & | address,
|  | U8 | packetType,
|  | BitStream * | stream |
| ) |  |  | `[virtual]`

Handles all packets that don't fall into the category of connection handshake or game data.

Reimplemented from TNL::NetInterface.

void Zap::GameNetInterface::sendPing | ( | const Address & | theAddress,
|  | const Nonce & | clientNonce |
| ) |  |  |

void Zap::GameNetInterface::sendQuery | ( | const Address & | theAddress,
|  | const Nonce & | clientNonce,
|  | U32 | identityToken |
| ) |  |  |

void Zap::GameNetInterface::processPacket | ( | const Address & | address,
|  | BitStream * | packetStream |
| ) |  |  | `[virtual]`

Processes a single packet, and dispatches either to handleInfoPacket or to the NetConnection associated with the remote address.

Reimplemented from TNL::NetInterface.

void Zap::GameNetInterface::banHost | ( | const Address & | bannedAddress,
|  | U32 | bannedMilliseconds |
| ) |  |  |

void Zap::GameNetInterface::checkBanlistTimeouts | ( | U32 | timeElapsed | ) |

bool Zap::GameNetInterface::isHostBanned | ( | const Address & | theAddress | ) |

## Field Documentation

Game* Zap::GameNetInterface::mGame`[private]`

Vector<BannedHost> Zap::GameNetInterface::mBanList`[private]`