PROCEDURE rap$define_lpds (
  protocol, p: key (stream_socket, ss), (cdna_session, cs), keyend = stream_socket
  status)

*IF $variable(rav$proc_doc,declared)<>'UNKNOWN'

"    This request defines the LPD server.
"
*IFEND

  VAR
    command_file: string = '$local.'//$unique
    ignore_status: status
    local_status: status
  VAREND

  IF protocol = stream_socket THEN
    collect_text $fname(command_file) until='    collect_end'
      $system.osf$command_library.manage_network_applications
        define_tcpip_application application=osa$lpd_server protocol=stream_socket
          change_maximum_sockets maximum_sockets=100
          change_tcpip_validation system_privilege=true
        quit
        activate_tcpip_application application=osa$lpd_server
      quit
    collect_end
  ELSE
    put_line 'WARNING - TCP/IP Gateway support terminated at release level 1.7.1' o=$response
    collect_text $fname(command_file) until='    collect_end'
      $system.osf$command_library.manage_network_applications
        define_client client=osa$lpd_server protocol=cdna_session
          change_maximum_connections mc=100
        end_define_client
        activate_client client=osa$lpd_server
      quit
    collect_end
  IFEND

  include_file $fname(command_file) status=local_status
  delete_file $fname(command_file) status=ignore_status

  IF local_status.normal THEN
    put_line ' LPD server is defined' o=$response
  IFEND

  EXIT_PROC WITH local_status WHEN NOT local_status.normal

PROCEND rap$define_lpds

