source: network-game/common/MessageProcessor.h@ e0fd377

Last change on this file since e0fd377 was 68d94de, checked in by dportnoy <dmp1488@…>, 11 years ago

MessageProcessor now takes a socket and optional output log file as constructor arguments instead of accepting them as parameters in each method

  • Property mode set to 100644
File size: 1.0 KB
RevLine 
[1a3c42d]1#ifndef _MESSAGE_PROCESSOR_H
2#define _MESSAGE_PROCESSOR_H
3
[5a64bea]4#include <map>
5
[46d6469]6#include "MessageContainer.h"
[5a64bea]7
[46d6469]8using namespace std;
[5a64bea]9
[46d6469]10class MessageProcessor {
11private:
[68d94de]12 int sock;
13 ofstream* outputLog;
[46d6469]14 int lastUsedId;
[1a3c42d]15
[46d6469]16 // map from message ids to maps from player addresses to message info
[b35b2b2]17 map<unsigned int, map<unsigned long, MessageContainer> > sentMessages;
[1a3c42d]18
[f9cb9fb]19 // map from player address to map from message id to time accked
20 map<unsigned long, map<unsigned int, unsigned long long> > ackedMessages;
[46d6469]21
[68d94de]22 //unsigned long pid;
[5a64bea]23
[1a3c42d]24public:
[5a64bea]25 MessageProcessor();
[68d94de]26 MessageProcessor(int sock, ofstream* outputLog = NULL);
[5a64bea]27 ~MessageProcessor();
28
[68d94de]29 int sendMessage(NETWORK_MSG *msg, struct sockaddr_in *dest);
30 int receiveMessage(NETWORK_MSG *msg, struct sockaddr_in *source);
31 void resendUnackedMessages();
32 void cleanAckedMessages();
[b35b2b2]33
34 map<unsigned int, map<unsigned long, MessageContainer> >& getSentMessages();
[f9cb9fb]35 map<unsigned long, map<unsigned int, unsigned long long> >& getAckedMessages();
[1a3c42d]36};
37
38#endif
Note: See TracBrowser for help on using the repository browser.