HP OpenVMS Systems Documentation

Content starts here

VMS DECwindows Transport Manual


Previous Contents Index


XPORT_OUT_WRITE_DISABLE

Sets the write disable flag.

Format

XPORT_OUT_WRITE_DISABLE xtcc


RETURNS

VMS usage: longword
type: longword
access: write
mechanism: value

Returns true (1) if the XTCC$L_OWQ_FLAG was set, that is, if write operations were already disabled, or false (0) if it was clear.


Arguments

xtcc


VMS usage: record
type: xtcc
access: modify
mechanism: reference

The XTCC for which you want to disable write operations.

Description

The XPORT_OUT_WRITE_DISABLE macro sets the write disable flag for this connection and returns true (1) if it was set or false (0) if it was clear.

XPORT_OUT_STATE_SRP

Marks a switch to the use of SRPs for output and returns true (1) if an LRP was being used.

Format

XPORT_OUT_STATE_SRP xtcc


RETURNS

VMS usage: longword
type: longword
access: write
mechanism: value

Returns true (1) if an LRP was being used.


Arguments

xtcc


VMS usage: record
type: xtcc
access: modify
mechanism: reference

The XTCC for which you want to test and set the state.

Description

The XPORT_OUT_STATE_SRP macro tests to see if the XTCC$V_LRP_ON_OUTPUT bit was set, and then clears it. XPORT_OUT_STATE_SRP marks a switch to the use of SRPs for output and returns true (1) if an LRP was being used.

XPORT_OUT_STATE_LRP

Marks a switch to the use of LRPs for output and returns true (1) if an SRP was being used.

Format

XPORT_OUT_STATE_LRP xtcc


RETURNS

VMS usage: longword
type: longword
access: write
mechanism: value

Returns true (1) if an SRP was being used.


Arguments

xtcc


VMS usage: record
type: xtcc
access: modify
mechanism: reference

The XTCC for which you want to test and set the state.

Description

The XPORT_OUT_STATE_LRP macro tests to see if the XTCC$V_LRP_ON_OUTPUT bit was clear, and then sets it. XPORT_OUT_STATE_SRP marks a switch to the use of LRPs for output and returns true (1) if an SRP was being used.

XPORT_IN_STATE_SRP

Marks a switch to the use of SRPs for input and returns true (1) if an LRP was being used.

Format

XPORT_IN_STATE_SRP xtcc


RETURNS

VMS usage: longword
type: longword
access: write
mechanism: value

Returns true (1) if an LRP was being used.


Arguments

xtcc


VMS usage: record
type: xtcc
access: modify
mechanism: reference

The XTCC for which you want to test and set the state.

Description

The XPORT_IN_STATE_SRP macro tests to see if the XTCC$V_LRP_ON_INPUT bit was set, and then clears it. XPORT_IN_STATE_SRP marks a switch to the use of SRPs for input and returns true (1) if an LRP was being used.

XPORT_IN_STATE_LRP

Marks a switch to the use of LRPs for input and returns true (1) if an SRP was being used.

Format

XPORT_IN_STATE_LRP xtcc


RETURNS

VMS usage: longword
type: longword
access: write
mechanism: value

Returns true (1) if an SRP was being used.


Arguments

xtcc


VMS usage: record
type: xtcc
access: modify
mechanism: reference

The XTCC for which you want to test and set the state.

Description

The XPORT_IN_STATE_LRP macro tests to see if the XTCC$V_LRP_ON_INPUT bit was clear, and then sets it. XPORT_IN_STATE_SRP marks a switch to the use of LRPs for input and returns true (1) if an SRP was being used.

XPORT_IN_FREE_ENABLE

Clears the free disable flag for this connection type of queue and returns (1) if it was clear or (0) if it was set.

Format

XPORT_IN_FREE_ENABLE xtcc, type


RETURNS

VMS usage: longword
type: longword
access: write
mechanism: value

Returns true (1) if the free disable flag was clear, that is, input operations were already enabled, or false (0) if it was set.


Arguments

xtcc


VMS usage: record
type: xtcc
access: modify
mechanism: reference

The XTCC for which you want to clear the disable flag.

type


VMS usage: longword
type: longword
access: read
mechanism: value

The type of buffer for which to clear the disable flag. Valid types are DECW$XPORT_BUFFER_SRP and DECW$XPORT_BUFFER_LRP.

Description

The XPORT_IN_FREE_ENABLE macro tests the XTCC$L_IFSQ_FLAG flag or the XTCC$L_IFLQ_FLAG flag (depending on the type argument) to see if it is clear, and then clears it. XPORT_IN_FREE_ENABLE returns true (1) if the free disable flag was clear or false (0) if it was set.

XPORT_IN_FREE_DISABLE

Sets the free disable flag for this connection and type of queue and returns (1) if it was set or (0) if clear.

Format

XPORT_IN_FREE_DISABLE xtcc, type


RETURNS

VMS usage: longword
type: longword
access: write
mechanism: value

Returns true (1) if the free disable flag was set, that is, free input operations were already disabled, or false (0) if it was clear.


Arguments

xtcc


VMS usage: record
type: xtcc
access: modify
mechanism: reference

The XTCC for which you want to set the disable flag.

type


VMS usage: longword
type: longword
access: read
mechanism: value

The type of buffer for which to set the disable flag. Valid types are DECW$XPORT_BUFFER_SRP and DECW$XPORT_BUFFER_LRP.

Description

The XPORT_IN_FREE_ENABLE macro tests the XTCC$L_IFSQ_FLAG flag or the XTCC$L_IFLQ_FLAG flag (depending on the type argument) to see if it is set, and then sets it. XPORT_IN_FREE_ENABLE returns true (1) if the free disable flag was set or false (0) if it was clear.

VALIDATE_XTCC

Validates an XTCC and returns the IXTCC.

Format

status_return=VALIDATE_XTCC xtcc, ixtcc


RETURNS

VMS usage: cond_value
type: longword (unsigned)
access: write
mechanism: value

Returns a longword condition value to R0. Possible condition values are listed under Condition Values Returned.


Arguments

xtcc


VMS usage: record
type: xtcc
access: modify
mechanism: reference

The XTCC that you want to validate.

ixtcc


VMS usage: record
type: ixtcc
access: modify
mechanism: reference

The previously registered IXTCC address is returned to this argument. Valid only if SS$_NORMAL is returned.

Description

The VALIDATE_XTCC macro calls the transport-common DECW$XPORT_VALIDATE_STRUCT_JSB routine to validate an XTCC. If the XTCC ID is known and is valid, VALIDATE_XTCC returns the previously registered address of the IXTCC data structure in the ixtcc argument.

Condition Values Returned

SS$_ACCVIO The XTCC is not user-readable.
SS$_NORMAL Routine successfully completed.
SS$_BADPARAM Bad parameter. Either the XTCC$B_SUBTYPE field is not equal to the constant DECW$C_DYN_XTCC, or the IXTCC$A_TCC field does not point to this XTCC.
Any DECW$XPORT_VALIDATE_STRUCT_JSB condition value.

VALIDATE_USERW

Checks a user buffer for write access.

Format

status_return=VALIDATE_USERW bufadr, buflen


RETURNS

VMS usage: cond_value
type: longword (unsigned)
access: write
mechanism: value

Returns a longword condition value to R0. Possible condition values are listed under Condition Values Returned.


Arguments

bufadr


VMS usage: record
type: buffer
access: modify
mechanism: reference

The address of the buffer that you want to check for write access.

buflen


VMS usage: longword
type: longword
access: read
mechanism: value

The length of the buffer that you want to check for write access.

Description

The VALIDATE_USERW macro checks the user-supplied buffer for write access and returns a status.

VALIDATE_USERW is called only by the transport-common component.


Condition Values Returned

SS$_NORMAL Routine successfully completed. The buffer is user-writable.
SS$_ACCVIO The buffer is not user-writable.

VALIDATE_USER

Checks a user buffer for read access.

Format

status_return=VALIDATE_USER bufadr, buflen


RETURNS

VMS usage: cond_value
type: longword (unsigned)
access: write
mechanism: value

Returns a longword condition value to R0. Possible condition values are listed under Condition Values Returned.


Arguments

bufadr


VMS usage: record
type: buffer
access: modify
mechanism: reference

The address of the buffer that you want to check for read access.

buflen


VMS usage: longword
type: longword
access: read
mechanism: value

The length of the buffer that you want to check for read access.

Description

The VALIDATE_USERW macro checks the user-supplied buffer for read access and returns a status.

VALIDATE_USER is called only by the transport-common component.


Condition Values Returned

SS$_NORMAL Routine successfully completed. The buffer is user-readable.
SS$_ACCVIO The buffer is not user-readable.


Chapter 8
Writing Your Own Transport

This chapter describes the example transport layer provided in DECW$EXAMPLES:XPORT_EXAMPLE.B32. The chapter includes a sample BLISS-32 code example for each of the transport-specific routines that you must write. This chapter also includes an example of how to compile and link the routines as a shareable image in the DECwindows environment.

The code examples collectively describe a TCP/IP transport for DECwindows layered on the ULTRIX Connection product (UCX), the implementation of TCP/IP for VMS. Your own implementation of the transport-specific routines may be different depending on the lower-level transport on which you are building.

Note

This chapter describes how to write the transport-specific routines only. Modifications to the existing transport-common routines are not recommended or supported.

8.1 Where to Begin

Depending upon your implementation, you will probably find that the routines that initialize a transport and establish a connection require the most modification. The following routines are included in this group:

  • XTFT$A_OPEN (client side)
  • XTFT$A_ATTACH_TRANSPORT (server side)
  • TRANSPORT_READ_AST (server side)

You may also find that routines that primarily insert and remove buffers from the queues, such as XTFT$A_EXECUTE_FREE, can be used with minimal changes.

The sample transport layer described in this chapter uses the $QIO/AST completion interface. If the lower-level transport on which you are building uses the $QIO/AST completion interface, you should check the $QIO function codes to make sure that they are applicable in your implementation.

If the lower-level transport on which you are building does not use the $QIO/AST completion interface and instead waits for read operations to complete, the server may spend a substantial amount of time waiting.

8.2 Example TCP/IP Transport Layer Implementation

The code examples in this section implement a sample TCP/IP DECwindows transport layer.

8.2.1 TCP/IP Transport Layer Setup

Example 8-1 shows module and data structure declarations, macro and literal definitions, and external definitions that are used in the TCP/IP implementation.

Example 8-1 TCP/IP Transport Layer Setup

      .
      .
      .
   %TITLE   'XPORT_EXAMPLE  - Example TCP/IP Communication Library'
   MODULE XPORT_EXAMPLE     (
           IDENT = 'V3.0',
           ADDRESSING_MODE(EXTERNAL = GENERAL,
                           NONEXTERNAL = WORD_RELATIVE )
           ) =
   BEGIN
(1)
   LIBRARY 'SYS$LIBRARY:STARLET' ;
   REQUIRE 'SYS$LIBRARY:UCX$INETDEF.R32' ;
   REQUIRE 'SRC$:XPORTEXAMPLEDEF.R32' ;
   REQUIRE 'SYS$LIBRARY:DECW$XPORTMAC.R32' ;
   REQUIRE 'SYS$LIBRARY:DECW$XPORTMSG.R32' ;


(2) FORWARD ROUTINE
       DECW$$TCPIP_EXECUTE_WRITE,
       DECW$$TCPIP_WRITE,
       WRITE_AST : NOVALUE,
       DECW$$TCPIP_WRITE_USER,
       DECW$$TCPIP_EXECUTE_FREE,
       DECW$$TCPIP_FREE_INPUT_BUFFER,
       FREE_INPUT_AST : NOVALUE,
       DECW$$TCPIP_ATTACH_TRANSPORT,
       PARSE_INTERNET_ADDRESS,
       DECW$$TCPIP_CLOSE,
       CLOSE_AND_DEALLOCATE_AST : NOVALUE,
       DECW$$TCPIP_OPEN,
       OPEN_AST1 : NOVALUE,
       OPEN_AST2 : NOVALUE,
       OPEN_AST3 : NOVALUE,
       TRANSPORT_READ_QUEUE,
       TRANSPORT_READ_AST : NOVALUE,
       TRANSPORT_OPEN_CALLBACK : NOVALUE,
       DETACH_AND_POLL : NOVALUE,
       REATTACH_AST : NOVALUE,
       DECW$$TCPIP_RUNDOWN : NOVALUE ,
       DECW$TRANSPORT_INIT ;

(3) MACRO

       XPORT_FAO(control_string) =

           BEGIN
           EXTERNAL ROUTINE
               DECW$XPORT_FAO;

           LOCAL
               xport_fao_control_string_desc : $BBLOCK [DSC$K_S_BLN]

            xport_fao_control_string_desc [DSC$W_LENGTH]  =
                    %CHARCOUNT( control_string );

            xport_fao_control_string_desc [DSC$A_POINTER] =
                    UPLIT( control_string );

            DECW$XPORT_FAO
                    (
                    xport_fao_control_string_desc
                    %IF NOT %NULL(%REMAINING)
                    %THEN
                            ,%REMAINING
                    %FI
                    )
            END
            %,

        inet_dev_str    = 'UCX$DEVICE' %,
        inet_local_node = 'UCX$INET_HOST' %,
        swap_long( val ) = ( ( (val ^ 24) AND %X'FF000000') OR ( (val ^ 8 )
            AND %X'FF0000') OR ( (val ^ -8) AND %X'FF00') OR ( (val ^ -24 )
            AND %X'FF') ) %,
        swap_short( val ) = ( ( (val ^ 8) AND %X'FF00') OR ( (val ^ -8) AND %X'FF') ) %,

        xtcc_status( xtcc, status ) =
        IF NOT .xtcc [xtcc$v_err_sts_valid]
        THEN
             BEGIN
             xtcc [xtcc$l_err_status] = status ;
             xtcc [xtcc$v_err_sts_valid] = 1 ;
             END %,

        load_desc( desc, string ) = BEGIN desc [0] = %CHARCOUNT( string ) ;
            desc [1] = UPLIT( string ) ; END % ;


(4) LITERAL
           REATTACH_INTERVAL_SECS = 60,
           USER_WRITE_BY_COPY = 1,
           ASYNC_EFN = 31,
           WRITE_MAXIMUM_LENGTH = 32768,
           INET_NODE_NAME_LEN = 256
           BASE_TCP_PORT = 6000 ;

(5) OWN

       reattach_timer_id : INITIAL( 0 ),
       reattach_timer_delta : VECTOR[2] INITIAL( 0, 0 ),
       inet_dev_desc : VECTOR[2],
       tcpip_tft : $BBLOCK [xtft$c_length],
       tcpip_tdb : REF $BBLOCK,
       local_node : $BBLOCK [INET_NODE_NAME_LEN],
       lnn_desc : $BBLOCK [DSC$S_DSCDEF1] ;

(6) EXTERNAL ROUTINE
       DECW$$XPORT_FREE_INPUT,
       DECW$XPORT_READ_COMPLETE,
       DECW$$XPORT_WRITE,
       DECW$$XPORT_OPEN_COMPLETE,
       DECW$XPORT_CLOSE,
       DECW$XPORT_FREE_INPUT_BUFFER,
       DECW$XPORT_COPY_AND_WRITE,
       DECW$XPORT_ALLOC_INIT_QUEUES,
       DECW$XPORT_DEALLOC_QUEUES,
       DECW$XPORT_ALLOC_PMEM,
       DECW$XPORT_DEALLOC_PMEM : NOVALUE,
       DECW$XPORT_VALIDATE_STRUCT,
       DECW$XPORT_VALIDATE_STRUCT_JSB : L_VALIDATE_STRUCT,
       DECW$XPORT_ACCEPT_FAILED,
       DECW$XPORT_ATTACHED,
       DECW$XPORT_ATTACH_LOST,
       DECW$XPORT_REATTACH_FAILED,
       DECW$XPORT_REFUSED_BY_SERVER ;

      .
      .
      .
  1. The included files are as follows:
    • SYS$LIBRARY:STARLET includes the VAX/VMS System Service definitions.
    • SYS$LIBRARY:UCX$INETDEF.R32 includes the definitions for the UCX product, the TCP/IP implementation upon which this example is layered.
    • SRC$:XPORTEXAMPLEDEF.R32 includes the TCP/IP transport-specific structure definitions.
    • SYS$LIBRARY:DECW$XPORTMAC.R32 includes the transport layer support macros.
    • SYS$LIBRARY:DECW$XPORTMSG.R32 includes the transport layer message symbols.
  2. Forward declarations for the procedures and routines that are defined in this module.
  3. Define the following macros to be used in this module:
    • inet_dev_str is the logical name that identifies UCX's controlling device.
    • inet_local_node is the logical name that contains the name of the local host.
    • swap_long converts between little-endian and big-endian unsigned longword integer formats.
    • swap_short converts between little-endian and big-endian unsigned word integer formats.
    • xtcc_status stores a condition code in an XTCC's error status field (XTCC$L_ERR_STATUS) exactly once.
    • load_desc builds a 2-longword string descriptor suitable for system services and internal descriptors.
  4. Define the following constants used in this module:
    • REATTACH_INTERVAL_SECS controls the number of seconds between transport restart attempts.
    • USER_WRITE_BY_COPY controls whether the DECW$$TCPIP_WRITE_USER routine implements its function as a call to the common transport DECW$XPORT_COPY_AND_WRITE routine.
    • ASYNC_EFN is the number of the event flag to be used in asynchronous network I/O operations. Event flag 31 is used for such operations by convention.
    • WRITE_MAXIMUM_LENGTH has meaning only if USER_WRITE_BY_COPY tests false. Then, the DECW$$TCPIP_WRITE_USER routine implements a write-from-user's-buffer function and the value of this literal is the maximum size of any one $QIO. It should be a multiple of 4 and representable in 15 bits.
    • INET_NODE_NAME_LEN is the maximum length of any Internet node name.
    • BASE_TCP_PORT is the TCP/IP port used by server number 0. The convention for TCP/IP is that server number 0 listens on port 6000.
  5. Allocate the following data structures that are private to this transport:
    • reattach_timer_id is the identifier of this timer.
    • reattach_timer_delta is the time to wait between polling attempts.
    • inet_dev_desc is a 2-longword descriptor of the name of UCX's controlling device (macro inet_dev_str). It is initialized in the DECW$$TCPIP_ATTACH_TRANSPORT routine.
    • tcpip_tft is the XTFT structure for the TCP/IP transport. It is initialized in the DECW$TRANSPORT_INIT routine.
    • tcpip_tdb is the address of the XTDB allocated by the common transport on behalf of the TCP/IP transport. It is initialized in the DECW$$TCPIP_ATTACH_TRANSPORT routine.
    • local_node is where the translation of the local node name logical name (UCX$DEVICE) is stored. It is initialized in the DECW$$TCPIP_ATTACH_TRANSPORT routine.
    • lnn_desc is a 2-longword descriptor for the logical name that represents the local node name. It is initialized in the DECW$$TCPIP_ATTACH_TRANSPORT routine.
  6. Declare all references to external procedures. These are all resident in the common transport shareable image.


Previous Next Contents Index