Trailing-Edge
-
PDP-10 Archives
-
BB-P363B-SM_1985
-
t20/nmlt20/falacc.bli
There are 2 other files named falacc.bli in the archive. Click here to see a list.
! NET:<DECNET20-V3P0.XPT>FALACC.BLI.11 25-Jan-82 10:08:40, Edit by WEBBER
!
! Changed "status received" code from 209 to 212.
!
! NET:<DECNET20-V3P0.XPT>FALACC.BLI.8 13-Jan-82 14:26:04, Edit by WEBBER
!
! Fixed the OPEN processing to:
! Expect an ACK after the ATTRIBUTES message;
! Once the ACK has been received, send out either a CTL/GET or CTL/PUT,
! depending on the open type. No response is expected to this message.
! Fixed the GET and PUT processing not to send the CTL/GET or CTL/PUT.
!
! NET:<DECNET20-V3P0.XPT>FALACC.BLI.5 8-Jan-82 16:20:12, Edit by WEBBER
!
! Added RESPONSE if an error Status message is received from the remote
! FAL.
!
! NET:<DECNET20-V3P0.XPT>FALACC.BLI.2 6-Jan-82 15:59:31, Edit by WEBBER
!
! Fixed send of CTL/PUT not to expect a response from the remote.
! Also fix ACC-CMP send to expect a response.
!
! This is the common DAP access portion of the NMUFIL utility module.
!
%routine ('FAL_ACCESS', FILE : ref FILE_DATA_BLOCK, OP, PTR, LEN) =
!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS
!
! NONE.
!
! IMPLICIT INPUTS
!
! NONE.
!
! ROUTINE VALUE:
!
! NONE.
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
bind
BUFFER = (FILE [FD_CURRENT_BUFFER]) : ref BUFFER_DATA_BLOCK,
CONFIG_MSG = uplit (CH$BYTE (1,0,0,2,8,6,5,6,0,3,0,%O'42')),
CONFIG_LEN = 12,
ATTRIB_MSG = uplit (CH$BYTE (2,0,%O'13',2,0,%O'200',1)),
ATTRIB_LEN = 7,
CONTROL_GET_MSG = uplit (CH$BYTE (4,0,1,1,3)),
CONTROL_GET_LEN = 5,
CONTROL_PUT_MSG = uplit (CH$BYTE (4,0,4,1,3)),
CONTROL_PUT_LEN = 5,
ACCOMP_MSG = uplit (CH$BYTE (7,0,1)),
ACCOMP_LEN = 3;
$field
FLAG_FIELDS =
set
ALL = [$bits(%bpval)], ! All the flags
$overlay (ALL)
SEND = [$bit], ! Send a DAP message
RECEIVE = [$bit], ! Receive a DAP message
ALLOCATE = [$bit], ! Allocate a DAP buffer
DEALLOCATE = [$bit], ! Deallocate a DAP buffer
BUFFER_ALLOCATED = [$bit], ! DAP_BFR contains address of buffer
SUCCESS = [$bit], ! Return TRUE/FALSE value
DONE = [$bit] ! File function complete
tes;
local
TEMP, ! A convenient temporary
FLAGS : block [1] field (FLAG_FIELDS),
DAP_BFR,
DAP_PTR,
DAP_LEN;
bind
OSTYPE = TEMP, ! OSTYPE in configuration msg
FAC = TEMP; ! FAC in access message
%debug (FILE_TRACE,
(TRACE_INFO ('FAL request operation: %O',
.OP)));
FLAGS [ALL] = 0; ! Clear all flags to FALSE
FLAGS [SUCCESS] = $TRUE; ! Be optimistic
DAP_BFR = 0; ! No buffer allocated
do
begin
%debug (FILE_TRACE,
(TRACE_INFO ('FAL Access State: %D', .FILE [FD_DAP_STATE])));
case .FILE [FD_DAP_STATE] from -2 to 9 of
set
[-1] : ! Error - failed
begin
FLAGS [SUCCESS] = $FALSE;
FLAGS [DONE] = $TRUE;
if .FLAGS [BUFFER_ALLOCATED]
then
FLAGS [DEALLOCATE] = $TRUE;
end;
[0] : ! Initial - unopened
begin
DAP_PTR = ch$ptr (CONFIG_MSG,,8);
DAP_LEN = CONFIG_LEN;
FLAGS [SEND] =
FLAGS [RECEIVE] =
FLAGS [ALLOCATE] = $TRUE;
end;
[1] : ! Configuration received
begin
!
! Get operating system type of remote node.
! If it's TOPS-10 or TOPS-20 then set the
! MACY11 format flag in the RAT field of the
! attribute message.
!
OSTYPE = ch$rchar (ch$ptr (.DAP_BFR,4,8));
if .OSTYPE eql 7 or .OSTYPE eql 8
then ch$wchar (%O'001',ch$ptr (ATTRIB_MSG,6,8))
else ch$wchar (%O'000',ch$ptr (ATTRIB_MSG,6,8));
DAP_PTR = ch$ptr (ATTRIB_MSG,,8);
DAP_LEN = ATTRIB_LEN;
FLAGS [SEND] = $TRUE;
FLAGS [RECEIVE] = $FALSE;
FILE [FD_DAP_STATE] = -2;
end;
[-2] : ! Attributes sent
begin
!
! Set up pointer to DAP buffer for access message.
!
DAP_PTR = ch$ptr (.DAP_BFR,,8);
!
! Build access message.
! ACCESS --> 003,000,ACCFUNC(1)B,000,FILESPEC(I-255)A,FAC(EX-3)BM
!
PUTB (%O'003',DAP_PTR); ! OPERATOR TYPE = 3 (ACCESS)
PUTB (%O'000',DAP_PTR); ! OPERATOR FLAGS
if .FILE [FD_ACCESS] neq FILE_ACCESS_WRITE_ONLY
then PUTB (%O'001',DAP_PTR) ! $OPEN an existing file
else PUTB (%O'002',DAP_PTR); ! $CREATE a new file
PUTB (%O'000',DAP_PTR); ! ACCOPT field
LEN = min (.LEN, 255); ! Not more than 255 maximum
PUTB (.LEN,DAP_PTR); ! I-field length
DAP_PTR = ch$move (.LEN,
.PTR,
.DAP_PTR);
!
! Set bits in FAC based on file access requested.
!
FAC = 0; ! Clear initial FAC
selectone .FILE [FD_ACCESS] of
set
[FILE_ACCESS_WRITE_ONLY] :
FAC = .FAC or %B'0000001'; ! Set FB$PUT
[FILE_ACCESS_READ_ONLY] :
FAC = .FAC or %B'0000010'; ! Set FB$GET
[FILE_ACCESS_RANDOM] :
FAC = .FAC or %B'0001000'; ! set FB$UPD
tes;
PUTB (.FAC,DAP_PTR); ! Store FAC in message
DAP_LEN = 6 + .LEN;
DAP_PTR = ch$ptr (.DAP_BFR,,8);
FLAGS [SEND] =
FLAGS [RECEIVE] = $TRUE;
end;
[2] : ! Attributes received
begin
selectone .OP of
set
[DAP_OPEN] : ! Open complete
begin
BUFFER [BD_BIAS] = 4;
FLAGS [RECEIVE] = $TRUE;
FLAGS [DEALLOCATE] =
FLAGS [DONE] =
FLAGS [SEND] = $FALSE;
end;
[DAP_CLOSE] : ! Send access complete message
begin
DAP_PTR = ch$ptr (ACCOMP_MSG,,8);
DAP_LEN = ACCOMP_LEN;
FLAGS [SEND] =
FLAGS [RECEIVE] =
FLAGS [ALLOCATE] = $TRUE;
FLAGS [DONE] = $FALSE;
end;
tes;
end;
[6] : ! Acknowledge received
begin
selectone .OP of
set
[DAP_GET] : ! Read a data message
begin
DAP_BFR = .BUFFER [BD_ADDRESS];
DAP_LEN = .BUFFER [BD_LENGTH];
FLAGS [SEND] = $FALSE;
FLAGS [RECEIVE] = $TRUE;
end;
[DAP_PUT] : ! Send a data message
begin
TEMP =
DAP_PTR = ch$ptr (.BUFFER [BD_ADDRESS],,8);
ch$wchar_a (8,TEMP); ! Write data message header
ch$wchar_a (0,TEMP);
ch$wchar_a (1,TEMP);
ch$wchar_a (0,TEMP);
DAP_LEN = .BUFFER [BD_DATA_COUNT] + .BUFFER [BD_BIAS];
FLAGS [RECEIVE] =
FLAGS [DEALLOCATE] = $FALSE;
FLAGS [SEND] =
FLAGS [DONE] = $TRUE;
end;
[DAP_OPEN] :
begin
selectone .FILE[FD_ACCESS] of
set
[FILE_ACCESS_READ_ONLY]:
begin
DAP_PTR = ch$ptr (CONTROL_GET_MSG,,8);
DAP_LEN = CONTROL_GET_LEN;
FLAGS [SEND] =
FLAGS [DEALLOCATE] =
FLAGS [DONE] = $TRUE;
FLAGS [RECEIVE] = $FALSE;
end;
[FILE_ACCESS_WRITE_ONLY]:
begin
DAP_PTR = ch$ptr (CONTROL_PUT_MSG,,8);
DAP_LEN = CONTROL_PUT_LEN;
FLAGS [SEND] =
FLAGS [DEALLOCATE] =
FLAGS [DONE] = $TRUE;
FLAGS [RECEIVE] = $FALSE;
end;
tes;
end;
[DAP_CLOSE] : ! Send access complete message
begin
DAP_PTR = ch$ptr (ACCOMP_MSG,,8);
DAP_LEN = ACCOMP_LEN;
FLAGS [SEND] =
FLAGS [ALLOCATE] =
FLAGS [RECEIVE] = $TRUE;
end;
tes;
end;
[7] : ! Access Complete received
begin
FLAGS [SEND] =
FLAGS [RECEIVE] = $FALSE;
FLAGS [DEALLOCATE] =
FLAGS [DONE] = $TRUE;
end;
[8] : ! Data message received
begin
selectone .OP of
set
[DAP_GET] : ! Process header
begin
!
! Get length of header portion of DAP data message
! and save as bias into buffer.
! Save number of data bytes read.
!
BUFFER [BD_BIAS] = 3 + ch$rchar (ch$ptr (.BUFFER [BD_ADDRESS],2,8));
BUFFER [BD_DATA_COUNT] = .DAP_LEN - .BUFFER [BD_BIAS];
FLAGS [SEND] =
FLAGS [RECEIVE] = $FALSE;
FILE [FD_DAP_STATE] = 6; ! Make this work next time
FLAGS [DONE] = $TRUE;
end;
[DAP_PUT] : ! Illegal
begin
FLAGS [SUCCESS] = $FALSE;
if .FLAGS [BUFFER_ALLOCATED]
then
FLAGS [DEALLOCATE] = $TRUE;
FLAGS [DONE] = $TRUE;
end;
[DAP_OPEN] : ! Illegal
begin
FLAGS [SUCCESS] = $FALSE;
if .FLAGS [BUFFER_ALLOCATED]
then
FLAGS [DEALLOCATE] = $TRUE;
FLAGS [DONE] = $TRUE;
end;
[DAP_CLOSE] : ! Send access complete message
begin
DAP_PTR = ch$ptr (ACCOMP_MSG,,8);
DAP_LEN = ACCOMP_LEN;
FLAGS [SEND] =
FLAGS [DONE] = $TRUE;
end;
tes;
end;
[9] : ! Status message received
begin
%debug (ALWAYS,
(DAP_PTR = ch$ptr (.DAP_BFR,2,8); ! Point to STSCODE
TEMP = GETW (DAP_PTR); ! Get STSCODE
TRACE_INFO ('DAP Status Received: MACCODE = %O, MICCODE = %O',
.TEMP<12,4>,
.TEMP<0,12>)));
$RESPONSE_X (.FILE [FD_RESPONSE], NICE$_FIO, .FILE [FD_TYPE],
'Received error Status message from remote FAL', 212);
FLAGS [SUCCESS] = $FALSE;
if .FLAGS [BUFFER_ALLOCATED]
then
FLAGS [DEALLOCATE] = $TRUE;
FLAGS [DONE] = $TRUE;
end;
[inrange,
outrange] : ! Unexpected DAP message received
begin
FLAGS [SUCCESS] = $FALSE;
if .FLAGS [BUFFER_ALLOCATED]
then
FLAGS [DEALLOCATE] = $TRUE;
FLAGS [DONE] = $TRUE;
end;
tes;
if .FLAGS [SEND]
then
begin
if not NMU$NETWORK_WRITE (.FILE [FD_JFN], $TRUE, .DAP_LEN, .DAP_PTR)
then begin
$RESPONSE_X (.FILE [FD_RESPONSE], NICE$_FIO, .FILE [FD_TYPE],
'Could not send DAP message to remote FAL', 210);
FILE [FD_DAP_STATE] = -1;
FLAGS [SUCCESS] = $FALSE;
FLAGS [DONE] = $TRUE;
end;
FLAGS [SEND] = $FALSE;
%debug ((FILE_TRACE and DAP_MESSAGE_TRACE),
(FORMAT_BUFFER ('DAP message sent',,
0, .DAP_PTR, .DAP_LEN)));
end;
if .FLAGS [ALLOCATE]
then
begin
DAP_BFR = NMU$MEMORY_GET (DAP_BFR_ALLOCATION);
DAP_LEN = DAP_BFR_ALLOCATION;
FLAGS [ALLOCATE] = $FALSE;
FLAGS [BUFFER_ALLOCATED] = $TRUE;
end;
if .FLAGS [RECEIVE]
then
begin
DAP_PTR = ch$ptr (.DAP_BFR,,8);
%( N.B. - The action to be taken when a network error occurs, i.e., we get
a zero return value, needs to be evaluated. Maybe a way needs to be
devised to return the network failure information back to the requestor
in the response message. )%
if (DAP_LEN = NMU$NETWORK_READ (.FILE [FD_JFN], .DAP_LEN,
.DAP_PTR)) leq 0
then begin
$RESPONSE_X (.FILE [FD_RESPONSE], NICE$_FIO, .FILE [FD_TYPE],
'Could not receive DAP message from remote FAL', 211);
FILE [FD_DAP_STATE] = -1;
FLAGS [SUCCESS] = $FALSE;
FLAGS [DONE] = $TRUE;
end;
FLAGS [RECEIVE] = $FALSE;
!
! Set state based on DAP message type received.
!
if .DAP_LEN geq 1
then
FILE [FD_DAP_STATE] = ch$rchar (ch$ptr (.DAP_BFR,0,8))
else
FILE [FD_DAP_STATE] = -1;
%debug ((FILE_TRACE and DAP_MESSAGE_TRACE),
(FORMAT_BUFFER ('DAP message received, %D bytes: %/%+%16B',
(.DAP_LEN),
0, .DAP_PTR, .DAP_LEN)));
end;
if .FLAGS [DEALLOCATE]
then
begin
NMU$MEMORY_RELEASE (.DAP_BFR, DAP_BFR_ALLOCATION);
DAP_BFR = 0;
FLAGS [DEALLOCATE] = $FALSE;
FLAGS [BUFFER_ALLOCATED] = $FALSE;
end;
end
until .FLAGS [DONE];
%debug (FILE_TRACE,
((if .FLAGS [SUCCESS]
then TRACE_INFO ('FAL operation complete')
else TRACE_INFO ('FAL operation failed'))));
return .FLAGS [SUCCESS]
end; !End of FAL_ACCESS
! Local Modes:
! Mode:BLISS
! Auto Save Mode:2
! Comment Column:40
! Comment Rounding:+1
! End: