#include <post.h>
Inheritance diagram for PostOfficeInput::

Public Methods | |
| PostOfficeInput (int nBoxes) | |
| Allocate and initialize Post Office. More... | |
| ~PostOfficeInput () | |
| De-allocate Post Office data. More... | |
| void | Receive (int box, PacketHeader *pktHdr, MailHeader *mailHdr, char *data) |
| Retrieve a message from "box". Wait if there is no message in the box. More... | |
| void | PostalDelivery () |
| Wait for incoming messages, and then put them in the correct mailbox. More... | |
| void | CallBack () |
| Called when incoming packet has arrived and can be pulled off of network (i.e., time to call PostalDelivery). More... | |
Private Attributes | |
| NetworkInput* | network |
| Physical network connection. More... | |
| MailBox* | boxes |
| Table of mail boxes to hold incoming mail. More... | |
| int | numBoxes |
| Number of mail boxes. More... | |
| Semaphore* | messageAvailable |
| V'ed when message has arrived from network. More... | |
Definition at line 104 of file post.h.
|
|
Allocate and initialize Post Office. PostOfficeInput::PostOfficeInput Initialize the post office input queues as a collection of mailboxes. Also initialize the network device, to allow post offices on different machines to deliver messages to one another. We use a separate thread "the postal worker" to wait for messages to arrive, and deliver them to the correct mailbox. Note that delivering messages to the mailboxes can't be done directly by the interrupt handlers, because it requires a Lock. "nBoxes" is the number of mail boxes in this Post Office |
|
|
De-allocate Post Office data. PostOfficeInput::~PostOfficeInput De-allocate the post office data structures. Since the postal helper is waiting on the "messageAvail" semaphore, we don't deallocate it! This leaves garbage lying about, but the alternative is worse! |
|
|
Called when incoming packet has arrived and can be pulled off of network (i.e., time to call PostalDelivery). PostOffice::CallBack Interrupt handler, called when a packet arrives from the network. Signal the PostalDelivery routine that it is time to get to work! Reimplemented from CallBackObj. |
|
|
Wait for incoming messages, and then put them in the correct mailbox. PostOffice::PostalDelivery Wait for incoming messages, and put them in the right mailbox. Incoming messages have had the PacketHeader stripped off, but the MailHeader is still tacked on the front of the data. |
|
|
Retrieve a message from "box". Wait if there is no message in the box. PostOfficeInput::Receive Retrieve a message from a specific box if one is available, otherwise wait for a message to arrive in the box. Note that the MailHeader + data looks just like normal payload data to the Network. "box" -- mailbox ID in which to look for message "pktHdr" -- address to put: source, destination machine ID's "mailHdr" -- address to put: source, destination mailbox ID's "data" -- address to put: payload message data Definition at line 243 of file post.cc. Referenced by NetKernel::SelfTest().
|
|
|
Table of mail boxes to hold incoming mail.
|
|
|
V'ed when message has arrived from network.
|
|
|
Physical network connection.
|
|
|
Number of mail boxes.
|
1.2.8.1 written by Dimitri van Heesch,
© 1997-2001