00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef lint
00021 static const char rcsid[] =
00022 "@(#) $Header: /nfs/jade/vint/CVSROOT/ns-2/adc/adc.cc,v 1.7 1999/02/12 22:01:31 breslau Exp $";
00023 #endif
00024
00025 #include "adc.h"
00026 #include <stdlib.h>
00027
00028 ADC::ADC() :bandwidth_(0), tchan_(0)
00029 {
00030 bind_bw("bandwidth_",&bandwidth_);
00031 bind_bool("backoff_",&backoff_);
00032 bind("src_", &src_);
00033 bind("dst_", &dst_);
00034 bind_bool("dobump_", &dobump_);
00035 }
00036
00037 int ADC::command(int argc,const char*const*argv)
00038 {
00039
00040 Tcl& tcl = Tcl::instance();
00041 if (argc==2) {
00042 if (strcmp(argv[1],"start") ==0) {
00043
00044 est_[1]->start();
00045 return (TCL_OK);
00046 }
00047 } else if (argc==4) {
00048 if (strcmp(argv[1],"attach-measmod") == 0) {
00049
00050 MeasureMod *meas_mod = (MeasureMod *)TclObject::lookup(argv[2]);
00051 if (meas_mod== 0) {
00052 tcl.resultf("no measuremod found");
00053 return(TCL_ERROR);
00054 }
00055 int cl=atoi(argv[3]);
00056 est_[cl]->setmeasmod(meas_mod);
00057 return(TCL_OK);
00058 } else if (strcmp(argv[1],"attach-est") == 0 ) {
00059
00060 Estimator *est_mod = (Estimator *)TclObject::lookup(argv[2]);
00061 if (est_mod== 0) {
00062 tcl.resultf("no estmod found");
00063 return(TCL_ERROR);
00064 }
00065 int cl=atoi(argv[3]);
00066 setest(cl,est_mod);
00067 return(TCL_OK);
00068 }
00069 }
00070 else if (argc == 3) {
00071 if (strcmp(argv[1], "attach") == 0) {
00072 int mode;
00073 const char* id = argv[2];
00074 tchan_ = Tcl_GetChannel(tcl.interp(), (char*)id, &mode);
00075 if (tchan_ == 0) {
00076 tcl.resultf("ADC: trace: can't attach %s for writing", id);
00077 return (TCL_ERROR);
00078 }
00079 return (TCL_OK);
00080
00081 }
00082 if (strcmp(argv[1], "setbuf") == 0) {
00083
00084 return(TCL_OK);
00085 }
00086
00087
00088 }
00089 return (NsObject::command(argc,argv));
00090 }
00091
00092
00093
00094