Chapter 3 Management
4.18 Miscellaneous data link independent procedures
The procedures in this section are miscellaneous utility procedures used in the Modula-2-
Plus descriptions of the MOP algorithms. These are independent of the data link being used.
4.18.1 Resource allocation/deallocation
These procedures allocate and deallocate resources used by MOP operation threads. PROCEDURE DLI.Alloc (VAR op: POINTER TO Operation; VAR buff: POINTER TO Buffer)
RAISES {InsufficientResources}; BEGIN
NEW (buff); NEW (op);
« insert the new Operation record in the list of active operations » END DLI.Alloc;
PROCEDURE DLI.Free (op: POINTER TO Operation; buff: POINTER TO Buffer); BEGIN
« remove Operation record from the list of active operations »; FREE (buff);
FREE (op) END DLI.Free;
4.18.2: Manipulatefields in the buffer contents
97
4.18.2 Manipulate fields in the buffer contents
The procedures below are used in the Modula-2-Plus algorithm descriptions to examine or load fields in message buffers.
PROCEDURE DLI.GetInteger (buff: POINTER TO Buffer; off: INTEGER) : INTEGER;
« return the value of the 16-bit integer whose low order byte is at the specified offset, and high order byte at the byte following that in the buffer. »
END DLI.GetInteger;
PROCEDURE DLI.PutInteger (buff: POINTER TO Buffer; off: INTEGER; value: INTEGER);
« store the 16-bit integer (value), with low order byte at the specified offset and high order byte at the byte following that, into the buffer. »
END DLI.PutInteger;
PROCEDURE DLI.GetLong (buff: POINTER TO Buffer; off: INTEGER) : INTEGER;
« return the value of the 32-bit integer whose low order byte is at the specified offset, and higher order bytes at the 3 bytes following that in the buffer. »
END DLI.GetLong;
PROCEDURE DLI.PutLong (buff: POINTER TO Buffer; off: INTEGER; value: INTEGER);
« store the 32-bit integer (value), with low order byte at the specified offset and higher order bytes at the 3 bytes following that, into the buffer. »
END DLI.PutLong;
PROCEDURE DLI.GetAddress (buff: POINTER TO Buffer; off: INTEGER) : LANAddress;
« return the value of the 6-byte LAN address whost first byte is at the specified offset in the buffer. » END DLI.GetAddress;
PROCEDURE DLI.PutAddress (buff: POINTER TO Buffer; off: INTEGER; value: LANAddress); « store the 6-byte LAN address (value), with its first byte at the specified offset, into the buffer. » END DLI.PutAddress;
4.18.3 Find a Client record
These are the procedures that find a Client record, i.e., an entry in the Client database. There are three ways to get an entry:
1. By name — this is simply a search for a Client record whose Name attribute matches
the supplied name. This case applies for management requests where the directive specifies the name of the Client record to use.
2. By circuit — here we know what circuit is to be used, and we need tofind the Client record to use. This case applies to server functions, which use the Client record tofind
out how to respond to a received request message.
Note that it is possible to have multiple matches (more than one Client record satisfies the search criteria). In that case any of the matching Client records may be used. This is usually undesirable; the network manager should take care to avoid such client data-
base setups.
There are two variants of lookup by circuit:
a. Lookup by circuit and address — this searches for a Client record whose Circuit at-
tribute points to the circuit in question and, for a LAN, with an Addresses attrib-
ute value that contains the specified address. (For point to point circuits the match is by Circuit only.)
b. Lookup by circuit and device type — this searches for a Client record whose Circuit
attribute points to the specified circuit and a Device Types attribute that contains
the specified device type. (This variant is not used for point to point circuits.)
PROCEDURE DLI.FindClientByName(cl: SimpleName) : POINTER TO Client RAISES {UnrecognizedClient}
BEGIN
« return a pointer to the Client entity whose Name field equals the name in the cl argument » END DLI.FindClientByName;
PROCEDURE DLI.FindClientByCircAddr (cir: POINTER TO Circuit; addr: LANAddress) : POINTER TO Client;
BEGIN
« return a pointer to a matching Client entity, or NIL if no such entity exists. » END DLI.FindClientByCircAddr;
PROCEDURE DLI.FindClientByCircDev (cir: POINTER TO Circuit; dev: DevType) : POINTER TO Client; BEGIN
« return a pointer to a matching Client entity, or NIL if no such entity exists. » END DLI.FindClientByCircDev;
4.18.4 Find a Circuit record
PROCEDURE DLI.FindCircuitByName(cir: SimpleName) : POINTER TO Circuit RAISES {UnrecognizedCircuit}
BEGIN
« return a pointer to the Circuit entity whose Name field equals the name in the cir argument » END DLI.FindCircuitByName;
4.18.5 Pick a Source SAP address
The Source SAP used in Test and XID requests is selected in an implementation specific fashion. Unfortunately, there is no standard SAP address assigned for the purpose we need here. Therefore the SSAP has to be a “locally administered” value. We can’t pick one architec-
turally, since locally administered values are selected by the local network manager, not by Digital architects. Therefore the only way out is for the implementation to select a value dy-
namically.
Any value is acceptable provided that it is:
1. Not currently in use on the circuit, and 2. An individual SAP (low order bit is zero), and 3. A locally administered SAP (second bit zero), and 4. Not the null SAP (i.e., not the all-zero SAP address)
5. It may also be a good idea to avoid SAP address values that other vendors have archi-
tecturally assigned to their proprietary protocols
PROCEDURE LAN.SelectaSAP (op: POINTER TO Operation) : SAPAddress; BEGIN
RETURN « a suitable SAP address » END LAN.SelectaSAP;