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