home *** CD-ROM | disk | FTP | other *** search
/ PowerPlay 1998 July / PowerPlay0798.bin / Online / WINCIMIE / SCRIPTS.LIB / CONNECT.SCR < prev    next >
Text File  |  1997-05-08  |  10KB  |  431 lines

  1. !
  2. !  Copyright (c) 1997
  3. !  by CompuServe Incorporated, Columbus, Ohio
  4. !
  5. !  The information in this software is subject to change without
  6. !  notice and should not be construed as a commitment by CompuServe.
  7. !
  8. !  CONNECT:
  9. !       Handles CompuServe and Direct.
  10. !
  11. !  NOTE:  It is recommended that the numeric codes for networks NOT be
  12. !       modified since other utility programs may assume the relationships
  13. !       of network names and network ids specified below.
  14. !
  15. !+V
  16. ! "4.0.1"
  17. !-V
  18.  
  19. !+N
  20. CompuServe = 1;         ! "CompuServe"
  21. AlaskaNet = 36;         ! "AlaskaNet"
  22. ArgNet  = 37;           ! "ARG-Net"
  23. Chilepac= 28;           ! "Chilepac"
  24. CSIRnet = 16;           ! "CSIR-Net"
  25. DataPac = 4;            ! "DataPac"
  26. Datex_J = 19;           ! "Datex-J"
  27. Datex_P = 10;           ! "Datex-P"
  28. EIRPAC = 33;            ! "EIRPAC"
  29. FENICSII = 24;          ! "FENICS II/IV"
  30. FTConnect = 12;         ! "FT-Connect"
  31. Dialplus = 11;          ! "GNS Dialplus"
  32. InfoNet_Europe = 5;     ! "InfoNet-Euro"
  33. InfoNet_Korea = 29;     ! "InfoNet-Kor"
  34. InfoNet_SAfrica = 32;   ! "InfoNet-RSA"
  35. InfoNet_Taiwan = 30;    ! "InfoNet-Taiw"
  36. InfoNet_World = 6;      ! "InfoNet-Wrld"
  37. Internet = 25;          ! "Internet"
  38. ISRAKAV = 17;           ! "ISRAKAV"
  39. LATA = 7;               ! "LATA"
  40. CTLATA = 8;             ! "LATA-Ct"
  41. Mercury = 15;           ! "Mercury"
  42. PacNet = 21;            ! "PacNet"
  43. PlusNet = 38;           ! "PlusNet"
  44. PosServe = 27;          ! "HANJIN-NET"
  45. SCITOR = 34;            ! "SCITOR"
  46. SEVA = 35;              ! "SEVA"
  47. Telenet = 2;            ! "SprintNet"
  48. Telepac = 9;            ! "Telepac"
  49. Transpac = 18;          ! "Transpac"
  50. TTNNet = 22;            ! "TTN-Net"
  51. Tymnet = 3;             ! "Tymnet"
  52. VNZNET = 23;            ! "VNZ-Net"
  53. Direkt = 40;        ! "Direkt"
  54. !-N
  55.  
  56. define %CR = "^M";
  57. define %FALSE = 0;
  58. define %TRUE = 1;
  59. define %ErrorCode = 0;
  60. define %PPP = "";
  61. define %GatewayFailure = 0;
  62. GatewayRetry = 0;
  63. define %State = 1;
  64. ! %State defines the state of the connection:
  65. !       1 - Opening port
  66. !       2 - Initializing modem
  67. !       3 - Dialing phone
  68. !       4 - Connecting through alternate gateway
  69. !       5 - Connecting to CompuServe network (Host Name:)
  70. !       6 - Responding to User ID
  71. !       7 - Responding to Password/Secure login
  72. !       8 - Exited success
  73. !       9 - Reserved
  74. !       10 - Disconnecting Network
  75. !       11 - Hanging up modem
  76. !       12 - Exited success
  77.  
  78. hangup = 1;
  79. UsingModem = %FALSE;
  80. CISNetwork = %FALSE;
  81. ifndef %App = "";
  82. if (%App = "CID") and (%Network = Internet) goto Dialer;
  83.  
  84. Initialize:
  85. !
  86. ! Main Program
  87. !
  88. init %Port, %BaudRate;
  89. if %_init goto Continue_Connect;
  90.  
  91. define %FailureMsg = "Konnte Schnittstelle nicht initialisieren";
  92. define %ErrorCode = 2;
  93. if %Network <> Internet goto Connect_Fatal;
  94. define %ErrorCode = 3;
  95. goto Connect_Fatal;
  96.  
  97. Dialer:
  98. define %Network = CompuServe;
  99. goto Initialize;
  100.  
  101. Continue_Connect:
  102.     call %Dir & "first.scr" () : Result;
  103.     if Result = %Cancel goto Cancel_Connect;
  104.     if Result = %Failure goto Connect_Failure;
  105.     if Result = %Fatal goto Connect_Fatal;
  106.  
  107.     on cancel goto Cancel_Connect;
  108.     DirectConnect = (%Network = Direkt) or (%DialType = 2);
  109.  
  110.     if DirectConnect goto Connect_Network;
  111.  
  112.     call %Dir & "phone.scr" () : Result;
  113.  
  114.     if Result = %Cancel goto Cancel_Connect;
  115.     if Result = %Failure goto Connect_Failure;
  116.     if Result = %Fatal goto Connect_Fatal;
  117.     UsingModem = %TRUE;
  118.  
  119. Connect_Network:
  120.     if %Network = CompuServe goto Connect_CIS;
  121.     if %Network = Direkt goto Connect_CIS;
  122.     if %Network = Internet goto Connect_CIS;
  123.     if %Network = PlusNet goto Connect_CIS;
  124.     if %Network = VNZNET goto Connect_CIS;
  125.     define %State = 4;
  126.     if %Network = Telenet goto Connect_Telenet;
  127.     if %Network = Tymnet goto Connect_Tymnet;
  128.     if %Network = DataPac goto Connect_DataPac;
  129.     if %Network = InfoNet_Europe goto Connect_InfoNet_Europe;
  130.     if %Network = InfoNet_Korea goto Connect_InfoNet_Korea;
  131.     if %Network = InfoNet_Taiwan goto Connect_InfoNet_Taiwan;
  132.     if %Network = InfoNet_SAfrica goto Connect_InfoNet_SAfrica;
  133.     if %Network = InfoNet_World goto Connect_InfoNet_World;
  134.     if %Network = LATA goto Connect_LATA;
  135.     if %Network = CTLATA goto Connect_CTLATA;
  136.     if %Network = Telepac goto Connect_Telepac;
  137.     if %Network = Datex_P goto Connect_Datex_P;
  138.     if %Network = Datex_J goto Connect_Datex_J;
  139.     if %Network = Dialplus goto Connect_Dialplus;
  140.     if %Network = Mercury goto Connect_Mercury;
  141.     if %Network = CSIRnet goto Connect_CSIRnet;
  142.     if %Network = ISRAKAV goto Connect_ISRAKAV;
  143.     if %Network = Transpac goto Connect_Transpac;
  144.     if %Network = PacNet goto Connect_PacNet;
  145.     if %Network = PosServe goto Connect_PosServe;
  146.     if %Network = TTNNet goto Connect_TTNNet;
  147.     if %Network = FENICSII goto Connect_FENICSII;
  148.     if %Network = Chilepac goto Connect_Chilepac;
  149.     if %Network = EIRPAC goto Connect_EIRPAC;
  150.     if %Network = SCITOR goto Connect_SCITOR;
  151.     if %Network = SEVA goto Connect_SEVA;
  152.     if %Network = AlaskaNet goto Connect_AlaskaNet;
  153.     if %Network = ArgNet goto Connect_ArgNet;
  154.     if %Network = FTConnect goto Connect_FTConnect;
  155.  
  156.     define %FailureMsg = "Netzwerk nicht unterstⁿtzt";
  157.     goto Connect_Fatal;
  158.  
  159. !
  160. !  Connect to Telenet
  161. !
  162. Connect_Telenet:
  163.     call %Dir & "telenet.scr" () : Result;
  164.     goto Handle_Network_Return;
  165.  
  166. !
  167. !  Connect to Tymnet
  168. !
  169. Connect_Tymnet:
  170.     call %Dir & "tymnet.scr" (1) : Result;
  171.     goto Handle_Network_Return;
  172.  
  173. !
  174. !  Connect to DataPac
  175. !
  176. Connect_DataPac:
  177.     call %Dir & "datapac.scr" () : Result;
  178.     goto Handle_Network_Return;
  179.  
  180. !
  181. !  Connect to InfoNet World
  182. !
  183. Connect_InfoNet_World:
  184.     call %Dir & "infonet.scr" (0) : Result;
  185.     goto Handle_Network_Return;
  186.  
  187. !
  188. !  Connect to InfoNet Europe
  189. !
  190. Connect_InfoNet_Europe:
  191.     call %Dir & "infonet.scr" (1) : Result;
  192.     goto Handle_Network_Return;
  193.  
  194. !
  195. !  Connect to InfoNet Korea
  196. !
  197. Connect_InfoNet_Korea:
  198.     call %Dir & "infonet.scr" (2) : Result;
  199.     goto Handle_Network_Return;
  200.  
  201. !
  202. !  Connect to InfoNet Taiwan
  203. !
  204. Connect_InfoNet_Taiwan:
  205.     call %Dir & "infonet.scr" (3) : Result;
  206.     goto Handle_Network_Return;
  207.  
  208.  
  209. !
  210. !  Connect to InfoNet South Africa
  211. !
  212. Connect_InfoNet_SAfrica:
  213.     call %Dir & "infonet.scr" (5) : Result;
  214.     goto Handle_Network_Return;
  215.  
  216. !
  217. !  Connect to LATA
  218. !
  219. Connect_LATA:
  220.     call %Dir & "lata.scr" (%TRUE) : Result;
  221.     goto Handle_Network_Return;
  222.  
  223. !
  224. !  Connect to Connecticut LATA
  225. !
  226. Connect_CTLATA:
  227.     call %Dir & "lata.scr" (%FALSE) : Result;
  228.     goto Handle_Network_Return;
  229.  
  230. !
  231. !  Connect to Telepac
  232. !
  233. Connect_Telepac:
  234.     call %Dir & "telepac.scr" () : Result;
  235.     goto Handle_Network_Return;
  236.  
  237. !
  238. !  Connect to Datex-P
  239. !
  240. Connect_Datex_P:
  241.     call %Dir & "datexp.scr" () : Result;
  242.     goto Handle_Network_Return;
  243.  
  244. !
  245. !  Connect to Datex-J
  246. !
  247. Connect_Datex_J:
  248.     call %Dir & "datexj.scr" () : Result;
  249.     goto Handle_Network_Return;
  250.  
  251. !
  252. !  Connect to Dialplus
  253. !
  254. Connect_Dialplus:
  255.     call %Dir & "dialplus.scr" () : Result;
  256.     goto Handle_Network_Return;
  257.  
  258. !
  259. !  Connect to FT-Connect
  260. !
  261. Connect_FTConnect:
  262.     call %Dir & "ftconn.scr" () : Result;
  263.     goto Handle_Network_Return;
  264.  
  265. !
  266. !  Connect to Mercury
  267. !
  268. Connect_Mercury:
  269.     call %Dir & "mercury.scr" () : Result;
  270.     goto Handle_Network_Return;
  271.  
  272. !
  273. !  Connect to CSIR-Net
  274. !
  275. Connect_CSIRnet:
  276.     call %Dir & "csirnet.scr" () : Result;
  277.     goto Handle_Network_Return;
  278.  
  279. !
  280. !  Connect to ISRAKAV
  281. !
  282. Connect_ISRAKAV:
  283.     call %Dir & "israkav.scr" () : Result;
  284.     goto Handle_Network_Return;
  285.  
  286. !
  287. !  Connect to Transpac
  288. !
  289. Connect_Transpac:
  290.     call %Dir & "transpac.scr" () : Result;
  291.     goto Handle_Network_Return;
  292.  
  293. !
  294. !  Connect to AlaskaNet
  295. !
  296. Connect_AlaskaNet:
  297.     call %Dir & "tymnet.scr" (2) : Result;
  298.     goto Handle_Network_Return;
  299.  
  300. !
  301. !  Connect to ArgNet
  302. !
  303. Connect_ArgNet:
  304.     call %Dir & "argnet.scr" () : Result;
  305.     goto Handle_Network_Return;
  306.  
  307. !
  308. !  Connect to PacNet
  309. !
  310. Connect_PacNet:
  311.     call %Dir & "tymnet.scr" (3) : Result;
  312.     goto Handle_Network_Return;
  313.  
  314.     
  315. !
  316. !  Connect to Pos-Serve
  317. !
  318. Connect_PosServe:
  319.     call %Dir & "posserve.scr" () : Result;
  320.     goto Handle_Network_Return;
  321.  
  322. !
  323. !  Connect to TTN-Net
  324. !
  325. Connect_TTNNet:
  326.     call %Dir & "ttnnet.scr" (3) : Result;
  327.     goto Handle_Network_Return;
  328.  
  329. !
  330. !  Connect to FENICS II
  331. !
  332. Connect_FENICSII:
  333.     call %Dir & "fenics2.scr" (3) : Result;
  334.     goto Handle_Network_Return;
  335.  
  336. !
  337. !  Connect to Chilepac
  338. !
  339. Connect_Chilepac:
  340.     call %Dir & "chilepac.scr" (3) : Result;
  341.     goto Handle_Network_Return;
  342.  
  343. !
  344. !  Connect to EIRPAC
  345. !
  346. Connect_EIRPAC:
  347.     call %Dir & "eirpac.scr" () : Result;
  348.     goto Handle_Network_Return;
  349.  
  350. !
  351. !  Connect to SCITOR
  352. !
  353. Connect_SCITOR:
  354.     call %Dir & "scitor.scr" () : Result;
  355.     goto Handle_Network_Return;
  356.  
  357. !
  358. !  Connect to SEVA
  359. !
  360. Connect_SEVA:
  361.     call %Dir & "seva.scr" () : Result;
  362.     goto Handle_Network_Return;
  363.  
  364.  
  365. !
  366. !  Handle Network Return
  367. !
  368. Handle_Network_Return:
  369.     if Result = %Success goto Do_CIS_Script;
  370.     if Result = %Cancel goto Cancel_Connect;
  371.     if Result = %Fatal goto Connect_Fatal;
  372.     goto Connect_Failure;
  373.  
  374. !
  375. !  Connect to CIS
  376. !
  377. Connect_CIS:
  378.     CISNetwork = %TRUE;
  379.     send %CR;
  380.  
  381. Do_CIS_Script:
  382.     call %Dir & "cserve.scr" (DirectConnect, CISNetwork) : Result;
  383.     if Result = %Failure goto Connect_Failure;
  384.     if Result = %Cancel goto Cancel_Connect;
  385.     if Result = %Fatal goto Connect_Fatal;
  386.     exit %Success;
  387.  
  388. Connect_Failure:
  389.     if %GatewayFailure = 0 goto ExitFailure;
  390.     define %GatewayFailure = 0;
  391.     if GatewayRetry = 3 goto ExitFailure;
  392.     GatewayRetry = GatewayRetry + 1;
  393.     wait until 50;
  394.     reset;
  395.     goto Initialize;
  396.  
  397. ExitFailure:
  398.  
  399.     gosub Hangup_Connect;
  400.     reset;
  401.     exit %Failure;
  402.  
  403. Connect_Fatal:
  404.     if %GatewayFailure = 0 goto Gateway_OK;
  405.     define %GatewayFailure = 0;
  406.     if GatewayRetry = 3 goto ExitFailure;
  407.     GatewayRetry = GatewayRetry + 1;
  408.     wait until 50;
  409.     reset;
  410.     goto Initialize;
  411.  
  412. Gateway_OK:
  413.  
  414.     gosub Hangup_Connect;
  415.     reset;
  416.     exit %Fatal;
  417.  
  418. Hangup_Connect:
  419.     if not UsingModem goto Hangup_Done;
  420.     define %LOCAL = 1;
  421.     call %Dir & "disconct.scr" ();
  422. Hangup_Done:
  423.     return;
  424.  
  425. Cancel_Connect:
  426.     show "Verbindung abgebrochen";
  427.     gosub Hangup_Connect;
  428.     reset;
  429.     define %ErrorCode = 1;
  430.     exit %Cancel;
  431.