Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

NetworkOutput Class Reference

The following class defines a physical network device. The network is capable of delivering fixed sized packets, in order but unreliably, to other machines connected to the network. The "reliability" of the network can be specified to the constructor. This number, between 0 and 1, is the chance that the network will lose a packet. Note that you can change the seed for the random number generator, by changing the arguments to RandomInit() in Initialize(). The random number generator is used to choose which packets to drop. More...

#include <network.h>

Inheritance diagram for NetworkOutput::

CallBackObj List of all members.

Public Methods

 NetworkOutput (double reliability, CallBackObj *toCall)
 Allocate and initialize network output driver. More...

 ~NetworkOutput ()
 De-allocate the network input driver data. More...

void Send (PacketHeader hdr, char *data)
 Send the packet data to a remote machine, specified by "hdr". Returns immediately. "callWhenDone" is invoked once the next packet can be sent. Note that callWhenDone is called whether or not the packet is dropped, and note that the "from" field of the PacketHeader is filled in automatically by Send(). More...

void CallBack ()
 Interrupt handler, called when message is sent. More...


Private Attributes

int sock
 UNIX socket number for outgoing packets. More...

double chanceToWork
 Likelihood packet will be dropped. More...

CallBackObjcallWhenDone
 Interrupt handler, signalling next packet can be sent. More...

bool sendBusy
 Packet is being sent. More...


Detailed Description

The following class defines a physical network device. The network is capable of delivering fixed sized packets, in order but unreliably, to other machines connected to the network. The "reliability" of the network can be specified to the constructor. This number, between 0 and 1, is the chance that the network will lose a packet. Note that you can change the seed for the random number generator, by changing the arguments to RandomInit() in Initialize(). The random number generator is used to choose which packets to drop.

Definition at line 94 of file network.h.


Constructor & Destructor Documentation

NetworkOutput::NetworkOutput ( double reliability,
CallBackObj * toCall )
 

Allocate and initialize network output driver.

NetworkOutput::NetworkOutput Initialize the simulation for sending network packets

"reliability" says whether we drop packets to emulate unreliable links "toCall" is the interrupt handler to call when next packet can be sent

Definition at line 113 of file network.cc.

NetworkOutput::~NetworkOutput ( )
 

De-allocate the network input driver data.

NetworkOutput::~NetworkOutput Deallocate the simulation for sending network packets

Definition at line 130 of file network.cc.


Member Function Documentation

void NetworkOutput::CallBack ( ) [virtual]
 

Interrupt handler, called when message is sent.

Reimplemented from CallBackObj.

Definition at line 141 of file network.cc.

void NetworkOutput::Send ( PacketHeader hdr,
char * data )
 

Send the packet data to a remote machine, specified by "hdr". Returns immediately. "callWhenDone" is invoked once the next packet can be sent. Note that callWhenDone is called whether or not the packet is dropped, and note that the "from" field of the PacketHeader is filled in automatically by Send().

NetworkOutput::Send Send a packet into the simulated network, to the destination in hdr. Concatenate hdr and data, and schedule an interrupt to tell the user when the next packet can be sent

Note we always pad out a packet to MaxWireSize before putting it into the socket, because it's simpler at the receive end.

Definition at line 159 of file network.cc.

Referenced by PostOfficeOutput::Send().


Member Data Documentation

CallBackObj * NetworkOutput::callWhenDone [private]
 

Interrupt handler, signalling next packet can be sent.

Definition at line 116 of file network.h.

double NetworkOutput::chanceToWork [private]
 

Likelihood packet will be dropped.

Definition at line 115 of file network.h.

bool NetworkOutput::sendBusy [private]
 

Packet is being sent.

Definition at line 118 of file network.h.

int NetworkOutput::sock [private]
 

UNIX socket number for outgoing packets.

Definition at line 114 of file network.h.


The documentation for this class was generated from the following files:
Generated at Wed Jul 4 11:32:23 2001 for Nachos by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001