Last change
on this file since 68d94de 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
|
Line | |
---|
1 | #ifndef _MESSAGE_PROCESSOR_H
|
---|
2 | #define _MESSAGE_PROCESSOR_H
|
---|
3 |
|
---|
4 | #include <map>
|
---|
5 |
|
---|
6 | #include "MessageContainer.h"
|
---|
7 |
|
---|
8 | using namespace std;
|
---|
9 |
|
---|
10 | class MessageProcessor {
|
---|
11 | private:
|
---|
12 | int sock;
|
---|
13 | ofstream* outputLog;
|
---|
14 | int lastUsedId;
|
---|
15 |
|
---|
16 | // map from message ids to maps from player addresses to message info
|
---|
17 | map<unsigned int, map<unsigned long, MessageContainer> > sentMessages;
|
---|
18 |
|
---|
19 | // map from player address to map from message id to time accked
|
---|
20 | map<unsigned long, map<unsigned int, unsigned long long> > ackedMessages;
|
---|
21 |
|
---|
22 | //unsigned long pid;
|
---|
23 |
|
---|
24 | public:
|
---|
25 | MessageProcessor();
|
---|
26 | MessageProcessor(int sock, ofstream* outputLog = NULL);
|
---|
27 | ~MessageProcessor();
|
---|
28 |
|
---|
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();
|
---|
33 |
|
---|
34 | map<unsigned int, map<unsigned long, MessageContainer> >& getSentMessages();
|
---|
35 | map<unsigned long, map<unsigned int, unsigned long long> >& getAckedMessages();
|
---|
36 | };
|
---|
37 |
|
---|
38 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.