-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClientNetwork.hpp
49 lines (37 loc) · 1.37 KB
/
ClientNetwork.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef CLIENTNETWORK_HPP
#define CLIENTNETWORK_HPP
#define ROOM_LIVE_TIME 50000
#include <omnetpp.h>
#include <map>
#include <string>
#include "libraries/Client.hpp"
using namespace omnetpp;
class ClientNetwork : public cSimpleModule
{
public:
ClientNetwork();
protected:
Client * client;
int timeToLive;
int personalRoomId; // Used to create unique room ids
int personalMessageId; // Used to create unique message ids
double stopEventTime;
double createRoomMinTime, createRoomMaxTime, createRoomProbability,
sendMessageMinTime, sendMessageMaxTime, sendMessageProbability,
resendCreationTime,
askMessagesMinTime, askMessagesMaxTime,
deleteRoomMinTime, deleteRoomMaxTime, deleteRoomProbability;
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
virtual void sendToAll(cMessage *msg) = 0;
virtual void forward(cMessage *msg) = 0;
void handleUserEvent(cMessage *msg);
void handleEvent_RoomCreation();
void handleEvent_SendMessage();
void handleEvent_ResendCreation();
void handleEvent_AskMessages();
void handleEvent_deleteFirstRoom();
void handleReceivedMessage(cMessage *msg);
void forwardMessage(cMessage *msg);
};
#endif // CLIENTNETWORK_HPP