-
Notifications
You must be signed in to change notification settings - Fork 5
/
GENROUTES.PAS
3119 lines (3119 loc) · 247 KB
/
GENROUTES.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(**********************************************************************)00001000
(* *)00002000
(* Program to generate optimized routing tables for the *)00003000
(* EARN network. *)00004000
(* *)00005000
(* Author: Roland Wolf & Udo Meyer (MEYER@DEARN) *)00006000
(* Gesellschaft fuer Schwerionenforschung mbH *)00007000
(* 6100 Darmstadt 11 *)00008000
(* *)00009000
(* Copyright: IBM Deutschland *)00010000
(* *)00011000
(* *)00012000
(* 85/04/17 Complete rewritten version of the old GENROUTS program *)00013000
(* 85/05/02 Info file included R. W. *)00014000
(* 85/06/21 Generate also NOS and UNIX routing tables R. W. *)00015000
(* 85/06/26 Error in the ALIAS NODENUM corrected R. W. *)00016000
(* 85/10/30 Some improvements (larger PEND numbers) linkchk R. W. *)00017000
(* 85/11/06 Some corrections for JES2 R. W. *)00018000
(* 85/11/19 Generation of a plot file possible R. W. *)00019000
(* 86/01/14 Errors for UREP corrected R. W. *)00020000
(* 86/05/28 RSCS/V2 and CTC connections included U. M. *)00021000
(* 86/08/09 All LINK (local) statements as comment, check of U. M. *)00022000
(* nodes file added U. M. *)00023000
(* 87/02/27 Parameter <nodialog>, new JES2 release, JES2 node U. M. *)00024000
(* number offset, generation of XMAILER NAMES file, U. M. *)00025000
(* info file with specified tag U. M. *)00026000
(* 87/03/24 Corrections for JES2, XMAILER, INFO U. M. *)00027000
(* 87/04/08 Truncation error with long mailer-ids fixed. B. P. *)00028000
(* 87/04/09 Uppercasing netsoft now done correctly in MVS versP. S. *)00029000
(* 87/04/10 Error in JES2 v2 offset handling removed D. S. *)00030000
(* Uppercasing netsoft now done correctly in VM vers.P. S. *)00031000
(* 87/04/15 Errors corrected: U. M. *)00032000
(* Run with parameter TSO U. M. *)00033000
(* NOS table, adjacent nodes U. M. *)00034000
(* 87/06/11 Node number limit increased to 4000 U. M. *)00035000
(* JES2 max range for local node numbers: 300 U. M. *)00036000
(* Adjtypes (speed) treatment corrected U. M. *)00037000
(* 87/07/08 Node number limit dropped U. M. *)00038000
(* JES2 local range limit dropped U. M. *)00039000
(* JES2 table sorted by node numbers (option) U. M. *)00040000
(* 88/05/20 LINKIGN tag supported U. M. *)00041000
(* routing optimization algorithm changed U. M. *)00042000
(* eadjacent string increased U. M. *)00043000
(* 88/06/08 Error creating multiple NETINIT files corrected U. M. *)00044000
(* 88/11/05 CMS command function (7) U. G. *)00045000
(* 88/11/10 eadjacents length changed to 400 U. G. *)00046000
(* 89/04/05 comment-char changed for JNET ('/.' -> '!') U. G. *)00047000
(* 89/04/20 jes2_sort answer (trailing blanks removed) U. G. *)00048000
(* 89/04/20 resistence for CTC changed from 0 to 1 M. G. *)00049000
(* 89/04/20 info-file output abend U. G. *)00050000
(* 89/05/03 handling of :via without :adj M. G. *)00051000
(* 89/09/12 better handling for NETSERV U. G. *)00052000
(* *)00053000
(* Abbreviations: R. W. Roland Wolf *)00054000
(* U. M. Udo Meyer *)00055000
(* B. P. Bert Pasch *)00056000
(* P. S. Peter Sylvester *)00057000
(* D. S. Doron Shikmoni *)00058000
(* U. G. Ulrich Giese *)00059000
(* M. G. Michael Gettes *)00060000
(* *)00061000
(**********************************************************************)00062000
program genrouts 00063000
(nodesfil,netfile,infofile,plotfile,xmailfil); 00064000
(* *)00065000
(* nodesfil: NODES file with tags and all information about the *)00066000
(* EARN nodes *)00067000
(* netfile: OUTPUT file for the routing table *)00068000
(* infofile: OUTPUT file with information about the nodes *)00069000
(* plotfile: OUTPUT file with plot instructions *)00070000
(* xmailfil: XMAILER NAMES file for VM(CUCCA) MAILER *)00071000
(* *)00072000
(**********************************************************************)00073000
%page 00074000
(* *)00075000
type lpointer = @typlink; 00076000
type npointer = @typnode; 00077000
typnode = record (********* node ********** *)00078000
name : alfa; (* nodename * *)00079000
number : integer; (* node number for JES2 * *)00080000
nnstart : integer; (* first node number * *)00081000
country : string(8); (* country * | *)00082000
gmtoff : integer; (* GMT offset * | *)00083000
institute : string(40); (* institute * | *)00084000
syst : string(20); (* OP system * | *)00085000
contact : string(60); (* contact person * | *)00086000
soft : packed array(.1..4.) of char; (* software | *)00087000
softrel : string(2); (* software release * | *)00088000
next : npointer; (* --> to next node *---+ *)00089000
numnex : npointer; (* --> to next nodenumber*---> *)00090000
linklist: lpointer; (* --> to list of links *----+*)00091000
actlink : lpointer; (* --> actual link point * | |*)00092000
via : npointer; (* --> prev. node in net *-+| |*)00093000
vialink : npointer; (* --> link routed throu *--+ |*)00094000
distance: integer; (* dist. from local node * |*)00095000
resist : integer; (* weight for distance * |*)00096000
sumnum : integer; (* sum of node numbers * |*)00097000
ok : boolean; (* ind. node is OK now * |*)00098000
link_ok : boolean; (* ind. link is OK * |*)00099000
level : integer; (* level in plot * |*)00100000
member : integer; (* plot variable * |*)00101000
connect : integer; (* for plot * |*)00102000
xmailer : string(255); (* XMAILER NAMES entry * |*)00103000
linkign : string(255); (* links to be ignored * |*)00104000
end; (*************************<-+ |*)00105000
(* | |*)00106000
typlink = record (********* link ********* | |*)00107000
name : alfa; (* linkname *<----+*)00108000
speed : integer; (* speed of the line * | *)00109000
ptolink : npointer; (* --> node connected *---+ *)00110000
next : lpointer; (* --> to next link *--+ *)00111000
end; (************************ | *)00112000
(* V *)00113000
type entries = record (***** NODE entry **************)00114000
enodename : string(8); (* node name *)00115000
ealianame : string(255); (* alias nodename *)00116000
ecountry : string(8); (* country of the node *)00117000
enodenum : string(4); (* JES2 Node Number *)00118000
ennstart : integer; (* JES2 Node Number start *)00119000
ealianum : string(4); (* number for the alias node *)00120000
elocation : string(50); (* address of the node *)00121000
esyst : string(20); (* operating system *)00122000
econtact : string(60); (* contact person *)00123000
esoftware : string(4); (* software of the node *)00124000
esoftrel : string(2); (* software release *)00125000
eadjacents: string(400); (* list of the next EARN nodes *)00126000
evia : string(8); (* next node to CUNY *)00127000
espeed : string(255); (* speed of the line *)00128000
elinkign : string(255); (* links to be ignored *)00129000
egmtoff : integer; (* GMT offset *)00130000
emailer : string(34); (* MAILER entry *)00131000
emsoftw : string(34); (* complete software tag *)00132000
ereqrel : string(8); (* required GENROUTS release *)00133000
enet : string(8); (* network entry *)00134000
end; (*******************************)00135000
%page 00136000
var code : integer; (* what to do 1,2,3,4,5 *)00137000
date : alfa; (* the current date *)00138000
dialog : boolean; (* false if run as BATCH JOB *)00139000
dummyvia : npointer; (* dummy node for via pointer *)00140000
endstring : boolean; (* flags the end of a string *)00141000
entry : entries; (* contains the node entries *)00142000
filcheck : integer; (* check of nodes file *)00143000
formopt : integer; (* sort criteria for nodes *)00144000
formopt2 : integer; (* form of info file *)00145000
gen_rel : string(8); (* current GENROUTS release *)00146000
hug_offset : integer; 00147000
hug_soft : packed array (.1..4.) of char; 00148000
hug_softrel : packed array (.1..2.) of char; 00149000
info : string(64); (* update information for rout *)00150000
infofile : text; (* file with info about nodes *)00151000
inforeq : boolean; (* request for a info file *)00152000
ix : integer; (* auxilary *)00153000
iy : integer; (* auxilary *)00154000
jes2_sort : integer; (* how to sort JES2 tables *)00155000
key : string(6); (* indicates start of a nodesec*)00156000
level : integer; (* distance to local node *)00157000
line : string(400); (* input line *)00158000
linjesx : integer; (* number of lines *)00159000
link : lpointer; (* points to a link entry *)00160000
linkign_1 : string(17); (* link to be ignored *)00161000
linkign_2 : string(17); (* link to be ignored *)00162000
linklink : lpointer; (* points to the list of links *)00163000
linknode : npointer; (* points to a link-node *)00164000
links_ok : boolean; (* if all links are OK *)00165000
links_id : string(8); (* nodes file update state *)00166000
local_node : npointer; (* netinits are gen for this n *)00167000
locountry : string(3); (* country initial *)00168000
locount : alfa; (* same but other type *)00169000
maxdist : integer; (* maximum distance from local *)00170000
maxname : string(8); (* node with maximum distance *)00171000
maxnum : integer; (* maximum assigned node num *)00172000
namen : alfa; (* aux nodename *)00173000
ndnamen : alfa; (* input nodename *)00174000
netfile : text; (* output file *)00175000
newop : boolean; (* true if TSOLNK is available *)00176000
node : npointer; (* pointer to a node *)00177000
nodeid : alfa; (* aux nodename *)00178000
nodesfil : text; (* inputfile *)00179000
nummer : integer; (* aux node number *)00180000
numjes2 : integer; (* number of JES2 nodes *)00181000
numjes3 : integer; (* number of JES3 nodes *)00182000
numjnet : integer; (* number of JNET nodes *)00183000
numnje : integer; (* number of NJE nodes *)00184000
numrscs : integer; (* number of RSCS nodes *)00185000
numnos : integer; (* number of NOS nodes *)00186000
numurep : integer; (* number of UREP nodes *)00187000
numnodes : integer; (* number of all nodes *)00188000
numstr : string(4); (* number as a string *)00189000
oldline : string(400); (* last input line *)00190000
oldnum : integer; (* number for not yet numb nod *)00191000
outline : string(255); (* output line *)00192000
orignode : npointer; (* points to a node *)00193000
pendstart : integer; (* start number for PEND nodes *)00194000
plotfile : text; (* plot file *)00195000
plotreq : boolean; (* request for a plot file *)00196000
pos : integer; (* position for tokening *)00197000
posi : integer; (* position for tokening *)00198000
pred_link : lpointer; (* last link *)00199000
pred_node : npointer; (* last node *)00200000
protocol : alfa; (* line protocol type *)00201000
resistence : integer; (* weighted distance of a node *)00202000
resmod : alpha; (* filemode *)00203000
restyp : alpha; (* filetype *)00204000
result : alpha; (* filename and others *)00205000
softw : packed array(.1..4.) of char; (* *)00206000
speedline : string(255); (* speeds of the adjacent nodes*)00207000
startnode : npointer; (* points to the dummy node *)00208000
tag : string(12); (* "tag" of an entry *)00209000
tag_found : boolean; (* indicates "tag found" *)00210000
tagend : integer; (* marks end of tag *)00211000
tag_num : integer; (* tag choice for INFO file *)00212000
tagstart : integer; (* marks start of tag *)00213000
tagval : string(255); (* value of the tag *)00214000
tagvalend : integer; (* marks end of that value *)00215000
testkey : string(6); (* to compare with tag :node. *)00216000
tsoname : string(30); (* TSO data set name *)00217000
time : alfa; (* current time *)00218000
ttyin : text; (* terminal input *)00219000
ttyout : text; (* terminal output *)00220000
vers_id : string(8); (* nodes file update state *)00221000
vmcms : boolean; (* true if CMS, false if TSO *)00222000
xmailerreq : boolean; (* request for XMAILER NAMES *)00223000
xmailfil : text; (* XMAILER NAMES file *)00224000
label again; (* ask what to do *)00225000
label nextno; (* next node *)00226000
label terminate; (* terminate the program *)00227000
procedure cms(const s : string; var rc : integer); external; 00228000
%page 00229000
(**********************************************************************)00230000
(* *)00231000
(* This procedure converts a character (alfa) word to uppercase *)00232000
(* *)00233000
(**********************************************************************)00234000
procedure convert(var wort : alfa); (* translate to uppercase *) 00235000
var ix : integer; 00236000
begin 00237000
for ix := 1 to 8 do 00238000
begin 00239000
case ord(wort(.ix.)) of 00240000
129..137,145..153,162..169 : wort(.ix.) := chr(ord(wort(.ix.))+64); 00241000
otherwise; 00242000
end; 00243000
end; 00244000
end; (* of convert *)00245000
%page 00246000
(**********************************************************************)00247000
(* *)00248000
(* This procedure converts a character (alpha) word to uppercase *)00249000
(* *)00250000
(**********************************************************************)00251000
procedure convert_alpha(var wort : alpha); (* translate to uppercase *)00252000
var ix : integer; 00253000
begin 00254000
for ix := 1 to 16 do 00255000
begin 00256000
case ord(wort(.ix.)) of 00257000
129..137,145..153,162..169 : wort(.ix.) := chr(ord(wort(.ix.))+64); 00258000
otherwise; 00259000
end; 00260000
end; 00261000
end; (* of convert_alpha *)00262000
%page 00263000
(**********************************************************************)00264000
(* *)00265000
(* This procedure prints a number with leading zeros *)00266000
(* *)00267000
(**********************************************************************)00268000
%page 00269000
procedure printnum( num : integer); 00270000
begin 00271000
case num of 00272000
0..9: write(netfile,'000',num:1); 00273000
10..99: write(netfile,'00',num:2); 00274000
100..999: write(netfile,'0',num:3); 00275000
otherwise write(netfile,num:4); 00276000
end; 00277000
end; (* of printnum *)00278000
(**********************************************************************)00279000
(* *)00280000
(* This procedure initializes the node variables *)00281000
(* This initialization was requested becaus uninitialized variables *)00282000
(* caused problems at some installations *)00283000
(* *)00284000
(**********************************************************************)00285000
procedure initial(var initnode : npointer); 00286000
begin 00287000
[email protected] := ' '; 00288000
[email protected] := 0; 00289000
[email protected] := 1; 00290000
[email protected] := ''; 00291000
[email protected] := 0; 00292000
[email protected] := ''; 00293000
[email protected] := ''; 00294000
[email protected] := ''; 00295000
[email protected] := ' '; 00296000
[email protected] := ' '; 00297000
[email protected] := nil; 00298000
[email protected] := nil; 00299000
[email protected] := nil; 00300000
[email protected] := nil; 00301000
[email protected] := nil; 00302000
[email protected] := ''; 00303000
[email protected] := 0; 00304000
[email protected] := 0; 00305000
[email protected] := 0; 00306000
[email protected] := false; 00307000
[email protected]_ok := false; 00308000
[email protected] := 0; 00309000
[email protected] := 0; 00310000
[email protected] := 0; 00311000
[email protected] := ''; 00312000
end; (* of initial *) 00313000
%page 00314000
(**********************************************************************)00315000
(* *)00316000
(* This procedure executes a TSO command or program *)00317000
(* *)00318000
(**********************************************************************)00319000
procedure tsocmd( prog_cmd : integer; cmdstr : string(255); 00320000
var rcode : integer); 00321000
type pa4 = packed array (.1..4.) of char; 00322000
pa80 = packed array (.1..255.) of char; 00323000
procedure tsolnk( var parm1 : pa4; 00324000
var parm2 : pa80; 00325000
var parm3 : integer; 00326000
var parm4 : integer; 00327000
var parm5 : integer; 00328000
var parm6 : integer); FORTRAN; 00329000
var parm1 : pa4; 00330000
parm2 : pa80; 00331000
parm3 : integer; 00332000
parm4 : integer; 00333000
parm5 : integer; 00334000
parm6 : integer; 00335000
begin 00336000
rcode := 99; 00337000
if (prog_cmd ^= 1) and (prog_cmd ^= 2) then return; 00338000
parm1(.1.) := chr(0); 00339000
parm1(.2.) := chr(0); 00340000
parm1(.3.) := chr(0); 00341000
parm1(.4.) := chr(prog_cmd); 00342000
parm2 := cmdstr; 00343000
parm3 := length(cmdstr); 00344000
parm4 := 0; 00345000
parm5 := 0; 00346000
parm6 := 0; 00347000
tsolnk(parm1,parm2,parm3,parm4,parm5,parm6); 00348000
rcode := parm4; 00349000
end; (* of tsocmd *) 00350000
%page 00351000
(**********************************************************************)00352000
(* *)00353000
(* This procedure searches for a node entry 'namen' *)00354000
(* *)00355000
(**********************************************************************)00356000
procedure search( ptr : npointer; namen : alfa; 00357000
var runptr : npointer; var pred_node : npointer); 00358000
begin 00359000
(* search for the node with the name 'namen' *)00360000
runptr := ptr; 00361000
pred_node := ptr; 00362000
repeat 00363000
if [email protected] = namen then leave (* we found it *)00364000
else if [email protected] > namen then 00365000
begin (* we are too far in the alphabet !!! *)00366000
runptr := nil; (* initiate termination *)00367000
end else 00368000
begin 00369000
pred_node := runptr; 00370000
runptr := [email protected]; (* try the next one *)00371000
end; 00372000
until runptr = nil 00373000
end; (* of search *) 00374000
%page 00375000
(**********************************************************************)00376000
(* *)00377000
(* This procedure searches for a link entry *)00378000
(* *)00379000
(**********************************************************************)00380000
procedure linksearch( lptr : lpointer; namen : alfa; 00381000
var runlink : lpointer; var pred_link : lpointer); 00382000
begin 00383000
(* search for the link that points to 'namen' *)00384000
runlink := lptr; 00385000
pred_link := nil; 00386000
if [email protected] > namen then begin 00387000
runlink := nil; return end; 00388000
repeat 00389000
if [email protected] = namen then leave (* we found it *)00390000
else if [email protected] > namen then 00391000
begin (* we are too far in the alphabet !!! *)00392000
runlink := nil; (* initiate termination *)00393000
end else 00394000
begin 00395000
pred_link := runlink; 00396000
runlink := [email protected]; (* try the next one *)00397000
end; 00398000
until runlink = nil 00399000
end; (* of linksearch *) 00400000
%page 00401000
(**********************************************************************)00402000
(* *)00403000
(* This procedure decodes the complete node entry *)00404000
(* *)00405000
(**********************************************************************)00406000
procedure decode; 00407000
var actpos : integer; 00408000
cconv : alfa; 00409000
str_1 : string(255); 00410000
label eofchk; 00411000
(* *)00412000
procedure build_xmailer; (* builds the mailer entry for XMAILER *)00413000
var m_pos : integer; 00414000
m_id : string(24); 00415000
m_exit : string(16); 00416000
begin 00417000
with entry do begin 00418000
m_pos := index(emailer,' '); 00419000
if m_pos > 0 then begin 00420000
m_id := substr(emailer,1,m_pos); 00421000
if index(emailer,'BITNET') > 0 then m_exit := 'BITNET 2' 00422000
else 00423000
if index(emailer,'BSMTP') > 0 then m_exit := 'BSMTP 3' 00424000
else 00425000
if index(emailer,'LOCAL') > 0 then m_exit := 'LOCAL 1' 00426000
else 00427000
if index(emailer,'NOMAIL') > 0 then m_exit := 'NOMAIL 2' 00428000
else 00429000
if index(emailer,'INTERNET') > 0 then m_exit := 'INTERNET 1' 00430000
else 00431000
if index(emailer,'RSMAIL') > 0 then m_exit := 'RSMAIL 1' 00432000
else 00433000
if index(emailer,'DEFRT') > 0 then 00434000
if index(emailer,'TRUNC') > 0 then m_exit := 'DEFRT 1 TRUNCATE' 00435000
else m_exit := 'DEFRT 1' 00436000
else 00437000
m_exit := ''; 00438000
emailer := trim(m_id)||' '||trim(m_exit); 00439000
end; 00440000
end; 00441000
end; (* of procedure build_xmailer *)00442000
(* *)00443000
procedure build_netsoft; (* builds the networking software tag *)00444000
var str_h1 : string(255); 00445000
str_h2 : string(255); 00446000
begin 00447000
with entry do begin 00448000
str_h1 := trim(tagval); 00449000
emsoftw := str_h1; 00450000
str_h2 := ''; 00451000
posi := 1; 00452000
repeat 00453000
cconv := substr(str_h1,posi, 00454000
min((length(str_h1)-posi+1),8)); 00455000
convert(cconv); 00456000
str_h2 := str_h2||str(cconv); 00457000
posi := posi + 8; 00458000
until posi > length(str_h1); 00459000
str_h2 := trim(str_h2); 00460000
if index(str_h2,'RSCS') > 0 then begin 00461000
esoftware := 'RSCS'; 00462000
if index(str_h2,'V2') > 0 then esoftrel := 'V2'; 00463000
end else 00464000
if index(str_h2,'JES2') > 0 then begin 00465000
esoftware := 'JES2'; 00466000
if ((index(str_h2,'1.3.6') > 0) | 00467000
(index(str_h2,'2.1.5') > 0) | 00468000
(index(str_h2,'2.2.0') > 0)) then esoftrel := 'V2'; 00469000
end else 00470000
if index(str_h2,'JES3') > 0 then esoftware := 'JES3' 00471000
else 00472000
if index(str_h2,'JNET') > 0 then esoftware := 'JNET' 00473000
else 00474000
if index(str_h2,'NJE') > 0 then esoftware := 'NJE ' 00475000
else 00476000
if index(str_h2,'UREP') > 0 then esoftware := 'UREP' 00477000
else 00478000
if index(str_h2,'TIEL') > 0 then esoftware := 'TIEL' 00479000
else 00480000
if index(str_h2,'INTE') > 0 then esoftware := 'INTE' 00481000
else 00482000
esoftware := substr(str_h2,1,min(length(str_h2),4)); 00483000
end; 00484000
end; (* of procedure build_netsoft *)00485000
(* *)00486000
procedure namecheck; (* checks names for comment characters *)00487000
var compos : integer; 00488000
begin 00489000
with entry do begin 00490000
compos := max(index(enodename,'/'), 00491000
index(enodename,'*'), 00492000
index(enodename,'.')); 00493000
if compos > 0 then begin 00494000
writeln(ttyout,'=Err=> WARNING: Invalid nodename ' 00495000
,enodename,' found in nodes file'); 00496000
goto terminate; 00497000
end; 00498000
end; 00499000
end; (* of procedure namecheck *)00500000
(* *)00501000
begin 00502000
with entry do begin (* in 'entry' we store all the variables *) 00503000
enodename := ''; 00504000
ealianame := ''; 00505000
ecountry := ''; 00506000
enodenum := ''; 00507000
ennstart := 1; 00508000
ealianum := ''; 00509000
elocation := ''; 00510000
esyst := ''; 00511000
econtact := ''; 00512000
esoftware := ''; 00513000
esoftrel := 'V1'; 00514000
eadjacents := ''; 00515000
elinkign := ''; 00516000
espeed := ''; 00517000
evia := ''; 00518000
egmtoff := 0; 00519000
emailer := ''; 00520000
enet := ''; 00521000
ereqrel := ''; 00522000
end; 00523000
testkey := ''; 00524000
if oldline = '' then begin (* did we already read the line ? *) 00525000
readln(nodesfil,key:6,line); (* if 'not' then read tag and rest*) 00526000
posi := index(line,' '); (* ...find the end of the nodename*) 00527000
readstr(line,nodeid:posi,line); (* ...and read the nodename *) 00528000
end else begin 00529000
readstr(oldline,key:6,line); (* if we already read the line ...*) 00530000
posi := index(line,' '); (* do the same *) 00531000
readstr(line,nodeid:posi,line); 00532000
end; 00533000
(* *) 00534000
repeat (* decode a node entry *) 00535000
tagvalend:= 2; 00536000
%page 00537000
repeat (* decode a line *) 00538000
if line = '' then leave; 00539000
if tagvalend = 2 then (* decode ':tag.tagvalue' *) 00540000
tagstart := index(substr(line,1,length(line)),':') 00541000
else 00542000
tagstart := index(substr(line,tagvalend-1,length(line) 00543000
- tagvalend + 2),' :') + tagvalend - 1; 00544000
tagend := index(substr(line,tagstart,length(line) 00545000
- tagstart + 1),'.') + tagstart - 1; 00546000
tagvalend:= index(substr(line,tagend ,length(line) 00547000
- tagend + 1),' :') + tagend; 00548000
if tagvalend = tagend then tagvalend := length(line) + 1; 00549000
tag := substr(line,tagstart+1,tagend-tagstart-1); 00550000
tagval := substr(line,tagend+1,tagvalend-tagend-1); 00551000
(* OK, we have 'tag' and 'tagval' *) 00552000
with entry do (* now, which tag is it ? *) 00553000
if tag = 'nodenum' then begin 00554000
enodenum := trim(tagval); 00555000
if (enodenum='PEND') then enodenum:=''; 00556000
end else 00557000
if tag = 'country' then ecountry := trim(tagval) else 00558000
if tag = 'alias' then ealianame := trim(tagval) else 00559000
if tag = 'aliasnum' then ealianum := trim(tagval) else 00560000
if tag = 'via' then evia := trim(tagval) else 00561000
if tag = 'linkign' then elinkign := trim(tagval) else 00562000
if tag = 'genrouts' then begin 00563000
ereqrel := trim(tagval); 00564000
if ereqrel > gen_rel then begin 00565000
writeln(ttyout,'=Err=> The input nodes dataset '|| 00566000
'requires GENROUTS release >= ',ereqrel); 00567000
goto terminate; 00568000
end; 00569000
end else 00570000
if tag = 'mailer' then begin 00571000
emailer := trim(tagval); 00572000
if length(emailer) > 0 then build_xmailer; 00573000
end else 00574000
if tag = 'net' then enet := trim(tagval) else 00575000
if tag = 'gmtoff' then readstr(tagval,egmtoff) else 00576000
if tag = 'abbr' then 00577000
elocation := trim(substr(tagval,1, 00578000
min(length(tagval),50))) else 00579000
if tag = 'system' then 00580000
esyst := trim(substr(tagval,1, 00581000
min(length(tagval),20))) else 00582000
if tag = 'contact' then 00583000
econtact := trim(substr(tagval,1, 00584000
min(length(tagval),60))) else 00585000
if (tag = 'site') and (elocation = '') then 00586000
elocation := trim(substr(tagval,1, 00587000
min(length(tagval),50))) else 00588000
if (tag = 'netsoft') or (tag = 'swnet') then build_netsoft else 00589000
if ((substr(tag,1,min(length(tag),3)) = 'inf') & 00590000
(substr(tag,1,min(length(tag),6)) ^= 'inform')) then begin 00591000
if length(tagval) > 4 then begin 00592000
actpos := 1; 00593000
repeat 00594000
cconv := substr(tagval,actpos, 00595000
min(length(tagval)-actpos,8)); 00596000
convert(cconv); 00597000
str_1 := str(cconv); 00598000
posi := index(str_1,'JES2-'); 00599000
if posi > 0 then begin 00600000
posi := posi + actpos -1; 00601000
str_1 := substr(tagval,posi+5, 00602000
length(tagval)-posi-4); 00603000
pos := index(str_1,' '); 00604000
if (pos = 0) then pos := (length(str_1) + 1); 00605000
readstr(substr(str_1,1,pos-1),ennstart); 00606000
actpos := length(tagval); 00607000
end; 00608000
actpos := actpos + 4; 00609000
until actpos > length(tagval); 00610000
end; 00611000
end else 00612000
if length(tag) > 8 then begin 00613000
if substr(tag,1,8) = 'adjnodes' then 00614000
eadjacents := eadjacents||' '||tagval; 00615000
if substr(tag,1,8) = 'adjtypes' then 00616000
if espeed = '' then 00617000
espeed := tagval 00618000
else espeed := trim(espeed)||' '||tagval; 00619000
end else 00620000
enodename := str(nodeid); 00621000
if substr(str(nodeid),1,4) = 'VERS' then 00622000
vers_id := str(nodeid) else 00623000
if substr(str(nodeid),1,5) = 'LINKS' then 00624000
links_id := str(nodeid); 00625000
(* *)00626000
until tagvalend = length(line) + 1; 00627000
(* *)00628000
eofchk: 00629000
if eof(nodesfil) then 00630000
begin 00631000
testkey := ''; 00632000
leave; 00633000
end; 00634000
readln(nodesfil,line); 00635000
if line = '' then goto eofchk; 00636000
readstr(line,testkey:6); 00637000
if (testkey=':node.') then 00638000
begin oldline := line; 00639000
leave; end; 00640000
until testkey = ''; 00641000
namecheck; 00642000
end; (* of decode *) 00643000
%page 00644000
(**********************************************************************)00645000
(* *)00646000
(* This procedure initiates the setting of the via variables *)00647000
(* *)00648000
(**********************************************************************)00649000
procedure initvia; 00650000
(**********************************************************************)00651000
(* *)00652000
(* This procedure optimizes the routings by setting the 'distance' *)00653000
(* and 'resistence' variables for each node *)00654000
(* *)00655000
(**********************************************************************)00656000
procedure setlevel( level : integer; actnode : npointer; 00657000
loclink : npointer; nodesum : integer); 00658000
var resistence : integer; 00659000
linknode : npointer; 00660000
ign_flag : boolean; 00661000
begin 00662000
level := level + 10; 00663000
ign_flag := false; 00664000
[email protected] := [email protected]; 00665000
repeat (* linknode points to the *)00666000
linknode := [email protected]@.ptolink; (* link of actnode *)00667000
linkign_1 := trim(str([email protected]))||'-'; 00668000
linkign_1 := linkign_1||trim(str([email protected])); 00669000
linkign_2 := trim(str([email protected]))||'-'; 00670000
linkign_2 := linkign_2||trim(str([email protected])); 00671000
if ((index([email protected],linkign_1) > 0) | 00672000
(index([email protected],linkign_2) > 0)) then ign_flag := true;00673000
resistence := [email protected] + [email protected]@.speed; 00674000
if ((resistence < [email protected]) & (* weight for the distance*)00675000
([email protected] > 10) & (* to the local node *)00676000
(^ign_flag)) then begin 00677000
[email protected] := level; 00678000
[email protected] := resistence; 00679000
[email protected] := actnode; 00680000
[email protected] := loclink; 00681000
if ([email protected] > ([email protected]+nodesum+10000)) then 00682000
[email protected] := [email protected] + nodesum + 10000; 00683000
(* goto the next level ! *)00684000
setlevel(level,linknode,loclink,[email protected]); 00685000
end else ign_flag := false; 00686000
[email protected] := [email protected]@.next; 00687000
until [email protected] = nil; 00688000
end; 00689000
%page 00690000
(**********************************************************************)00691000
(* *)00692000
(* This procedure sets the distance variables relative to the local *)00693000
(* node back to the default values *)00694000
(* *)00695000
(**********************************************************************)00696000
procedure clearlevel; 00697000
var linknode : npointer; 00698000
begin 00699000
linknode := [email protected]; 00700000
repeat 00701000
[email protected] := 9999; 00702000
[email protected] := 9999; 00703000
[email protected] := 1000000000; 00704000
[email protected] := nil; 00705000
[email protected] := nil; 00706000
[email protected] := false; 00707000
linknode := [email protected]; 00708000
until linknode = nil; 00709000
end; 00710000
%page 00711000
(**********************************************************************)00712000
(* *)00713000
(* This procedure checks wether the via pointer are set for each *)00714000
(* node - detection of errors in nodes file. *)00715000
(* *)00716000
(**********************************************************************)00717000
procedure viacheck; 00718000
begin 00719000
node := [email protected]; 00720000
filcheck := 0; 00721000
repeat (* for each node *)00722000
if [email protected] = nil then 00723000
begin 00724000
writeln(ttyout,'=Err=> No via pointer set for node ' 00725000
,[email protected]:8,'.'); 00726000
filcheck := filcheck + 1; 00727000
end; 00728000
if (maxdist < [email protected]) then begin 00729000
maxdist := max(maxdist,[email protected]); 00730000
maxname := str([email protected]); 00731000
end; 00732000
node := [email protected]; 00733000
until node = nil; 00734000
if filcheck >= 1 then 00735000
begin 00736000
writeln(ttyout,'=Err=> ',filcheck:4,' nodes not connected to ' 00737000
,[email protected]:8,'.'); 00738000
writeln(ttyout,'=Err=> Check nodes file.'); 00739000
goto terminate; 00740000
end; 00741000
end; 00742000
%page 00743000
(**********************************************************************)00744000
(* *)00745000
(* This procedure sets the vialink pointers *)00746000
(* *)00747000
(**********************************************************************)00748000
procedure setvia( vnode : npointer; var vianode : npointer); 00749000
var checkres : integer; 00750000
ign_flag : boolean; 00751000
begin 00752000
if [email protected] = true then (* we had this node already *)00753000
begin 00754000
vianode := [email protected]; 00755000
return; 00756000
end; 00757000
[email protected] := [email protected]; 00758000
resistence := [email protected]; 00759000
repeat (* search the link to the local node *)00760000
linknode := [email protected]@.ptolink; 00761000
linkign_1 := trim(str([email protected]))||'-'; 00762000
linkign_1 := linkign_1||trim(str([email protected])); 00763000
linkign_2 := trim(str([email protected]))||'-'; 00764000
linkign_2 := linkign_2||trim(str([email protected])); 00765000
if ((index([email protected],linkign_1) > 0) | 00766000
(index([email protected],linkign_2) > 0)) 00767000
then ign_flag := true 00768000
else ign_flag := false; 00769000
if ^ign_flag then begin 00770000
checkres := [email protected] + [email protected]@.speed; 00771000
if checkres < resistence then (* which link has the *)00772000
begin (* smallest resistence to *)00773000
resistence := checkres; (* the local node *)00774000
[email protected] := linknode; (* set pointer to this node*)00775000
end else 00776000
if checkres = resistence then (* two equal links ! *)00777000
begin (* decide by the sum of *)00778000
if [email protected] < [email protected]@.sumnum (* node numbers *)00779000
then [email protected] := linknode; (* reset the pointer *)00780000
end; 00781000
end; 00782000
[email protected] := [email protected]@.next; 00783000
until [email protected] = nil; 00784000
(* now we have the correct link to the next node *)00785000
if [email protected]@.distance = 10 then (* we are down at the link of the *)00786000
vianode := [email protected] (* local node *)00787000
else setvia([email protected],vianode); 00788000
[email protected] := vianode; (* set pointer to link of loc node*)00789000
[email protected] := true; 00790000
end; (* of procedure setvia *)00791000
%page 00792000
(* *)00793000
(* start of initvia *)00794000
(* *)00795000
begin 00796000
clearlevel; 00797000
[email protected] := 0; 00798000
[email protected] := 0; 00799000
[email protected] := [email protected]; 00800000
level := 10; (* set the pointer to the node with*)00801000
[email protected] := [email protected]; (* --> to link-list *)00802000
[email protected] := dummyvia; 00803000
[email protected] := dummyvia; 00804000
repeat 00805000
linknode := [email protected]@.ptolink; 00806000
resistence := [email protected]@.speed; 00807000
[email protected] := level; 00808000
[email protected] := resistence; 00809000
[email protected] := local_node; 00810000
[email protected] := dummyvia; 00811000
(* set levels of the other nodes *) 00813000
setlevel(level,linknode,linknode,[email protected]); 00814000
[email protected] := [email protected]@.next; 00815000
until [email protected] = nil; 00816000
viacheck; 00817000
(* now make sure that a routing generated at one node to another *) 00818000
(* is the same if the program is run at the other node *) 00819000
(* The decision in made for equal distances acording the smaller *) 00820000
(* sum of node numbers along the line *) 00821000
(* Set the via and vialink variables ! *) 00822000
node := [email protected]; 00823000
repeat (* for each node *) 00824000
if ([email protected] <= 10) or ([email protected] = true) then 00825000
begin 00826000
node := [email protected]; 00827000
continue; 00828000
end; 00829000
setvia(node,[email protected]); 00830000
[email protected] := true; 00831000
node := [email protected]; 00832000
until node = nil; 00833000
end; (* of initvia *) 00834000
%page 00835000
(**********************************************************************)00836000
(* *)00837000
(* This procedure generates the routing tables for RSCS *)00838000
(* *)00839000
(**********************************************************************)00840000
procedure rscsinit; 00841000
var runptr : npointer; 00842000
gmto : integer; 00843000
procedure printroute; (* proc to print a routing statement *)00844000
begin 00845000
writeln(netfile,' ROUTE ',[email protected]:8, 00846000
' ',[email protected]@.name:8, 00847000
' ',round([email protected]/10-1):2, 00848000
' ',[email protected]:-3, 00849000
' ',[email protected]); 00850000
end; 00851000
begin 00852000
(* print the heading *) 00853000
writeln(netfile,'***', 00854000
'******************************************************************'); 00855000
if [email protected] = 'RSCS' then 00856000
writeln(netfile,'* ',[email protected],'/',[email protected], 00857000
' ROUTING STATEMENTS FOR NODE ' 00858000
,[email protected]:-8,' *') 00859000
else 00860000
writeln(netfile,'* RSCS ROUTING STATEMENTS FOR NODE ' 00861000
,[email protected]:-8,' *'); 00862000
writeln(netfile,'*':-68,'*'); 00863000
writeln(netfile,'* Nodes file update level: EARN - ' 00864000
,vers_id:-8,' *'); 00865000
writeln(netfile,'* BITNET - ' 00866000
,links_id:-8,' *'); 00867000
writeln(netfile,'*':-68,'*'); 00868000
writeln(netfile,'* Generation date: ',date,' ',time, 00869000
' *'); 00870000
writeln(netfile,'*':-68,'*'); 00871000
writeln(netfile,'* ',info:-64,'*'); 00872000
writeln(netfile,'*':-68,'*'); 00873000
writeln(netfile,'***', 00874000
'******************************************************************'); 00875000
writeln(netfile,'* ', 00876000
' RSCS LOCAL NODE SPECIFICATION *'); 00877000
writeln(netfile,'***', 00878000
'******************************************************************'); 00879000
writeln(netfile,'* ', 00880000
' LOCAL GMT *'); 00881000
writeln(netfile,'* ', 00882000
' NODE-ID OFFSET *'); 00883000
writeln(netfile,'* ', 00884000
' -------- -------- *'); 00885000
gmto := [email protected]; 00886000
if gmto <= 0 then gmto := abs(gmto) else gmto := 25 - gmto; 00887000
writeln(netfile,'* ', 00888000
' LOCAL ',[email protected]:8,' ',gmto:2,' '); 00889000
writeln(netfile,'***', 00890000
'******************************************************************'); 00891000
%page 00892000
if [email protected] = 'RSCS' then 00893000
writeln(netfile,'* RSCS/',[email protected], 00894000
' LINK SPECIFICATIONS *') 00895000
else 00896000
writeln(netfile,'* RSCS', 00897000
' LINK SPECIFICATIONS *'); 00898000
writeln(netfile,'***', 00899000
'******************************************************************'); 00900000
if ([email protected] = 'V1') then begin 00901000
writeln(netfile,'* ', 00902000
' LINE VIRTUAL TIME TASK SPOOL KEEP *'); 00903000
writeln(netfile,'* ', 00904000
' LINK-ID DRIVER ADDRESS ZONE ID CLASS SLOTS *'); 00905000
writeln(netfile,'* ', 00906000
' -------- -------- ------- ---- ---- ----- ----- *'); 00907000
end else begin 00908000
writeln(netfile,'* ', 00909000
' LINE VIRT TIME SPOOL KEEP *'); 00910000
writeln(netfile,'* ', 00911000
' LINK-ID DRIVER ADDR ZONE CLASS SLOTS QUEUE DP *'); 00912000
writeln(netfile,'* ', 00913000
' -------- ------ ---- ---- ----- ----- ----- -- *'); 00914000
end; 00915000
(* first the links ! *)00916000
[email protected] := [email protected]; 00917000
repeat 00918000
runptr := [email protected]@.ptolink; 00919000
if (((([email protected] = 'RSCS') & ([email protected] ^= 'V2')) or 00920000
([email protected] = 'JNET')) or ([email protected] = 'UREP')) then 00921000
protocol := 'DMTVMB' 00922000
else 00923000
if (([email protected] = 'TIEL') or ([email protected] = 'INTE')) then 00924000
protocol := 'DMTSML' 00925000
else 00926000
protocol := 'DMTNJI'; 00927000
gmto := [email protected]; 00928000
if gmto <= 0 then gmto := abs(gmto) else gmto := 25 - gmto; 00929000
if ([email protected] = 'V1') then 00930000
writeln(netfile,'* LINK ',[email protected]:8,' ', 00931000
protocol:8,' xxx ',gmto:2,' XXXX * 2') 00932000
else 00933000
writeln(netfile,'* ', 00934000
'LINK ',[email protected]:8,' NJE xxx ',gmto:2, 00935000
' X * PRI *'); 00936000
[email protected] := [email protected]@.next; 00937000
until [email protected] = nil; 00938000
%page 00939000
(* now the routings: first the national nodes! *)00940000
writeln(netfile,'***', 00941000
'******************************************************************'); 00942000
writeln(netfile,'* ', 00943000
' RSCS ROUTE SPECIFICATIONS *'); 00944000
writeln(netfile,'***', 00945000
'******************************************************************'); 00946000
writeln(netfile,'* ', 00947000
' Interm. *'); 00948000
writeln(netfile,'* ', 00949000
' Node Vianode | Country *'); 00950000
writeln(netfile,'* ', 00951000
' | | nodes | Institute/Location *'); 00952000
writeln(netfile,'*--', 00953000
'----|--------|---------|-|---|-----------------------------------*'); 00954000
runptr := [email protected]; 00955000
repeat (* routing statements for the version entries *)00956000
if ((substr(str([email protected]),1,4) = 'VERS') | 00957000
(substr(str([email protected]),1,5) = 'LINKS')) then printroute; 00958000
runptr := [email protected]; 00959000
until runptr = nil; 00960000
runptr := [email protected]; 00961000
repeat (* routing statements for national nodes *)00962000
if ([email protected] = [email protected]) and 00963000
([email protected] > 10) then 00964000
if ((substr(str([email protected]),1,4) ^= 'VERS') & 00965000
(substr(str([email protected]),1,5) ^= 'LINKS')) then printroute; 00966000
runptr := [email protected]; 00967000
until runptr = nil; 00968000
runptr := [email protected]; 00969000
repeat (* routing statements for the international nodes *)00970000
if ([email protected] ^= [email protected]) and 00971000
([email protected] > 10) then 00972000
if ((substr(str([email protected]),1,4) ^= 'VERS') & 00973000
(substr(str([email protected]),1,5) ^= 'LINKS')) then printroute; 00974000
runptr := [email protected]; 00975000
until runptr = nil; 00976000
end; (********************** of rscsinit ****************************) 00977000
%page 00978000
(**********************************************************************)00979000
(* *)00980000
(* This procedure generates the routing tables for JES3 *)00981000
(* *)00982000
(**********************************************************************)00983000
procedure jes3init; 00984000
var runptr : npointer; 00985000
procedure printroute; (* proc to print a routing statement *)00986000
begin 00987000
ix := length(trim(str([email protected]))); 00988000
writeln(netfile,'* ',[email protected],' (', 00989000
round([email protected]/10-1):2,') = ', 00990000
[email protected]:-3,' ',[email protected]); 00991000
writeln(netfile,'NJERMT,NAME=',[email protected]:ix, 00992000
',MAXLINE=0,PATH=',[email protected]@.name:8); 00993000
end; 00994000
begin 00995000
(* print the heading *) 00996000
writeln(netfile,'***', 00997000
'******************************************************************'); 00998000
writeln(netfile,'* ',[email protected]:4, 00999000
' ROUTING STATEMENTS FOR NODE ' 01000000