Protocols:
CEDAR
DEFINITIONS = {
ROPE: TYPE = Rope.ROPE;
Socket: TYPE = PupTypes.PupSocketID;
Protocol: TYPE = REF ProtocolRep;
ProtocolRep:
TYPE =
RECORD [
name: ROPE,
Connect:
PROC
[
serverName: ROPE,
fromClient, toClient: IO.STREAM,
noteDisconnect: PROC [clientData: REF ANY] ← NIL,
clientData: REF ANY ← NIL,
login: BOOL ← FALSE]
RETURNS [c: Conversation],
Disconnect: PROC [c: Conversation],
data: REF ANY ← NIL];
Conversation: TYPE = REF ConversationRep;
ConversationRep:
TYPE =
RECORD [
protocol: Protocol,
noteDisconnect: PROC [clientData: REF ANY],
data, clientData: REF ANY ← NIL];
GetProtocol: PROC [name: ROPE] RETURNS [p: Protocol];
RegProtocol: PROC [p: Protocol];
}.