53 void initializeApp(
int stage);
56 void handleTimerEvent(cMessage *msg);
71 publicIdentifier.createFromHash(
"Triggers 0");
74 os <<
"Triggers " << myIndex;
76 myIdentifier.createFromHash(os.str());
77 insertTrigger(myIdentifier);
80 handShakeTimer =
new cMessage(
"handshake timer");
81 scheduleAt(simTime() + 5, handShakeTimer);
83 sendPacketTimer =
new cMessage(
"packet timer");
84 scheduleAt(simTime() + 10, sendPacketTimer);
90 if (msg == handShakeTimer) {
97 sendPacket(publicIdentifier, msg);
98 getParentModule()->bubble(
"Started handshake");
100 }
else if (msg == sendPacketTimer) {
105 sendPacket(privateIdentifier, msg);
108 sendPacketTimer =
new cMessage(
"packet timer");
109 scheduleAt(simTime() + 5, sendPacketTimer);
111 getParentModule()->bubble(
"Sending packet");
128 getParentModule()->bubble(
"Got handshake!");
138 insertTrigger(privateId);
145 clients[privateId] = client;
156 getParentModule()->bubble(
"Got normal message!");
163 sendPacket(client.
clientId, newMsg);
171 getParentModule()->bubble(
"Finished handshaking!");
175 WATCH(privateIdentifier);
181 getParentModule()->bubble(
"Got packet - Got my id!");
183 getParentModule()->bubble(
"Got packet - Got an unknown id");