home *** CD-ROM | disk | FTP | other *** search
/ Computer Buyer 1997 October / DPCB1097.iso / internet / CSI303UK / SCRIPTS.LIB / CONNECT.SCR < prev    next >
Text File  |  1997-01-30  |  10KB  |  437 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"
  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_Mexico = 31;    ! "InfoNet-Mex"
  35. InfoNet_SAfrica = 32;   ! "InfoNet-RSA"
  36. InfoNet_Taiwan = 30;    ! "InfoNet-Taiw"
  37. InfoNet_World = 6;      ! "InfoNet-Wrld"
  38. Internet = 25;          ! "Internet"
  39. ISRAKAV = 17;           ! "ISRAKAV"
  40. LATA = 7;               ! "LATA"
  41. CTLATA = 8;             ! "LATA-Ct"
  42. Mercury = 15;           ! "Mercury"
  43. PacNet = 21;            ! "PacNet"
  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. Direct = 40;        ! "Direct"
  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 = "Could not initialize port";
  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 = Direct) 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 = Direct goto Connect_CIS;
  122.     if %Network = Internet goto Connect_CIS;
  123.     if %Network = VNZNET goto Connect_CIS;
  124.     define %State = 4;
  125.     if %Network = Telenet goto Connect_Telenet;
  126.     if %Network = Tymnet goto Connect_Tymnet;
  127.     if %Network = DataPac goto Connect_DataPac;
  128.     if %Network = InfoNet_Europe goto Connect_InfoNet_Europe;
  129.     if %Network = InfoNet_Korea goto Connect_InfoNet_Korea;
  130.     if %Network = InfoNet_Taiwan goto Connect_InfoNet_Taiwan;
  131.     if %Network = InfoNet_Mexico goto Connect_InfoNet_Mexico;
  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 = "Network not supported";
  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. !  Connect to InfoNet Mexico
  210. !
  211. Connect_InfoNet_Mexico:
  212.     call %Dir & "infonet.scr" (4) : Result;
  213.     goto Handle_Network_Return;
  214.  
  215. !
  216. !  Connect to InfoNet South Africa
  217. !
  218. Connect_InfoNet_SAfrica:
  219.     call %Dir & "infonet.scr" (5) : Result;
  220.     goto Handle_Network_Return;
  221.  
  222. !
  223. !  Connect to LATA
  224. !
  225. Connect_LATA:
  226.     call %Dir & "lata.scr" (%TRUE) : Result;
  227.     goto Handle_Network_Return;
  228.  
  229. !
  230. !  Connect to Connecticut LATA
  231. !
  232. Connect_CTLATA:
  233.     call %Dir & "lata.scr" (%FALSE) : Result;
  234.     goto Handle_Network_Return;
  235.  
  236. !
  237. !  Connect to Telepac
  238. !
  239. Connect_Telepac:
  240.     call %Dir & "telepac.scr" () : Result;
  241.     goto Handle_Network_Return;
  242.  
  243. !
  244. !  Connect to Datex-P
  245. !
  246. Connect_Datex_P:
  247.     call %Dir & "datexp.scr" () : Result;
  248.     goto Handle_Network_Return;
  249.  
  250. !
  251. !  Connect to Datex-J
  252. !
  253. Connect_Datex_J:
  254.     call %Dir & "datexj.scr" () : Result;
  255.     goto Handle_Network_Return;
  256.  
  257. !
  258. !  Connect to Dialplus
  259. !
  260. Connect_Dialplus:
  261.     call %Dir & "dialplus.scr" () : Result;
  262.     goto Handle_Network_Return;
  263.  
  264. !
  265. !  Connect to FT-Connect
  266. !
  267. Connect_FTConnect:
  268.     call %Dir & "ftconn.scr" () : Result;
  269.     goto Handle_Network_Return;
  270.  
  271. !
  272. !  Connect to Mercury
  273. !
  274. Connect_Mercury:
  275.     call %Dir & "mercury.scr" () : Result;
  276.     goto Handle_Network_Return;
  277.  
  278. !
  279. !  Connect to CSIR-Net
  280. !
  281. Connect_CSIRnet:
  282.     call %Dir & "csirnet.scr" () : Result;
  283.     goto Handle_Network_Return;
  284.  
  285. !
  286. !  Connect to ISRAKAV
  287. !
  288. Connect_ISRAKAV:
  289.     call %Dir & "israkav.scr" () : Result;
  290.     goto Handle_Network_Return;
  291.  
  292. !
  293. !  Connect to Transpac
  294. !
  295. Connect_Transpac:
  296.     call %Dir & "transpac.scr" () : Result;
  297.     goto Handle_Network_Return;
  298.  
  299. !
  300. !  Connect to AlaskaNet
  301. !
  302. Connect_AlaskaNet:
  303.     call %Dir & "tymnet.scr" (2) : Result;
  304.     goto Handle_Network_Return;
  305.  
  306. !
  307. !  Connect to ArgNet
  308. !
  309. Connect_ArgNet:
  310.     call %Dir & "argnet.scr" () : Result;
  311.     goto Handle_Network_Return;
  312.  
  313. !
  314. !  Connect to PacNet
  315. !
  316. Connect_PacNet:
  317.     call %Dir & "tymnet.scr" (3) : Result;
  318.     goto Handle_Network_Return;
  319.  
  320.     
  321. !
  322. !  Connect to Pos-Serve
  323. !
  324. Connect_PosServe:
  325.     call %Dir & "posserve.scr" () : Result;
  326.     goto Handle_Network_Return;
  327.  
  328. !
  329. !  Connect to TTN-Net
  330. !
  331. Connect_TTNNet:
  332.     call %Dir & "ttnnet.scr" (3) : Result;
  333.     goto Handle_Network_Return;
  334.  
  335. !
  336. !  Connect to FENICS II
  337. !
  338. Connect_FENICSII:
  339.     call %Dir & "fenics2.scr" (3) : Result;
  340.     goto Handle_Network_Return;
  341.  
  342. !
  343. !  Connect to Chilepac
  344. !
  345. Connect_Chilepac:
  346.     call %Dir & "chilepac.scr" (3) : Result;
  347.     goto Handle_Network_Return;
  348.  
  349. !
  350. !  Connect to EIRPAC
  351. !
  352. Connect_EIRPAC:
  353.     call %Dir & "eirpac.scr" () : Result;
  354.     goto Handle_Network_Return;
  355.  
  356. !
  357. !  Connect to SCITOR
  358. !
  359. Connect_SCITOR:
  360.     call %Dir & "scitor.scr" () : Result;
  361.     goto Handle_Network_Return;
  362.  
  363. !
  364. !  Connect to SEVA
  365. !
  366. Connect_SEVA:
  367.     call %Dir & "seva.scr" () : Result;
  368.     goto Handle_Network_Return;
  369.  
  370.  
  371. !
  372. !  Handle Network Return
  373. !
  374. Handle_Network_Return:
  375.     if Result = %Success goto Do_CIS_Script;
  376.     if Result = %Cancel goto Cancel_Connect;
  377.     if Result = %Fatal goto Connect_Fatal;
  378.     goto Connect_Failure;
  379.  
  380. !
  381. !  Connect to CIS
  382. !
  383. Connect_CIS:
  384.     CISNetwork = %TRUE;
  385.     send %CR;
  386.  
  387. Do_CIS_Script:
  388.     call %Dir & "cserve.scr" (DirectConnect, CISNetwork) : Result;
  389.     if Result = %Failure goto Connect_Failure;
  390.     if Result = %Cancel goto Cancel_Connect;
  391.     if Result = %Fatal goto Connect_Fatal;
  392.     exit %Success;
  393.  
  394. Connect_Failure:
  395.     if %GatewayFailure = 0 goto ExitFailure;
  396.     define %GatewayFailure = 0;
  397.     if GatewayRetry = 3 goto ExitFailure;
  398.     GatewayRetry = GatewayRetry + 1;
  399.     wait until 50;
  400.     reset;
  401.     goto Initialize;
  402.  
  403. ExitFailure:
  404.  
  405.     gosub Hangup_Connect;
  406.     reset;
  407.     exit %Failure;
  408.  
  409. Connect_Fatal:
  410.     if %GatewayFailure = 0 goto Gateway_OK;
  411.     define %GatewayFailure = 0;
  412.     if GatewayRetry = 3 goto ExitFailure;
  413.     GatewayRetry = GatewayRetry + 1;
  414.     wait until 50;
  415.     reset;
  416.     goto Initialize;
  417.  
  418. Gateway_OK:
  419.  
  420.     gosub Hangup_Connect;
  421.     reset;
  422.     exit %Fatal;
  423.  
  424. Hangup_Connect:
  425.     if not UsingModem goto Hangup_Done;
  426.     define %LOCAL = 1;
  427.     call %Dir & "disconct.scr" ();
  428. Hangup_Done:
  429.     return;
  430.  
  431. Cancel_Connect:
  432.     show "Connect cancelled";
  433.     gosub Hangup_Connect;
  434.     reset;
  435.     define %ErrorCode = 1;
  436.     exit %Cancel;
  437.