tac0S
Template Affectional Command Operating System
|
Public Member Functions | |
Network (NetworkAddress addr, double reliability, VoidFunctionPtr readAvail, VoidFunctionPtr writeDone, int callArg) | |
Initialize the network emulation addr is used to generate the socket name reliability says whether we drop packets to emulate unreliable links readAvail, writeDone, callArg – analogous to console. | |
void | Send (PacketHeader hdr, char *data) |
send a packet by concatenating hdr and data, and schedule an interrupt to tell the user when the next packet can be sent More... | |
PacketHeader | Receive (char *data) |
void | SendDone () |
notify user that another packet can be sent | |
void | CheckPktAvail () |
if a packet is already buffered, we simply delay reading the incoming packet. In real life, the incoming packet might be dropped if we can't read it in time. | |
void Network::Send | ( | PacketHeader | hdr, |
char * | data | ||
) |
send a packet by concatenating 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.