[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] Input Queue



> I want to implement a input queue.
> but, ns only buit output queue.
> generally, ns consist of following object..

I wanted to do something quite similar - I wanted to implement a
diffserv conditioner in a node. I did it in two ways - the first approach
involved inserting a conditioner between the link and the node entry
point. The conditioner was not part of the node but it served my purpose
reasonably well. I used this to model a conditioner being installed on
each input interface. The conditioner then only acted on the traffic
arriving on a single interface. My other approach was to have the
conditioner in the node itself - this approach was used to apply a
conditioner to all the traffic entering a node, and involved using a
different node class.

I created a child class of the Node class which had the extra
functionality. This involved inserting an extra component into the new
Node class.

Hth,
Sean.

-----

Simulator instproc insert-conditioner {cond n1 n2} {
    # this method inserts a conditioner before node 2 on the link
    # between node1 and node2

    $self instvar link_
    set sid [$n1 id]
    set did [$n2 id]
    set templink $link_($sid:$did)
    set linktarget [$templink get-target]
    $templink set-target $cond
    $cond target $linktarget
}

SimpleLink instproc set-target {tg} {
    $self instvar link_
    $link_ target $tg
}

SimpleLink instproc get-target {} {
    $self instvar link_
    set tg [$link_ target]
    return $tg 
}

Class DSNode -superclass Node

DSNode instproc init args {
    $self instvar np_ id_ agents_ dmux_ neighbor_ rtsize_ conditioner_
    $self instvar classifier_
    set neighbor_ ""
    set agents_ ""
    set dmux_ ""
    set np_ 0
    set id_ [Node getid]
    set rtsize_ 0
    $self mk-default-classifier

    # This is the stuff that I added    
    set conditioner_ [new DSConditioner]
    $conditioner_ target $classifier_
}

DSNode instproc entry {} {
    $self instvar conditioner_
    return $conditioner_
}

# these functions are not necessary for your purpose.

DSNode instproc conditioner {} {
    $self instvar conditioner_
    return $conditioner_ 
}

DSNode instproc add-profile {profile} {
    $self instvar conditioner_
    $conditioner_ add-profile $profile
}

-----
Sean Murphy,			Email: [email protected]
Teltec Ireland,			Phone: +353-1-7045080
DCU, Dublin 9,			Fax:   +353-1-7045092
Ireland.