source:
network-game/common/MessageProcessor.h@
1df6bec
Last change on this file since 1df6bec was 46d6469, checked in by , 11 years ago | |
---|---|
|
|
File size: 751 bytes |
Rev | Line | |
---|---|---|
[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] | 8 | using namespace std; |
[5a64bea] | 9 | |
[46d6469] | 10 | class MessageProcessor { |
11 | private: | |
12 | int lastUsedId; | |
[1a3c42d] | 13 | |
[46d6469] | 14 | // map from message ids to maps from player addresses to message info |
15 | map<int, map<unsigned long, MessageContainer> > sentMessages; | |
[1a3c42d] | 16 | |
[46d6469] | 17 | // map from message ids to the time each mesage was acked |
18 | map<unsigned int, unsigned long long> ackedMessages; | |
19 | ||
20 | unsigned long pid; | |
[5a64bea] | 21 | |
[1a3c42d] | 22 | public: |
[5a64bea] | 23 | MessageProcessor(); |
24 | ~MessageProcessor(); | |
25 | ||
[1a3c42d] | 26 | int sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest); |
27 | int receiveMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest); | |
[5a64bea] | 28 | void resendUnackedMessages(int sock); |
[1a3c42d] | 29 | void cleanAckedMessages(); |
30 | }; | |
31 | ||
32 | #endif |
Note:
See TracBrowser
for help on using the repository browser.