Dear friends:
  I wrote a new MAC protocol named ATMAC,there are two files: atmac.h and
atmac.cc.I want to know the queue length from the MAC layer,so in atmac.h I
added some code: Queue *ifq_; inline Queue *ifq() {return ifq_;}
In atmac.cc, I modified the command function:
int ATMAC::command(int argc, const char*const* argv)
{
        if (argc == 3) {
                if (strcmp(argv[1], "log-target") == 0) {
                        logtarget_ = (NsObject*) TclObject::lookup(argv[2]);
                        if(logtarget_ == 0)
                                return TCL_ERROR;
                        return TCL_OK;
                } else if(strcmp(argv[1], "ifq") == 0) {
                        ifq_ = (Queue*)TclObject::lookup(argv[2]);
                        if (ifq_ == 0)
                                return TCL_ERROR;
                        return TCL_OK;
                }
        }

        return Mac::command(argc, argv);

}
Then in atmac.cc I use "ifq()->length" to get the queue  length from the MAC
layer.However, when  I  run  the  tcl  script, I got "segmentation fault".
Schould I  use  the  command  "ifq" in the tcl script? And how?
Please help me! Any suggestions will be appreciated! Thanks
Regards
David

Reply via email to