-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphr.patch
More file actions
1996 lines (1972 loc) · 62.7 KB
/
phr.patch
File metadata and controls
1996 lines (1972 loc) · 62.7 KB
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
diff -Naur ns-allinone-2.35_orig/ns-2.35/common/packet.h ns-allinone-2.35/ns-2.35/common/packet.h
--- ns-allinone-2.35_orig/ns-2.35/common/packet.h 2020-07-24 19:47:50.905828092 +0300
+++ ns-allinone-2.35/ns-2.35/common/packet.h 2020-07-24 15:07:58.805298659 +0300
@@ -59,6 +59,7 @@
#define HDR_LL(p) (hdr_ll::access(p))
#define HDR_HDLC(p) ((hdr_hdlc *)hdr_ll::access(p))
#define HDR_IP(p) (hdr_ip::access(p))
+#define HDR PHR(p) (hdr phr::access(p))
#define HDR_RTP(p) (hdr_rtp::access(p))
#define HDR_TCP(p) (hdr_tcp::access(p))
#define HDR_SCTP(p) (hdr_sctp::access(p))
@@ -199,8 +200,10 @@
// M-DART packets
static const packet_t PT_MDART = 72;
- // insert new packet types here
-static packet_t PT_NTYPE = 73; // This MUST be the LAST one
+// PHR packet
+static const packet_t PT_PHR = 73;
+// insert new packet types here
+static packet_t PT_NTYPE = 74; // This MUST be the LAST one
enum packetClass
{
@@ -402,6 +405,8 @@
// AOMDV patch
name_[PT_AOMDV]= "AOMDV";
+ // PHR
+ name_[PT_PHR]="PHR";
// PUMA
name_[PT_PUMA]="PUMA";
diff -Naur ns-allinone-2.35_orig/ns-2.35/config.log ns-allinone-2.35/ns-2.35/config.log
--- ns-allinone-2.35_orig/ns-2.35/config.log 2020-07-24 19:47:50.749824686 +0300
+++ ns-allinone-2.35/ns-2.35/config.log 2020-07-24 18:50:22.090920026 +0300
@@ -27,7 +27,7 @@
/usr/bin/oslevel = unknown
/bin/universe = unknown
-PATH: /home/coaka/Documents/ns-original/ns-allinone-2.35/bin
+PATH: /home/coaka/Downloads/ns-allinone-2.35/bin
PATH: /home/coaka/bin
PATH: /home/coaka/.local/bin
PATH: /usr/local/sbin
@@ -804,8 +804,8 @@
configure:7959: result: yes
configure:7959: checking for fesetprecision
configure:7959: gcc-4.8 -o conftest -g -O2 conftest.c -lm >&5
-/tmp/ccDVoKMc.o: In function `main':
-/home/coaka/Documents/ns-original/ns-allinone-2.35/ns-2.35/conftest.c:83: undefined reference to `fesetprecision'
+/tmp/ccPk2ZlL.o: In function `main':
+/home/coaka/Downloads/ns-allinone-2.35/ns-2.35/conftest.c:83: undefined reference to `fesetprecision'
collect2: error: ld returned 1 exit status
configure:7959: $? = 1
configure: failed program was:
@@ -1893,8 +1893,8 @@
configure:8901: result: found
configure:8915: checking for addr2ascii
configure:8915: gcc-4.8 -o conftest -g -O2 -Wl,-export-dynamic conftest.c -lm >&5
-/tmp/ccXsrzQe.o: In function `main':
-/home/coaka/Documents/ns-original/ns-allinone-2.35/ns-2.35/conftest.c:94: undefined reference to `addr2ascii'
+/tmp/ccddOzdX.o: In function `main':
+/home/coaka/Downloads/ns-allinone-2.35/ns-2.35/conftest.c:94: undefined reference to `addr2ascii'
collect2: error: ld returned 1 exit status
configure:8915: $? = 1
configure: failed program was:
@@ -2114,14 +2114,14 @@
on coaka
-config.status:927: creating Makefile
-config.status:927: creating tcl/lib/ns-autoconf.tcl
-config.status:927: creating indep-utils/webtrace-conv/ucb/Makefile
-config.status:927: creating indep-utils/webtrace-conv/dec/Makefile
-config.status:927: creating indep-utils/webtrace-conv/nlanr/Makefile
-config.status:927: creating indep-utils/webtrace-conv/epa/Makefile
-config.status:927: creating indep-utils/cmu-scen-gen/setdest/Makefile
-config.status:927: creating autoconf.h
+config.status:926: creating Makefile
+config.status:926: creating tcl/lib/ns-autoconf.tcl
+config.status:926: creating indep-utils/webtrace-conv/ucb/Makefile
+config.status:926: creating indep-utils/webtrace-conv/dec/Makefile
+config.status:926: creating indep-utils/webtrace-conv/nlanr/Makefile
+config.status:926: creating indep-utils/webtrace-conv/epa/Makefile
+config.status:926: creating indep-utils/cmu-scen-gen/setdest/Makefile
+config.status:926: creating autoconf.h
## ---------------- ##
## Cache variables. ##
@@ -2271,16 +2271,16 @@
V_DEFINES='-DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_14 -DHAVE_OTCL_H -DHAVE_LIBTK8_5 -DHAVE_TK_H -DHAVE_LIBTCL8_5 -DHAVE_TCLINT_H -DHAVE_TCL_H '
V_IMPORT_LIBS=''
V_INCLUDE=''
-V_INCLUDES='-I/home/coaka/Documents/ns-original/ns-allinone-2.35/tclcl-1.20 -I/home/coaka/Documents/ns-original/ns-allinone-2.35/otcl-1.14 -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/usr/include/pcap'
+V_INCLUDES='-I/home/coaka/Downloads/ns-allinone-2.35/tclcl-1.20 -I/home/coaka/Downloads/ns-allinone-2.35/otcl-1.14 -I/home/coaka/Downloads/ns-allinone-2.35/include -I/home/coaka/Downloads/ns-allinone-2.35/include -I/home/coaka/Downloads/ns-allinone-2.35/include -I/usr/include/pcap'
V_INCLUDE_X11=''
V_LIB=' -lnsl -ldl'
V_LIBRARY_TCL='../lib/tcl8.5'
V_LIBRARY_TK='../lib/tk8.5'
-V_LIBS='-L/home/coaka/Documents/ns-original/ns-allinone-2.35/tclcl-1.20 -ltclcl -L/home/coaka/Documents/ns-original/ns-allinone-2.35/otcl-1.14 -lotcl -L/home/coaka/Documents/ns-original/ns-allinone-2.35/lib -ltk8.5 -L/home/coaka/Documents/ns-original/ns-allinone-2.35/lib -ltcl8.5'
-V_LIB_OTCL='-L/home/coaka/Documents/ns-original/ns-allinone-2.35/otcl-1.14 -lotcl'
-V_LIB_TCL='-L/home/coaka/Documents/ns-original/ns-allinone-2.35/lib -ltcl8.5'
-V_LIB_TCLCL='-L/home/coaka/Documents/ns-original/ns-allinone-2.35/tclcl-1.20 -ltclcl'
-V_LIB_TK='-L/home/coaka/Documents/ns-original/ns-allinone-2.35/lib -ltk8.5'
+V_LIBS='-L/home/coaka/Downloads/ns-allinone-2.35/tclcl-1.20 -ltclcl -L/home/coaka/Downloads/ns-allinone-2.35/otcl-1.14 -lotcl -L/home/coaka/Downloads/ns-allinone-2.35/lib -ltk8.5 -L/home/coaka/Downloads/ns-allinone-2.35/lib -ltcl8.5'
+V_LIB_OTCL='-L/home/coaka/Downloads/ns-allinone-2.35/otcl-1.14 -lotcl'
+V_LIB_TCL='-L/home/coaka/Downloads/ns-allinone-2.35/lib -ltcl8.5'
+V_LIB_TCLCL='-L/home/coaka/Downloads/ns-allinone-2.35/tclcl-1.20 -ltclcl'
+V_LIB_TK='-L/home/coaka/Downloads/ns-allinone-2.35/lib -ltk8.5'
V_LIB_X11='-lXext -lX11'
V_LSSCRIPT=''
V_NS_TCL_LIB_STL='$(NS_TCL_LIB_STL)'
@@ -2295,7 +2295,7 @@
V_TAR_EXTRA=''
V_TAR_TARGET='linux-gnu'
V_TCL2CPP='../tclcl-1.20/tcl2c++'
-V_TCLSH='/home/coaka/Documents/ns-original/ns-allinone-2.35/bin/tclsh8.5'
+V_TCLSH='/home/coaka/Downloads/ns-allinone-2.35/bin/tclsh8.5'
V_TCL_LIBRARY_FILES='$(TCL_BASE_LIBRARY_FILES) ../lib/tcl8.5/http1.0/http.tcl'
V_TKDOSNAMES='$(LIBRARY_TK)/optMenu.tcl $(LIBRARY_TK)/scrlbar.tcl'
ac_ct_CC='gcc-4.8'
diff -Naur ns-allinone-2.35_orig/ns-2.35/config.status ns-allinone-2.35/ns-2.35/config.status
--- ns-allinone-2.35_orig/ns-2.35/config.status 2020-07-24 19:47:50.897827918 +0300
+++ ns-allinone-2.35/ns-2.35/config.status 2020-07-24 18:50:21.754905181 +0300
@@ -445,7 +445,7 @@
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
-ac_pwd='/home/coaka/Documents/ns-original/ns-allinone-2.35/ns-2.35'
+ac_pwd='/home/coaka/Downloads/ns-allinone-2.35/ns-2.35'
srcdir='.'
INSTALL='/usr/bin/install -c'
test -n "$AWK" || AWK=awk
@@ -641,18 +641,17 @@
S["V_TAR_EXTRA"]=""
S["V_CCOPT"]=""
S["V_ALL"]=""
-S["V_LIB_TK"]="-L/home/coaka/Documents/ns-original/ns-allinone-2.35/lib -ltk8.5"
-S["V_LIB_TCL"]="-L/home/coaka/Documents/ns-original/ns-allinone-2.35/lib -ltcl8.5"
-S["V_LIB_OTCL"]="-L/home/coaka/Documents/ns-original/ns-allinone-2.35/otcl-1.14 -lotcl"
-S["V_LIB_TCLCL"]="-L/home/coaka/Documents/ns-original/ns-allinone-2.35/tclcl-1.20 -ltclcl"
+S["V_LIB_TK"]="-L/home/coaka/Downloads/ns-allinone-2.35/lib -ltk8.5"
+S["V_LIB_TCL"]="-L/home/coaka/Downloads/ns-allinone-2.35/lib -ltcl8.5"
+S["V_LIB_OTCL"]="-L/home/coaka/Downloads/ns-allinone-2.35/otcl-1.14 -lotcl"
+S["V_LIB_TCLCL"]="-L/home/coaka/Downloads/ns-allinone-2.35/tclcl-1.20 -ltclcl"
S["V_TAR_TARGET"]="linux-gnu"
S["V_STATIC"]=""
S["V_DEFINES"]="-DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_14 -DHAVE_OTCL_H -DHAVE_LIBTK8_5 -DHAVE_TK_H -DHAVE_LIBTCL8_5 -DHAVE_TCLINT_H -DHAVE_TCL_H "
-S["V_LIBS"]="-L/home/coaka/Documents/ns-original/ns-allinone-2.35/tclcl-1.20 -ltclcl -L/home/coaka/Documents/ns-original/ns-allinone-2.35/otcl-1.14 -lotcl -L/hom"\
-"e/coaka/Documents/ns-original/ns-allinone-2.35/lib -ltk8.5 -L/home/coaka/Documents/ns-original/ns-allinone-2.35/lib -ltcl8.5"
-S["V_INCLUDES"]="-I/home/coaka/Documents/ns-original/ns-allinone-2.35/tclcl-1.20 -I/home/coaka/Documents/ns-original/ns-allinone-2.35/otcl-1.14 -I/home/coaka/Documen"\
-"ts/ns-original/ns-allinone-2.35/include -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/home/coaka/Documents/ns-original/ns-allinone"\
-"-2.35/include -I/usr/include/pcap"
+S["V_LIBS"]="-L/home/coaka/Downloads/ns-allinone-2.35/tclcl-1.20 -ltclcl -L/home/coaka/Downloads/ns-allinone-2.35/otcl-1.14 -lotcl -L/home/coaka/Downloads/ns-all"\
+"inone-2.35/lib -ltk8.5 -L/home/coaka/Downloads/ns-allinone-2.35/lib -ltcl8.5"
+S["V_INCLUDES"]="-I/home/coaka/Downloads/ns-allinone-2.35/tclcl-1.20 -I/home/coaka/Downloads/ns-allinone-2.35/otcl-1.14 -I/home/coaka/Downloads/ns-allinone-2.35/incl"\
+"ude -I/home/coaka/Downloads/ns-allinone-2.35/include -I/home/coaka/Downloads/ns-allinone-2.35/include -I/usr/include/pcap"
S["build_nse"]=""
S["NSLIB"]="libns.so"
S["PKG_SHLIB_CFLAGS"]=""
@@ -671,7 +670,7 @@
S["V_LIBRARY_TK"]="../lib/tk8.5"
S["V_TKDOSNAMES"]="$(LIBRARY_TK)/optMenu.tcl $(LIBRARY_TK)/scrlbar.tcl"
S["V_LIBRARY_TCL"]="../lib/tcl8.5"
-S["V_TCLSH"]="/home/coaka/Documents/ns-original/ns-allinone-2.35/bin/tclsh8.5"
+S["V_TCLSH"]="/home/coaka/Downloads/ns-allinone-2.35/bin/tclsh8.5"
S["V_TCL_LIBRARY_FILES"]="$(TCL_BASE_LIBRARY_FILES) ../lib/tcl8.5/http1.0/http.tcl"
S["CPP_NAMESPACE"]="std"
S["ac_ct_CXX"]=""
diff -Naur ns-allinone-2.35_orig/ns-2.35/indep-utils/webtrace-conv/dec/Makefile ns-allinone-2.35/ns-2.35/indep-utils/webtrace-conv/dec/Makefile
--- ns-allinone-2.35_orig/ns-2.35/indep-utils/webtrace-conv/dec/Makefile 2020-07-24 19:47:50.897827918 +0300
+++ ns-allinone-2.35/ns-2.35/indep-utils/webtrace-conv/dec/Makefile 2020-07-24 18:50:21.938913315 +0300
@@ -52,10 +52,10 @@
BINDEST = /usr/local/bin
CC = g++-4.8
-INCLUDE = -I. -I/home/coaka/Documents/ns-original/ns-allinone-2.35/tclcl-1.20 -I/home/coaka/Documents/ns-original/ns-allinone-2.35/otcl-1.14 -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/usr/include/pcap
+INCLUDE = -I. -I/home/coaka/Downloads/ns-allinone-2.35/tclcl-1.20 -I/home/coaka/Downloads/ns-allinone-2.35/otcl-1.14 -I/home/coaka/Downloads/ns-allinone-2.35/include -I/home/coaka/Downloads/ns-allinone-2.35/include -I/home/coaka/Downloads/ns-allinone-2.35/include -I/usr/include/pcap
CFLAGS = -DCPP_NAMESPACE=std
LDFLAGS =
-LIBS = -L/home/coaka/Documents/ns-original/ns-allinone-2.35/lib -ltcl8.5 -lnsl -ldl -lm
+LIBS = -L/home/coaka/Downloads/ns-allinone-2.35/lib -ltcl8.5 -lnsl -ldl -lm
INSTALL = /usr/bin/install -c
SRC = proxytrace.cc formsquid.cc formtxt.cc my-endian.cc \
diff -Naur ns-allinone-2.35_orig/ns-2.35/indep-utils/webtrace-conv/epa/Makefile ns-allinone-2.35/ns-2.35/indep-utils/webtrace-conv/epa/Makefile
--- ns-allinone-2.35_orig/ns-2.35/indep-utils/webtrace-conv/epa/Makefile 2020-07-24 19:47:50.901828005 +0300
+++ ns-allinone-2.35/ns-2.35/indep-utils/webtrace-conv/epa/Makefile 2020-07-24 18:50:21.994915790 +0300
@@ -49,10 +49,10 @@
CC = g++-4.8
MKDEP = ../../../conf/mkdep
-INCLUDE = -I. -I/home/coaka/Documents/ns-original/ns-allinone-2.35/tclcl-1.20 -I/home/coaka/Documents/ns-original/ns-allinone-2.35/otcl-1.14 -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/usr/include/pcap
+INCLUDE = -I. -I/home/coaka/Downloads/ns-allinone-2.35/tclcl-1.20 -I/home/coaka/Downloads/ns-allinone-2.35/otcl-1.14 -I/home/coaka/Downloads/ns-allinone-2.35/include -I/home/coaka/Downloads/ns-allinone-2.35/include -I/home/coaka/Downloads/ns-allinone-2.35/include -I/usr/include/pcap
CFLAGS = -DCPP_NAMESPACE=std
LDFLAGS =
-LIBS = -L/home/coaka/Documents/ns-original/ns-allinone-2.35/lib -ltcl8.5 -lnsl -ldl -lm
+LIBS = -L/home/coaka/Downloads/ns-allinone-2.35/lib -ltcl8.5 -lnsl -ldl -lm
INSTALL = /usr/bin/install -c
SRC = tr-stat.cc
diff -Naur ns-allinone-2.35_orig/ns-2.35/indep-utils/webtrace-conv/nlanr/Makefile ns-allinone-2.35/ns-2.35/indep-utils/webtrace-conv/nlanr/Makefile
--- ns-allinone-2.35_orig/ns-2.35/indep-utils/webtrace-conv/nlanr/Makefile 2020-07-24 19:47:50.897827918 +0300
+++ ns-allinone-2.35/ns-2.35/indep-utils/webtrace-conv/nlanr/Makefile 2020-07-24 18:50:21.966914552 +0300
@@ -49,10 +49,10 @@
BINDEST = /usr/local/bin
CC = g++-4.8
-INCLUDE = -I. -I../../.. -I/home/coaka/Documents/ns-original/ns-allinone-2.35/tclcl-1.20 -I/home/coaka/Documents/ns-original/ns-allinone-2.35/otcl-1.14 -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/usr/include/pcap
+INCLUDE = -I. -I../../.. -I/home/coaka/Downloads/ns-allinone-2.35/tclcl-1.20 -I/home/coaka/Downloads/ns-allinone-2.35/otcl-1.14 -I/home/coaka/Downloads/ns-allinone-2.35/include -I/home/coaka/Downloads/ns-allinone-2.35/include -I/home/coaka/Downloads/ns-allinone-2.35/include -I/usr/include/pcap
CFLAGS = -DCPP_NAMESPACE=std
LDFLAGS =
-LIBS = -L/home/coaka/Documents/ns-original/ns-allinone-2.35/lib -ltcl8.5 -lnsl -ldl -lm
+LIBS = -L/home/coaka/Downloads/ns-allinone-2.35/lib -ltcl8.5 -lnsl -ldl -lm
INSTALL = /usr/bin/install -c
SRC = tr-stat.cc logparse.cc
diff -Naur ns-allinone-2.35_orig/ns-2.35/indep-utils/webtrace-conv/ucb/Makefile ns-allinone-2.35/ns-2.35/indep-utils/webtrace-conv/ucb/Makefile
--- ns-allinone-2.35_orig/ns-2.35/indep-utils/webtrace-conv/ucb/Makefile 2020-07-24 19:47:50.901828005 +0300
+++ ns-allinone-2.35/ns-2.35/indep-utils/webtrace-conv/ucb/Makefile 2020-07-24 18:50:21.906911900 +0300
@@ -27,10 +27,10 @@
CC = g++-4.8
MKDEP = ../../../conf/mkdep
-INCLUDE = -I. -I/home/coaka/Documents/ns-original/ns-allinone-2.35/tclcl-1.20 -I/home/coaka/Documents/ns-original/ns-allinone-2.35/otcl-1.14 -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/usr/include/pcap
+INCLUDE = -I. -I/home/coaka/Downloads/ns-allinone-2.35/tclcl-1.20 -I/home/coaka/Downloads/ns-allinone-2.35/otcl-1.14 -I/home/coaka/Downloads/ns-allinone-2.35/include -I/home/coaka/Downloads/ns-allinone-2.35/include -I/home/coaka/Downloads/ns-allinone-2.35/include -I/usr/include/pcap
CFLAGS = -DCPP_NAMESPACE=std
LDFLAGS =
-LIBS = -L/home/coaka/Documents/ns-original/ns-allinone-2.35/lib -ltcl8.5 -lnsl -ldl -lm
+LIBS = -L/home/coaka/Downloads/ns-allinone-2.35/lib -ltcl8.5 -lnsl -ldl -lm
INSTALL = /usr/bin/install -c
SRC = tr-stat.cc logparse.cc utils.cc
diff -Naur ns-allinone-2.35_orig/ns-2.35/Makefile ns-allinone-2.35/ns-2.35/Makefile
--- ns-allinone-2.35_orig/ns-2.35/Makefile 2020-07-24 19:47:50.905828092 +0300
+++ ns-allinone-2.35/ns-2.35/Makefile 2020-07-24 18:50:21.842909070 +0300
@@ -38,7 +38,7 @@
LINK = $(CPP)
LINK_SHLIB = gcc-4.8 -shared
MKDEP = ./conf/mkdep
-TCLSH = /home/coaka/Documents/ns-original/ns-allinone-2.35/bin/tclsh8.5
+TCLSH = /home/coaka/Downloads/ns-allinone-2.35/bin/tclsh8.5
TCL2C = ../tclcl-1.20/tcl2c++
AR = ar rc $(BLANK)
@@ -64,7 +64,7 @@
INCLUDES = \
-I. \
-I. \
- -I/home/coaka/Documents/ns-original/ns-allinone-2.35/tclcl-1.20 -I/home/coaka/Documents/ns-original/ns-allinone-2.35/otcl-1.14 -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/home/coaka/Documents/ns-original/ns-allinone-2.35/include -I/usr/include/pcap \
+ -I/home/coaka/Downloads/ns-allinone-2.35/tclcl-1.20 -I/home/coaka/Downloads/ns-allinone-2.35/otcl-1.14 -I/home/coaka/Downloads/ns-allinone-2.35/include -I/home/coaka/Downloads/ns-allinone-2.35/include -I/home/coaka/Downloads/ns-allinone-2.35/include -I/usr/include/pcap \
-I./tcp -I./sctp -I./common -I./link -I./queue \
-I./adc -I./apps -I./mac -I./mobile -I./trace \
-I./routing -I./tools -I./classifier -I./mcast \
@@ -76,7 +76,7 @@
LIB = \
- -L/home/coaka/Documents/ns-original/ns-allinone-2.35/tclcl-1.20 -ltclcl -L/home/coaka/Documents/ns-original/ns-allinone-2.35/otcl-1.14 -lotcl -L/home/coaka/Documents/ns-original/ns-allinone-2.35/lib -ltk8.5 -L/home/coaka/Documents/ns-original/ns-allinone-2.35/lib -ltcl8.5 \
+ -L/home/coaka/Downloads/ns-allinone-2.35/tclcl-1.20 -ltclcl -L/home/coaka/Downloads/ns-allinone-2.35/otcl-1.14 -lotcl -L/home/coaka/Downloads/ns-allinone-2.35/lib -ltk8.5 -L/home/coaka/Downloads/ns-allinone-2.35/lib -ltcl8.5 \
-lXext -lX11 \
-lnsl -ldl \
-lm -lm
@@ -278,6 +278,7 @@
aomdv/aomdv_logs.o aomdv/aomdv.o \
aomdv/aomdv_rtable.o aomdv/aomdv_rqueue.o \
puma/puma.o \
+ phr/phr.o \
mdart/mdart_adp.o mdart/mdart_dht.o mdart/mdart_ndp.o \
mdart/mdart_neighbor.o mdart/mdart_queue.o mdart/mdart_table.o \
mdart/mdart.o \
diff -Naur ns-allinone-2.35_orig/ns-2.35/Makefile.in ns-allinone-2.35/ns-2.35/Makefile.in
--- ns-allinone-2.35_orig/ns-2.35/Makefile.in 2020-07-24 19:47:50.753824774 +0300
+++ ns-allinone-2.35/ns-2.35/Makefile.in 2020-07-24 14:49:25.200638586 +0300
@@ -278,6 +278,7 @@
aomdv/aomdv_logs.o aomdv/aomdv.o \
aomdv/aomdv_rtable.o aomdv/aomdv_rqueue.o \
puma/puma.o \
+ phr/phr.o \
mdart/mdart_adp.o mdart/mdart_dht.o mdart/mdart_ndp.o \
mdart/mdart_neighbor.o mdart/mdart_queue.o mdart/mdart_table.o \
mdart/mdart.o \
diff -Naur ns-allinone-2.35_orig/ns-2.35/phr/phr.cc ns-allinone-2.35/ns-2.35/phr/phr.cc
--- ns-allinone-2.35_orig/ns-2.35/phr/phr.cc 1970-01-01 03:00:00.000000000 +0300
+++ ns-allinone-2.35/ns-2.35/phr/phr.cc 2020-07-24 13:57:06.791104187 +0300
@@ -0,0 +1,1038 @@
+/*//
+ * Copyright (c) 2017, Awos K. Ali, Loughborough University- UK
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *//////
+
+#include <phr/phr.h>
+#include <phr/phr_packet.h>
+#include <random.h>
+#include <cmu-trace.h>
+#include <energy-model.h>
+#include <math.h>
+#include<string.h>
+#include "mac.h"
+#include "ll.h"
+#include <address.h>
+#define max(a,b) ( (a) > (b) ? (a) : (b) )
+#define CURRENT_TIME Scheduler::instance().clock()
+
+#define DEBUG
+
+// ======================================================================
+// TCL Hooking Classes
+/// ======================================================================
+
+int
+ hdr_phr::offset_;
+static
+ class
+ PHRHeaderClass:
+ public
+ PacketHeaderClass
+{
+public:
+ PHRHeaderClass ():
+ PacketHeaderClass ("PacketHeader/PHR", sizeof (hdr_all_phr))
+ {
+ bind_offset (&hdr_phr::offset_);
+ }
+}
+class_rtProtoPHR_hdr;
+
+static
+ class
+ PHRclass:
+ public
+ TclClass
+{
+public:
+ PHRclass ():
+ TclClass ("Agent/PHR")
+ {
+ }
+ TclObject *
+ create (int argc, const char *const *argv)
+ {
+ assert (argc == 5);
+ return (new PHR ((nsaddr_t) Address::instance ().str2addr (argv[4])));
+ }
+}
+
+class_rtProtoPHR;
+
+
+int
+PHR::command (int argc, const char *const *argv)
+{
+ if (argc == 2)
+ {
+ Tcl & tcl = Tcl::instance ();
+
+ if (strncasecmp (argv[1], "id", 2) == 0)
+ {
+ tcl.resultf ("%d", index);
+ return TCL_OK;
+ }
+
+ if (strncasecmp (argv[1], "start", 5) == 0)
+ {
+ btimer.handle ((Event *) 0);
+ rtimer.handle ((Event *) 0);
+
+ return TCL_OK;
+ }
+
+
+ if (strncasecmp (argv[1], "stop-broadcast", 4) == 0)
+ {
+
+ stop_ = 1;
+ begin = 0;
+
+#ifdef DEBUG
+ printf ("N (%.6f): node %d, stop brodcasting \n", CURRENT_TIME,
+ index);
+#endif
+ return TCL_OK;
+ }
+
+
+ }
+ else if (argc == 3)
+ {
+ if (strcmp (argv[1], "broadcast") == 0)
+ {
+
+ iNode = (MobileNode *) (Node::get_node_by_address (atoi (argv[2])));
+ nodeid = atoi (argv[2]);
+
+ stop_ = 0;
+ begin = 1;
+ sendbroadcast (nodeid);
+ return TCL_OK;
+ }
+
+
+ if (strcmp (argv[1], "index") == 0)
+ {
+ index = atoi (argv[2]);
+ return TCL_OK;
+ }
+
+
+ else if (strcmp (argv[1], "log-target") == 0
+ || strcmp (argv[1], "tracetarget") == 0)
+ {
+ logtarget = (Trace *) TclObject::lookup (argv[2]);
+ if (logtarget == 0)
+ return TCL_ERROR;
+ return TCL_OK;
+ }
+
+ else if (strcmp (argv[1], "drop-target") == 0)
+ {
+
+
+ return Agent::command (argc, argv);
+ return TCL_OK;
+ }
+
+ else if (strcmp (argv[1], "if-queue") == 0)
+ {
+ ifqueue = (PriQueue *) TclObject::lookup (argv[2]);
+
+ if (ifqueue == 0)
+ return TCL_ERROR;
+ return TCL_OK;
+ }
+
+ else if (strcmp (argv[1], "port-dmux") == 0)
+ {
+ dmux_ = (PortClassifier *) TclObject::lookup (argv[2]);
+ if (dmux_ == 0)
+ {
+ fprintf (stderr, "%s: %s lookup of %s failed\n", __FILE__,
+ argv[1], argv[2]);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+ }
+ }
+
+ return Agent::command (argc, argv);
+}
+
+// ======================================================================
+// Agent Constructor
+// ======================================================================
+
+PHR::PHR (nsaddr_t id):Agent (PT_PHR), btimer (this), sbtimer (this), rtimer (this),
+stoptimer (this)
+{
+
+#ifdef DEBUG
+
+#endif
+ index = id;
+ seqno = 1;
+ begin = 0;
+ //hops =0;
+ LIST_INIT (&bhead);
+ LIST_INIT (&rthead);
+ LIST_INIT (&cbrhead);
+ LIST_INIT (&knhead);
+ LIST_INIT (&parhead);
+ LIST_INIT (&sumhead);
+ stop_ = 0;
+ logtarget = 0;
+ ifqueue = 0;
+ r = 0; //random float (0,1]
+ prob_prob = 0.5;
+ prob_forwarding = true;
+ broadcast = true;
+ pkt_count = 0;
+ max_par = 0; // An inital value.
+ bind_time ("known_prob_", &known_prob);
+ bind_time ("unknown_prob_", &unknown_prob);
+ par_insert (0); //add par inital value to the ParLIST
+ time_gab = 0;
+ rece_pkts = 0;
+}
+
+// ======================================================================
+// Timer Functions
+// ======================================================================
+
+void
+Broadcasttimer::handle (Event *)
+{
+ agent->id_purge ();
+ agent->app_pkt_purge (); //to expire cached cbr pkts. ids. every interval.
+ agent->known_purge (); //to expire Known-List entries
+ agent->sum_purge (); //to expire Sum-List entries
+ Scheduler::instance ().schedule (this, &intr, BCAST_ID_SAVE);
+}
+
+void
+SendBroadcastTimer::handle (Event *)
+{
+
+ // agent->sendbroadcast(dst);
+
+ double interval = MinBcInterval +
+ ((MaxBcInterval - MinBcInterval) * Random::uniform ());
+ assert (interval >= 0);
+ Scheduler::instance ().schedule (this, &intr, interval);
+ // Scheduler::instance().schedule(this, &intr, BCAST_ID_SAVE);
+}
+
+void
+SendBroadcastTimer::stop (void)
+{
+ Scheduler & s = Scheduler::instance ();
+ s.cancel (&intr);
+ busy_ = 0;
+ // Scheduler::instance().schedule(this, &intr, BCAST_ID_SAVE);
+}
+
+
+
+
+void
+Routecachetimer::handle (Event *)
+{
+ //agent->rt_purge ();
+#define FREQUENCY 0.5 // sec
+ Scheduler::instance ().schedule (this, &intr, FREQUENCY);
+}
+
+
+
+void
+PHR::sendbroadcast (nsaddr_t dest)
+{
+ Packet *p = Packet::alloc ();
+ struct hdr_cmn *ch = HDR_CMN (p);
+ struct hdr_ip *ih = HDR_IP (p);
+ struct hdr_phr_bc *bc = HDR_PHR_BC (p);
+
+ // Write Channel Header
+ ch->ptype () = PT_PHR;
+ ch->size () = IP_HDR_LEN + bc->size ();
+ ch->addr_type () = NS_AF_NONE;
+ ch->prev_hop_ = index;
+
+ // Write IP Header
+ ih->saddr () = index;
+ ih->daddr () = PHR_BROADCAST;
+ ih->sport () = RT_PORT;
+ ih->dport () = RT_PORT;
+ ih->ttl_ = NETWORK_DIAMETER;
+
+ // Write BC Header
+ bc->bc_type = PHR_BC;
+ bc->bc_bcast_id = seqno;
+ bc->bc_src = index;
+ bc->bc_dst = dest;
+ // Here we add the current hops no.from source.
+ bc->bc_hop_count = 1;
+ bc->bc_timestamp = CURRENT_TIME;
+
+ // increase sequence number for next bc
+ seqno += 1;
+
+
+#ifdef DEBUG
+ printf ("S (%.6f): send broadcast by %d \n", CURRENT_TIME, index);
+#endif
+ Scheduler::instance ().schedule (target_, p, 0.0);
+ //send(p,0);
+
+}
+
+void
+PHR::forward (Packet * p, nsaddr_t nexthop, double delay)
+{
+ struct hdr_cmn *ch = HDR_CMN (p);
+ struct hdr_ip *ih = HDR_IP (p);
+
+ if (ih->ttl_ == 0)
+ {
+ drop (p, DROP_RTR_TTL);
+ }
+ // if next hop != broadcast
+ if (nexthop != (nsaddr_t) IP_BROADCAST)
+ {
+ ch->next_hop_ = nexthop;
+ ch->prev_hop_ = index;
+ ch->addr_type () = NS_AF_INET;
+ ch->direction () = hdr_cmn::DOWN;
+ }
+ else
+ {
+ assert (ih->daddr () == (nsaddr_t) MAC_BROADCAST);
+ ch->prev_hop_ = index;
+ ch->addr_type () = NS_AF_NONE;
+ ch->direction () = hdr_cmn::DOWN; // need to update the pkt.
+
+ }
+ Scheduler::instance ().schedule (target_, p, delay);
+}
+
+
+
+// ======================================================================
+// Recv Packet
+// ======================================================================
+
+void
+PHR::recv (Packet * p, Handler *)
+{
+ struct hdr_cmn *ch = HDR_CMN (p);
+ struct hdr_ip *ih = HDR_IP (p);
+
+ // if the packet is routing protocol control packet, give the packet to agent
+ if (ch->ptype () == PT_PHR)
+ {
+ // ih->ttl_ -= 1;
+ recv_phr (p);
+ return;
+ }
+
+ // Must be a packet I'm originating
+ if ((ih->saddr () == index) && (ch->num_forwards () == 0))
+ {
+
+ // Add the IP Header. TCP adds the IP header too, so to avoid setting it twice,
+ // we check if this packet is not a TCP or ACK segment.
+
+ if (ch->ptype () != PT_TCP && ch->ptype () != PT_ACK)
+ {
+ ch->size () += IP_HDR_LEN;
+ }
+
+ }
+
+ // Packet I'm forwarding...
+ else
+ {
+ if (--ih->ttl_ == 0)
+ { // check if the time to live is exceeded
+ drop (p, DROP_RTR_TTL);
+ return;
+ }
+ }
+
+ // This is data packet, decide, forward the packet or not based on PHR.
+
+ recv_data (p);
+}
+
+
+// ======================================================================
+// Recv Data Packet
+// ======================================================================
+
+void
+PHR::recv_data (Packet * p)
+{
+ struct hdr_ip *ih = HDR_IP (p);
+ struct hdr_cmn *ch = HDR_CMN (p);
+ struct hdr_phr *ph = HDR_PHR (p);
+ //////Calculate the probability of forwarding.
+ ParList *pr = par_lookup ();
+ bool reset;
+
+ rece_pkts += 1; // increase no. of received pkts.
+ S = sum ();
+ if (pr->par_expire <= CURRENT_TIME)
+ {
+ reset = true;
+ pr->par_expire = CURRENT_TIME + PAR_RESET; //vaild for 2 sec.
+ }
+ else
+ {
+ reset = false;
+ }
+ //get the PAR(Packet Arriving Rate)
+ par = Record (reset);
+ length = length_of_list ();
+ //SAVE PAR VALUE INTO A LIST EVERY SECOND OR SO.
+ time_slot = CURRENT_TIME - time_gab;
+ if (time_slot > (1.1))
+ {
+ // printf("Insert rece_pkts %d into the sum list at %.3f \n",rece_pkts, CURRENT_TIME);
+ time_gab = CURRENT_TIME;
+ sum_insert (rece_pkts); //par);
+ //par_update(rece_pkts);
+ rece_pkts = 0; //reset the counter
+ //par =0;
+ }
+
+
+ //S is sumation of 5 par s.
+ //update the max_par value.
+
+ if (S > 0)
+ {
+ PAR = S / length; //if we need to do average.
+
+ if (max_par < PAR)
+ {
+ max_par = PAR * 2;
+ }
+ prob_prob = 1.0 - (PAR / max_par);
+
+ }
+ //To Avoid full brodcast at the begning.
+ else
+ {
+ prob_prob = 0.6;
+ }
+
+
+ ////////END OF FORWARDING PROBABILITY CALCULATION\\\\\\\\\
+
+
+//Check if the pkt received before.
+ if (app_pkt_lookup (ih->saddr (), ch->uid ()))
+ { //if pkt come from different neighbour save the neighbour and discard pkt.
+ KnownList *kn1 = known_lookup (ph->ph);
+ if (kn1 == NULL)
+ {
+ known_insert (ph->ph, 1);
+ }
+ else
+ {
+ //just update the neighbout info.
+ kn1->hops_to_dest = 1;
+ kn1->phr_expire = CURRENT_TIME + DEFAULT_ENTRY_EXPIRE;
+ }
+
+ Packet::free (p);
+ // drop(p, DROP_RTR_ROUTE_LOOP);
+ return;
+ }
+#ifdef DEBUG
+ // printf ("packet_id %d now on node %d and its hop_count is %d PH is %d \n",
+ // ch->uid (), index, ph->hops_so_far, ph->ph);
+#endif
+ //Cache cbr bcast pkt.
+ app_pkt_insert (ih->saddr (), ch->uid ());
+
+ //previous hop
+ nsaddr_t neighbour = ph->ph;
+ ph->ph = index;
+ /////////////
+#ifdef DEBUG
+ //printf ("Receive at %d, id %d \n", index, ch->uid ());
+#endif
+ //Generate random float value (0,1]
+ r = ((float) rand ()) / (float) (RAND_MAX);
+ if (ih->ttl () == 32) //If I am the source node
+ {
+ //fill phr pkt header at source node
+ ch->prev_hop_ = index;
+ ch->addr_type () = NS_AF_NONE;
+ ch->direction () = hdr_cmn::DOWN;
+ ch->next_hop_ = MAC_BROADCAST;
+ ph->dest_ = ih->daddr ();
+ ih->daddr () = MAC_BROADCAST;
+ ph->src = ih->saddr ();
+ ph->pkt_id = ch->uid ();
+ ph->hops_so_far = 1;
+ //To reduce no. of forwarding.
+ // look up for the destination
+ KnownList *kn = known_lookup (ph->dest_);
+ if (kn != NULL)
+ {
+ ph->dist_to_dest = kn->hops_to_dest;
+ ph->known_flag = true;
+ /* printf ("I am the source and I know where the dest. is, pkt_id is \n",*/
+
+ }
+ else
+ {
+ // printf ("dest. is unkown %d \n", index);
+ ph->dist_to_dest = NETWORK_DIAMETER;
+ ph->known_flag = false;
+
+ }
+ forward (p, MAC_BROADCAST, 0.0);
+ // printf ("source node send packet %d on node %d \n", ch->uid (), index);
+ }
+ // if I am the destination, send the pkt to the upper layers.
+ else if (index == ph->dest_)
+ {
+ // look up for the src.
+ KnownList *kn = known_lookup (ph->src);
+ if (kn == NULL)
+ {
+ // printf ("Insert to known list on dest. node %d \n", index);
+ known_insert (neighbour, 1); //Adding neighbour to the known-list
+ known_insert (ph->src, ph->hops_so_far);
+ }
+ else
+ {
+ // update the Known list
+ //printf ("Update known list on dest. node %d \n", index);
+ kn->hops_to_dest = ph->hops_so_far;
+ kn->phr_expire = CURRENT_TIME + DEFAULT_ENTRY_EXPIRE;
+ }
+ //printf ("sending up stack %d, %d\n", index, ih->daddr ());
+ ch->addr_type () = NS_AF_INET;
+ ih->daddr () = (nsaddr_t) ph->dest_;
+ dmux_->recv (p, 0);
+
+ }
+
+ else
+ {
+ KnownList *kn = known_lookup (ph->dest_);
+ if (kn == NULL)
+ {
+ KnownList *nbr = known_lookup (neighbour);
+ if (nbr == NULL)
+ {
+ known_insert (neighbour, 1); //Adding neighbour to the known-list
+ }
+ else
+ {
+ nbr->phr_expire = CURRENT_TIME + DEFAULT_ENTRY_EXPIRE;
+ }
+ KnownList *knsrc = known_lookup (ph->src);
+ if (knsrc == NULL)
+ {
+ known_insert (ph->src, ph->hops_so_far);
+ }
+ else
+ {
+ knsrc->hops_to_dest = ph->hops_so_far;
+ knsrc->phr_expire = CURRENT_TIME + DEFAULT_ENTRY_EXPIRE;
+ }
+ broadcast = prob_forwarding; //
+ broadcast = broadcast && (r <= prob_prob); //<= unknown_prob);//changed to &&
+ broadcast = broadcast && (ph->known_flag == false);
+ if (broadcast)
+ {
+ ph->hops_so_far += 1;
+ ph->dist_to_dest -= 1;
+ forward (p, MAC_BROADCAST, DELAY);
+ }
+ else
+ {
+ //Drop if the flag is set and prob value is low.
+ drop(p, DROP_PHR_DKNOW);
+ return;
+ }
+
+ }
+ else
+ {
+ if (kn->hops_to_dest <= ph->dist_to_dest)
+ {
+ // prepare the packet for forwarding/
+ ph->hops_so_far += 1;
+ ph->known_flag = true;
+ ph->dist_to_dest = kn->hops_to_dest;
+ //Check if I received from this src before.
+ KnownList *kn2 = known_lookup (ph->src);
+ if (kn2 == NULL)
+ {
+ known_insert (neighbour, 1); //Adding neighbour to the known-list
+ known_insert (ph->src, ph->hops_so_far);
+ }
+ else
+ { //update the entry./
+ // kn2->hops_to_dest = ph->hops_so_far;
+ kn2->phr_expire = CURRENT_TIME + DEFAULT_ENTRY_EXPIRE;
+ }
+
+ // send the pkt. probabilistically.
+ ////***************
+ if (prob_forwarding && r < prob_prob)
+ { // known_prob){
+ forward (p, MAC_BROADCAST, DELAY);
+ }
+ else
+ {
+ Packet::free (p);
+ return;
+
+ }
+ }
+ else
+ {
+
+ drop(p, DROP_PHR_PH_CLOSER);
+
+ }
+ }
+ }
+}
+
+// ======================================================================
+// Recv PHR Packet
+// ======================================================================
+void
+PHR::recv_phr (Packet * p)
+{
+ struct hdr_phr *wh = HDR_PHR (p);
+
+ assert (HDR_IP (p)->sport () == RT_PORT);
+ assert (HDR_IP (p)->dport () == RT_PORT);
+
+ // What kind of packet is this
+ switch (wh->pkt_type)
+ {
+
+ case PHR_BC:
+ recevbroadcast (p);
+ break;
+
+ //case WFRP_ERROR:
+ //recv_error(p);
+ //break;
+ // We can add new function here to process Unicast Packet routing(WFRP_UNI)
+ default:
+ fprintf (stderr, "Invalid packet type (%x)\n", wh->pkt_type);
+ exit (1);
+ }
+}
+
+
+// ======================================================================
+// Recv Broadcast Packet
+// ======================================================================
+void
+PHR::recevbroadcast (Packet * p)
+{
+ struct hdr_ip *ih = HDR_IP (p);
+ struct hdr_phr_bc *bc = HDR_PHR_BC (p);
+
+ Routecache *rt = rt_lookup (bc->bc_src);
+
+ if (!rt)
+ {
+ rt_insert (bc->bc_src, bc->bc_bcast_id, ih->saddr (), bc->bc_hop_count);
+ }
+ // I have originated the packet, just drop it
+ if (bc->bc_src == index)
+ {
+ //drop(p, DROP_RTR_ROUTE_LOOP);
+ Packet::free (p);
+ return;
+ }
+ // If I received this bcast pkt befor.
+ if (id_lookup (bc->bc_src, bc->bc_bcast_id))
+ {
+
+#ifdef DEBUG
+ fprintf (stderr, "%s: discarding brodcast\n", __FUNCTION__);
+#endif // DEBUG
+ Packet::free (p);
+
+ return;
+ }
+ //Cache bcast pkt.
+ id_insert (bc->bc_src, bc->bc_bcast_id);
+ #ifdef DEBUG
+ printf ("R (%.6f): recv broadcast by %d, src:%d, seqno:%d, hop: %d \n",
+ CURRENT_TIME, index, bc->bc_src, bc->bc_bcast_id, bc->bc_hop_count);
+#endif
+ // if I am the destination then receive the pkt and don't froward it.
+ if (bc->bc_dst == index)
+ {
+
+#ifdef DEBUG
+ fprintf (stderr, "%d : pkt received by its destination \n", index);
+#endif
+ // dmux_->recv(p, 0);
+ // Packet::free(p);
+ }