---------- Forwarded message ----------
From: Sushma M <[email protected]>
Date: Fri, Apr 16, 2010 at 12:51 PM
Subject: ns2
To: [email protected]
hello...
can ne explain me abt this code.... ns2/routing/route.cc i mean how
these argc==2? and argv[1], compute is compared? how it works?
int RouteLogic::command(int argc, const char*const* argv)
{
Tcl& tcl = Tcl::instance();
if (argc == 2) {
if (strcmp(argv[1], "compute") == 0) {
if (adj_ == 0)
return (TCL_OK);
compute_routes();
return (TCL_OK);
and also how cost is calculated using argc and argv[]?
else if (argc > 2) {
if (strcmp(argv[1], "insert") == 0) {
int src = atoi(argv[2]) + 1;
int dst = atoi(argv[3]) + 1;
if (src <= 0 || dst <= 0) {
tcl.result("negative node number");
return (TCL_ERROR);
}
* double cost = (argc == 5 ? atof(argv[4]) : 1);*
insert(src, dst, cost);
return (TCL_OK);
} else if (strcmp(argv[1], "hlevel-is") == 0) {
level_ = atoi(argv[2]);
if (level_ < 1) {
tcl.result("send-hlevel: # hierarchy levels should be
non-zero");
return (TCL_ERROR);
}
return (TCL_OK);
} else if (strcmp(argv[1], "send-num-of-domains") == 0) {
D_ = atoi(argv[2]) + 1;
if (D_ <= 1) {
tcl.result("send-num-of-domains: # domains should be larger
than 1");
return (TCL_ERROR);
}
return (TCL_OK);
} else if (strcmp(argv[1], "send-num-of-clusters") == 0) {
if (argc != D_ + 1) {
tcl.resultf("send-num-of-clusters: # of "
"clusters %d != domain (%d) + 1\n",
argc, D_);
return (TCL_ERROR);
}
thanking u all....
Sushma