CMSC 417-0101 |
PROJECT 2 -- PRELIMINARY |
October 11, 1999 |
This project deals with achieving reliable data transfer over LRD network channels. (Recall that an LRD channel can lose, reorder, and duplicate messages in transit, subject to a maximum message lifetime). You are provided a specification of the data transfer service and a specification of the LRD network layer service. You are to implement a data transfer protocol that provides the data transfer service using the network layer service.
Specifically, the project consists of two interacting programs, a Source and a Sink. The Source consists of three threads: SourceTester, _417_SourceTransportEntity, and _417_NetworkEntity. The Sink consists of three threads: SinkTester, _417_SinkTransportEntity, and _417_NetworkEntity. You are to implement _417_SourceTransportEntity and _417_SinkTransportEntity. You will be provided the others. SourceTester and SinkTester are the users of the transport entities. The pair of 417_NetworkEntity provide LRD channels.
You are provided a class called _417_NetworkEntity that is used by transport entities to communicate with each other, instead of the usual sockets.
Class _417_NetworkEntity has the following interface:
Constructor _417_NetworkEntity(
local IP address and port, remote IP address and port, max msg
lifetime, max msg size )
Creates the local half of a pair of LRD
channels between local and remote sites. A corresponding entity
would be created at the remote site.
Method Send( network packet )
Sends a network packet into outgoing LRD channel. The network
packet is of class _417_NetworkPacket (analogous to DatagramPacket).
The packet is not immediately sent to the remote site. Instead it is
placed in a queue where it can be sent, lost, duplicated, reordered,
all subject to the max msg lifetime constraint.
Method Receive( network packet, timeout value )
Receive
network packet from incoming LRD channel. Returns with a timeout
exception if no packet is received within timeout value.
You are to implement two classes, _417_SourceTransportEntity and _417_SinkTransportEntity, that provide reliable byte stream transfer. These classes can interact only via the LRD channels defined above.
Class _417_SourceTransportEntity must have the following interface:
Constructor
_417_SourceTransportEntity( local IP address and port, remote IP
address and port, timeout value )
Constructs the source half of
a data transfer protocol. It would have a send window, counters,
timers, etc. Timeout signifies that the remote site is not reachable
(in this case, due to congestion in LRD channels or due to the
remote site closing).
Initialize()
Initializes send
window, counters, timers, etc.
Send( byte string )
Accepts
byte string from local user to be transferred to remote user. If
local resources cannot handle byte string, it blocks until resources
become free or until timeout. This method only transfers the data
from user to source entity. It does not wait for this data to be sent
to remote site or acked by remote site.
Acked( )
Blocks until all data
has been acked or timeout. This method allows the local user to
determine when all data sent has been acked.
Assume that at any time at most one call of any of the above procedures is outstanding; i.e., an above method is called only when all previous calls of these methods have returned.
Class _417_SinkTransportEntity must have the following interface:
Constructor
_417_SinkTransportEntity( local IP address and port, remote IP
address and port, timeout value )
Constructs the sink half of a
data transfer protocol. It would have a receive window, counters,
timers, etc. Timeout signifies that the remote site is not reachable
(in this case, due to congestion in LRD channels or due to the
remote site closing).
Initialize()
Initializes
receive window, counters, timers, etc.
Receive( byte string )
Returns
byte string or timeout. Blocking.
Assume that at any time at most one call of any of the above procedures is outstanding; i.e., an above method is called only when all previous calls of these methods have returned.
Consider the execution of a corresponding pair of Source and Sink entities. At the source, the activity consists of a sequence of Initialize, Send, and Acked calls (issued by SourceTester). At the sink, the activity consists of a sequence of Initialize and Receive calls (issued by SinkTester). Assume that for every Initialize at the Source, there is a corresponding Initialize at the Sink and that until the Source does not do a send before the Sink does its initialize. Given this, your protocol must ensure that between any two successive initializes, the aggregate byte stream sent by the source user (i.e., concatenation of the byte streams in the Send calls) is equal to the aggregate byte stream received at the sink user (i.e., concatenation of the byte streams in the Receive calls).