?? RIGHT := 110 ??
*copyc osd$default_pragmats
?? NEWTITLE := 'NOS/VE PTF Application : Remote Validation Commands' ??

MODULE nfm$remote_validation_commands;

{
{ PURPOSE:
{   This module contains processors for commands that manage system access
{   validation for remote permanent file access.
{

?? NEWTITLE := '  Global Declarations', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc clt$parameter_list
*copyc nfe$ptf_condition_codes
*copyc ost$status
?? POP ??
*copyc clp$count_list_elements
*copyc clp$evaluate_parameters
*copyc clp$get_set_count
*copyc clp$get_value
*copyc clp$scan_parameter_list
*copyc nfp$clear_remote_validation
*copyc nfp$find_remote_validation
*copyc nfp$get_remote_validation
*copyc nfp$remote_validation_display
*copyc nfp$set_remote_validation
*copyc osp$set_status_abnormal

?? TITLE := '  [XDCL] nfp$_create_remote_validation', EJECT ??

{
{ PURPOSE:
{   This procedure is the command processor for the create_remote_validation
{   command.  Remote validation is in the form of one or more command lines
{   used to validate a user on a remote system.
{

  PROCEDURE [XDCL] nfp$_create_remote_validation
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (osm$crerv) create_remote_validation, crerv (
{   location, l: name = $required
{   validation, v: (SECURE) list of string 1..osc$max_string_size = $required
{   status)

?? PUSH (LISTEXT := ON) ??

    VAR
      pdt: [STATIC, READ, cls$declaration_section] record
        header: clt$pdt_header,
        names: array [1 .. 5] of clt$pdt_parameter_name,
        parameters: array [1 .. 3] of clt$pdt_parameter,
        type1: record
          header: clt$type_specification_header,
          qualifier: clt$name_type_qualifier,
        recend,
        type2: record
          header: clt$type_specification_header,
          qualifier: clt$list_type_qualifier,
          element_type_spec: record
            header: clt$type_specification_header,
            qualifier: clt$string_type_qualifier,
          recend,
        recend,
        type3: record
          header: clt$type_specification_header,
        recend,
      recend := [[1, [87, 10, 20, 14, 26, 55, 880], clc$command, 5, 3, 2, 0, 0, 0, 3, 'OSM$CRERV'],
            [['L                              ', clc$abbreviation_entry, 1],
            ['LOCATION                       ', clc$nominal_entry, 1],
            ['STATUS                         ', clc$nominal_entry, 3],
            ['V                              ', clc$abbreviation_entry, 2],
            ['VALIDATION                     ', clc$nominal_entry, 2]], [
{ PARAMETER 1
      [2, clc$normal_usage_entry, clc$non_secure_parameter, $clt$parameter_spec_methods
            [clc$specify_by_name, clc$specify_positionally], clc$pass_by_value, clc$immediate_evaluation,
            clc$standard_parameter_checking, 5, clc$required_parameter, 0, 0],
{ PARAMETER 2
      [5, clc$normal_usage_entry, clc$secure_parameter, $clt$parameter_spec_methods
            [clc$specify_by_name, clc$specify_positionally], clc$pass_by_value, clc$immediate_evaluation,
            clc$standard_parameter_checking, 24, clc$required_parameter, 0, 0],
{ PARAMETER 3
      [3, clc$normal_usage_entry, clc$non_secure_parameter, $clt$parameter_spec_methods [clc$specify_by_name],
            clc$pass_by_reference, clc$immediate_evaluation, clc$standard_parameter_checking, 3,
            clc$optional_parameter, 0, 0]],
{ PARAMETER 1
      [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 2
      [[1, 0, clc$list_type], [8, 1, clc$max_list_size, FALSE],
            [[1, 0, clc$string_type], [1, osc$max_string_size, FALSE]]],
{ PARAMETER 3
      [[1, 0, clc$status_type]]];

?? POP ??

    CONST
      p$location = 1,
      p$validation = 2,
      p$status = 3;

    VAR
      pvt: array [1 .. 3] of clt$parameter_value;

    VAR
      i: clt$list_size,
      val_line_count: clt$list_size,
      validation_ptr: ^array [1 .. * ] of string (osc$max_string_size),
      validation_value: ^clt$data_value;


    clp$evaluate_parameters (parameter_list, #SEQ (pdt), NIL, ^pvt, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    nfp$find_remote_validation (pvt [p$location].value^.name_value, val_line_count, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    IF val_line_count <> 0 THEN
      osp$set_status_abnormal (nfc$status_id, nfe$remote_val_defined, pvt [p$location].value^.name_value,
            status);
      RETURN;
    IFEND;

    validation_value := pvt [p$validation].value;
    val_line_count := clp$count_list_elements (pvt [p$validation].value);

    PUSH validation_ptr: [1 .. val_line_count];
    FOR i := 1 TO val_line_count DO
      validation_ptr^ [i] := validation_value^.element_value^.string_value^;
      validation_value := validation_value^.link;
    FOREND;

    nfp$set_remote_validation (pvt [p$location].value^.name_value, validation_ptr, status);

  PROCEND nfp$_create_remote_validation;


?? TITLE := '  [XDCL] nfp$_delete_remote_validation', EJECT ??

{
{ PURPOSE:
{   This procedure is the command processor for the delete_remote_validation
{   command, which removes a previously created validation for the
{   specified location.
{

  PROCEDURE [XDCL] nfp$_delete_remote_validation
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (osm$delrv) delete_remote_validation, delrv (
{   location, l: list of any of
{       key
{         all
{       keyend
{       name
{     anyend = $required
{   status)

?? PUSH (LISTEXT := ON) ??

    VAR
      pdt: [STATIC, READ, cls$declaration_section] record
        header: clt$pdt_header,
        names: array [1 .. 3] of clt$pdt_parameter_name,
        parameters: array [1 .. 2] of clt$pdt_parameter,
        type1: record
          header: clt$type_specification_header,
          qualifier: clt$list_type_qualifier,
          element_type_spec: record
            header: clt$type_specification_header,
            qualifier: clt$union_type_qualifier,
            type_size_1: clt$type_specification_size,
            element_type_spec_1: record
              header: clt$type_specification_header,
              qualifier: clt$keyword_type_qualifier,
              keyword_specs: array [1 .. 1] of clt$keyword_specification,
            recend,
            type_size_2: clt$type_specification_size,
            element_type_spec_2: record
              header: clt$type_specification_header,
              qualifier: clt$name_type_qualifier,
            recend,
          recend,
        recend,
        type2: record
          header: clt$type_specification_header,
        recend,
      recend := [[1, [87, 10, 20, 14, 29, 24, 546], clc$command, 3, 2, 1, 0, 0, 0, 2, 'OSM$DELRV'],
            [['L                              ', clc$abbreviation_entry, 1],
            ['LOCATION                       ', clc$nominal_entry, 1],
            ['STATUS                         ', clc$nominal_entry, 2]], [
{ PARAMETER 1
      [2, clc$normal_usage_entry, clc$non_secure_parameter, $clt$parameter_spec_methods
            [clc$specify_by_name, clc$specify_positionally], clc$pass_by_value, clc$immediate_evaluation,
            clc$standard_parameter_checking, 85, clc$required_parameter, 0, 0],
{ PARAMETER 2
      [3, clc$normal_usage_entry, clc$non_secure_parameter, $clt$parameter_spec_methods [clc$specify_by_name],
            clc$pass_by_reference, clc$immediate_evaluation, clc$standard_parameter_checking, 3,
            clc$optional_parameter, 0, 0]],
{ PARAMETER 1
      [[1, 0, clc$list_type], [69, 1, clc$max_list_size, FALSE],
            [[1, 0, clc$union_type], [[clc$keyword_type, clc$name_type], FALSE, 2], 44,
            [[1, 0, clc$keyword_type], [1], [['ALL                            ', clc$nominal_entry,
            clc$normal_usage_entry, 1]]], 5, [[1, 0, clc$name_type], [1, osc$max_name_size]]]],
{ PARAMETER 2
      [[1, 0, clc$status_type]]];

?? POP ??

    CONST
      p$location = 1,
      p$status = 2;

    VAR
      pvt: array [1 .. 2] of clt$parameter_value;

    VAR
      location: ost$name,
      location_value: ^clt$data_value,
      val_line_count: 0 .. nfc$max_validation_lines,
      i: 1 .. clc$max_value_sets;


    clp$evaluate_parameters (parameter_list, #SEQ (pdt), NIL, ^pvt, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    location_value := pvt [p$location].value;

    WHILE location_value <> NIL DO
      IF location_value^.element_value^.kind = clc$keyword THEN
        location := 'ALL';
      ELSE
        location := location_value^.element_value^.name_value;
      IFEND;
      nfp$find_remote_validation (location, val_line_count, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;

      IF val_line_count = 0 THEN
        IF location = 'ALL' THEN
          osp$set_status_abnormal (nfc$status_id, nfe$remote_val_empty, '', status);
        ELSE
          osp$set_status_abnormal (nfc$status_id, nfe$remote_val_undefined, location, status);
        IFEND;
        RETURN;
      IFEND;

      nfp$clear_remote_validation (location, status);
      IF (location = 'ALL') OR NOT status.normal THEN
        RETURN;
      IFEND;

      location_value := location_value^.link;
    WHILEND;

  PROCEND nfp$_delete_remote_validation;


?? TITLE := '  [XDCL] nfp$display_remote_validation', EJECT ??

{
{ PURPOSE:
{   This procedure is the command processor for the display_remote_validation
{   command.
{

  PROCEDURE [XDCL] nfp$display_remote_validation
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (osm$disrv) display_remote_validation, disrv (
{   location, l: list of any of
{       key
{         all
{       keyend
{       name
{     anyend = ALL
{   output, o: file = OUTPUT
{   status)

?? PUSH (LISTEXT := ON) ??

    VAR
      pdt: [STATIC, READ, cls$declaration_section] record
        header: clt$pdt_header,
        names: array [1 .. 5] of clt$pdt_parameter_name,
        parameters: array [1 .. 3] of clt$pdt_parameter,
        type1: record
          header: clt$type_specification_header,
          qualifier: clt$list_type_qualifier,
          element_type_spec: record
            header: clt$type_specification_header,
            qualifier: clt$union_type_qualifier,
            type_size_1: clt$type_specification_size,
            element_type_spec_1: record
              header: clt$type_specification_header,
              qualifier: clt$keyword_type_qualifier,
              keyword_specs: array [1 .. 1] of clt$keyword_specification,
            recend,
            type_size_2: clt$type_specification_size,
            element_type_spec_2: record
              header: clt$type_specification_header,
              qualifier: clt$name_type_qualifier,
            recend,
          recend,
          default_value: string (3),
        recend,
        type2: record
          header: clt$type_specification_header,
          default_value: string (6),
        recend,
        type3: record
          header: clt$type_specification_header,
        recend,
      recend := [[1, [87, 10, 20, 14, 24, 12, 964], clc$command, 5, 3, 0, 0, 0, 0, 3, 'OSM$DISRV'],
            [['L                              ', clc$abbreviation_entry, 1],
            ['LOCATION                       ', clc$nominal_entry, 1],
            ['O                              ', clc$abbreviation_entry, 2],
            ['OUTPUT                         ', clc$nominal_entry, 2],
            ['STATUS                         ', clc$nominal_entry, 3]], [
{ PARAMETER 1
      [2, clc$normal_usage_entry, clc$non_secure_parameter, $clt$parameter_spec_methods
            [clc$specify_by_name, clc$specify_positionally], clc$pass_by_value, clc$immediate_evaluation,
            clc$standard_parameter_checking, 85, clc$optional_default_parameter, 0, 3],
{ PARAMETER 2
      [4, clc$normal_usage_entry, clc$non_secure_parameter, $clt$parameter_spec_methods
            [clc$specify_by_name, clc$specify_positionally], clc$pass_by_value, clc$immediate_evaluation,
            clc$standard_parameter_checking, 3, clc$optional_default_parameter, 0, 6],
{ PARAMETER 3
      [5, clc$normal_usage_entry, clc$non_secure_parameter, $clt$parameter_spec_methods [clc$specify_by_name],
            clc$pass_by_reference, clc$immediate_evaluation, clc$standard_parameter_checking, 3,
            clc$optional_parameter, 0, 0]],
{ PARAMETER 1
      [[1, 0, clc$list_type], [69, 1, clc$max_list_size, FALSE],
            [[1, 0, clc$union_type], [[clc$keyword_type, clc$name_type], FALSE, 2], 44,
            [[1, 0, clc$keyword_type], [1], [['ALL                            ', clc$nominal_entry,
            clc$normal_usage_entry, 1]]], 5, [[1, 0, clc$name_type], [1, osc$max_name_size]]], 'ALL'],
{ PARAMETER 2
      [[1, 0, clc$file_type], 'OUTPUT'],
{ PARAMETER 3
      [[1, 0, clc$status_type]]];

?? POP ??

    CONST
      p$location = 1,
      p$output = 2,
      p$status = 3;

    VAR
      pvt: array [1 .. 3] of clt$parameter_value;

    VAR
      location_value: ^clt$data_value,
      locations: ^array [1 .. * ] of ost$name,
      location_count: 0 .. clc$max_value_sets,
      loc_index: 1 .. clc$max_value_sets;


    clp$evaluate_parameters (parameter_list, #SEQ (pdt), NIL, ^pvt, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    location_value := pvt [p$location].value;

    location_count := clp$count_list_elements (pvt [p$location].value);
    PUSH locations: [1 .. location_count];
    loc_index := 1;
    WHILE location_value <> NIL DO
      IF location_value^.element_value^.kind = clc$name THEN
        locations^ [loc_index] := location_value^.element_value^.name_value;
      ELSE {keyword = ALL}
        locations^ [1] := 'ALL';
      IFEND;
      location_value := location_value^.link;
      loc_index := loc_index + 1;
    WHILEND;

    nfp$remote_validation_display (locations, pvt [p$output].value^.file_value^, status);

  PROCEND nfp$display_remote_validation;

MODEND nfm$remote_validation_commands;

