[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [ns] enqueue & dequeue usage at OTCL level ?!
Sorry to reask again my question because no answer at all. May be I was not
clear, so I will try to be more clear.
I would like to create a signaling class in order to create new node class
using signaling protocole to forward their packets (typically not forwarding
before an event in another node or link ou queue).
I have not seen this kind of node or protocole in the available
documentations on NS2. Does anybody can tell me if it exist, may under other
form or name, or if it is not yet developped.
The question was then about the abilitu to use at the OTCL level methodes
like enque and deque from the DropTail class.
Thanks.
Ahmad BADRAH
> -----Message d'origine-----
> De : [email protected] [mailto:[email protected]]De la part de
> Ahmad BADRAH
> Envoy� : mardi 22 mai 2001 18:26
> � : [email protected]
> Objet : [ns] enqueue & dequeue usage at OTCL level ?!
>
>
> Hi ,
> Is it possible to use the enqueue and dequeue methode of a DropTail object
> directly in a OTCL class ?
> I am writing the bellow source but have an error because I need a
> pointer to
> a Packet objetc to use enqueue and dequeue.
>
> Does anybody used signaling Agent for blocking queue (typicaly
> semaphore) ?
>
> Thanks.
>
> # Classes definition
> # the semaphore class will allow user to define a ressources
> queue which can
> control transition
> # between queue or node.# In this classe 2 methods will be defined, the
> Djikstra classical one,
> # P() and V()
>
> Class AbSemaphor
> AbSemaphor instproc init {multiplicity} {
> # $self next
> $self instvar cpt_
> set cpt_ $multiplicity
> puts "creation d'un sem avec multiplicity = $multiplicity \n"
> # handle a queue for the non satisfied request.
> $self instvar semaQueue
> # declaration of Queue not allowd. Use Queue/Type ...
> set semaQueue [new Queue/DropTail]
> # Fix the queue limit to the requested multipicite of the Semaphore
> $semaQueue set qlim_ $multiplicity
> # par prudence de changement dans ns on force la queue a etre non
> bloquante.
> $semaQueue set blocked_ 0
> }
>
> AbSemaphor instproc P {} {
> $self instvar cpt_ semaQueue
> if {$cpt_ > 0} {
> puts " Give a token because cpt_= $cpt_ "
> # The available nb of ressource is > 0 then we can
> give one and update
> # the counter cpt
> set cpt_ [expr $cpt_ - 1]
> # return 1 to say OK
> return 1
> } else {
> puts " Non satisfied request because cpt_=$cpt_\n"
> # enque the request in a FIFO
> set p [new Packet]
> semaQueue enque p
> # return a false to say that it does not work
> return 0
> }
> }
>
>
> ----------------- Error ....
> Non satisfied request because cpt_=0
>
> invalid command name "Packet"
> while executing
> "Packet create _o14 "
> invoked from within
> "catch "$className create $o $args" msg"
> (procedure "new" line 3)
> invoked from within
> "new Packet"
> (procedure "_o10" line 13)
> (AbSemaphor P line 13)
> invoked from within
> "$a P"
> (file "Semaphor.tcl" line 66)
> -------------------------------
> --------------------
> Ahmad BADRAH /-/ [email protected] /-/ phone: +33(0)4 9294 4818
> Performance Modelling Architect
> Tachys Technologies /-/ Les Algorithmes, ABS BP 29
> 06901 Sophia-Antipolis Cedex /-/ http://www.tachys.com
>