#include <EtherMACBase.h>
Inheritance diagram for EtherMACBase:
EtherMACBase::EtherMACBase | ( | ) |
00029 { 00030 nb = NULL; 00031 queueModule = NULL; 00032 interfaceEntry = NULL; 00033 endTxMsg = endIFGMsg = endPauseMsg = NULL; 00034 }
EtherMACBase::~EtherMACBase | ( | ) | [virtual] |
00037 { 00038 cancelAndDelete(endTxMsg); 00039 cancelAndDelete(endIFGMsg); 00040 cancelAndDelete(endPauseMsg); 00041 }
void EtherMACBase::beginSendFrames | ( | ) | [protected] |
00537 { 00538 if (!txQueue.empty()) 00539 { 00540 // Other frames are queued, therefore wait IFG period and transmit next frame 00541 EV << "Transmit next frame in output queue, after IFG period\n"; 00542 scheduleEndIFGPeriod(); 00543 } 00544 else 00545 { 00546 transmitState = TX_IDLE_STATE; 00547 if (queueModule) 00548 { 00549 // tell queue module that we've become idle 00550 EV << "Requesting another frame from queue module\n"; 00551 queueModule->requestPacket(); 00552 } 00553 else 00554 { 00555 // No more frames set transmitter to idle 00556 EV << "No more frames to send, transmitter set to idle\n"; 00557 } 00558 } 00559 }
void EtherMACBase::calculateParameters | ( | ) | [protected] |
00232 { 00233 if (disabled || !connected) 00234 { 00235 bitTime = slotTime = interFrameGap = jamDuration = shortestFrameDuration = 0; 00236 carrierExtension = frameBursting = false; 00237 return; 00238 } 00239 00240 if (txrate != ETHERNET_TXRATE && txrate != FAST_ETHERNET_TXRATE && 00241 txrate != GIGABIT_ETHERNET_TXRATE && txrate != FAST_GIGABIT_ETHERNET_TXRATE) 00242 { 00243 error("nonstandard transmission rate %g, must be %g, %g, %g or %g bit/sec", 00244 txrate, ETHERNET_TXRATE, FAST_ETHERNET_TXRATE, GIGABIT_ETHERNET_TXRATE, FAST_GIGABIT_ETHERNET_TXRATE); 00245 } 00246 00247 bitTime = 1/(double)txrate; 00248 00249 // set slot time 00250 if (txrate==ETHERNET_TXRATE || txrate==FAST_ETHERNET_TXRATE) 00251 slotTime = SLOT_TIME; 00252 else 00253 slotTime = GIGABIT_SLOT_TIME; 00254 00255 // only if Gigabit Ethernet 00256 frameBursting = (txrate==GIGABIT_ETHERNET_TXRATE || txrate==FAST_GIGABIT_ETHERNET_TXRATE); 00257 carrierExtension = (slotTime == GIGABIT_SLOT_TIME && !duplexMode); 00258 00259 interFrameGap = INTERFRAME_GAP_BITS/(double)txrate; 00260 jamDuration = 8*JAM_SIGNAL_BYTES*bitTime; 00261 shortestFrameDuration = carrierExtension ? GIGABIT_MIN_FRAME_WITH_EXT : MIN_ETHERNET_FRAME; 00262 }
bool EtherMACBase::checkAndScheduleEndPausePeriod | ( | ) | [protected] |
00522 { 00523 if (pauseUnitsRequested>0) 00524 { 00525 // if we received a PAUSE frame recently, go into PAUSE state 00526 EV << "Going to PAUSE mode for " << pauseUnitsRequested << " time units\n"; 00527 00528 scheduleEndPausePeriod(pauseUnitsRequested); 00529 pauseUnitsRequested = 0; 00530 return true; 00531 } 00532 00533 return false; 00534 }
bool EtherMACBase::checkDestinationAddress | ( | EtherFrame * | frame | ) | [protected] |
00215 { 00216 // If not set to promiscuous = on, then checks if received frame contains destination MAC address 00217 // matching port's MAC address, also checks if broadcast bit is set 00218 if (!promiscuous && !frame->getDest().isBroadcast() && !frame->getDest().equals(address)) 00219 { 00220 EV << "Frame `" << frame->name() <<"' not destined to us, discarding\n"; 00221 numDroppedNotForUs++; 00222 numDroppedNotForUsVector.record(numDroppedNotForUs); 00223 delete frame; 00224 00225 return false; 00226 } 00227 00228 return true; 00229 }
void EtherMACBase::finish | ( | ) | [protected, virtual] |
Reimplemented in EtherMAC.
00570 { 00571 if (!disabled && par("writeScalars").boolValue()) 00572 { 00573 double t = simTime(); 00574 recordScalar("simulated time", t); 00575 recordScalar("txrate (Mb)", txrate/1000000); 00576 recordScalar("full duplex", duplexMode); 00577 recordScalar("frames sent", numFramesSent); 00578 recordScalar("frames rcvd", numFramesReceivedOK); 00579 recordScalar("bytes sent", numBytesSent); 00580 recordScalar("bytes rcvd", numBytesReceivedOK); 00581 recordScalar("frames from higher layer", numFramesFromHL); 00582 recordScalar("frames from higher layer dropped (iface down)", numDroppedIfaceDown); 00583 recordScalar("frames dropped (bit error)", numDroppedBitError); 00584 recordScalar("frames dropped (not for us)", numDroppedNotForUs); 00585 recordScalar("frames passed up to HL", numFramesPassedToHL); 00586 recordScalar("PAUSE frames sent", numPauseFramesSent); 00587 recordScalar("PAUSE frames rcvd", numPauseFramesRcvd); 00588 00589 if (t>0) 00590 { 00591 recordScalar("frames/sec sent", numFramesSent/t); 00592 recordScalar("frames/sec rcvd", numFramesReceivedOK/t); 00593 recordScalar("bits/sec sent", 8*numBytesSent/t); 00594 recordScalar("bits/sec rcvd", 8*numBytesReceivedOK/t); 00595 } 00596 } 00597 }
void EtherMACBase::fireChangeNotification | ( | int | type, | |
cMessage * | msg | |||
) | [protected] |
00562 { 00563 if (nb) { 00564 notifDetails.setMessage(msg); 00565 nb->fireChangeNotification(type, ¬ifDetails); 00566 } 00567 }
void EtherMACBase::frameReceptionComplete | ( | EtherFrame * | frame | ) | [protected] |
00349 { 00350 int pauseUnits; 00351 00352 switch (frame->kind()) 00353 { 00354 case ETH_FRAME: 00355 processReceivedDataFrame((EtherFrame *)frame); 00356 break; 00357 00358 case ETH_PAUSE: 00359 pauseUnits = ((EtherPauseFrame *)frame)->getPauseTime(); 00360 delete frame; 00361 numPauseFramesRcvd++; 00362 numPauseFramesRcvdVector.record(numPauseFramesRcvd); 00363 processPauseCommand(pauseUnits); 00364 break; 00365 00366 default: 00367 error("Invalid message kind %d",frame->kind()); 00368 } 00369 }
MACAddress EtherMACBase::getMACAddress | ( | ) | [inline] |
void EtherMACBase::handleEndIFGPeriod | ( | ) | [protected, virtual] |
Reimplemented in EtherMAC, and EtherMAC2.
00426 { 00427 if (transmitState!=WAIT_IFG_STATE) 00428 error("Not in WAIT_IFG_STATE at the end of IFG period"); 00429 00430 if (txQueue.empty()) 00431 error("End of IFG and no frame to transmit"); 00432 00433 // End of IFG period, okay to transmit, if Rx idle OR duplexMode 00434 cMessage *frame = (cMessage *)txQueue.tail(); 00435 EV << "IFG elapsed, now begin transmission of frame " << frame << endl; 00436 00437 // Perform carrier extension if in Gigabit Ethernet 00438 if (carrierExtension && frame->byteLength() < GIGABIT_MIN_FRAME_WITH_EXT) 00439 { 00440 EV << "Performing carrier extension of small frame\n"; 00441 frame->setByteLength(GIGABIT_MIN_FRAME_WITH_EXT); 00442 } 00443 00444 // start frame burst, if enabled 00445 if (frameBursting) 00446 { 00447 EV << "Starting frame burst\n"; 00448 framesSentInBurst = 0; 00449 bytesSentInBurst = 0; 00450 } 00451 }
void EtherMACBase::handleEndPausePeriod | ( | ) | [protected, virtual] |
00481 { 00482 if (transmitState != PAUSE_STATE) 00483 error("At end of PAUSE not in PAUSE_STATE!"); 00484 EV << "Pause finished, resuming transmissions\n"; 00485 beginSendFrames(); 00486 }
void EtherMACBase::handleEndTxPeriod | ( | ) | [protected, virtual] |
Reimplemented in EtherMAC, and EtherMAC2.
00454 { 00455 // we only get here if transmission has finished successfully, without collision 00456 if (transmitState!=TRANSMITTING_STATE || (!duplexMode && receiveState!=RX_IDLE_STATE)) 00457 error("End of transmission, and incorrect state detected"); 00458 00459 if (txQueue.empty()) 00460 error("Frame under transmission cannot be found"); 00461 00462 // get frame from buffer 00463 cMessage *frame = (cMessage*)txQueue.pop(); 00464 00465 numFramesSent++; 00466 numBytesSent += frame->byteLength(); 00467 numFramesSentVector.record(numFramesSent); 00468 numBytesSentVector.record(numBytesSent); 00469 00470 if (frame->kind()==ETH_PAUSE) 00471 { 00472 numPauseFramesSent++; 00473 numPauseFramesSentVector.record(numPauseFramesSent); 00474 } 00475 00476 EV << "Transmission of " << frame << " successfully completed\n"; 00477 delete frame; 00478 }
void EtherMACBase::initialize | ( | ) | [protected, virtual] |
Reimplemented in EtherMAC, and EtherMAC2.
00044 { 00045 initializeFlags(); 00046 00047 initializeTxrate(); 00048 WATCH(txrate); 00049 00050 initializeMACAddress(); 00051 initializeQueueModule(); 00052 initializeNotificationBoard(); 00053 initializeStatistics(); 00054 00055 registerInterface(txrate); // needs MAC address 00056 00057 // initialize queue 00058 txQueue.setName("txQueue"); 00059 00060 // initialize self messages 00061 endTxMsg = new cMessage("EndTransmission", ENDTRANSMISSION); 00062 endIFGMsg = new cMessage("EndIFG", ENDIFG); 00063 endPauseMsg = new cMessage("EndPause", ENDPAUSE); 00064 00065 // initialize states 00066 transmitState = TX_IDLE_STATE; 00067 receiveState = RX_IDLE_STATE; 00068 WATCH(transmitState); 00069 WATCH(receiveState); 00070 00071 // initalize pause 00072 pauseUnitsRequested = 0; 00073 WATCH(pauseUnitsRequested); 00074 00075 // initialize queue limit 00076 txQueueLimit = par("txQueueLimit"); 00077 WATCH(txQueueLimit); 00078 }
void EtherMACBase::initializeFlags | ( | ) | [protected] |
00118 { 00119 // initialize connected flag 00120 connected = gate("physOut")->destinationGate()->isConnected(); 00121 if (!connected) EV << "MAC not connected to a network.\n"; 00122 WATCH(connected); 00123 00124 // TODO: this should be settable from the gui 00125 // initialize disabled flag 00126 // Note: it is currently not supported to enable a disabled MAC at runtime. 00127 // Difficulties: (1) autoconfig (2) how to pick up channel state (free, tx, collision etc) 00128 disabled = false; 00129 WATCH(disabled); 00130 00131 // initialize promiscuous flag 00132 promiscuous = par("promiscuous"); 00133 WATCH(promiscuous); 00134 }
void EtherMACBase::initializeMACAddress | ( | ) | [protected] |
00092 { 00093 const char *addrstr = par("address"); 00094 00095 if (!strcmp(addrstr,"auto")) 00096 { 00097 // assign automatic address 00098 address = MACAddress::generateAutoAddress(); 00099 00100 // change module parameter from "auto" to concrete address 00101 par("address").setStringValue(address.str().c_str()); 00102 } 00103 else 00104 { 00105 address.setAddress(addrstr); 00106 } 00107 }
void EtherMACBase::initializeNotificationBoard | ( | ) | [protected] |
00110 { 00111 if (interfaceEntry) { 00112 nb = NotificationBoardAccess().getIfExists(); 00113 notifDetails.setInterfaceEntry(interfaceEntry); 00114 } 00115 }
void EtherMACBase::initializeQueueModule | ( | ) | [protected] |
00081 { 00082 if (par("queueModule").stringValue()[0]) 00083 { 00084 cModule *module = parentModule()->submodule(par("queueModule").stringValue()); 00085 queueModule = check_and_cast<IPassiveQueue *>(module); 00086 EV << "Requesting first frame from queue module\n"; 00087 queueModule->requestPacket(); 00088 } 00089 }
void EtherMACBase::initializeStatistics | ( | ) | [protected] |
00137 { 00138 framesSentInBurst = 0; 00139 bytesSentInBurst = 0; 00140 00141 numFramesSent = numFramesReceivedOK = numBytesSent = numBytesReceivedOK = 0; 00142 numFramesPassedToHL = numDroppedBitError = numDroppedNotForUs = 0; 00143 numFramesFromHL = numDroppedIfaceDown = 0; 00144 numPauseFramesRcvd = numPauseFramesSent = 0; 00145 00146 WATCH(framesSentInBurst); 00147 WATCH(bytesSentInBurst); 00148 00149 WATCH(numFramesSent); 00150 WATCH(numFramesReceivedOK); 00151 WATCH(numBytesSent); 00152 WATCH(numBytesReceivedOK); 00153 WATCH(numFramesFromHL); 00154 WATCH(numDroppedIfaceDown); 00155 WATCH(numDroppedBitError); 00156 WATCH(numDroppedNotForUs); 00157 WATCH(numFramesPassedToHL); 00158 WATCH(numPauseFramesRcvd); 00159 WATCH(numPauseFramesSent); 00160 00161 numFramesSentVector.setName("framesSent"); 00162 numFramesReceivedOKVector.setName("framesReceivedOK"); 00163 numBytesSentVector.setName("bytesSent"); 00164 numBytesReceivedOKVector.setName("bytesReceivedOK"); 00165 numDroppedIfaceDownVector.setName("framesDroppedIfaceDown"); 00166 numDroppedBitErrorVector.setName("framesDroppedBitError"); 00167 numDroppedNotForUsVector.setName("framesDroppedNotForUs"); 00168 numFramesPassedToHLVector.setName("framesPassedToHL"); 00169 numPauseFramesRcvdVector.setName("pauseFramesRcvd"); 00170 numPauseFramesSentVector.setName("pauseFramesSent"); 00171 }
virtual void EtherMACBase::initializeTxrate | ( | ) | [protected, pure virtual] |
void EtherMACBase::printParameters | ( | ) | [protected] |
00265 { 00266 // Dump parameters 00267 EV << "MAC address: " << address << (promiscuous ? ", promiscuous mode" : "") << endl; 00268 EV << "txrate: " << txrate << ", " << (duplexMode ? "duplex" : "half-duplex") << endl; 00269 #if 0 00270 EV << "bitTime: " << bitTime << endl; 00271 EV << "carrierExtension: " << carrierExtension << endl; 00272 EV << "frameBursting: " << frameBursting << endl; 00273 EV << "slotTime: " << slotTime << endl; 00274 EV << "interFrameGap: " << interFrameGap << endl; 00275 EV << endl; 00276 #endif 00277 }
void EtherMACBase::processFrameFromUpperLayer | ( | EtherFrame * | msg | ) | [protected, virtual] |
Reimplemented in EtherMAC, and EtherMAC2.
00280 { 00281 EV << "Received frame from upper layer: " << frame << endl; 00282 00283 // check message kind 00284 if (frame->kind()!=ETH_FRAME && frame->kind()!=ETH_PAUSE) 00285 error("message with unexpected message kind %d arrived from higher layer", frame->kind()); 00286 00287 // pause frames must be EtherPauseFrame AND kind==ETH_PAUSE 00288 ASSERT((frame->kind()==ETH_PAUSE) == (dynamic_cast<EtherPauseFrame *>(frame)!=NULL)); 00289 00290 if (frame->getDest().equals(address)) 00291 { 00292 error("logic error: frame %s from higher layer has local MAC address as dest (%s)", 00293 frame->fullName(), frame->getDest().str().c_str()); 00294 } 00295 00296 if (frame->byteLength() > MAX_ETHERNET_FRAME) 00297 error("packet from higher layer (%d bytes) exceeds maximum Ethernet frame size (%d)", frame->byteLength(), MAX_ETHERNET_FRAME); 00298 00299 // must be ETH_FRAME (or ETH_PAUSE) from upper layer 00300 bool isPauseFrame = (frame->kind()==ETH_PAUSE); 00301 if (!isPauseFrame) 00302 { 00303 numFramesFromHL++; 00304 00305 if (txQueueLimit && txQueue.length()>txQueueLimit) 00306 error("txQueue length exceeds %d -- this is probably due to " 00307 "a bogus app model generating excessive traffic " 00308 "(or if this is normal, increase txQueueLimit!)", 00309 txQueueLimit); 00310 00311 // fill in src address if not set 00312 if (frame->getSrc().isUnspecified()) 00313 frame->setSrc(address); 00314 00315 // store frame and possibly begin transmitting 00316 EV << "Packet " << frame << " arrived from higher layers, enqueueing\n"; 00317 txQueue.insert(frame); 00318 } 00319 else 00320 { 00321 EV << "PAUSE received from higher layer\n"; 00322 00323 // PAUSE frames enjoy priority -- they're transmitted before all other frames queued up 00324 if (!txQueue.empty()) 00325 txQueue.insertBefore(txQueue.tail(), frame); // tail() frame is probably being transmitted 00326 else 00327 txQueue.insert(frame); 00328 } 00329 00330 }
void EtherMACBase::processMessageWhenDisabled | ( | cMessage * | msg | ) | [protected, virtual] |
00496 { 00497 EV << "MAC is disabled -- dropping message " << msg << endl; 00498 delete msg; 00499 }
void EtherMACBase::processMessageWhenNotConnected | ( | cMessage * | msg | ) | [protected, virtual] |
00489 { 00490 EV << "Interface is not connected -- dropping packet " << msg << endl; 00491 delete msg; 00492 numDroppedIfaceDown++; 00493 }
void EtherMACBase::processMsgFromNetwork | ( | cMessage * | msg | ) | [protected, virtual] |
Reimplemented in EtherMAC, and EtherMAC2.
00333 { 00334 EV << "Received frame from network: " << frame << endl; 00335 00336 // frame must be ETH_FRAME, ETH_PAUSE or JAM_SIGNAL 00337 if (frame->kind()!=ETH_FRAME && frame->kind()!=ETH_PAUSE && frame->kind()!=JAM_SIGNAL) 00338 error("message with unexpected message kind %d arrived from network", frame->kind()); 00339 00340 // detect cable length violation in half-duplex mode 00341 if (!duplexMode && simTime()-frame->sendingTime()>=shortestFrameDuration) 00342 error("very long frame propagation time detected, maybe cable exceeds maximum allowed length? " 00343 "(%lgs corresponds to an approx. %lgm cable)", 00344 simTime()-frame->sendingTime(), 00345 (simTime()-frame->sendingTime())*200000000.0); 00346 }
void EtherMACBase::processPauseCommand | ( | int | pauseUnits | ) | [protected] |
00402 { 00403 if (transmitState==TX_IDLE_STATE) 00404 { 00405 EV << "PAUSE frame received, pausing for " << pauseUnitsRequested << " time units\n"; 00406 if (pauseUnits>0) 00407 scheduleEndPausePeriod(pauseUnits); 00408 } 00409 else if (transmitState==PAUSE_STATE) 00410 { 00411 EV << "PAUSE frame received, pausing for " << pauseUnitsRequested << " more time units from now\n"; 00412 cancelEvent(endPauseMsg); 00413 if (pauseUnits>0) 00414 scheduleEndPausePeriod(pauseUnits); 00415 } 00416 else 00417 { 00418 // transmitter busy -- wait until it finishes with current frame (endTx) 00419 // and then it'll go to PAUSE state 00420 EV << "PAUSE frame received, storing pause request\n"; 00421 pauseUnitsRequested = pauseUnits; 00422 } 00423 }
void EtherMACBase::processReceivedDataFrame | ( | EtherFrame * | frame | ) | [protected] |
00372 { 00373 // bit errors 00374 if (frame->hasBitError()) 00375 { 00376 numDroppedBitError++; 00377 numDroppedBitErrorVector.record(numDroppedBitError); 00378 delete frame; 00379 return; 00380 } 00381 00382 // strip preamble and SFD 00383 frame->addByteLength(-PREAMBLE_BYTES-SFD_BYTES); 00384 00385 // statistics 00386 numFramesReceivedOK++; 00387 numBytesReceivedOK += frame->byteLength(); 00388 numFramesReceivedOKVector.record(numFramesReceivedOK); 00389 numBytesReceivedOKVector.record(numBytesReceivedOK); 00390 00391 if (!checkDestinationAddress(frame)) 00392 return; 00393 00394 numFramesPassedToHL++; 00395 numFramesPassedToHLVector.record(numFramesPassedToHL); 00396 00397 // pass up to upper layer 00398 send(frame, "upperLayerOut"); 00399 }
long EtherMACBase::queueLength | ( | ) | [inline] |
void EtherMACBase::registerInterface | ( | double | txrate | ) | [protected] |
00174 { 00175 InterfaceTable *ift = InterfaceTableAccess().getIfExists(); 00176 if (!ift) 00177 return; 00178 00179 interfaceEntry = new InterfaceEntry(); 00180 00181 // interface name: our module name without special characters ([]) 00182 char *interfaceName = new char[strlen(parentModule()->fullName())+1]; 00183 char *d=interfaceName; 00184 for (const char *s=parentModule()->fullName(); *s; s++) 00185 if (isalnum(*s)) 00186 *d++ = *s; 00187 *d = '\0'; 00188 00189 interfaceEntry->setName(interfaceName); 00190 delete [] interfaceName; 00191 00192 // data rate 00193 interfaceEntry->setDatarate(txrate); 00194 00195 // generate a link-layer address to be used as interface token for IPv6 00196 interfaceEntry->setMACAddress(address); 00197 interfaceEntry->setInterfaceToken(address.formInterfaceIdentifier()); 00198 //InterfaceToken token(0, simulation.getUniqueNumber(), 64); 00199 //interfaceEntry->setInterfaceToken(token); 00200 00201 // MTU: typical values are 576 (Internet de facto), 1500 (Ethernet-friendly), 00202 // 4000 (on some point-to-point links), 4470 (Cisco routers default, FDDI compatible) 00203 interfaceEntry->setMtu(1500); 00204 00205 // capabilities 00206 interfaceEntry->setMulticast(true); 00207 interfaceEntry->setBroadcast(true); 00208 00209 // add 00210 ift->addInterface(interfaceEntry, this); 00211 }
void EtherMACBase::scheduleEndIFGPeriod | ( | ) | [protected] |
00502 { 00503 scheduleAt(simTime()+interFrameGap, endIFGMsg); 00504 transmitState = WAIT_IFG_STATE; 00505 }
void EtherMACBase::scheduleEndPausePeriod | ( | int | pauseUnits | ) | [protected] |
00514 { 00515 // length is interpreted as 512-bit-time units 00516 double pausePeriod = pauseUnits*PAUSE_BITTIME*bitTime; 00517 scheduleAt(simTime()+pausePeriod, endPauseMsg); 00518 transmitState = PAUSE_STATE; 00519 }
void EtherMACBase::scheduleEndTxPeriod | ( | cMessage * | ) | [protected] |
00508 { 00509 scheduleAt(simTime()+frame->length()*bitTime, endTxMsg); 00510 transmitState = TRANSMITTING_STATE; 00511 }
void EtherMACBase::updateConnectionColor | ( | int | txState | ) | [protected] |
00652 { 00653 const char *color; 00654 if (txState==TRANSMITTING_STATE) 00655 color = "yellow"; 00656 else if (txState==JAMMING_STATE || txState==BACKOFF_STATE) 00657 color = "red"; 00658 else 00659 color = ""; 00660 00661 cGate *g = gate("physOut"); 00662 while (g && g->type()=='O') 00663 { 00664 g->displayString().setTagArg("o",0,color); 00665 g->displayString().setTagArg("o",1, color[0] ? "3" : "1"); 00666 g = g->toGate(); 00667 } 00668 }
void EtherMACBase::updateDisplayString | ( | ) | [protected] |
00600 { 00601 // icon coloring 00602 const char *color; 00603 if (receiveState==RX_COLLISION_STATE) 00604 color = "red"; 00605 else if (transmitState==TRANSMITTING_STATE) 00606 color = "yellow"; 00607 else if (transmitState==JAMMING_STATE) 00608 color = "red"; 00609 else if (receiveState==RECEIVING_STATE) 00610 color = "#4040ff"; 00611 else if (transmitState==BACKOFF_STATE) 00612 color = "white"; 00613 else if (transmitState==PAUSE_STATE) 00614 color = "gray"; 00615 else 00616 color = ""; 00617 displayString().setTagArg("i",1,color); 00618 if (!strcmp(parentModule()->className(),"EthernetInterface")) 00619 parentModule()->displayString().setTagArg("i",1,color); 00620 00621 // connection coloring 00622 updateConnectionColor(transmitState); 00623 00624 #if 0 00625 // this code works but didn't turn out to be very useful 00626 const char *txStateName; 00627 switch (transmitState) { 00628 case TX_IDLE_STATE: txStateName="IDLE"; break; 00629 case WAIT_IFG_STATE: txStateName="WAIT_IFG"; break; 00630 case TRANSMITTING_STATE: txStateName="TX"; break; 00631 case JAMMING_STATE: txStateName="JAM"; break; 00632 case BACKOFF_STATE: txStateName="BACKOFF"; break; 00633 case PAUSE_STATE: txStateName="PAUSE"; break; 00634 default: error("wrong tx state"); 00635 } 00636 const char *rxStateName; 00637 switch (receiveState) { 00638 case RX_IDLE_STATE: rxStateName="IDLE"; break; 00639 case RECEIVING_STATE: rxStateName="RX"; break; 00640 case RX_COLLISION_STATE: rxStateName="COLL"; break; 00641 default: error("wrong rx state"); 00642 } 00643 00644 char buf[80]; 00645 sprintf(buf, "tx:%s rx: %s\n#boff:%d #cTx:%d", 00646 txStateName, rxStateName, backoffs, numConcurrentTransmissions); 00647 displayString().setTagArg("t",0,buf); 00648 #endif 00649 }
MACAddress EtherMACBase::address [protected] |
double EtherMACBase::bitTime [protected] |
int EtherMACBase::bytesSentInBurst [protected] |
bool EtherMACBase::carrierExtension [protected] |
bool EtherMACBase::connected [protected] |
bool EtherMACBase::disabled [protected] |
bool EtherMACBase::duplexMode [protected] |
cMessage * EtherMACBase::endIFGMsg [protected] |
cMessage * EtherMACBase::endPauseMsg [protected] |
cMessage* EtherMACBase::endTxMsg [protected] |
bool EtherMACBase::frameBursting [protected] |
int EtherMACBase::framesSentInBurst [protected] |
InterfaceEntry* EtherMACBase::interfaceEntry [protected] |
double EtherMACBase::interFrameGap [protected] |
double EtherMACBase::jamDuration [protected] |
NotificationBoard* EtherMACBase::nb [protected] |
TxNotifDetails EtherMACBase::notifDetails [protected] |
unsigned long EtherMACBase::numBytesReceivedOK [protected] |
cOutVector EtherMACBase::numBytesReceivedOKVector [protected] |
unsigned long EtherMACBase::numBytesSent [protected] |
cOutVector EtherMACBase::numBytesSentVector [protected] |
unsigned long EtherMACBase::numDroppedBitError [protected] |
cOutVector EtherMACBase::numDroppedBitErrorVector [protected] |
unsigned long EtherMACBase::numDroppedIfaceDown [protected] |
cOutVector EtherMACBase::numDroppedIfaceDownVector [protected] |
unsigned long EtherMACBase::numDroppedNotForUs [protected] |
cOutVector EtherMACBase::numDroppedNotForUsVector [protected] |
unsigned long EtherMACBase::numFramesFromHL [protected] |
unsigned long EtherMACBase::numFramesPassedToHL [protected] |
cOutVector EtherMACBase::numFramesPassedToHLVector [protected] |
unsigned long EtherMACBase::numFramesReceivedOK [protected] |
cOutVector EtherMACBase::numFramesReceivedOKVector [protected] |
unsigned long EtherMACBase::numFramesSent [protected] |
cOutVector EtherMACBase::numFramesSentVector [protected] |
unsigned long EtherMACBase::numPauseFramesRcvd [protected] |
cOutVector EtherMACBase::numPauseFramesRcvdVector [protected] |
unsigned long EtherMACBase::numPauseFramesSent [protected] |
cOutVector EtherMACBase::numPauseFramesSentVector [protected] |
int EtherMACBase::pauseUnitsRequested [protected] |
bool EtherMACBase::promiscuous [protected] |
IPassiveQueue* EtherMACBase::queueModule [protected] |
int EtherMACBase::receiveState [protected] |
double EtherMACBase::shortestFrameDuration [protected] |
double EtherMACBase::slotTime [protected] |
int EtherMACBase::transmitState [protected] |
cQueue EtherMACBase::txQueue [protected] |
int EtherMACBase::txQueueLimit [protected] |
double EtherMACBase::txrate [protected] |