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

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

Support for logging to a textfile

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