Re: [ns] wireless ping broadcast questions

2006-05-12 Thread Hajer FERJANI

Hi Kathy,

May be all you need is to assign a port number for the ping agent that
you will use when sending packets in your c++ code. Then, in TCL
script, you have to create ping agents and to attach them to nodes
with this port number.

Example :

- In .h and .cc files:

#define MY_PING_PORT 113
struct hdr_ip *ih = HDR_IP(p);
ih->daddr() = dest; // destination node address
ih->saddr() = index;
ihpk->sport() = MY_PING_PORT ;
ihpk->dport() = MY_PING_PORT ;

- In .tcl script :

#creating ping agents and attaching them to nodes through port 113.
   for {set j 0} {$j < $opt(nn) } {incr j} {
   set clagent_($j) [new Agent/Ping ... ]
   $node_($j) attach $clagent_($j) 113
   }


Hope it helps.
Regards.



On 5/12/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I was messing around with the ping agent from Marc Greis' Tutorial, and 
> wanted to change the ping to a broadcast.  I added the IP header stuff as 
> I've seen elsewhere online,
>
> hdr_ip *ip = hdr_ip::access(pkt);
> ip->daddr() = IP_BROADCAST;
>
> and now I get this error:
>
> -- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
> _o996: no target for slot -1
> _o996 type: Classifier/Port
> content dump:
> classifier _o996
> 0 offset
> 0 shift
> 2147483647 mask
> 2 slots
> slot 0: _o (Agent/Ping)
> slot 255: _o983 (Agent/DSDV)
>
> I can't find out how to fix it and I don't know anything about Classifiers.  
> I realize that there was no port assigned to Ping, but how do I fix this?
>
> My other question is, do I have to use an IP_Broadcast?  Can I just use a 
> MAC_BROADCAST?
>
> Kathy
>
>
>
>
>



Re: [ns] Connecting agents--many to many

2006-05-04 Thread Hajer FERJANI

Hi,

You can do that by specifying a port number for your agent and then
attach your agent to the nodes through that port. That way, an agent
can communicate with any other agent by specifying its address and
port id.
Example :

- In .h and .cc files:

#define CLUSTERING_PORT 113
struct hdr_ip *ih = HDR_IP(p);
ihpk->daddr() = dest; // destination node address
ihpk->saddr() = index;
ihpk->sport() = CLUSTERING_PORT;
ihpk->dport() = CLUSTERING_PORT;

- In .tcl script :

#creating clustering agents and attaching them to nodes through port 113.
for {set j 0} {$j < $opt(nn) } {incr j} {
set clagent_($j) [new Agent/Clustering [$node_($j) node-addr] ]
$node_($j) attach $clagent_($j) 113
}

Hope it helps.
Regards.

On 5/2/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I am currently trying to develop a simulation in which a wireless sensor
> network with sleeping nodes has an ad-hoc "backbone" of nodes with a higher
> duty cycle to reduce latency.  In order for this scenario to work, however,
> nodes must be able to negotiate with logical children and neighboring nodes
> in order to nominate backbone nodes.  I have implemented this logic as an
> Agent subclass; however, I am now realizing that Agents seem to have only a
> one-to-one relationship.  Is there a workaround for this (so that an Agent
> may have multiple agents it can communicate with?) I have tried calls
> through the OTCL linkage directly to the interpreter to try and reconnect
> nodes on the fly, but this does not seem to work.  Does anyone have any
> suggestions?
>
>



Re: [ns] port number

2006-05-04 Thread Hajer FERJANI

Hi,
These tcl commands are implemented in Node.cc or MobileNode.cc in the
command( ) method which is used to add tcl commands.
Bye.



On 4/28/06, Chams D <[EMAIL PROTECTED]> wrote:
>
> Hi,
> can anyone tell me how to use the procedure $node id
> or $node port ???
> and also where are theses methodes implemented,
> because I need to implement a new method like this.
> thanx
>
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>



Re: [ns] modify node no of nodes in tcl script codes

2006-04-26 Thread Hajer FERJANI

Hi,
You can specify node movements using "setdest" utility, which will
generate a file with initial positions and movements of the nodes.
then you have to source this file in your tcl file.
You can find more details in the ns_manuel about that.
Bye.

On 4/24/06, mohd hammad <[EMAIL PROTECTED]> wrote:
>
> hi
> during the implementation the ad hoc routing protcole
> such as aodv dsr and dsdv i do the following
> Iam trying to modify my tcl script to optain the no of
> nodes to be 50 nodes from 6 nodes using the xgraph
> visual tool but i faild
> becouse the 50 need to defined the movement and
> sceinario file
>
> can any body help me
> or owrking to gather
> please
> best regards
>
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>



Re: [ns] Can we change the transmission range of the node during the simulation?

2006-04-26 Thread Hajer FERJANI

Hi,

You can change the nodes transmission range by changing the value of
RXThresh_ of Phy/WirelessPhy by doing :
Phy/WirelessPhy set RXThresh_ 

A separate C program is provided at
~ns/indep-utils/propagation/threshold.cc to compute the receiving
threshold. You have to compile it, then you can use the executable to
compute the threshold as follows:

threshold -m  [other-options] distance

Ex:

threshold -m Shadowing -r 0.95 50.

Here the propagation model is Shadowing, the communication range is
set to 50m, and 0.95 is the rate of correctly received packets.

Hope it helps.


On 4/24/06, Sivakumar Kulasekaran <[EMAIL PROTECTED]> wrote:
>
> Hi
>
> I like to know how can we change transmission range between nodes to
> different values in dsr??
>
> I like to know is it possible to do that
>
> Also NOAH routing agent ,  i got an error saying  wrong routing agent!!!
> can anyone help me on this
>



Re: [ns] calculate mobility by using the parameters in setdest

2006-04-24 Thread Hajer FERJANI

Hi,
You must have the mnode_ variable really pointing to the mobile node
associated to that agent.
For example for me, I defined a tcl command that I called "node" that
get's the node associates with the agent.
I added the following to the "command( )" method of my agent :
if (argc == 3)
if(strcmp(argv[1], "node") == 0) {
mnode_ = (MobileNode*) TclObject::lookup(argv[2]);
if(mnode_ == 0)
return TCL_ERROR;
mnode_ is declared as MobileNode *  in the .h file of my agent.

Then in my tcl script, after creating nodes and agents, I can do :

for {set i 0} {$i < $opt(nn) } {incr i} {
set node_($i) [$ns_ node]   ;#nodes creation
}

for {set j 0} {$j < $opt(nn) } {incr j} {
set clagent_($j) [new Agent/Clustering [$node_($j) node-addr] ]
;#agent creation
$clagent_($j) node $node_($j)
}

Hope it's clear.
Bye.


On 4/21/06, mohamed yahia <[EMAIL PROTECTED]> wrote:
> Hi Hajer.
>
> please from where to call my function to get node position and node
> speed. i tried to call it from recv() function but it give me strange
> and same result for speed and x-position like this :
>
>
> The node speed is 6.78901e-316
>
> this is my code
> tell me what is wrong plz
>
>
> #include "common/mobilenode.h"
> void
> mytcpTcpAgent::node_speed()
> {
>
> MobileNode * mnode_;
> double speed = mnode_->speed();
> printf("The node speed is %g\n", speed);
> return;
>
> }
>
> kind regards
> Yahia
>
>
>  On Fri, 2006-04-21 at 12:25 +0200, Hajer FERJANI wrote:
> > Hi,
> > Do you mean by mobility the speed of a mobile node?
> > In this case, considering that -m and -M are the options to specify the
> > minimum and maximum speed of nodes (I don't remember well setdest options),
> > then setdest will dynamically assign to mobile nodes speed values ranging
> > from 1 to 6 m/s. If you look to the file generated by setdest, you'll see in
> > it commands like
> > "$node0 setdest X Y V" X and Y being future positions and V the speed of the
> > node.
> > Now, to get this value during simulation, you should have a pointer to
> > the MobileNode
> > instance of you agent (MobileNode * mnode_; ), then you can do :
> > double speed = mnode_->speed();
> >
> > Hope it helps.
> > Bye.
> >
> >
> >
> > On 4/20/06, www triste <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > Hello everybody
> > > i have a big probleme concerning mobility;i use setdest for generate a
> > > scenario,and i use v2
> > > setdest -v 2 -n 50 -s 1 -m 1 -M 6 -t 50 -P 1 -p 3.0 -x 1000 -y 1000
> > > in this case what is the value of mobility?
> > > please if it is possibile to calculate mobility,help me;thanks a lot
> > >
> > >
> > > -
> > > Faites de Yahoo! votre page d'accueil sur le web pour retrouver
> > > directement vos services préférés : vérifiez vos nouveaux mails, lancez 
> > > vos
> > > recherches et suivez l'actualité en temps réel. Cliquez ici.
> > >
>
>



Re: [ns] When does packets learn source and destination mode IDs.

2006-04-21 Thread Hajer FERJANI

Hi Faisal,
There's two possibilities to do that in ns. May be, in the examples
you are referring to, source and destination agents responsible of
generating packets are explicitely connected to each other in the tcl
script, making one of them source of packets and the other its
destination for all the simulation (I think this was the case in the
ping tutorial, where ther's 2 agents, one source and the other the
destination). In this case, the variable target_ -I'm not sure this is
its actual name, but jsut to say that the destination of each packet
is fixed in the beginning of the simulation an has not to be set in
the code.
The other way, is to not conect explicitely source and destination but
set them in the source code, like this:


Packet *pk = Packet::alloc();
struct hdr_ip *ihpk = HDR_IP(pk);
ihpk->daddr() = dest;
ihpk->saddr() = my_address;
ihpk->sport() = MYAGENT_PORT;
ihpk->dport() = MYAGENT_PORT;

In this case, you should assign a port value to all agents created in
your tcl file, to be sure packets are correctly received by
correspondent agent.

Bye.


On 4/18/06, Faisal Siddiqui <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have been investigating NS2 for research purposes for the last several
> weeks. I have a very basic question and would really appreciate if someone
> could shed some valuable light on it.
>
> I really stepped through each line of the code but can't really find when
> and where the simulator assigns source and destination node addresses to the
> packets. Could someone please explain in some detail how, when and where the
> packets are assigned source and destination node addresses and from where
> does the packets learn this information? Also, if there are more than 3
> nodes (in case of ping agent), how does the packet establishes the source
> and the destination nodes for traffic because in the Tcl script we only
> connect the agents and do not specify the source and destination nodes.
>
> Secondly, function "access (some argument) is spread all over the code. I
> went through the manual as well but can't really understand why it is being
> used in so many places. Could someone please explain what is the purpose of
> using this function and how does this function when cast into different data
> types provides information?
>
> Thanks,
> - Faisal Siddiqui
>



Re: [ns] calculate mobility by using the parameters in setdest

2006-04-21 Thread Hajer FERJANI

Hi,
Do you mean by mobility the speed of a mobile node?
In this case, considering that -m and -M are the options to specify the
minimum and maximum speed of nodes (I don't remember well setdest options),
then setdest will dynamically assign to mobile nodes speed values ranging
from 1 to 6 m/s. If you look to the file generated by setdest, you'll see in
it commands like
"$node0 setdest X Y V" X and Y being future positions and V the speed of the
node.
Now, to get this value during simulation, you should have a pointer to
the MobileNode
instance of you agent (MobileNode * mnode_; ), then you can do :
double speed = mnode_->speed();

Hope it helps.
Bye.



On 4/20/06, www triste <[EMAIL PROTECTED]> wrote:
>
>
> Hello everybody
> i have a big probleme concerning mobility;i use setdest for generate a
> scenario,and i use v2
> setdest -v 2 -n 50 -s 1 -m 1 -M 6 -t 50 -P 1 -p 3.0 -x 1000 -y 1000
> in this case what is the value of mobility?
> please if it is possibile to calculate mobility,help me;thanks a lot
>
>
> -
> Faites de Yahoo! votre page d'accueil sur le web pour retrouver
> directement vos services préférés : vérifiez vos nouveaux mails, lancez vos
> recherches et suivez l'actualité en temps réel. Cliquez ici.
>


Re: [ns] Location aware protocols in NS

2006-03-13 Thread Hajer FERJANI

Hi,
To have current position of a node at agent level, you can do :


MobileNode* mnode_;

double x = 0.0,y = 0.0,z = 0.0;
mnode_->getLoc(&x, &y, &z);



You should have mnode_ referencing to a node. For example, in my case I pass
the node address to my agent in the tcl script and for this reason i defined
a new "node" command in the Command( ) method of the agent like this :

if(strcmp(argv[1], "node") == 0) {
mnode_ = (MobileNode*) TclObject::lookup(argv[2]);
if(mnode_ == 0)
return TCL_ERROR;
return TCL_OK;
}





then in my tcl script I create a node node_1 and my agent , then I do
$my_agent node $node_1



Hope this helps.

Bye.


On 3/10/06, Shibdas Bandyopadhyay <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>I am using ns-2.29 and currently implementating a new protocol which
> depends on the location information of the nodes. How can I get the
> location
> of the attached node from the agent code.  Even if I keep  the location
> information in the agent information ( say by keeping it in routing
> table),
> how to set the corresponding entries. I have made the variables accessible
> to the tcl script using bind function but how can I access the routing
> agent
> corresponding to a particular node? It would be better for me if I get the
> x-cordinates and y-coordinates of the grid topology assigned to the node
> from the routing agent.
>
>
> Thanks
> shibdas
>
> --
> ===
> Shibdas Bandyopadhyay
> Second Year Post graduate student,
> Department of Computer Science
> Indian Statistical Institute, Kolkata
>
> http://snipurl.com/shibdas
>


Re: [ns] IP_BROADCAST problem

2006-02-07 Thread Hajer FERJANI

Hi Dan,
May be you have to specify the address type in the common header as NS_AF_NONE.

struct hdr_cmn *chpk = HDR_CMN(pk);
chpk->addr_type() = NS_AF_NONE;
...

Bye.

Ps : This is the case for wireless networks, I don't know if it is the
same thing for wired ones.


On 2/6/06, Dan Jurca <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I am trying to implement some route-discovery mechanism in ns2, at the
> application layer. This requires me to send some broadcast packets. I set
> the IP destination address to IP_BROADCAST and I get the following error:
>
> __
>
> --- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
>
>  _o15: no target for slot -1
>
>  _o15 type: Classifier/Hash/Dest content dump:
>
>  classifier _o15
>
>  0 offset
>
>  0 shift
>
>  2147483647 mask
>
>  1 slots
>
>  slot 1: _o106 (Classifier/Port)
>
>  -1 default
>
>  -- Finished standard no-slot{} default handler --
>
> 
>
>
>
> Is there something I am missing? Thank you for your help,
>
> Dan
>
>



Re: [ns] how do we define source and destination nodes in adhoc networks

2006-02-01 Thread Hajer FERJANI

Hi,

You just need to do from your c++ code:

  Packet *pk = Packet::alloc();
  struct hdr_cmn *chpk = HDR_CMN(pk);
  struct hdr_ip *ihpk = HDR_IP(pk);

  chpk->addr_type() = NS_AF_INET;
  ihpk->daddr() = dest;  // the addr of the destination node
  ihpk->saddr() = my_index;  //currnet node address
  ihpk->sport() = MyAgent_PORT;  //agent defined port
  ihpk->dport() = MyAgent_PORT; //destination agent defined port

If you need to send packet in broadcast mode, you replace the
addr_type and the daddr by :

  chpk->addr_type() = NS_AF_NONE;
  ihpk->daddr() = IP_BROADCAST;

Hope it helps.
Bye.


On 1/30/06, Ashutosh Srivastava <[EMAIL PROTECTED]> wrote:
>
>  dear all
>please help me out how to define source and destination nodes  
> for  a packet to be  sent from  any node (I wish to use DSR  protocol) .
>   
>  with regards
>  ashutosh
>
>
>
> -
>  Jiyo cricket on Yahoo! India cricket
>



[ns] How to disable tracing

2006-01-30 Thread Hajer FERJANI

Hello,

I've tried to turn off the tracing bu doing in my tcl script :

set AgentTrace OFF
set RouterTrace OFF
set MacTrace OFF

But this does not work, I always get a trace file.
Then I tried to comment the following line:
$ns_ trace-all $tracefile
but I get an error and could not execute the script.

Is there another way to turn OFF the trace feature?
Thanks for your help.
Bye.



Re: [ns] Ping protocol in greis's tutorial

2006-01-27 Thread Hajer FERJANI

Hi Ramya,

I'm using ns2.28 and I know that packet headers management changed a
little bit so the Marc Greis Tutorial could not work anymore.

Now, to add you new packet you have to :
- add you packet name to the enum structure containing packet names in
packet.h (under Common directory) (sorry I don't remeber its name)
- add the name of you packet as it should appears intraces in the same
file (another class just below the enum structure in the same file).

- define an offset and an access () method in the header structure of
you new agent like this :

struct hdr_newAgent{

   // Contents of a newAgent message
   double send_time;
   double weight;
   
  // Header access methods
static int offset_; // required by PacketHeaderManager
inline static int& offset() { return offset_; }
inline static hdr_newAgent* access(const Packet* p) {
return (hdr_newAgent*) p->access(offset_);
}

};


notice also that accessing the header of a protocol changed. So for
example to access the IP headerof a received packet, you should do :

struct hdr_ip *ih = HDR_IP(p);

where HDR_IP(p) is defined as:
#define HDR_IP(p)  ((struct hdr_ip*)hdr_ip::access(p)).
and access(p) is the inline method of struct hdr_ip.

I think this is all,
Hope this helps.

Bye.


On 26 Jan 2006 17:53:40 -, ramya r <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> I tried to implement the Ping protocol specified in the Greis's tutorials 
> under the ~ns/tcl/ns-tutorial folder..
>
> As per the specifications for the necessary changes to be made in order to 
> implement this protocol,
>
> its mentioned that..-
> ---
>
> You also have to add an entry for the new ping packets in the file 
> 'tcl/lib/ns-packet.tcl' in the list at the beginning of the file. It would 
> look like the following piece of code.
>
>{ SRMEXT off_srm_ext_}
>{ Ping off_ping_ }} {
> set cl PacketHeader/[lindex $pair 0]
> -
>
> the problem i have is that i do not find any such list in ns-paclet.tcl
>
> there is one list but its found commented ie., its an old code..
>
>
> What do i do?
>
>
>
>
>
>



Re: [ns] Which parameters are accessable in script for wireless medium

2006-01-27 Thread Hajer FERJANI

Hi,

May be you could replace :
"set ww cwnd_" by " set ww [$your_tcp_agent  tcl_method_to_return_cwnd] "
where "tcl_method_to_return_cwnd" is a tcl method defined in the command()
function of tcp class, which returns the cwnd_ param.

Bye.



On 1/27/06, dharmendra <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> I want to access congestion window for TCP traffic in my tcl script for
> wireless medium. I tried to access through following code:   fw is file
> pointer
>
> proc record {} {
> global ns fw
> set time 0.3
> set now [$ns now]
> set ww cwnd_
> puts $fw "$ww"
> $ns at [expr $time + $now] "record"
> }
>
> This code is not giving cwnd parameter. Could you please pont out where
> is the mistake.
> Also where can i read about parameters  which are accessable in tcl
> script for wireless medium. Can i very these parameters dynamically?
>
> Thanks in advance.
> Dharmendra
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>


Re: [ns] delay for wireless link

2006-01-27 Thread Hajer FERJANI

Hi,

You could may be set the parameter delay_ of link layer in your tcl
script like this:
LL set delay_  10us
Or you could add delay at application layer in your agent before
sending or processing packets using timers.

Hope it helps.
Bye.


On 1/27/06, bhaskar sardar <[EMAIL PROTECTED]> wrote:
>
> how to include delay between two wireless nodes?? please reply quickly
>



Re: [ns] how to reduce the signal range for a mobile node

2006-01-21 Thread Hajer FERJANI

Hi Dheepa,

One way of reducing the signal range is to set an appropriate value of
the receiving threshold in the network interface (in your tcl script),
i.e

Phy/WirelessPhy set RXThresh_ 

A separate C program is provided at
~ns/indep-utils/propagation/threshold.cc to compute the receiving
threshold. You have to compiled it, then you can use the executable to
compute the threshold as follows:

threshold -m  [other-options] distance

Ex:

threshold -m Shadowing -r 0.95 50.

Here the propagation model is Shadowing, the communication range is
set to 50m, and 0.95 is the rate of correctly received packets.

More details can be found in ns_manual.


Hope this helps.

Bye.



On 1/20/06, Dheepa Rajendran <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
>  How to reduce the signal range for a Mobile node?
> I went through antenna.cc and omniantenna.cc
> and they have discussed about Gt_,Gr_,X_,Y_,Z_ and
> some threshold values.Which factor is used for
> reducing the range?
>
> Thanks for ur suggestions
>
> Dheepa
>
>
> Send instant messages to your online friends http://in.messenger.yahoo.com
>
>



Re: [ns] Node id_

2006-01-13 Thread Hajer FERJANI

Hi,
To have the current positions of a node you need to do :

MobileNode* mnode_;

double x = 0.0,y = 0.0,z = 0.0;
mnode_->getLoc(&x, &y, &z);

You should have mnode_ referencing to a node. For example, in my case I pass
the node address to my agent in the tcl script and for this reason i defined
a new "node" command in the Command( ) method of the agent like this :

if(strcmp(argv[1], "node") == 0) {
mnode_ = (MobileNode*) TclObject::lookup(argv[2]);
if(mnode_ == 0)
return TCL_ERROR;
return TCL_OK;
}

Hope this helps.

Bye.


On 1/10/06, Christoph Schroth <[EMAIL PROTECTED]> wrote:
>
>
> Hi all,
>
>
> I actually have a very similar problem and also woul like to get to
> To know the current node I am in from the Interface Queue, for example.
>
> How can I find out the node id and other related data such as mobile
> node
> Position etc.?
>
>
> Thank you so much,
>
>
> Christoph
>


Re: [ns] mobile node communication range

2005-12-17 Thread Hajer FERJANI

Hi,
To specify the communication range of wireless nodes, you should set
an appropriate value of the receiving threshold in the network
interface (in your tcl script), i.e

Phy/WirelessPhy set RXThresh_ 

A separate C program is provided at
~ns/indep-utils/propagation/threshold.cc to compute the receiving
threshold. You have to compile it, then you can use the executable to
compute the threshold as follows:

threshold -m  [other-options] distance

Ex:

threshold -m Shadowing -r 0.95 50.

Here the propagation model is Shadowing, the communication range is
set to 50m, and 0.95 is the rate of correctly received packets.

More details can be found in ns_manual.
I think the default value is 250m (ns 2.28)

Hope this helps.

Bye.


On 12/17/05, shahram mohrehkesh <[EMAIL PROTECTED]> wrote:
>
> Dear All,
>
> I want to know how I could the communication range of a mobile node?
>
> what is its default value?
>
> Regards, Shahram Mohrehkesh
>