forked from inet-framework/inet
-
Notifications
You must be signed in to change notification settings - Fork 7
/
__CPACKET_PATCH
4187 lines (3802 loc) · 147 KB
/
__CPACKET_PATCH
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Index: src/applications/tcpapp/TCPSessionApp.cc
===================================================================
--- src/applications/tcpapp/TCPSessionApp.cc (revision 2038)
+++ src/applications/tcpapp/TCPSessionApp.cc (working copy)
@@ -54,7 +54,7 @@
}
}
-void TCPSessionApp::count(cMessage *msg)
+void TCPSessionApp::count(cPacket *msg)
{
if (msg->getKind()==TCP_I_DATA || msg->getKind()==TCP_I_URGENT_DATA)
{
@@ -77,7 +77,7 @@
cMessage *msg=NULL;
while ((msg=receive())!=timeoutMsg)
{
- count(msg);
+//FIXME ??? PK() or if (isPacket) ? count(msg);
socket.processMessage(msg);
}
delete timeoutMsg;
@@ -138,7 +138,7 @@
{
waitUntil(tSend);
EV << "sending " << sendBytes << " bytes\n";
- cMessage *msg = new cMessage("data1");
+ cPacket *msg = new cPacket("data1");
msg->setByteLength(sendBytes);
socket.send(msg);
}
@@ -146,7 +146,7 @@
{
waitUntil(i->tSend);
EV << "sending " << i->numBytes << " bytes\n";
- cMessage *msg = new cMessage("data1");
+ cPacket *msg = new cPacket("data1");
msg->setByteLength(i->numBytes);
socket.send(msg);
}
@@ -164,7 +164,7 @@
for (;;)
{
cMessage *msg = receive();
- count(msg);
+ count(PK(msg));
socket.processMessage(msg);
}
}
Index: src/applications/tcpapp/TCPSessionApp.h
===================================================================
--- src/applications/tcpapp/TCPSessionApp.h (revision 2038)
+++ src/applications/tcpapp/TCPSessionApp.h (working copy)
@@ -46,7 +46,7 @@
protected:
virtual void parseScript(const char *script);
virtual void waitUntil(simtime_t t);
- virtual void count(cMessage *msg);
+ virtual void count(cPacket *msg);
virtual void activity();
virtual void finish();
Index: src/applications/tcpapp/TelnetApp.h
===================================================================
--- src/applications/tcpapp/TelnetApp.h (revision 2038)
+++ src/applications/tcpapp/TelnetApp.h (working copy)
@@ -42,7 +42,7 @@
virtual void socketEstablished(int connId, void *yourPtr);
/** Redefined. */
- virtual void socketDataArrived(int connId, void *yourPtr, cMessage *msg, bool urgent);
+ virtual void socketDataArrived(int connId, void *yourPtr, cPacket *msg, bool urgent);
/** Redefined to start another session after a delay. */
virtual void socketClosed(int connId, void *yourPtr);
Index: src/applications/tcpapp/TCPSinkApp.cc
===================================================================
--- src/applications/tcpapp/TCPSinkApp.cc (revision 2038)
+++ src/applications/tcpapp/TCPSinkApp.cc (working copy)
@@ -43,7 +43,7 @@
}
else if (msg->getKind()==TCP_I_DATA || msg->getKind()==TCP_I_URGENT_DATA)
{
- bytesRcvd += msg->getByteLength();
+ bytesRcvd += PK(msg)->getByteLength();
delete msg;
if (ev.isGUI())
Index: src/applications/tcpapp/TCPGenericSrvApp.cc
===================================================================
--- src/applications/tcpapp/TCPGenericSrvApp.cc (revision 2038)
+++ src/applications/tcpapp/TCPGenericSrvApp.cc (working copy)
@@ -1,3 +1,4 @@
+#if 0 //XXX
//
// Copyright 2004 Andras Varga
//
@@ -143,4 +144,4 @@
recordScalar("bytes sent", bytesSent);
recordScalar("bytes rcvd", bytesRcvd);
}
-
+#endif 0 //XXX
Index: src/applications/tcpapp/TCPSrvHostApp.h
===================================================================
--- src/applications/tcpapp/TCPSrvHostApp.h (revision 2038)
+++ src/applications/tcpapp/TCPSrvHostApp.h (working copy)
@@ -58,7 +58,7 @@
protected:
// internal: TCPSocket::CallbackInterface methods
- virtual void socketDataArrived(int, void *, cMessage *msg, bool urgent) {dataArrived(msg,urgent);}
+ virtual void socketDataArrived(int, void *, cPacket *msg, bool urgent) {dataArrived(msg,urgent);}
virtual void socketEstablished(int, void *) {established();}
virtual void socketPeerClosed(int, void *) {peerClosed();}
virtual void socketClosed(int, void *) {closed();}
Index: src/applications/tcpapp/TCPEchoApp.h
===================================================================
--- src/applications/tcpapp/TCPEchoApp.h (revision 2038)
+++ src/applications/tcpapp/TCPEchoApp.h (working copy)
@@ -33,7 +33,7 @@
long bytesSent;
protected:
- virtual void sendOrSchedule(cMessage *msg);
+ virtual void sendDown(cMessage *msg);
protected:
virtual void initialize();
Index: src/applications/tcpapp/TCPBasicClientApp.h
===================================================================
--- src/applications/tcpapp/TCPBasicClientApp.h (revision 2038)
+++ src/applications/tcpapp/TCPBasicClientApp.h (working copy)
@@ -46,7 +46,7 @@
virtual void socketEstablished(int connId, void *yourPtr);
/** Redefined. */
- virtual void socketDataArrived(int connId, void *yourPtr, cMessage *msg, bool urgent);
+ virtual void socketDataArrived(int connId, void *yourPtr, cPacket *msg, bool urgent);
/** Redefined to start another session after a delay. */
virtual void socketClosed(int connId, void *yourPtr);
Index: src/applications/tcpapp/TelnetApp.cc
===================================================================
--- src/applications/tcpapp/TelnetApp.cc (revision 2038)
+++ src/applications/tcpapp/TelnetApp.cc (working copy)
@@ -95,7 +95,7 @@
scheduleAt(simTime()+(simtime_t)par("thinkTime"), timeoutMsg);
}
-void TelnetApp::socketDataArrived(int connId, void *ptr, cMessage *msg, bool urgent)
+void TelnetApp::socketDataArrived(int connId, void *ptr, cPacket *msg, bool urgent)
{
int len = msg->getByteLength();
TCPGenericCliAppBase::socketDataArrived(connId, ptr, msg, urgent);
Index: src/applications/tcpapp/TCPGenericSrvThread.cc
===================================================================
--- src/applications/tcpapp/TCPGenericSrvThread.cc (revision 2038)
+++ src/applications/tcpapp/TCPGenericSrvThread.cc (working copy)
@@ -46,13 +46,13 @@
if (requestedBytes==0)
{
- delete msg;
+ delete appmsg;
}
else
{
- msg->setByteLength(requestedBytes);
- delete msg->removeControlInfo();
- getSocket()->send(msg);
+ appmsg->setByteLength(requestedBytes);
+ delete appmsg->removeControlInfo();
+ getSocket()->send(appmsg);
}
if (doClose)
Index: src/applications/tcpapp/TCPGenericCliAppBase.cc
===================================================================
--- src/applications/tcpapp/TCPGenericCliAppBase.cc (revision 2038)
+++ src/applications/tcpapp/TCPGenericCliAppBase.cc (working copy)
@@ -98,7 +98,7 @@
setStatusString("connected");
}
-void TCPGenericCliAppBase::socketDataArrived(int, void *, cMessage *msg, bool)
+void TCPGenericCliAppBase::socketDataArrived(int, void *, cPacket *msg, bool)
{
// *redefine* to perform or schedule next sending
packetsRcvd++;
Index: src/applications/tcpapp/TCPGenericCliAppBase.h
===================================================================
--- src/applications/tcpapp/TCPGenericCliAppBase.h (revision 2038)
+++ src/applications/tcpapp/TCPGenericCliAppBase.h (working copy)
@@ -85,7 +85,7 @@
* Does nothing but update statistics/status. Redefine to perform or schedule next sending.
* Beware: this funcion deletes the incoming message, which might not be what you want.
*/
- virtual void socketDataArrived(int connId, void *yourPtr, cMessage *msg, bool urgent);
+ virtual void socketDataArrived(int connId, void *yourPtr, cPacket *msg, bool urgent);
/** Since remote TCP closed, invokes close(). Redefine if you want to do something else. */
virtual void socketPeerClosed(int connId, void *yourPtr);
Index: src/applications/tcpapp/GenericAppMsg.msg
===================================================================
--- src/applications/tcpapp/GenericAppMsg.msg (revision 2038)
+++ src/applications/tcpapp/GenericAppMsg.msg (working copy)
@@ -34,7 +34,7 @@
//
// @see TCPGenericSrvApp, TCPGenericCliAppBase (C++ only)
//
-message GenericAppMsg
+packet GenericAppMsg
{
int expectedReplyLength; // in bytes
double replyDelay; // reply after this many seconds
Index: src/applications/tcpapp/TCPEchoApp.cc
===================================================================
--- src/applications/tcpapp/TCPEchoApp.cc (revision 2038)
+++ src/applications/tcpapp/TCPEchoApp.cc (working copy)
@@ -36,54 +36,55 @@
socket.listen();
}
-void TCPEchoApp::sendOrSchedule(cMessage *msg)
+void TCPEchoApp::sendDown(cMessage *msg)
{
- if (delay==0)
- {
- bytesSent += msg->getByteLength();
- send(msg, "tcpOut");
- }
- else
- {
- scheduleAt(simTime()+delay, msg);
- }
+ if (msg->isPacket())
+ bytesSent += ((cPacket *)msg)->getByteLength();
+ send(msg, "tcpOut");
}
void TCPEchoApp::handleMessage(cMessage *msg)
{
if (msg->isSelfMessage())
{
- bytesSent += msg->getByteLength();
- send(msg, "tcpOut");
+ sendDown(msg);
}
else if (msg->getKind()==TCP_I_PEER_CLOSED)
{
// we'll close too
msg->setKind(TCP_C_CLOSE);
- sendOrSchedule(msg);
+ if (delay==0)
+ sendDown(msg);
+ else
+ scheduleAt(simTime()+delay, msg); // send after a delay
}
else if (msg->getKind()==TCP_I_DATA || msg->getKind()==TCP_I_URGENT_DATA)
{
- bytesRcvd += msg->getByteLength();
+ cPacket *pkt = check_and_cast<cPacket *>(msg);
+ bytesRcvd += pkt->getByteLength();
+
if (echoFactor==0)
{
- delete msg;
+ delete pkt;
}
else
{
// reverse direction, modify length, and send it back
- msg->setKind(TCP_C_SEND);
- TCPCommand *ind = check_and_cast<TCPCommand *>(msg->removeControlInfo());
+ pkt->setKind(TCP_C_SEND);
+ TCPCommand *ind = check_and_cast<TCPCommand *>(pkt->removeControlInfo());
TCPSendCommand *cmd = new TCPSendCommand();
cmd->setConnId(ind->getConnId());
- msg->setControlInfo(cmd);
+ pkt->setControlInfo(cmd);
delete ind;
- long byteLen = msg->getByteLength()*echoFactor;
+ long byteLen = pkt->getByteLength()*echoFactor;
if (byteLen<1) byteLen=1;
- msg->setByteLength(byteLen);
+ pkt->setByteLength(byteLen);
- sendOrSchedule(msg);
+ if (delay==0)
+ sendDown(pkt);
+ else
+ scheduleAt(simTime()+delay, pkt); // send after a delay
}
}
else
Index: src/applications/tcpapp/TCPBasicClientApp.cc
===================================================================
--- src/applications/tcpapp/TCPBasicClientApp.cc (revision 2038)
+++ src/applications/tcpapp/TCPBasicClientApp.cc (working copy)
@@ -96,7 +96,7 @@
numRequestsToSend--;
}
-void TCPBasicClientApp::socketDataArrived(int connId, void *ptr, cMessage *msg, bool urgent)
+void TCPBasicClientApp::socketDataArrived(int connId, void *ptr, cPacket *msg, bool urgent)
{
TCPGenericCliAppBase::socketDataArrived(connId, ptr, msg, urgent);
Index: src/applications/udpapp/UDPBasicApp.cc
===================================================================
--- src/applications/udpapp/UDPBasicApp.cc (revision 2038)
+++ src/applications/udpapp/UDPBasicApp.cc (working copy)
@@ -67,19 +67,19 @@
}
-cMessage *UDPBasicApp::createPacket()
+cPacket *UDPBasicApp::createPacket()
{
char msgName[32];
sprintf(msgName,"UDPBasicAppData-%d", counter++);
- cMessage *payload = new cMessage(msgName);
+ cPacket *payload = new cPacket(msgName);
payload->setByteLength(msgByteLength);
return payload;
}
void UDPBasicApp::sendPacket()
{
- cMessage *payload = createPacket();
+ cPacket *payload = createPacket();
IPvXAddress destAddr = chooseDestAddr();
sendToUDP(payload, localPort, destAddr, destPort);
@@ -97,7 +97,7 @@
else
{
// process incoming packet
- processPacket(msg);
+ processPacket(PK(msg));
}
if (ev.isGUI())
@@ -109,7 +109,7 @@
}
-void UDPBasicApp::processPacket(cMessage *msg)
+void UDPBasicApp::processPacket(cPacket *msg)
{
EV << "Received packet: ";
printPacket(msg);
Index: src/applications/udpapp/UDPBasicApp.h
===================================================================
--- src/applications/udpapp/UDPBasicApp.h (revision 2038)
+++ src/applications/udpapp/UDPBasicApp.h (working copy)
@@ -44,9 +44,9 @@
// chooses random destination address
virtual IPvXAddress chooseDestAddr();
- virtual cMessage *createPacket();
+ virtual cPacket *createPacket();
virtual void sendPacket();
- virtual void processPacket(cMessage *msg);
+ virtual void processPacket(cPacket *msg);
protected:
virtual int numInitStages() const {return 4;}
Index: src/applications/udpapp/UDPEchoAppMsg.msg
===================================================================
--- src/applications/udpapp/UDPEchoAppMsg.msg (revision 2038)
+++ src/applications/udpapp/UDPEchoAppMsg.msg (working copy)
@@ -20,7 +20,7 @@
//
// Message class used by UDPEchoApp.
//
-message UDPEchoAppMsg
+packet UDPEchoAppMsg
{
bool isRequest = true;
}
Index: src/applications/udpapp/UDPSink.cc
===================================================================
--- src/applications/udpapp/UDPSink.cc (revision 2038)
+++ src/applications/udpapp/UDPSink.cc (working copy)
@@ -38,7 +38,7 @@
void UDPSink::handleMessage(cMessage *msg)
{
- processPacket(msg);
+ processPacket(PK(msg));
if (ev.isGUI())
{
@@ -49,7 +49,7 @@
}
-void UDPSink::processPacket(cMessage *msg)
+void UDPSink::processPacket(cPacket *msg)
{
EV << "Received packet: ";
printPacket(msg);
Index: src/applications/udpapp/UDPSink.h
===================================================================
--- src/applications/udpapp/UDPSink.h (revision 2038)
+++ src/applications/udpapp/UDPSink.h (working copy)
@@ -34,7 +34,7 @@
int numReceived;
protected:
- virtual void processPacket(cMessage *msg);
+ virtual void processPacket(cPacket *msg);
protected:
virtual void initialize();
Index: src/applications/udpapp/UDPVideoStreamCli.cc
===================================================================
--- src/applications/udpapp/UDPVideoStreamCli.cc (revision 2038)
+++ src/applications/udpapp/UDPVideoStreamCli.cc (working copy)
@@ -50,7 +50,7 @@
}
else
{
- receiveStream(msg);
+ receiveStream(PK(msg));
}
}
@@ -70,11 +70,11 @@
bindToPort(localPort);
- cMessage *msg = new cMessage("VideoStrmReq");
+ cPacket *msg = new cPacket("VideoStrmReq");
sendToUDP(msg, localPort, svrAddr, svrPort);
}
-void UDPVideoStreamCli::receiveStream(cMessage* msg)
+void UDPVideoStreamCli::receiveStream(cPacket *msg)
{
EV << "Video stream packet:\n";
printPacket(msg);
Index: src/applications/udpapp/UDPAppBase.cc
===================================================================
--- src/applications/udpapp/UDPAppBase.cc (revision 2038)
+++ src/applications/udpapp/UDPAppBase.cc (working copy)
@@ -36,7 +36,7 @@
send(msg, "udpOut");
}
-void UDPAppBase::sendToUDP(cMessage *msg, int srcPort, const IPvXAddress& destAddr, int destPort)
+void UDPAppBase::sendToUDP(cPacket *msg, int srcPort, const IPvXAddress& destAddr, int destPort)
{
// send message to UDP, with the appropriate control info attached
msg->setKind(UDP_C_DATA);
@@ -53,7 +53,7 @@
send(msg, "udpOut");
}
-void UDPAppBase::printPacket(cMessage *msg)
+void UDPAppBase::printPacket(cPacket *msg)
{
UDPControlInfo *ctrl = check_and_cast<UDPControlInfo *>(msg->getControlInfo());
Index: src/applications/udpapp/UDPVideoStreamCli.h
===================================================================
--- src/applications/udpapp/UDPVideoStreamCli.h (revision 2038)
+++ src/applications/udpapp/UDPVideoStreamCli.h (working copy)
@@ -44,12 +44,12 @@
//@{
virtual void initialize();
virtual void finish();
- virtual void handleMessage(cMessage* msg);
+ virtual void handleMessage(cMessage *msg);
//@}
protected:
virtual void requestStream();
- virtual void receiveStream(cMessage* msg);
+ virtual void receiveStream(cPacket *msg);
};
Index: src/applications/udpapp/UDPAppBase.h
===================================================================
--- src/applications/udpapp/UDPAppBase.h (revision 2038)
+++ src/applications/udpapp/UDPAppBase.h (working copy)
@@ -39,13 +39,13 @@
/**
* Sends a packet over UDP
*/
- virtual void sendToUDP(cMessage *msg, int srcPort, const IPvXAddress& destAddr, int destPort);
+ virtual void sendToUDP(cPacket *msg, int srcPort, const IPvXAddress& destAddr, int destPort);
/**
* Prints a brief about packets having an attached UDPControlInfo
* (i.e. those which just arrived from UDP, or about to be send to UDP).
*/
- virtual void printPacket(cMessage *msg);
+ virtual void printPacket(cPacket *msg);
};
Index: src/applications/udpapp/UDPVideoStreamSvr.cc
===================================================================
--- src/applications/udpapp/UDPVideoStreamSvr.cc (revision 2038)
+++ src/applications/udpapp/UDPVideoStreamSvr.cc (working copy)
@@ -108,7 +108,7 @@
VideoStreamData *d = (VideoStreamData *) timer->getContextPointer();
// generate and send a packet
- cMessage *pkt = new cMessage("VideoStrmPk");
+ cPacket *pkt = new cPacket("VideoStrmPk");
long pktLen = packetLen->longValue();
if (pktLen > d->bytesLeft)
pktLen = d->bytesLeft;
Index: src/applications/udpapp/UDPEchoApp.cc
===================================================================
--- src/applications/udpapp/UDPEchoApp.cc (revision 2038)
+++ src/applications/udpapp/UDPEchoApp.cc (working copy)
@@ -39,18 +39,18 @@
{
}
-cMessage *UDPEchoApp::createPacket()
+cPacket *UDPEchoApp::createPacket()
{
char msgName[32];
sprintf(msgName,"UDPEcho-%d", counter++);
- cMessage *message = new UDPEchoAppMsg(msgName);
+ UDPEchoAppMsg *message = new UDPEchoAppMsg(msgName);
message->setByteLength(msgByteLength);
return message;
}
-void UDPEchoApp::processPacket(cMessage *msg)
+void UDPEchoApp::processPacket(cPacket *msg)
{
UDPEchoAppMsg *packet = check_and_cast<UDPEchoAppMsg *>(msg);
Index: src/applications/udpapp/UDPEchoApp.h
===================================================================
--- src/applications/udpapp/UDPEchoApp.h (revision 2038)
+++ src/applications/udpapp/UDPEchoApp.h (working copy)
@@ -31,8 +31,8 @@
class UDPEchoApp : public UDPBasicApp
{
protected:
- virtual cMessage *createPacket();
- virtual void processPacket(cMessage *msg);
+ virtual cPacket *createPacket();
+ virtual void processPacket(cPacket *msg);
protected:
virtual void initialize(int stage);
Index: src/applications/generic/IPTrafGen.cc
===================================================================
--- src/applications/generic/IPTrafGen.cc (revision 2038)
+++ src/applications/generic/IPTrafGen.cc (working copy)
@@ -36,7 +36,7 @@
void IPTrafSink::handleMessage(cMessage *msg)
{
- processPacket(msg);
+ processPacket(check_and_cast<cPacket *>(msg));
if (ev.isGUI())
{
@@ -47,7 +47,7 @@
}
-void IPTrafSink::printPacket(cMessage *msg)
+void IPTrafSink::printPacket(cPacket *msg)
{
IPvXAddress src, dest;
int protocol = -1;
@@ -72,7 +72,7 @@
ev << "src: " << src << " dest: " << dest << " protocol=" << protocol << "\n";
}
-void IPTrafSink::processPacket(cMessage *msg)
+void IPTrafSink::processPacket(cPacket *msg)
{
EV << "Received packet: ";
printPacket(msg);
@@ -133,7 +133,7 @@
char msgName[32];
sprintf(msgName,"appData-%d", counter++);
- cMessage *payload = new cMessage(msgName);
+ cPacket *payload = new cPacket(msgName);
payload->setByteLength(msgByteLength);
IPvXAddress destAddr = chooseDestAddr();
@@ -179,7 +179,7 @@
else
{
// process incoming packet
- processPacket(msg);
+ processPacket(PK(msg));
}
if (ev.isGUI())
Index: src/applications/generic/IPTrafGen.h
===================================================================
--- src/applications/generic/IPTrafGen.h (revision 2038)
+++ src/applications/generic/IPTrafGen.h (working copy)
@@ -35,8 +35,8 @@
protected:
int numReceived;
- virtual void printPacket(cMessage *msg);
- virtual void processPacket(cMessage *msg);
+ virtual void printPacket(cPacket *msg);
+ virtual void processPacket(cPacket *msg);
protected:
virtual void initialize();
Index: src/applications/ethernet/EtherApp.msg
===================================================================
--- src/applications/ethernet/EtherApp.msg (revision 2038)
+++ src/applications/ethernet/EtherApp.msg (working copy)
@@ -29,7 +29,7 @@
// sent back as response; if this value is greater than ~1400, the reply
// will consist of several Ethernet frames. See also EtherAppResp.
//
-message EtherAppReq
+packet EtherAppReq
{
long requestId;
long responseBytes;
@@ -38,7 +38,7 @@
//
// Packet sent back by EtherAppSrv in response to an EtherAppReq.
//
-message EtherAppResp
+packet EtherAppResp
{
int requestId;
int numFrames;
Index: src/applications/pingapp/PingPayload.msg
===================================================================
--- src/applications/pingapp/PingPayload.msg (revision 2038)
+++ src/applications/pingapp/PingPayload.msg (working copy)
@@ -26,7 +26,7 @@
//
// Represents payload in an ICMP/ICMPv6 Echo Request/Reply.
//
-message PingPayload
+packet PingPayload
{
long originatorId; // sender module id
long seqNo; // sequence number
Index: src/networklayer/ldp/LDP.cc
===================================================================
--- src/networklayer/ldp/LDP.cc (revision 2038)
+++ src/networklayer/ldp/LDP.cc (working copy)
@@ -587,7 +587,7 @@
// FIXME start LDP session setup (if we're on the active side?)
}
-void LDP::socketDataArrived(int, void *yourPtr, cMessage *msg, bool)
+void LDP::socketDataArrived(int, void *yourPtr, cPacket *msg, bool)
{
peer_info& peer = myPeers[(long)yourPtr];
EV << "Message arrived over TCP from peer " << peer.peerIP << "\n";
Index: src/networklayer/ldp/LDP.h
===================================================================
--- src/networklayer/ldp/LDP.h (revision 2038)
+++ src/networklayer/ldp/LDP.h (working copy)
@@ -198,7 +198,7 @@
/** @name TCPSocket::CallbackInterface callback methods */
//@{
virtual void socketEstablished(int connId, void *yourPtr);
- virtual void socketDataArrived(int connId, void *yourPtr, cMessage *msg, bool urgent);
+ virtual void socketDataArrived(int connId, void *yourPtr, cPacket *msg, bool urgent);
virtual void socketPeerClosed(int connId, void *yourPtr);
virtual void socketClosed(int connId, void *yourPtr);
virtual void socketFailure(int connId, void *yourPtr, int code);
Index: src/networklayer/ldp/LDPPacket.msg
===================================================================
--- src/networklayer/ldp/LDPPacket.msg (revision 2038)
+++ src/networklayer/ldp/LDPPacket.msg (working copy)
@@ -59,7 +59,7 @@
//
// Base class for LDP packets
//
-message LDPPacket
+packet LDPPacket
{
int type;
IPAddress senderAddress;
@@ -70,7 +70,7 @@
//
// LDP Label Mapping Message
//
-message LDPLabelMapping extends LDPPacket
+packet LDPLabelMapping extends LDPPacket
{
FEC_TLV fec;
int label;
@@ -79,7 +79,7 @@
//
// LDP Label Request Message
//
-message LDPLabelRequest extends LDPPacket
+packet LDPLabelRequest extends LDPPacket
{
FEC_TLV fec;
}
@@ -88,7 +88,7 @@
//
// LDP Hello Message
//
-message LDPHello extends LDPPacket
+packet LDPHello extends LDPPacket
{
double holdTime;
bool tbit;
@@ -98,7 +98,7 @@
//
// LDP notification message
//
-message LDPNotify extends LDPPacket
+packet LDPNotify extends LDPPacket
{
int status;
FEC_TLV fec;
@@ -108,7 +108,7 @@
// LDP Ini Message
//
//# FIXME currently unused
-message LDPIni extends LDPPacket
+packet LDPIni extends LDPPacket
{
double keepAliveTime;
bool abit;
@@ -121,7 +121,7 @@
// LDP Address Message
//
//# FIXME currently unused
-message LDPAddress extends LDPPacket
+packet LDPAddress extends LDPPacket
{
bool isWithdraw;
string family;
Index: src/networklayer/ospfv2/OSPFPacket.msg
===================================================================
--- src/networklayer/ospfv2/OSPFPacket.msg (revision 2038)
+++ src/networklayer/ospfv2/OSPFPacket.msg (working copy)
@@ -48,7 +48,7 @@
//
// Represents an OSPF packet header
//
-message OSPFPacket
+packet OSPFPacket
{
char version = 2;
char type enum(OSPFPacketType) = HelloPacket;
@@ -65,7 +65,7 @@
//
// Represents an OSPF Hello packet
//
-message OSPFHelloPacket extends OSPFPacket
+packet OSPFHelloPacket extends OSPFPacket
{
IPAddress networkMask;
@@ -220,7 +220,7 @@
//
// Represents an OSPF Database Description packet
//
-message OSPFDatabaseDescriptionPacket extends OSPFPacket
+packet OSPFDatabaseDescriptionPacket extends OSPFPacket
{
unsigned short interfaceMTU;
OSPFOptions options;
@@ -239,7 +239,7 @@
//
// Represents an OSPF Link State Request packet
//
-message OSPFLinkStateRequestPacket extends OSPFPacket
+packet OSPFLinkStateRequestPacket extends OSPFPacket
{
LSARequest requests[];
}
@@ -247,7 +247,7 @@
//
// Represents an OSPF Link State Update packet
//
-message OSPFLinkStateUpdatePacket extends OSPFPacket
+packet OSPFLinkStateUpdatePacket extends OSPFPacket
{
unsigned long numberOfLSAs;
OSPFRouterLSA routerLSAs[];
@@ -259,7 +259,7 @@
//
// Represents an OSPF Link State Acknowledgement packet
//
-message OSPFLinkStateAcknowledgementPacket extends OSPFPacket
+packet OSPFLinkStateAcknowledgementPacket extends OSPFPacket
{
OSPFLSAHeader lsaHeaders[];
}
Index: src/networklayer/ospfv2/OSPFTimer.msg
===================================================================
--- src/networklayer/ospfv2/OSPFTimer.msg (revision 2038)
+++ src/networklayer/ospfv2/OSPFTimer.msg (working copy)
@@ -32,7 +32,7 @@
//
// Represents an OSPF Timer
//
-message OSPFTimer extends cMessage
+packet OSPFTimer extends cMessage
{
char timerKind enum(OSPFTimerType) = InterfaceHelloTimer;
}
Index: src/networklayer/arp/ARPPacket.msg
===================================================================
--- src/networklayer/arp/ARPPacket.msg (revision 2038)
+++ src/networklayer/arp/ARPPacket.msg (working copy)
@@ -54,7 +54,7 @@
// - hardware address length (6)
// - protocol address length (4)
//
-message ARPPacket
+packet ARPPacket
{
int opcode enum(ARPOpcode);
MACAddress srcMACAddress;
Index: src/networklayer/ipv4/ICMPMessage.msg
===================================================================
--- src/networklayer/ipv4/ICMPMessage.msg (revision 2038)
+++ src/networklayer/ipv4/ICMPMessage.msg (working copy)
@@ -78,7 +78,7 @@
//
// ICMP message class
//
-message ICMPMessage
+packet ICMPMessage
{
int type enum(ICMPType);
int code;
Index: src/networklayer/ipv4/IP.cc
===================================================================
--- src/networklayer/ipv4/IP.cc (revision 2038)
+++ src/networklayer/ipv4/IP.cc (working copy)
@@ -73,7 +73,7 @@
{
if (msg->getArrivalGate()->isName("transportIn"))
{
- handleMessageFromHL(msg);
+ handleMessageFromHL(PK(msg));
}
else if (dynamic_cast<ARPPacket *>(msg))
{
@@ -90,7 +90,7 @@
updateDisplayString();
}
-InterfaceEntry *IP::getSourceInterfaceFrom(cMessage *msg)
+InterfaceEntry *IP::getSourceInterfaceFrom(cPacket *msg)
{
cGate *g = msg->getArrivalGate();
return g ? ift->getInterfaceByNetworkLayerGateIndex(g->getIndex()) : NULL;
@@ -171,7 +171,7 @@
}
}
-void IP::handleMessageFromHL(cMessage *msg)
+void IP::handleMessageFromHL(cPacket *msg)
{
// if no interface exists, do not send datagram
if (ift->getNumInterfaces() == 0)
@@ -388,7 +388,7 @@
// decapsulate and send on appropriate output gate
int protocol = datagram->getTransportProtocol();
- cMessage *packet = decapsulateIP(datagram);
+ cPacket *packet = decapsulateIP(datagram);
if (protocol==IP_PROT_ICMP)
{
@@ -407,11 +407,11 @@
}
}
-cMessage *IP::decapsulateIP(IPDatagram *datagram)
+cPacket *IP::decapsulateIP(IPDatagram *datagram)
{
// decapsulate transport packet
InterfaceEntry *fromIE = getSourceInterfaceFrom(datagram);
- cMessage *packet = datagram->decapsulate();
+ cPacket *packet = datagram->decapsulate();
// create and fill in control info
IPControlInfo *controlInfo = new IPControlInfo();
@@ -493,7 +493,7 @@
}
-IPDatagram *IP::encapsulate(cMessage *transportPacket, InterfaceEntry *&destIE)
+IPDatagram *IP::encapsulate(cPacket *transportPacket, InterfaceEntry *&destIE)
{
IPControlInfo *controlInfo = check_and_cast<IPControlInfo*>(transportPacket->removeControlInfo());
IPDatagram *datagram = encapsulate(transportPacket, destIE, controlInfo);
@@ -501,7 +501,7 @@
return datagram;
}
-IPDatagram *IP::encapsulate(cMessage *transportPacket, InterfaceEntry *&destIE, IPControlInfo *controlInfo)
+IPDatagram *IP::encapsulate(cPacket *transportPacket, InterfaceEntry *&destIE, IPControlInfo *controlInfo)
{
IPDatagram *datagram = createIPDatagram(transportPacket->getName());
datagram->setByteLength(IP_HEADER_BYTES);
Index: src/networklayer/ipv4/IP.h
===================================================================
--- src/networklayer/ipv4/IP.h (revision 2038)
+++ src/networklayer/ipv4/IP.h (working copy)
@@ -68,7 +68,7 @@
protected:
// utility: look up interface from getArrivalGate()
- virtual InterfaceEntry *getSourceInterfaceFrom(cMessage *msg);
+ virtual InterfaceEntry *getSourceInterfaceFrom(cPacket *msg);
// utility: show current statistics above the icon
virtual void updateDisplayString();
@@ -77,14 +77,14 @@
* Encapsulate packet coming from higher layers into IPDatagram, using
* the control info attached to the packet.
*/
- virtual IPDatagram *encapsulate(cMessage *transportPacket, InterfaceEntry *&destIE);
+ virtual IPDatagram *encapsulate(cPacket *transportPacket, InterfaceEntry *&destIE);
/**
* Encapsulate packet coming from higher layers into IPDatagram, using
* the given control info. Override if you subclassed controlInfo and/or
* want to add options etc to the datagram.
*/
- virtual IPDatagram *encapsulate(cMessage *transportPacket, InterfaceEntry *&destIE, IPControlInfo *controlInfo);
+ virtual IPDatagram *encapsulate(cPacket *transportPacket, InterfaceEntry *&destIE, IPControlInfo *controlInfo);
/**
* Creates a blank IP datagram. Override when subclassing IPDatagram is needed
@@ -101,7 +101,7 @@
* Handle messages (typically packets to be send in IP) from transport or ICMP.
* Invokes encapsulate(), then routePacket().
*/
- virtual void handleMessageFromHL(cMessage *msg);
+ virtual void handleMessageFromHL(cPacket *msg);
/**
* Handle incoming ARP packets by sending them over "queueOut" to ARP.
@@ -135,7 +135,7 @@
/**
* Decapsulate and return encapsulated packet after attaching IPControlInfo.
*/
- virtual cMessage *decapsulateIP(IPDatagram *datagram);
+ virtual cPacket *decapsulateIP(IPDatagram *datagram);
/**
* Fragment packet if needed, then send it to the selected interface using
Index: src/networklayer/ipv4/IPDatagram.msg
===================================================================
--- src/networklayer/ipv4/IPDatagram.msg (revision 2038)
+++ src/networklayer/ipv4/IPDatagram.msg (working copy)
@@ -126,7 +126,7 @@
//
// Only only one of the option fields can exist at a time.
//
-message IPDatagram
+packet IPDatagram
{
short version = 4;
short headerLength = IP_HEADER_BYTES;
Index: src/networklayer/ipv4/ControlManetRouting.msg
===================================================================
--- src/networklayer/ipv4/ControlManetRouting.msg (revision 2038)
+++ src/networklayer/ipv4/ControlManetRouting.msg (working copy)
@@ -35,7 +35,7 @@
//
// ICMP message class
//
-message ControlManetRouting
+packet ControlManetRouting
{
IPAddress srcAddress;
IPAddress destAddress;
Index: src/networklayer/ipv4/ICMP.cc
===================================================================
--- src/networklayer/ipv4/ICMP.cc (revision 2038)
+++ src/networklayer/ipv4/ICMP.cc (working copy)