LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   problem in modifying cmu-trace.cc file in ns2.34 (https://www.linuxquestions.org/questions/programming-9/problem-in-modifying-cmu-trace-cc-file-in-ns2-34-a-4175426218/)

avinash20 09-08-2012 03:46 AM

problem in modifying cmu-trace.cc file in ns2.34
 
hi everybody im implementing grayhole in ns2.34 in red hat linux 5 i have performed all the steps of modifying different files of ns2.34 but i dont know how to modify the cmu-trace.cc file please somebody help me its urgent

KenJackson 09-08-2012 08:35 PM

Quote:

Originally Posted by avinash20 (Post 4775508)
hi everybody im implementing grayhole in ns2.34 in red hat linux 5 i have performed all the steps of modifying different files of ns2.34 but i dont know how to modify the cmu-trace.cc file please somebody help me its urgent

Ah! You didn't give us many hints, but I found cmu-trace.cc.

Now, what do you want to modify it to do? And why the urgency? And what the heck is grayhole?

avinash20 09-09-2012 02:55 AM

@KenJackson
thanks sir for paying attention grayhole is a type of attack in routing done by some malicious node, by modifying cmu-trace.cc i mean that like for aodv in cmu-trace.cc there is script like

void
858 CMUTrace::format_aodv(Packet *p, int offset)
859 {
860 struct hdr_aodv *ah = HDR_AODV(p);
861 struct hdr_aodv_request *rq = HDR_AODV_REQUEST(p);
862 struct hdr_aodv_reply *rp = HDR_AODV_REPLY(p);
863
864
865 switch(ah->ah_type) {
866 case AODVTYPE_RREQ:
867
868 if (pt_->tagged()) {
869 sprintf(pt_->buffer() + offset,
870 "-aodv:t %x -aodv:h %d -aodv:b %d -aodv:d %d "
871 "-aodv:ds %d -aodv:s %d -aodv:ss %d "
872 "-aodv:c REQUEST ",
873 rq->rq_type,
874 rq->rq_hop_count,
875 rq->rq_bcast_id,
876 rq->rq_dst,
877 rq->rq_dst_seqno,
878 rq->rq_src,
879 rq->rq_src_seqno);
880 } else if (newtrace_) {
881
882 sprintf(pt_->buffer() + offset,
883 "-P aodv -Pt 0x%x -Ph %d -Pb %d -Pd %d -Pds %d -Ps %d -Pss %d -Pc REQUEST ",
884 rq->rq_type,
885 rq->rq_hop_count,
886 rq->rq_bcast_id,
887 rq->rq_dst,
888 rq->rq_dst_seqno,
889 rq->rq_src,
890 rq->rq_src_seqno);
891
892
893 } else {
894
895 sprintf(pt_->buffer() + offset,
896 "[0x%x %d %d [%d %d] [%d %d]] (REQUEST)",
897 rq->rq_type,
898 rq->rq_hop_count,
899 rq->rq_bcast_id,
900 rq->rq_dst,
901 rq->rq_dst_seqno,
902 rq->rq_src,
903 rq->rq_src_seqno);
904 }
905 break;
906
907 case AODVTYPE_RREP:
908 case AODVTYPE_HELLO:
909 case AODVTYPE_RERR:
910
911 if (pt_->tagged()) {
912 sprintf(pt_->buffer() + offset,
913 "-aodv:t %x -aodv:h %d -aodv:d %d -adov:ds %d "
914 "-aodv:l %f -aodv:c %s ",
915 rp->rp_type,
916 rp->rp_hop_count,
917 rp->rp_dst,
918 rp->rp_dst_seqno,
919 rp->rp_lifetime,
920 rp->rp_type == AODVTYPE_RREP ? "REPLY" :
921 (rp->rp_type == AODVTYPE_RERR ? "ERROR" :
922 "HELLO"));
923 } else if (newtrace_) {
924
925 sprintf(pt_->buffer() + offset,
926 "-P aodv -Pt 0x%x -Ph %d -Pd %d -Pds %d -Pl %f -Pc %s ",
927 rp->rp_type,
928 rp->rp_hop_count,
929 rp->rp_dst,
930 rp->rp_dst_seqno,
931 rp->rp_lifetime,
932 rp->rp_type == AODVTYPE_RREP ? "REPLY" :
933 (rp->rp_type == AODVTYPE_RERR ? "ERROR" :
934 "HELLO"));
935 } else {
936
937 sprintf(pt_->buffer() + offset,
938 "[0x%x %d [%d %d] %f] (%s)",
939 rp->rp_type,
940 rp->rp_hop_count,
941 rp->rp_dst,
942 rp->rp_dst_seqno,
943 rp->rp_lifetime,
944 rp->rp_type == AODVTYPE_RREP ? "REPLY" :
945 (rp->rp_type == AODVTYPE_RERR ? "ERROR" :
946 "HELLO"));
947 }
948 break;
949
950 default:
951 #ifdef WIN32
952 fprintf(stderr,
953 "CMUTrace::format_aodv: invalid AODV packet type\n");
954 #else
955 fprintf(stderr,
956 "%s: invalid AODV packet type\n", __FUNCTION__);
957 #endif
958 abort();
959 }
960 }
961
962 // AOMDV patch
963 void

like above i have also to add script for grayhole attack in cmutrace

avinash20 09-12-2012 06:06 AM

invalid command name "Agent/Antnet"
 
hi every one i got this error while run tcl of antnet algo in ns2.34 red hat linux 5

invalid command name "Agent/Antnet"
while executing
"Agent/Antnet create _o139 0"
invoked from within
"catch "$className create $o $args" msg"
invoked from within
"if [catch "$className create $o $args" msg] {
if [string match "__FAILED_SHADOW_OBJECT_" $msg] {
delete $o
return ""
}
global errorInfo
error "class $..."
(procedure "new" line 3)
invoked from within
"new Agent/Antnet $i"
("for" body line 2)
invoked from within
"for {set i 0} {$i < $sz} {incr i} {
set nn($i) [ new Agent/Antnet $i]
}"
(file "ring.tcl" line 30)


All times are GMT -5. The time now is 04:26 PM.