?? LEFT := 1, RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE NETWORK ACCESS:  Display TCP/IP static routes.' ??
MODULE nam$display_tcpip_static_routes;

{ PURPOSE:
{   The following command procedure is used to display the TCP/IP static routes.
{
{ DESIGN:
{   This module resides on OSF$PROGRAMS library.

?? OLDTITLE ??
?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc nae$tcpip_mgmt_condition_codes
*copyc ost$status
?? POP ??
*copyc clp$close_display
*copyc clp$evaluate_parameters
*copyc clp$open_display_reference
*copyc clp$put_display
*copyc nlp$tm_get_static_routes
*copyc osv$task_private_heap

?? OLDTITLE ??
?? NEWTITLE := '[XDCL] nap$display_tcpip_static_routes', EJECT ??

  PROCEDURE [XDCL] nap$display_tcpip_static_routes
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{  PROCEDURE  display_tcpip_static_routes_pdt (
{    output,o: FILE = $OUTPUT
{    status)

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  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,
        default_value: string (7),
      recend,
      type2: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [89, 8, 22, 13, 36, 48, 177],
    clc$command, 3, 2, 0, 0, 0, 0, 2, ''], [
    ['O                              ',clc$abbreviation_entry, 1],
    ['OUTPUT                         ',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, 3, clc$optional_default_parameter, 0, 7],
{ 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$file_type],
    '$OUTPUT'],
{ PARAMETER 2
    [[1, 0, clc$status_type]]];

?? FMT (FORMAT := ON) ??
?? POP ??

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

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

    VAR
      count: integer,
      data_string: string (512),
      display_control: clt$display_control,
      i: integer,
      ignore_status: ost$status,
      length: integer,
      ring_attributes: amt$ring_attributes,
      static_routes: ^nlt$tm_static_route_definitions;

    ring_attributes.r1 := #ring (^ring_attributes);
    ring_attributes.r2 := #ring (^ring_attributes);
    ring_attributes.r3 := #ring (^ring_attributes);

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

    clp$open_display_reference (pvt [p$output].value^.file_value^, NIL, fsc$list,
      ring_attributes, display_control, status);
    IF NOT status.normal THEN
      clp$close_display (display_control, status);
      RETURN;
    IFEND;

    clp$put_display (display_control, 'Installed Static Route Definitions:', clc$trim, status);
    static_routes := NIL;
    REPEAT
      nlp$tm_get_static_routes (static_routes, count, status);
      IF (NOT status.normal) AND (status.condition = nae$tm_route_list_too_small) THEN
        IF static_routes <> NIL THEN
          FREE static_routes;
        IFEND;
        ALLOCATE static_routes: [1 .. count];
      IFEND;
    UNTIL (status.normal) OR (status.condition <> nae$tm_route_list_too_small);
    IF status.normal THEN
      FOR i := 1 to count DO
        clp$put_display (display_control, '', clc$trim, status);
        clp$put_display (display_control, '  DEFINE_TCPIP_STATIC_ROUTE ..', clc$trim, status);
        STRINGREP (data_string, length, '    LOCAL_DEVICE=', static_routes^ [i].local_device_name, ' ..');
        clp$put_display (display_control, data_string (1, length), clc$trim, status);
        STRINGREP (data_string, length, '    DESTINATION_ADDRESS=(',
              static_routes^ [i].destination_address DIV 1000000(16), ',',
              ((static_routes^ [i].destination_address MOD 1000000(16)) DIV 10000(16)), ',',
              ((static_routes^ [i].destination_address MOD 10000(16)) DIV 100(16)), ',',
              (static_routes^ [i].destination_address MOD 100(16)), ') ..');
        clp$put_display (display_control, data_string (1, length), clc$trim, status);
        STRINGREP (data_string, length, '    DESTINATION_ADDRESS_MASK=(',
              static_routes^ [i].destination_address_mask DIV 1000000(16), ',',
              ((static_routes^ [i].destination_address_mask MOD 1000000(16)) DIV 10000(16)), ',',
              ((static_routes^ [i].destination_address_mask MOD 10000(16)) DIV 100(16)), ',',
              (static_routes^ [i].destination_address_mask MOD 100(16)), ') ..');
        clp$put_display (display_control, data_string (1, length), clc$trim, status);
        IF static_routes^ [i].strict_route THEN
          clp$put_display (display_control, '    STRICT_ROUTE=TRUE', clc$trim, status);
        ELSE
          clp$put_display (display_control, '    STRICT_ROUTE=FALSE', clc$trim, status);
        IFEND;
      FOREND;
    IFEND;
    IF static_routes <> NIL THEN
      FREE static_routes;
    IFEND;
    clp$close_display (display_control, ignore_status);
  PROCEND nap$display_tcpip_static_routes;
?? OLDTITLE ??
MODEND nam$display_tcpip_static_routes;

