#include <errmodel.h>
Inheritance diagram for SelectErrorModel:


Public Member Functions | |
| SelectErrorModel () | |
| virtual int | corrupt (Packet *) |
| virtual void | recv (Packet *, Handler *) |
| virtual void | recv (Packet *p, const char *s) |
| virtual void | reset () |
| double | rate () |
| ErrorUnit | unit () |
| NsObject * | target () |
| virtual void | drop (Packet *p) |
| virtual void | recvOnly (Packet *) |
| virtual void | delay_bind_init_all () |
| virtual int | delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer) |
| int | isdebug () const |
| virtual void | debug (const char *fmt,...) |
Protected Member Functions | |
| int | command (int argc, const char *const *argv) |
| int | CorruptPkt (Packet *) |
| int | CorruptTime (Packet *) |
| int | CorruptByte (Packet *) |
| int | CorruptBit (Packet *) |
| double | PktLength (Packet *) |
| double * | ComputeBitErrProb (int) |
| virtual void | drop (Packet *p, const char *s) |
| void | send (Packet *p, Handler *h) |
| void | handle (Event *) |
Protected Attributes | |
| packet_t | pkt_type_ |
| int | drop_cycle_ |
| int | drop_offset_ |
| int | enable_ |
| int | markecn_ |
| int | delay_pkt_ |
| int | firstTime_ |
| ErrorUnit | unit_ |
| double | rate_ |
| double | delay_ |
| double | bandwidth_ |
| RandomVariable * | ranvar_ |
| int | FECstrength_ |
| int | datapktsize_ |
| int | cntrlpktsize_ |
| double * | cntrlprb_ |
| double * | dataprb_ |
| Event | intr_ |
| NsObject * | target_ |
| NsObject * | drop_ |
| int | debug_ |
|
|
Definition at line 759 of file errmodel.cc. References drop_cycle_, drop_offset_, and pkt_type_.
00760 {
00761 bind("pkt_type_", (int*)&pkt_type_);
00762 bind("drop_cycle_", &drop_cycle_);
00763 bind("drop_offset_", &drop_offset_);
00764 }
|
|
||||||||||||
|
Reimplemented from ErrorModel. Reimplemented in SRMErrorModel. Definition at line 766 of file errmodel.cc. References ErrorModel::command(), drop_cycle_, drop_offset_, packet_t, and pkt_type_.
00767 {
00768 if (strcmp(argv[1], "drop-packet") == 0) {
00769 pkt_type_ = packet_t(atoi(argv[2]));
00770 drop_cycle_ = atoi(argv[3]);
00771 drop_offset_ = atoi(argv[4]);
00772 return TCL_OK;
00773 }
00774 return ErrorModel::command(argc, argv);
00775 }
|
Here is the call graph for this function:

|
|
Definition at line 231 of file errmodel.cc. References comb(), ErrorModel::FECstrength_, pow(), and ErrorModel::rate_. Referenced by ErrorModel::CorruptBit().
00232 {
00233 double *dptr;
00234 int i;
00235
00236 dptr = (double *)calloc((FECstrength_ + 2), sizeof(double));
00237
00238 for (i = 0; i < (FECstrength_ + 1) ; i++)
00239 dptr[i] = comb(size, i) * pow(rate_, (double)i) * pow(1.0 - rate_, (double)(size - i));
00240
00241 // Cumulative probability
00242 for (i = 0; i < FECstrength_ ; i++)
00243 dptr[i + 1] += dptr[i];
00244
00245 dptr[FECstrength_ + 1] = 1.0;
00246
00247 /* printf("Size = %d\n", size);
00248 for (i = 0; i <(FECstrength_ + 2); i++)
00249 printf("Ptr[%d] = %g\n", i, dptr[i]); */
00250
00251 return dptr;
00252
00253 }
|
Here is the call graph for this function:

|
|
Reimplemented from ErrorModel. Reimplemented in SRMErrorModel. Definition at line 777 of file errmodel.cc. References hdr_cmn::access(), drop_cycle_, drop_offset_, EU_PKT, pkt_type_, PT_CBR, PT_UDP, hdr_cmn::ptype(), hdr_cmn::uid(), and ErrorModel::unit_.
00778 {
00779 if (unit_ == EU_PKT) {
00780 hdr_cmn *ch = hdr_cmn::access(p);
00781 // XXX Backward compatibility for cbr agents
00782 if (ch->ptype() == PT_UDP && pkt_type_ == PT_CBR)
00783 pkt_type_ = PT_UDP; // "udp" rather than "cbr"
00784 if (ch->ptype() == pkt_type_ && ch->uid() % drop_cycle_
00785 == drop_offset_) {
00786 //printf ("dropping packet type %d, uid %d\n",
00787 // ch->ptype(), ch->uid());
00788 return 1;
00789 }
00790 }
00791 return 0;
00792 }
|
Here is the call graph for this function:

|
|
Definition at line 270 of file errmodel.cc. References hdr_cmn::access(), ErrorModel::cntrlpktsize_, ErrorModel::cntrlprb_, ErrorModel::ComputeBitErrProb(), ErrorModel::datapktsize_, ErrorModel::dataprb_, ErrorModel::FECstrength_, ErrorModel::firstTime_, ErrorModel::ranvar_, hdr_cmn::size(), Random::uniform(), and RandomVariable::value(). Referenced by ErrorModel::corrupt().
00271 {
00272 double u, *dptr;
00273 int i;
00274
00275 if (firstTime_ && FECstrength_) {
00276 // precompute the probabilies for each bit-error cnts
00277 cntrlprb_ = ComputeBitErrProb(cntrlpktsize_);
00278 dataprb_ = ComputeBitErrProb(datapktsize_);
00279
00280 firstTime_ = 0;
00281 }
00282
00283 u = ranvar_ ? ranvar_->value() : Random::uniform();
00284 dptr = (hdr_cmn::access(p)->size() >= datapktsize_) ? dataprb_ : cntrlprb_;
00285 for (i = 0; i < (FECstrength_ + 2); i++)
00286 if (dptr[i] > u) break;
00287 return(i);
00288 }
|
Here is the call graph for this function:

|
|
Definition at line 262 of file errmodel.cc. References ErrorModel::PktLength(), pow(), ErrorModel::ranvar_, ErrorModel::rate_, Random::uniform(), and RandomVariable::value(). Referenced by ErrorModel::corrupt().
|
Here is the call graph for this function:

|
|
Definition at line 255 of file errmodel.cc. References ErrorModel::ranvar_, ErrorModel::rate_, Random::uniform(), and RandomVariable::value(). Referenced by ErrorModel::corrupt().
|
Here is the call graph for this function:

|
|
Definition at line 290 of file errmodel.cc. Referenced by ErrorModel::corrupt().
00291 {
00292 fprintf(stderr, "Warning: uniform rate error cannot be time-based\n");
00293 return 0;
00294 }
|
|
||||||||||||
|
Definition at line 102 of file object.cc. References NsObject::debug_.
00103 {
00104 if (!debug_)
00105 return;
00106 va_list ap;
00107 va_start(ap, fmt);
00108 vprintf(fmt, ap);
00109 }
|
|
||||||||||||||||
|
Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent. Definition at line 63 of file object.cc. References NsObject::debug_. Referenced by MPLSAddressClassifier::delay_bind_dispatch(), and Agent::delay_bind_dispatch().
00064 {
00065 if (delay_bind_bool(varName, localName, "debug_", &debug_, tracer))
00066 return TCL_OK;
00067 return TclObject::delay_bind_dispatch(varName, localName, tracer);
00068 }
|
|
|
Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent. Definition at line 57 of file object.cc. Referenced by MPLSAddressClassifier::delay_bind_init_all(), and Agent::delay_bind_init_all().
00058 {
00059 delay_bind_init_one("debug_");
00060 }
|
|
||||||||||||
|
Definition at line 114 of file connector.cc. References Connector::drop_, Packet::free(), and NsObject::recv().
00115 {
00116 if (drop_ != 0)
00117 drop_->recv(p, s);
00118 else
00119 Packet::free(p);
00120 }
|
Here is the call graph for this function:

|
Here is the call graph for this function:

|
|
Implements Handler. Reimplemented in LinkDelay, LL, AckRecons, and Snoop. Definition at line 91 of file object.cc. References NsObject::recv().
|
Here is the call graph for this function:

|
|
Definition at line 61 of file object.h. References NsObject::debug_.
00061 { return debug_; }
|
|
|
Definition at line 218 of file errmodel.cc. References hdr_cmn::access(), ErrorModel::bandwidth_, EU_BIT, EU_BYTE, EU_PKT, hdr_cmn::size(), and ErrorModel::unit_. Referenced by TwoStateErrorModel::corrupt(), and ErrorModel::CorruptByte().
00219 {
00220 //double now;
00221 if (unit_ == EU_PKT)
00222 return 1;
00223 int byte = hdr_cmn::access(p)->size();
00224 if (unit_ == EU_BYTE)
00225 return byte;
00226 if (unit_ == EU_BIT)
00227 return 8.0 * byte;
00228 return 8.0 * byte / bandwidth_;
00229 }
|
Here is the call graph for this function:

|
|
Definition at line 70 of file errmodel.h. References ErrorModel::rate_.
00070 { return rate_; }
|
|
||||||||||||
|
Reimplemented in CMUTrace. Definition at line 96 of file object.cc. References Packet::free().
00097 {
00098 Packet::free(p);
00099 }
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented from Connector. Definition at line 160 of file errmodel.cc. References hdr_flags::access(), hdr_cmn::access(), ErrorModel::bandwidth_, hdr_flags::ce(), ErrorModel::corrupt(), ErrorModel::delay_, ErrorModel::delay_pkt_, Connector::drop_, hdr_cmn::error(), Scheduler::instance(), ErrorModel::intr_, ErrorModel::markecn_, NsObject::recv(), Scheduler::schedule(), hdr_cmn::size(), Connector::target_, and Random::uniform().
00161 {
00162 // 1. Determine the error by calling corrupt(p)
00163 // 2. Set the packet's error flag if it is corrupted
00164 // 3. If there is no error, no drop_ target or markecn is true,
00165 // let pkt continue, otherwise hand the corrupted packet to drop_
00166
00167 hdr_cmn* ch = hdr_cmn::access(p);
00168 int error = corrupt(p);
00169
00170 // XXX When we do ECN, the packet is marked but NOT dropped.
00171 // So we don't resume handler here.
00172 if (!markecn_ && !delay_pkt_ && (h && ((error && drop_) || !target_))) {
00173 // if we drop or there is no target_, then resume handler
00174 double delay = Random::uniform(8.0 * ch->size() / bandwidth_);
00175 Scheduler::instance().schedule(h, &intr_, delay);
00176 }
00177 if (error) {
00178 ch->error() |= error;
00179
00180 if (markecn_) {
00181 hdr_flags* hf = hdr_flags::access(p);
00182 hf->ce() = 1;
00183 } else if (delay_pkt_) {
00184 // Delay the packet.
00185 Scheduler::instance().schedule(target_, p, delay_);
00186 return;
00187 } else if (drop_) {
00188 drop_->recv(p);
00189 return;
00190 }
00191 }
00192
00193 if (target_) {
00194 target_->recv(p, h);
00195 }
00196 }
|
Here is the call graph for this function:

|
|
Reimplemented in Agent, and Trace. Definition at line 56 of file object.h. Referenced by Trace::recvOnly().
00056 {};
|
|
|
Reimplemented from NsObject. Definition at line 154 of file errmodel.cc. References ErrorModel::firstTime_.
00155 {
00156 firstTime_ = 1;
00157 }
|
|
||||||||||||
|
Reimplemented in Agent, and LinkDelay. Definition at line 54 of file connector.h. References NsObject::recv(), and Connector::target_. Referenced by SessionTTLChecker::recv(), TTLChecker::recv(), DequeTrace::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), SatDequeTrace::recv(), SALink::recv(), SnoopQueueEDrop::recv(), SnoopQueueTagger::recv(), SnoopQueueDrop::recv(), SnoopQueueOut::recv(), SnoopQueueIn::recv(), PktCounter::recv(), NetworkInterface::recv(), MeasureMod::recv(), Filter::recv(), Connector::recv(), CMUTrace::recv(), CBQClass::recv(), and AddSR::recv().
|
Here is the call graph for this function:

|
|
Definition at line 48 of file connector.h. References Connector::target_. Referenced by JoBS::assignRateDropsADC(), FQ::deque(), QSAgent::recv(), and MIPMHAgent::reg().
00048 { return target_; }
|
|
|
Definition at line 71 of file errmodel.h. References ErrorUnit, and ErrorModel::unit_.
00071 { return unit_; }
|
|
|
Definition at line 89 of file errmodel.h. Referenced by ErrorModel::ErrorModel(), ErrorModel::PktLength(), and ErrorModel::recv(). |
|
|
Definition at line 94 of file errmodel.h. Referenced by ErrorModel::command(), and ErrorModel::CorruptBit(). |
|
|
Definition at line 95 of file errmodel.h. Referenced by ErrorModel::CorruptBit(). |
|
|
Definition at line 93 of file errmodel.h. Referenced by ErrorModel::command(), and ErrorModel::CorruptBit(). |
|
|
Definition at line 96 of file errmodel.h. Referenced by ErrorModel::CorruptBit(). |
|
|
Reimplemented in FECModel, FloodAgent, and LandmarkAgent. Definition at line 66 of file object.h. Referenced by REDQueue::command(), RedPDQueue::command(), PushbackQueue::command(), NsObject::debug(), NsObject::delay_bind_dispatch(), RedPDQueue::enque(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), and REDQueue::reset(). |
|
|
Definition at line 88 of file errmodel.h. Referenced by ErrorModel::ErrorModel(), and ErrorModel::recv(). |
|
|
Definition at line 84 of file errmodel.h. Referenced by ErrorModel::ErrorModel(), and ErrorModel::recv(). |
|
|
Definition at line 57 of file connector.h. Referenced by Connector::command(), Connector::drop(), and ErrorModel::recv(). |
|
|
Definition at line 186 of file errmodel.h. Referenced by SRMErrorModel::command(), command(), SRMErrorModel::corrupt(), corrupt(), and SelectErrorModel(). |
|
|
Definition at line 187 of file errmodel.h. Referenced by SRMErrorModel::command(), command(), SRMErrorModel::corrupt(), corrupt(), and SelectErrorModel(). |
|
|
Definition at line 82 of file errmodel.h. Referenced by ErrorModel::corrupt(), and ErrorModel::ErrorModel(). |
|
|
Definition at line 92 of file errmodel.h. Referenced by ErrorModel::command(), ErrorModel::ComputeBitErrProb(), and ErrorModel::CorruptBit(). |
|
|
Definition at line 85 of file errmodel.h. Referenced by MultiStateErrorModel::corrupt(), TwoStateErrorModel::corrupt(), ErrorModel::CorruptBit(), and ErrorModel::reset(). |
|
|
Definition at line 97 of file errmodel.h. Referenced by ErrorModel::recv(). |
|
|
Definition at line 83 of file errmodel.h. Referenced by ErrorModel::ErrorModel(), and ErrorModel::recv(). |
|
|
Definition at line 185 of file errmodel.h. Referenced by SRMErrorModel::command(), command(), SRMErrorModel::corrupt(), corrupt(), and SelectErrorModel(). |
|
|
Reimplemented in TwoStateErrorModel. Definition at line 90 of file errmodel.h. Referenced by ErrorModel::command(), ErrorModel::CorruptBit(), ErrorModel::CorruptByte(), and ErrorModel::CorruptPkt(). |
|
|
Definition at line 87 of file errmodel.h. Referenced by ErrorModel::ComputeBitErrProb(), ErrorModel::CorruptByte(), ErrorModel::CorruptPkt(), ErrorModel::ErrorModel(), and ErrorModel::rate(). |
|
|
|
Definition at line 86 of file errmodel.h. Referenced by ErrorModel::command(), LMSErrorModel::corrupt(), SRMErrorModel::corrupt(), corrupt(), ListErrorModel::corrupt(), PeriodicErrorModel::corrupt(), ErrorModel::corrupt(), ErrorModel::PktLength(), and ErrorModel::unit(). |
1.3.3