Google
 

Trailing-Edge - PDP-10 Archives - bb-r775d-bm_tops20_ks_upd_4 - sources/xpndis.b36
There are 25 other files named xpndis.b36 in the archive. Click here to see a list.
%TITLE 'XPNDIS - Disconnect a logical link'
MODULE xpndis (
               ENTRY ( XPN$DISCONNECT )
              ) =
BEGIN
!  COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1981, 1985.
!  ALL RIGHTS RESERVED.
!  
!  THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY  BE  USED  AND
!  COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH
!  THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.   THIS  SOFTWARE  OR
!  ANY  OTHER  COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE
!  AVAILABLE TO ANY OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE
!  SOFTWARE IS HEREBY TRANSFERRED.
!  
!  THE INFORMATION IN THIS SOFTWARE IS  SUBJECT  TO  CHANGE  WITHOUT
!  NOTICE  AND  SHOULD  NOT  BE CONSTRUED AS A COMMITMENT BY DIGITAL
!  EQUIPMENT CORPORATION.
!  
!  DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF
!  ITS SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL.

!++
! FACILITY:
!   Transportable BLISS interface to DECNET-20.
!
! ABSTRACT:
!   This module contains the code to implement the $XPN_DISCONNECT macro.
!
! ENVIRONMENT:
!   TOPS-20 user mode.
!
! AUTHOR:  Larry Campbell, CREATION DATE:  January 11, 1982
!
! MODIFIED BY:
!
!--
!
! TABLE OF CONTENTS:
!
FORWARD ROUTINE
    xpn$disconnect,                     ! Called by $XPN_DISCONNECT macro
    xpn$$disconnect;                    ! Does the actual work
!
! INCLUDE FILES:
!
LIBRARY 'BLI:XPORT';
LIBRARY 'BLISSNET';
LIBRARY 'BLI:MONSYM';
LIBRARY 'BLISSNET20';
REQUIRE 'JSYSDEF';
!
! MACROS:
!

!
! EQUATED SYMBOLS:
!

!
! OWN STORAGE:
!

!
! EXTERNAL REFERENCES:
!

EXTERNAL ROUTINE
    xpn$$valid_nlb,                     ! Validate an NLB
    xpn$$link_status;                   ! Read link status
GLOBAL ROUTINE xpn$disconnect (nlb, success_routine, failure_routine) =
!++
! FUNCTIONAL DESCRIPTION:
!   This routine is called by the $XPN_DISCONNECT macro to disconnect
!   a logical link.
!
! FORMAL PARAMETERS:
!   nlb                 - address of the Network Link Block
!   success_routine     - (optional) routine to call on success
!   failure_routine     - (optional) routine to call on failure
!
! IMPLICIT INPUTS:
!   NONE
!
! IMPLICIT OUTPUTS:
!   NONE
!
! ROUTINE VALUE and
! COMPLETION CODES:
!   NONE
!
! SIDE EFFECTS:
!   NONE
!
!--
    BEGIN

    MAP
        nlb : REF $XPN_NLB();

    LOCAL
        original_primary_code,
        primary_code,
        secondary_code,
        retcode;

    nlb_binds;                          ! create nice names for NLB fields
    !
    ! validate the NLB
    !
    retcode = xpn$$valid_nlb (.nlb);
    IF NOT .retcode THEN
        BEGIN
        original_primary_code = XPN$_BAD_NLB;
        secondary_code = .retcode
        END
    ELSE
        BEGIN
	original_primary_code = xpn$$disconnect (.nlb);
        nlb[NLB$G_COMP_CODE] = .original_primary_code;
        secondary_code = .nlb[NLB$G_2ND_CODE]
        END;
    !
    ! Check completion code and call success or failure routine as required
    !
    IF .original_primary_code THEN
        IF .success_routine NEQ 0 THEN
            primary_code =
                (.success_routine) (XPN$K_DISCONNECT, .original_primary_code,
                    .secondary_code, .nlb)
        ELSE
            primary_code = .original_primary_code
    ELSE
        IF .failure_routine NEQ 0 THEN
            primary_code =
                (.failure_routine) (XPN$K_DISCONNECT, .original_primary_code,
                    .secondary_code, .nlb)
        ELSE
            primary_code = .original_primary_code;
    !
    ! Unless the NLB was bad, store the completion code there
    !
    IF .original_primary_code NEQ XPN$_BAD_NLB
    THEN
        nlb[NLB$G_COMP_CODE] = .primary_code;
    RETURN (.primary_code)
    END;			!End of xpn$disconnect
ROUTINE xpn$$disconnect (p_nlb) =
!++
! FUNCTIONAL DESCRIPTION:
!   This routine does the actual work of disconnecting a logical link.
!
! FORMAL PARAMETERS:
!   p_nlb           - pointer to the Network Link Block
!
! IMPLICIT INPUTS:
!   NONE
!
! IMPLICIT OUTPUTS:
!   NONE
!
! ROUTINE VALUE and
! COMPLETION CODES:
!   NONE
!
! SIDE EFFECTS:
!   NONE
!
!--
    BEGIN

    BIND
        nlb = .p_nlb : $XPN_NLB (),
        output_descriptor = .nlb[NLB$A_OUTPUT] : $XPO_DESCRIPTOR ();

    LOCAL
	link_status,
        b;

    nlb_binds;                          ! Get concise names for popular fields
    IF NOT .nlb[NLB$V_OPEN]
    THEN
        RETURN (XPN$_NOT_OPEN);
    link_status = xpn$$link_status (nlb);
    IF .nlb[NLB$B_SUBFUNC] EQL NLB$K_REJECT
    THEN
        BEGIN
        !
        ! Insure that this is a passive link with conn req pending
        !
        IF NOT passive
        THEN
            RETURN (XPN$_ILLOGIC);
        IF (.link_status AND MO_WCC) EQL 0 THEN RETURN (XPN$_ILLOGIC)
        END;
    nlb[NLB$V_CONNECTED] = 0;
    IF (.link_status AND MO_CON) EQL 0
    THEN
        RETURN (XPN$_DISCONN);
    b<rh> = $MOCLZ;
    b<lh> = .nlb[NLB$G_DISC_CODE];
    JSYS_MTOPR (.nlb[NLB$H_JFN],
                .b,
                .output_descriptor[XPO$A_ADDRESS],
                .output_descriptor[XPO$H_LENGTH]);
    nlb[NLB$V_CONNECTED] = 0;
    IF .nlb[NLB$B_SUBFUNC] EQL NLB$K_ABORT
    THEN
        nlb[NLB$V_ABORTED] = 1;
    nlb[NLB$V_DISCONNECTED] = 1;
    RETURN (XPN$_NORMAL)
    END;                                !End of xpn$$disconnect
END
ELUDOM