[ns] Segmentation Fault while Modifying AODV
Dear NS2 Users I am facing a very serious problem regarding modification to AODV protocol. I have customized AODV Protocol to work as VANET Beaconing Protocol according to DSRC Standard. I also having implemented the duplicity mechansim where each node on receiving a beacon, stores it for certain time to check for duplicity, because i want the beacons to travel for multihops. i have divided the road into regions and there is a linked list for every region which stores the hashes of certain values taken from every beacon. i have implemented all this, and when i run my tcl script, it gives segmentation fault. basically i get the segmentation fault after adding the following code (This whole code is included in aodv.cc and aodv is no more a routing protocol. it is just a VANET Beaconing protocol now which i optimized for my simulations). aodv/aodv.cc recev_beacon() { ... ... . receive the beacon and calculate the hash from some values // Now Save the Beacons if (xx=x x(xx+200)) { bool flag=obj.search(hash2); if (flag==TRUE) { coutAlready exists in the linked listendl; } else { obj.add(hash2, 1); //ofstream list1;//for saving hash values //list1.open(linkedlist1.dat, ios::app); //list1hash2endl; } } // end of if else if (x=xx (xx=x x(xx+400))) { obj.add(hash2, 2); ofstream list2;//for saving hash values list2.open(linkedlist2.dat, ios::app); list2hash2endl; } else if (x=xx (xx=x x(xx+600))) { obj.add(hash2, 3); } else if (x=xx (xx=x x(xx+1000))) { obj.add(hash2, 4); } the linked list implemented is given below // // Defining Linked Lists // struct list1{ unsigned int bid;list1 *link; }; struct list2{ unsigned int bid;list2 *link; }; struct list3{ unsigned int bid;list3 *link; }; struct list4{ unsigned int bid;list4 *link; }; class list{ private: int i; list1 *cur1,*temp1,*start1; list2 *cur2,*temp2,*start2; list3 *cur3,*temp3,*start3; list4 *cur4,*temp4,*start4; public: list() { start1=NULL; start2=NULL; start3=NULL; start4=NULL; } void add(unsigned int hashval, int listno) { //coutEnter the list number to add element to;cini; // check for list no. if (listno==1) { if(start1==NULL) { start1=new list1; cur1=start1; cur1-bid=hashval; cur1-link=NULL; } else { cur1-link=new list1; cur1=cur1-link; cur1-bid=hashval; cur1-link=NULL; } } else if (listno==2) { if(start2==NULL) { start2=new list2; cur2=start2; cur2-bid=hashval; cur2-link=NULL; } else { cur2-link=new list2; cur2=cur2-link; cur2-bid=hashval; cur2-link=NULL; } } else if (listno==3) { if(start3==NULL) { start3=new list3; cur3=start3; cur3-bid=hashval; cur3-link=NULL; } else { cur3-link=new list3; cur3=cur3-link; cur3-bid=hashval; cur3-link=NULL; } } else if (listno==4) { if(start4==NULL) { start4=new list4; cur4=start4; cur4-bid=hashval; cur4-link=NULL; } else { cur4-link=new list4; cur4=cur4-link; cur4-bid=hashval; cur4-link=NULL; } } } // searching method bool search(unsigned int hashval) { bool b; cur1=start1; while (cur1-link!=NULL) { if(cur1-bid==hashval) b=TRUE; else b=FALSE; cur1=cur1-link; } return b; } I will be looking for some help as soon as possible. THanks to all concerned in advance!! Rasheed
[ns] Hash Table implementation in NS2
Dear NS2 Users Has anybody implemented Hash Table in NS2? If anyone has done that please let me know, i need the sample code to implement Hash Table. Thank You in advance! Regards Rasheed
[ns] Saving the received beacons in VANET
Dear NS2 Uers I am implementing VANET in NS2. I have implemented the beaconing mechansim in NS2. Now i want a vehicle to save the incoming beacons for cross-check. my beacons are going beyond one-hop. So i have to check for duplicity. Any suggetions, how it can be done? For Example i define some node to re-broadcast the beacon which it received. Now a neighbor node may already have got this beacon, but will again receive the re-broadcasted beacon. So the node should drop the duplicate beacon. Thanks in advance! Rasheed
[ns] Lane and Speed Information in Beacons
Dear NS Users I want to include Sending vehicle's Speed and Lane information (while the vehicle moves on a 4-lane road) in the frequently sent beacons while simulating VANET scenario. Any suggestions will be most welcomed. Thanx in advance My Beacon format is given below: *Struct hdr_aodv_beacon{* *u_int8_t pkt_type; //type of packet, beacon or error* *u_int8_t beacon_hops; //hop count* *u_int32_t beacon_id; //unique identifier for the beacon* *nsaddr_t beacon_src; //source of the beacon* *double beacon_posx; //x position of beacon source* *double beacon_posy; //y position of beacon source* *double timestamp; //timestamp* *.* *}; * Rasheed
[ns] How to Implement 4-lane Road in NS2?
Dear NS Users I am simulating VANET in NS2 and i have to implement a 4-lane road and only one sided traffic. Has anybody some idea how to do that? Thanks in advance! Rasheed
[ns] Adding Information in Hello Packets of AODV [Urgent]
Dear NS2 Users السلام عليكم/پہ خیرراغلے/Hello/안녕하세요. I want to include some information like *Location, Timestamp, Speed,* *and Lane information (if the node is vehicle)* in the *Hello Packet of AODV*which is periodically sent. How i can do that? Should i include these information in *void AODV::sendHello()* of *AODV.cc*file if so, how that could be done? Any help will be much appreciated. Regards Rasheed
[ns] Problem with an Example (AODV)
Dear NS2 Users السلام عليكم/پہ خیرراغلے/Hello/안녕하세요. I am executing a simple tcl script given below. it contains 3 nodes and using AODV protocol. I cannot see node2 to get any packet. Can somebody help me what is wrong with that? I think node2 is in between node0 and node1, so it should get packets but it is not. It is urgent, i will be thankful if somebody can tell me about that. Regards # A 3-node example for ad-hoc simulation with AODV # Define options set val(chan) Channel/WirelessChannel ;# channel type set val(prop) Propagation/TwoRayGround ;# radio-propagation model set val(netif) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802_11 ;# MAC type set val(ifq) Queue/DropTail/PriQueue ;# interface queue type set val(ll) LL ;# link layer type set val(ant) Antenna/OmniAntenna ;# antenna model set val(ifqlen) 50 ;# max packet in ifq set val(nn) 3 ;# number of mobilenodes set val(rp) AODV ;# routing protocol set val(x) 500 ;# X dimension of topography set val(y) 400 ;# Y dimension of topography set val(stop) 150 ;# time of simulation end set ns [new Simulator] set tracefd [open simple.tr w] set windowVsTime2 [open win.tr w] set namtrace [open simwrls.nam w] $ns trace-all $tracefd $ns namtrace-all-wireless $namtrace $val(x) $val(y) # set up topography object set topo [new Topography] $topo load_flatgrid $val(x) $val(y) create-god $val(nn) # # Create nn mobilenodes [$val(nn)] and attach them to the channel. # # configure the nodes $ns node-config -adhocRouting $val(rp) \ -llType $val(ll) \ -macType $val(mac) \ -ifqType $val(ifq) \ -ifqLen $val(ifqlen) \ -antType $val(ant) \ -propType $val(prop) \ -phyType $val(netif) \ -channelType $val(chan) \ -topoInstance $topo \ -agentTrace ON \ -routerTrace ON \ -macTrace OFF \ -movementTrace ON for {set i 0} {$i $val(nn) } { incr i } { set node_($i) [$ns node] } # Provide initial location of mobilenodes $node_(0) set X_ 5.0 $node_(0) set Y_ 5.0 $node_(0) set Z_ 0.0 $node_(1) set X_ 490.0 $node_(1) set Y_ 285.0 $node_(1) set Z_ 0.0 $node_(2) set X_ 150.0 $node_(2) set Y_ 240.0 $node_(2) set Z_ 0.0 # Generation of movements $ns at 10.0 $node_(0) setdest 250.0 250.0 3.0 $ns at 15.0 $node_(1) setdest 45.0 285.0 5.0 $ns at 110.0 $node_(0) setdest 480.0 300.0 5.0 # Set a TCP connection between node_(0) and node_(1) set tcp [new Agent/TCP/Newreno] $tcp set class_ 2 set sink [new Agent/TCPSink] $ns attach-agent $node_(0) $tcp $ns attach-agent $node_(1) $sink $ns connect $tcp $sink set ftp [new Application/FTP] $ftp attach-agent $tcp $ns at 10.0 $ftp start # Printing the window size proc plotWindow {tcpSource file} { global ns set time 0.01 set now [$ns now] set cwnd [$tcpSource set cwnd_] puts $file $now $cwnd $ns at [expr $now+$time] plotWindow $tcpSource $file } $ns at 10.1 plotWindow $tcp $windowVsTime2 # Define node initial position in nam for {set i 0} {$i $val(nn)} { incr i } { # 30 defines the node size for nam $ns initial_node_pos $node_($i) 30 } # Telling nodes when the simulation ends for {set i 0} {$i $val(nn) } { incr i } { $ns at $val(stop) $node_($i) reset; } # ending nam and the simulation $ns at $val(stop) $ns nam-end-wireless $val(stop) $ns at $val(stop) stop $ns at 150.01 puts \end simulation\ ; $ns halt proc stop {} { global ns tracefd namtrace $ns flush-trace close $tracefd close $namtrace } $ns run After running this and looking at the file simple.tr, i cannot find node2 to get any packet. Regards Rasheed
[ns] DSRC [Dedicated Short-Range Communications] in NS2
Dear NS2 Users السلام عليكم/پہ خیرراغلے/Hello/안녕하세요. Has anybody implemented DSRS (Dedicated Short-Range Communications) in NS2? If anyone has, Please give me a reply (i will be waiting for a reply from concerned), i will be much thankful. Thank You in advance -- Rasheed Hussain (후세인 라쉬드) Hanyang University.
[ns] Simple Broadcast Example
Dear NS users السلام عليكم/پہ خیرراغلے/Hello/안녕하세요. Could anyone provide me with a simple example of 2 mobile nodes moving and broadcasting beacon messages and receiving them when they are in the transmission range? Any help will be higly appreciated. Thank You in advance. Rasheed