#include <serverframework.h>
Inheritance diagram for ServerFramework:
Public Member Functions | |
ServerFramework (int port) | |
~ServerFramework () | |
ServerData * | getDataObject (unsigned int objid) |
Return the object with the given id, or NULL if none exists. | |
void | registerPreSendingChain (const std::string &chainname, const std::vector< Plugin< ServerPacket > * > &stations) |
Register a chain of plugins used to process packets before they are added in the outqueue. | |
void | setPreSendingChain (const std::string &chainname) |
Set the current chain of plugins. | |
void | setDefaultPreSendingChain () |
Set the current chain of plugins to the default (no plugins used, strait to the outqueue). | |
void | purgeCurrentPreSendingChain () |
This method will "purge" the active presending chain. | |
void | setConnectionTimeout (unsigned int ct) |
Change the number of milliseconds that the server/clients will use to determine if a silent disconnect has occured. | |
virtual void | keepAlive (unsigned int sleepmillis=0) |
This will handle any incomming packets, along with other keep-alive-stuff. | |
virtual bool | isPacketReadyForDelivery (ServerPacket *packet) |
virtual ServerPacket * | deliverPacket (ServerPacket *packet) |
virtual void | addPendingAck (ServerPacket *packet, bool haslock) |
Called when we want to insert a pending ack into the pendingacklist. | |
virtual unsigned int | bufferedPackets () const |
Returns total count of packets buffered on all clients, due to deliver-in-order. | |
virtual void | sentReliablePacket (ServerPacket *packet) |
std::map< unsigned int, Client * > & | getAllClients () |
Get all the well registered clients. | |
const std::map< unsigned int, ServerData * > & | getServerDataObjects () const |
Get all server data objects. | |
void | enqueuePacket (ServerPacket *packet, const std::map< unsigned int, Client * > &clientlist) |
This method will copy the packet and enqueue a copy for each client. | |
void | enqueuePacket (ServerPacket *packet, Client *client) |
This method will just enqueue the packet for this single client. | |
void | start () |
Protected Member Functions | |
virtual bool | onInitialHandshake (ServerPacket *handshake, ServerPacket *reply)=0 |
virtual void | onClientConnected (Client *client)=0 |
This method will be invoked when a new client has passed the handshaking-phase. | |
virtual void | onClientDisconnected (Client *client)=0 |
This method will be invoked when a client has timed out. | |
virtual Client * | createClient (const ipaddress &addr, int port)=0 |
This method should return some dirivative of the Client-class. | |
virtual void | addPluginSequenceNumber (ServerPacket *packet) |
This method should add a sequence number to the pluginpacket if it does not already have one. | |
Friends | |
class | ServerData |
testserver/testserverframework.cpp, testserver/testserverframework.h, testserver/testserversnakebite.cpp, and testserver/testserversnakebite.h.
Definition at line 65 of file serverframework.h.
|
This method delivers all packets, and returns any buffered packets waiting for the packet. Implements Framework< ServerPacket, ipmsgserver >. Definition at line 386 of file serverframework.cpp. References ServerPacket::client, Framework< ServerPacket, ipmsgserver >::currentTimeMillis(), FrameworkPacket::getType(), Client::incrementNextIngoingSeqNo(), Framework< ServerPacket, ipmsgserver >::inqueue, Queue< PacketType >::insert(), FrameworkPacket::isReliable(), and Client::registerLastPacketReceivedTime(). |
|
This method will test if a packet is in order, and if not buffer the packet for later delivery. Implements Framework< ServerPacket, ipmsgserver >. Definition at line 413 of file serverframework.cpp. References ServerPacket::client, createClient(), FrameworkPacket::PeerStruct::host, FrameworkPacket::isHandshakeInitPacket(), Client::isPacketReadyForDelivery(), FrameworkPacket::peer, and FrameworkPacket::PeerStruct::port. |
|
This method should write it's reply in the reply-packet, and return true or false depending on wether it want's us to continue the handshaking. |
|
This method will be called by the sender when ever it successfully sends a reliable packet to the socket, we will look up the client and register this on him/her. Implements Framework< ServerPacket, ipmsgserver >. Definition at line 452 of file serverframework.cpp. |