Oberon || Library || Module Index || Search Engine || Definition || Module
TYPE Network = POINTER TO NetworkRec;
TYPE NetworkRec = RECORD (PersistentDisciplines.ObjectRec) END;
TYPE Address = POINTER TO AddressRec;
TYPE AddressRec =
RECORD
(PersistentDisciplines.ObjectRec)
network: Network;
END;
TYPE Socket = POINTER TO SocketRec;
TYPE SocketRec = RECORD (Disciplines.ObjectRec) END;
TYPE OpenProc = PROCEDURE (VAR s: Streams.Stream; address: Address;
bufmode: Streams.BufMode;
errors: RelatedEvents.Object) : BOOLEAN;
TYPE CreateOpenConditionProc = PROCEDURE(VAR condition: Conditions.Condition;
address: Address);
TYPE TestAndOpenProc = PROCEDURE (VAR s: Streams.Stream;
condition: Conditions.Condition;
bufmode: Streams.BufMode;
errors: RelatedEvents.Object) : BOOLEAN;
TYPE CreateSomeSocketProc = PROCEDURE (VAR socket: Socket;
VAR address: Address;
errors: RelatedEvents.Object) : BOOLEAN;
TYPE ListenProc = PROCEDURE (VAR socket: Socket; address: Address;
errors: RelatedEvents.Object) : BOOLEAN;
TYPE ReleaseProc = PROCEDURE (socket: Socket);
TYPE AcceptProc = PROCEDURE (socket: Socket; VAR s: Streams.Stream;
bufmode: Streams.BufMode) : BOOLEAN;
TYPE AcceptConditionProc = PROCEDURE (VAR condition: Conditions.Condition;
socket: Socket);
TYPE Interface = POINTER TO InterfaceRec;
TYPE InterfaceRec =
RECORD
(Objects.ObjectRec)
open: OpenProc;
createOpenCondition: CreateOpenConditionProc;
testAndOpen: TestAndOpenProc;
createSomeSocket: CreateSomeSocketProc;
listen: ListenProc;
release: ReleaseProc;
accept: AcceptProc;
acceptCondition: AcceptConditionProc;
END;
CONST unknownNetwork = 0;
CONST corruptedInput = 1;
CONST errors = 2;
TYPE ErrorCode = SHORTINT;
TYPE ErrorEvent = POINTER TO ErrorEventRec;
TYPE ErrorEventRec =
RECORD
(Events.EventRec)
errorcode: ErrorCode;
END;
VAR error: Events.EventType;
VAR errormsg: ARRAY errors OF Events.Message;
PROCEDURE Register(VAR network: Network;
name: ARRAY OF CHAR; if: Interface);
PROCEDURE GetNetwork(name: ARRAY OF CHAR; VAR network: Network;
VAR errors: RelatedEvents.Object) : BOOLEAN;
PROCEDURE GetName(network: Network; VAR name: ARRAY OF CHAR);
PROCEDURE GetNetworks(VAR iterator: Iterators.Iterator);
PROCEDURE Open(VAR s: Streams.Stream;
address: Address;
bufmode: Streams.BufMode;
errors: RelatedEvents.Object) : BOOLEAN;
PROCEDURE CreateOpenCondition(VAR condition: Conditions.Condition;
address: Address);
PROCEDURE TestAndOpen(VAR s: Streams.Stream;
address: Address;
condition: Conditions.Condition;
bufmode: Streams.BufMode;
errors: RelatedEvents.Object) : BOOLEAN;
PROCEDURE CreateSomeSocket(VAR socket: Socket;
network: Network;
VAR address: Address;
errors: RelatedEvents.Object) : BOOLEAN;
PROCEDURE Listen(VAR socket: Socket; address: Address;
errors: RelatedEvents.Object) : BOOLEAN;
PROCEDURE Release(socket: Socket);
PROCEDURE Accept(socket: Socket;
VAR s: Streams.Stream;
bufmode: Streams.BufMode) : BOOLEAN;
PROCEDURE CreateAcceptCondition(VAR condition: Conditions.Condition;
socket: Socket);
GetNetwork returns the network for the given network name which is usually the name of the supporting module. GetName returns the name of the given network. GetNetworks returns an iterator which allows to iterate through all networks which are currently supported by already loaded modules.
Listen creates a socket for the given address which may be later used to wait for incoming connections. CreateSomeSocket works like Listen but chooses an address itself which is returned. Accept waits for incoming connections for socket and opens a bidirectional stream for it. CreateAcceptCondition creates a condition which evaluates to TRUE if a subsequent Accept would not block for socket.
Additionally, following error events may be generated on reading persistent objects of Networks:
Oberon || Library || Module Index || Search Engine || Definition || Module