[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] Need help on new Node Classifier!!!
I just use default "duplex-link"
If I just use my new classifier, which didn't override any of the
function, everything is OK. However if I want override function like
recv, it will have problem like I mentioned. It seems that find() call
classify() ,then problem came.
Thanks a lot
yours
Xiaojun Cao
penghe wrote:
> It seems you didn't install the object(link head) into the slot table of the
> classifiers. BTW, where are your links?
>
> Regards,
> Peng He
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]]On Behalf Of
> Xiaojun Cao
> Sent: July 24, 2001 3:02 PM
> Cc: [email protected]
> Subject: [ns] Need help on new Node Classifier!!!
>
>
> hi,
> I am trying to simulate a node which has packet filter. So I create a
> new classifer inherted from AddressClassifier and override its Function
> ::recv, it's just like following:
>
> void myClassifier::recv(Packet *p, Handler *h)
> {
> hdr_ip * iph=hdr_ip::access(p);
> nsaddr_t src=mshift(iph->saddr());
> nsaddr_t dst=mshift(iph->daddr());
> int fid=iph->flowid();
>
> NsObject * target =find(p);
> if(dst==Currentid){
>
> if(!target) target->recv(p,h);
> ....
> }
> ....
>
> }
>
> Basically, I will check the destionation address and decide whether this
> packet will be passed to an upper agent or next node.
> The problem came from: find(p)----> I can trace and found that nslot_
> is always 0, however, cl=classify(p) would be 3. I dont know why?
> Could you give me a hand?
> Thanks a lot!
>
> yours,
> Xiaojun Cao
>
> ********Here is the dump info:
>
> --- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
> _o17: no target for slot 3
> _o17 type: Classifier/Addr/MYFiL
> content dump:
> classifier _o17
> 0 offset
> 0 shift
> 2147483647 mask
> 0 slots
> ---------- Finished standard no-slot{} default handler ----------
>
> ********The toplogy is as following:
>
> set n0 [$ns node]
> set n1 [$ns MyNode]
> set n2 [$ns MyNode]
>
> #n0--->n1-->n2
> #n0 send udp packet to n2
> ....
>
> ******The node tcl code is as following:
> MyNode instproc mk-default-classifier {} {
>
> $self instvar address_ classifier_ id_
> set classifier_ [new Classifier/Addr/MYFiL]
> $classifier_ set mask_ [AddrParams NodeMask 1]
> $classifier_ set shift_ [AddrParams NodeShift 1]
> set address_ $id_
> }