diff options
author | Aaron Marks <nymacro@gmail.com> | 2005-07-17 03:18:31 +0000 |
---|---|---|
committer | Aaron Marks <nymacro@gmail.com> | 2005-07-17 03:18:31 +0000 |
commit | 98f41d64a9a1628dd132b356487415762b1409a8 (patch) | |
tree | c2e784d778c0285f589d555f6acb4395485bb406 /src/netcomputer.h | |
parent | 49bc551cc81f23c6e5243e1ddb0ddf6d0159c544 (diff) | |
download | manaserv-98f41d64a9a1628dd132b356487415762b1409a8.tar.gz manaserv-98f41d64a9a1628dd132b356487415762b1409a8.tar.bz2 manaserv-98f41d64a9a1628dd132b356487415762b1409a8.tar.xz manaserv-98f41d64a9a1628dd132b356487415762b1409a8.zip |
Added server->client communications.
Updated MessageHandler's to use short for message type.
Diffstat (limited to 'src/netcomputer.h')
-rw-r--r-- | src/netcomputer.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/netcomputer.h b/src/netcomputer.h index 1a73d675..046c2a69 100644 --- a/src/netcomputer.h +++ b/src/netcomputer.h @@ -27,6 +27,8 @@ #include "packet.h" #include <SDL_net.h> #include <string> +#include <queue> +#include <list> // Forward declaration class ConnectionHandler; @@ -44,6 +46,11 @@ class NetComputer NetComputer(ConnectionHandler *handler); /** + * Destructor + */ + ~NetComputer(); + + /** * Returns <code>true</code> if this computer is disconnected. */ bool isDisconnected(); @@ -54,17 +61,29 @@ class NetComputer void disconnect(const std::string &reason); /** - * Sends a packet to this computer. - * + * Queues (FIFO) a packet for sending to a client. + * * Note: When we'd want to allow communication through UDP, we could * introduce the reliable argument, which would cause a UDP message * to be sent when set to false. */ - void send(Packet *p); + void send(const Packet *p); //void send(Packet *p, bool reliable = true); + /** + * Get next message + */ + Packet *front(); + + /** + * Number of messages in queue + */ + unsigned int size() { return queue.size(); } + private: ConnectionHandler *handler; + + std::queue<Packet*> queue; /**< Message Queue (FIFO) */ }; #endif |