Hi,

It can be used to invoke codes from TCL.

e.g:
$ns_ at 10.00 "stop"

"stop" will be defined at command (e.g app.cc)

Good Luck.

rgds
Saravanan K

On Wed, Apr 10, 2013 at 6:09 AM, shiny <shiny....@gmail.com> wrote:

>
> hi all,
> anybody can explain about command() function,how it works and what's the
> purpose of that function.Waiting for ur replies frndz...
>
> *example command function in snoop.cc file *
> *
> *
> int
> Snoop::command(int argc, const char*const* argv)
> {
> //Tcl& tcl = Tcl::instance();
>
> if (argc == 3) {
> if (strcmp(argv[1], "llsnoop") == 0) {
> parent_ = (LLSnoop *) TclObject::lookup(argv[2]);
> if (parent_)
> recvtarget_ = parent_->uptarget();
> return (TCL_OK);
> }
>
> if (strcmp(argv[1], "check-rxmit") == 0) {
> if (empty_()) {
> rxmitStatus_ = SNOOP_PROPAGATE;
> return (TCL_OK);
> }
>
> Packet *p = pkts_[buftail_];
> hdr_snoop *sh = hdr_snoop::access(p);
>
> if (sh->sndTime()!=-1 && sh->sndTime()<atoi(argv[2]) &&
> sh->numRxmit() == 0)
> /* candidate for retransmission */
> rxmitStatus_ = snoop_rxmit(p);
> else
> rxmitStatus_ = SNOOP_PROPAGATE;
> return (TCL_OK);
> }
> }
> return NsObject::command(argc, argv);
> }
>
> --
> With Regards,
> John Shiny.J
>

Reply via email to