home *** CD-ROM | disk | FTP | other *** search
/ 3,500 Cliparts Vectoriels 2 / 3500_V2.iso / compu / csi302f / scripts.lib / connect.scr < prev    next >
Text File  |  1997-01-30  |  10KB  |  425 lines

  1. !
  2. !  Copyright (c) 1996
  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. ! "3.8.3F"
  17. !-V
  18.  
  19. !+N
  20. CompuServe = 1;     ! "CompuServe"
  21. AlaskaNet = 36;         ! "AlaskaNet"
  22. Chilepac= 28;       ! "Chilepac"
  23. CSIRnet = 16;       ! "CSIR-Net"
  24. DataPac = 4;        ! "DataPac"
  25. Datex_J = 19;       ! "Datex-J"
  26. Datex_P = 10;       ! "Datex-P"
  27. EIRPAC = 33;            ! "EIRPAC"
  28. FENICSII = 24;      ! "FENICS II/IV"
  29. FTConnect = 12;         ! "FT-Connect"
  30. Dialplus = 11;      ! "GNS Dialplus"
  31. InfoNet_Europe = 5; ! "InfoNet-Euro"
  32. InfoNet_Korea = 29; ! "InfoNet-Kor"
  33. InfoNet_Mexico = 31;    ! "InfoNet-Mex"
  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. PosServe = 27;      ! "Pos-Serve LL"
  44. SCITOR = 34;            ! "SCITOR"
  45. SEVA = 35;              ! "SEVA"
  46. Telenet = 2;        ! "SprintNet"
  47. Telepac = 9;        ! "Telepac"
  48. Transpac = 18;      ! "Transpac"
  49. TTNNet = 22;        ! "TTN-Net"
  50. Tymnet = 3;     ! "Tymnet"
  51. VNZNET = 23;        ! "VNZ-Net"
  52. Direct = 40;    ! "Direct"
  53. !-N
  54.  
  55. define %CR = "^M";
  56. define %FALSE = 0;
  57. define %TRUE = 1;
  58. define %ErrorCode = 0;
  59. define %PPP = "";
  60. define %GatewayFailure = 0;
  61. GatewayRetry = 0;
  62. define %State = 1;
  63. ! %State defines the state of the connection:
  64. !   1 - Opening port
  65. !   2 - Initializing modem
  66. !   3 - Dialing phone
  67. !   4 - Connecting through alternate gateway
  68. !   5 - Connecting to CompuServe network (Host Name:)
  69. !   6 - Responding to User ID
  70. !   7 - Responding to Password/Secure login
  71. !   8 - Exited success
  72. !   9 - Reserved
  73. !   10 - Disconnecting Network
  74. !   11 - Hanging up modem
  75. !   12 - Exited success
  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 = "Impossible d'initialiser le 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 = VNZNET goto Connect_CIS;
  122.     define %State = 4;
  123.     if %Network = Telenet goto Connect_Telenet;
  124.     if %Network = Tymnet goto Connect_Tymnet;
  125.     if %Network = DataPac goto Connect_DataPac;
  126.     if %Network = InfoNet_Europe goto Connect_InfoNet_Europe;
  127.     if %Network = InfoNet_Korea goto Connect_InfoNet_Korea;
  128.     if %Network = InfoNet_Taiwan goto Connect_InfoNet_Taiwan;
  129.     if %Network = InfoNet_Mexico goto Connect_InfoNet_Mexico;
  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 = Dialplus goto Connect_Dialplus;
  138.     if %Network = Mercury goto Connect_Mercury;
  139.     if %Network = CSIRnet goto Connect_CSIRnet;
  140.     if %Network = ISRAKAV goto Connect_ISRAKAV;
  141.     if %Network = Transpac goto Connect_Transpac;
  142.     if %Network = PacNet goto Connect_PacNet;
  143.     if %Network = PosServe goto Connect_PosServe;
  144.     if %Network = TTNNet goto Connect_TTNNet;
  145.     if %Network = FENICSII goto Connect_FENICSII;
  146.     if %Network = Chilepac goto Connect_Chilepac;
  147.         if %Network = EIRPAC goto Connect_EIRPAC;
  148.         if %Network = SCITOR goto Connect_SCITOR;
  149.         if %Network = SEVA goto Connect_SEVA;
  150.         if %Network = AlaskaNet goto Connect_AlaskaNet;
  151.         if %Network = FTConnect goto Connect_FTConnect;
  152.  
  153.     define %FailureMsg = "RΘseau non reconnu";
  154.     goto Connect_Fatal;
  155.  
  156. !
  157. !  Connect to Telenet
  158. !
  159. Connect_Telenet:
  160.     call %Dir & "telenet.scr" () : Result;
  161.     goto Handle_Network_Return;
  162.  
  163. !
  164. !  Connect to Tymnet
  165. !
  166. Connect_Tymnet:
  167.     call %Dir & "tymnet.scr" (1) : Result;
  168.     goto Handle_Network_Return;
  169.  
  170. !
  171. !  Connect to DataPac
  172. !
  173. Connect_DataPac:
  174.     call %Dir & "datapac.scr" () : Result;
  175.     goto Handle_Network_Return;
  176.  
  177. !
  178. !  Connect to InfoNet World
  179. !
  180. Connect_InfoNet_World:
  181.     call %Dir & "infonet.scr" (0) : Result;
  182.     goto Handle_Network_Return;
  183.  
  184. !
  185. !  Connect to InfoNet Europe
  186. !
  187. Connect_InfoNet_Europe:
  188.     call %Dir & "infonet.scr" (1) : Result;
  189.     goto Handle_Network_Return;
  190.  
  191. !
  192. !  Connect to InfoNet Korea
  193. !
  194. Connect_InfoNet_Korea:
  195.     call %Dir & "infonet.scr" (2) : Result;
  196.     goto Handle_Network_Return;
  197.  
  198. !
  199. !  Connect to InfoNet Taiwan
  200. !
  201. Connect_InfoNet_Taiwan:
  202.     call %Dir & "infonet.scr" (3) : Result;
  203.     goto Handle_Network_Return;
  204.  
  205. !
  206. !  Connect to InfoNet Mexico
  207. !
  208. Connect_InfoNet_Mexico:
  209.     call %Dir & "infonet.scr" (4) : Result;
  210.     goto Handle_Network_Return;
  211.  
  212. !
  213. !  Connect to InfoNet South Africa
  214. !
  215. Connect_InfoNet_SAfrica:
  216.     call %Dir & "infonet.scr" (5) : Result;
  217.     goto Handle_Network_Return;
  218.  
  219. !
  220. !  Connect to LATA
  221. !
  222. Connect_LATA:
  223.     call %Dir & "lata.scr" (%TRUE) : Result;
  224.     goto Handle_Network_Return;
  225.  
  226. !
  227. !  Connect to Connecticut LATA
  228. !
  229. Connect_CTLATA:
  230.     call %Dir & "lata.scr" (%FALSE) : Result;
  231.     goto Handle_Network_Return;
  232.  
  233. !
  234. !  Connect to Telepac
  235. !
  236. Connect_Telepac:
  237.     call %Dir & "telepac.scr" () : Result;
  238.     goto Handle_Network_Return;
  239.  
  240. !
  241. !  Connect to Datex-P
  242. !
  243. Connect_Datex_P:
  244.     call %Dir & "datexp.scr" () : Result;
  245.     goto Handle_Network_Return;
  246.  
  247. !
  248. !  Connect to Datex-J
  249. !
  250. Connect_Datex_J:
  251.     call %Dir & "datexj.scr" () : Result;
  252.     goto Handle_Network_Return;
  253.  
  254. !
  255. !  Connect to Dialplus
  256. !
  257. Connect_Dialplus:
  258.     call %Dir & "dialplus.scr" () : Result;
  259.     goto Handle_Network_Return;
  260.  
  261. !
  262. !  Connect to FT-Connect
  263. !
  264. Connect_FTConnect:
  265.         call %Dir & "ftconn.scr" () : Result;
  266.     goto Handle_Network_Return;
  267.  
  268. !
  269. !  Connect to Mercury
  270. !
  271. Connect_Mercury:
  272.     call %Dir & "mercury.scr" () : Result;
  273.     goto Handle_Network_Return;
  274.  
  275. !
  276. !  Connect to CSIR-Net
  277. !
  278. Connect_CSIRnet:
  279.     call %Dir & "csirnet.scr" () : Result;
  280.     goto Handle_Network_Return;
  281.  
  282. !
  283. !  Connect to ISRAKAV
  284. !
  285. Connect_ISRAKAV:
  286.     call %Dir & "israkav.scr" () : Result;
  287.     goto Handle_Network_Return;
  288.  
  289. !
  290. !  Connect to Transpac
  291. !
  292. Connect_Transpac:
  293.     call %Dir & "transpac.scr" () : Result;
  294.     goto Handle_Network_Return;
  295.  
  296. !
  297. !  Connect to AlaskaNet
  298. !
  299. Connect_AlaskaNet:
  300.     call %Dir & "tymnet.scr" (2) : Result;
  301.     goto Handle_Network_Return;
  302.  
  303. !
  304. !  Connect to PacNet
  305. !
  306. Connect_PacNet:
  307.     call %Dir & "tymnet.scr" (3) : Result;
  308.     goto Handle_Network_Return;
  309.  
  310.     
  311. !
  312. !  Connect to Pos-Serve
  313. !
  314. Connect_PosServe:
  315.     call %Dir & "posserve.scr" () : Result;
  316.     goto Handle_Network_Return;
  317.  
  318. !
  319. !  Connect to TTN-Net
  320. !
  321. Connect_TTNNet:
  322.     call %Dir & "ttnnet.scr" (3) : Result;
  323.     goto Handle_Network_Return;
  324.  
  325. !
  326. !  Connect to FENICS II
  327. !
  328. Connect_FENICSII:
  329.     call %Dir & "fenics2.scr" (3) : Result;
  330.     goto Handle_Network_Return;
  331.  
  332. !
  333. !  Connect to Chilepac
  334. !
  335. Connect_Chilepac:
  336.     call %Dir & "chilepac.scr" (3) : Result;
  337.     goto Handle_Network_Return;
  338.  
  339. !
  340. !  Connect to EIRPAC
  341. !
  342. Connect_EIRPAC:
  343.         call %Dir & "eirpac.scr" () : Result;
  344.     goto Handle_Network_Return;
  345.  
  346. !
  347. !  Connect to SCITOR
  348. !
  349. Connect_SCITOR:
  350.         call %Dir & "scitor.scr" () : Result;
  351.     goto Handle_Network_Return;
  352.  
  353. !
  354. !  Connect to SEVA
  355. !
  356. Connect_SEVA:
  357.         call %Dir & "seva.scr" () : Result;
  358.     goto Handle_Network_Return;
  359.  
  360.  
  361. !
  362. !  Handle Network Return
  363. !
  364. Handle_Network_Return:
  365.     if Result = %Success goto Do_CIS_Script;
  366.     if Result = %Cancel goto Cancel_Connect;
  367.     if Result = %Fatal goto Connect_Fatal;
  368.     goto Connect_Failure;
  369.  
  370. !
  371. !  Connect to CIS
  372. !
  373. Connect_CIS:
  374.     CISNetwork = %TRUE;
  375.     send %CR;
  376.  
  377. Do_CIS_Script:
  378.     call %Dir & "cserve.scr" (DirectConnect, CISNetwork) : Result;
  379.     if Result = %Failure goto Connect_Failure;
  380.     if Result = %Cancel goto Cancel_Connect;
  381.     if Result = %Fatal goto Connect_Fatal;
  382.     exit %Success;
  383.  
  384. Connect_Failure:
  385.     if %GatewayFailure = 0 goto ExitFailure;
  386.     define %GatewayFailure = 0;
  387.     if GatewayRetry = 3 goto ExitFailure;
  388.     GatewayRetry = GatewayRetry + 1;
  389.     wait until 50;
  390.     reset;
  391.     goto Initialize;
  392.  
  393. ExitFailure:
  394.     gosub Hangup_Connect;
  395.     reset;
  396.     exit %Failure;
  397.  
  398. Connect_Fatal:
  399.     if %GatewayFailure = 0 goto Gateway_OK;
  400.     define %GatewayFailure = 0;
  401.     if GatewayRetry = 3 goto ExitFailure;
  402.     GatewayRetry = GatewayRetry + 1;
  403.     wait until 50;
  404.     reset;
  405.     goto Initialize;
  406.     
  407. Gateway_OK:
  408.     gosub Hangup_Connect;
  409.     reset;
  410.     exit %Fatal;
  411.  
  412. Hangup_Connect:
  413.     if not UsingModem goto Hangup_Done;
  414.     define %LOCAL = 1;
  415.     call %Dir & "disconct.scr" ();
  416. Hangup_Done:
  417.     return;
  418.  
  419. Cancel_Connect:
  420.     show "Connexion annulΘe";
  421.     gosub Hangup_Connect;
  422.     reset;
  423.     define %ErrorCode = 1;
  424.     exit %Cancel;
  425.