home *** CD-ROM | disk | FTP | other *** search
/ Online Praxis 1998 March / Image.iso / CD-ROM / ZUGANG / CIS / CS304_D / SCRIPTS.LIB / cserve.scr < prev    next >
Encoding:
Text File  |  1997-08-12  |  10.2 KB  |  473 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. !  CSERVE:
  9. !       Connect to CIS.
  10. !       First argument is %TRUE if direct connect and %FALSE otherwise
  11. !       Success:  returns %Success
  12. !       Failure:  saves error msg in %FailureMsg and returns %Failure
  13. !               or %Fatal (depending on severity).
  14. !
  15. !  modified by Axel Pipahl, CompuServe Munich for DatexJ Access
  16. !
  17. !+V
  18. ! "4.0.2D-Memphis"
  19. !-V
  20.  
  21. DirectConnect = Arg1;
  22. Internet = 25;
  23. ifndef %HostName = "CPS";
  24. Plus = "+";
  25. ifndef %WaitForPPP = "1";
  26. Wait_Time = 100;
  27. ifndef %Scanned = "";
  28. Msg = "Verbindungsaufbau mit dem CompuServe-Netzwerk";
  29. if %Network <> Internet goto NotInternet;
  30. Msg = "Anmelden bei CompuServe .    ";
  31. define %HostName = "CISAGREE";
  32. Wait_Time = 40;
  33. goto Login_CIS;
  34.  
  35. NotInternet:
  36.     wait
  37.  
  38.         "00000"         goto Login_DatexJ,
  39.         "Host Name:"    goto Send_Extra_CR
  40.         
  41.     until 100;
  42.  
  43. Send_Extra_CR:
  44.    send %CR;
  45.  
  46. Login_CIS:
  47. show Msg;
  48. Tries = 7;
  49. NothingSent = 0;
  50. SecureTries = 3;
  51. FirstTry = %TRUE;
  52. FailStr = "";
  53. Sent_Host_Name = %FALSE;
  54. ifndef %X121Address = "";
  55. ifndef %OKCmd = "";
  56. ifndef %StopAtHost = "";
  57. ifndef %AccountID = "";
  58. ifndef %BreakChar = "#";
  59. ifndef %MicroChallenge = "";
  60. ifndef %App = "";
  61. on cancel goto Return_Cancel;
  62.  
  63. Start_Connect:
  64.     if Tries = 0 goto CIS_Error;
  65.     Tries = Tries - 1;
  66.  
  67. Connect_Wait:
  68.     wait
  69.         "UIC:"          goto Send_ETX,
  70.         "Host Name:"    goto Send_Host_Name,
  71.         "User ID:"      goto Send_ID,
  72.         "Password:"     goto Send_Password,
  73.         "XPAD:"         goto Send_XPAD,
  74.         "ITI:"          goto Send_XPAD,
  75.         "? LOG"         goto Process_Log_Msg,
  76.         "??LOG"         goto Process_Log_Msg,
  77.         "% IPN"         goto Process_IPX_Msg,
  78.         "? IPX"         goto Process_IPX_Msg,
  79.         "? ICD"         goto Process_Net_Msg,
  80.         "??ICD"         goto Process_Net_Msg,
  81.         "RA:"           goto Handle_Secure_Login,
  82.         "0, OFF):"      goto Send_Baud_Rate,
  83.         %mdm_Failure    goto CIS_No_Carrier
  84.     until Wait_Time;
  85.  
  86.     if %Network <> Internet goto Send_Break;
  87.     Wait_Time = 200;
  88.     if not Sent_Host_Name goto Send_CR;
  89.     if NothingSent goto Send_CR;
  90.     NothingSent = 1;
  91.     goto Start_Connect;
  92.  
  93. Send_Break:
  94.     if not DirectConnect goto Send_CR;
  95.     sendm %BreakChar;
  96.     sendm %BreakChar;
  97.     sendm %BreakChar;
  98.  
  99. Send_CR:
  100.     NothingSent = 0;
  101.     send %CR;
  102.     goto Start_Connect;
  103.  
  104. Send_Baud_Rate:
  105.     send %BaudRate;
  106.     send "^M";
  107.     goto Connect_Wait;
  108.  
  109. Send_ETX:
  110.     send "^C";
  111.     goto Connect_Wait;
  112.  
  113. PPPRecover:
  114.     Sent_Host_Name = %FALSE;
  115.  
  116. Send_Host_Name:
  117.     define %State = 5;
  118.     if Arg2 goto No_Wait;
  119.     wait until 10;
  120. No_Wait:
  121.     if Sent_Host_Name goto Reset_Host_Name;
  122.     Sent_Host_Name = %TRUE;
  123.  
  124.     Wait_Time = 200;
  125.     if %StopAtHost = "1" goto Return_Success;
  126.     send %HostName & "^M";
  127.     if %StopAtHost = "" goto Connect_Wait;
  128.     goto Return_Success;
  129.  
  130. !
  131. ! Only send Host Name response on 1st, 3rd, & 5th attempts
  132. ! to guard against unintended double host name prompts resulting
  133. ! from sending "^M".  On even attempts, eat the Host Name: prompt.
  134. !
  135. Reset_Host_Name:
  136.     Sent_Host_Name = %FALSE;
  137.     Tries = Tries - 1;
  138.     goto Connect_Wait;
  139.  
  140. Send_ID:
  141.     define %State = 6;
  142.     if %StopAtHost = "1" goto GetHost;
  143.     define %ErrorCode = 0;
  144.     if %App = "CID" goto No_Msg1;
  145.     show "Anmelden bei CompuServe . .  ";
  146. No_Msg1:
  147.     if %MicroChallenge = "" goto No_Secure_Login;
  148.  
  149.     send Plus & %UserID & %LogonParams & "/INT:60 /secure:1^M";
  150.     Plus = "";
  151.     goto Connect_Wait;
  152.  
  153. No_Secure_Login:
  154.     send %UserID & %LogonParams & "/INT:60^M";
  155.     goto Connect_Wait;
  156.  
  157. GetHost:
  158.     send "/HOST^M";
  159.     exit %Success;
  160.  
  161. Send_Password:
  162.     define %State = 7;
  163.     if %MicroChallenge <> "" goto Secure_Failure;
  164.     send %Password & %CR;
  165.     goto Logon_Wait;
  166.  
  167. Secure_Failure:
  168.     define %FailureMsg = "Konnte keine sichere Verbindung aufbauen, Verbindung abgebrochen";
  169.     define %ErrorCode = 37;
  170.     exit %Fatal;
  171.     
  172. Send_XPAD:
  173.     if %X121Address = "" goto Missing_XPAD;
  174.     send %X121Address & %CR;
  175.     goto Connect_Wait;
  176.  
  177. Missing_XPAD:
  178.     define %FailureMsg = "X.121 Adresse fehlt";
  179.     define %ErrorCode = 21;
  180.     exit %Fatal;
  181.     
  182. Logon_Wait:
  183.     wait
  184.         "Account ID:"   goto Send_AccountID,
  185.         "CompuServe"    goto Return_Success,
  186.         "^[[>"          goto Return_Success,
  187.         "^F"            goto Return_Success,
  188.         "? LOG"         goto Process_Log_Msg,
  189.         "??LOG"         goto Process_Log_Msg,
  190.         "? IPX"         goto Process_IPX_Msg,
  191.         " NTW"          goto Logon_Failure,
  192.         "? ICD"         goto Process_Net_Msg,
  193.         "??ICD"         goto Process_Net_Msg,
  194.         "800 Direct Dial access " goto Process_800,
  195.         "OK^M"          goto Send_OK_Cmd,
  196.         "^[I"           goto Send_Response,
  197.         "PPP:"          goto Connect_PPP,
  198.         %mdm_Failure    goto CIS_No_Carrier
  199.     until 300;
  200.  
  201.     define %ErrorCode = 22;
  202.     goto CIS_Failure;
  203.  
  204. Connect_PPP:
  205.     if %App <> "CID" goto Logon_Wait;
  206.     if %WaitForPPP = "0" goto PPPDone;
  207.     PPPTries = 2;
  208.  
  209. RetryPPP:
  210.     if PPPTries = 0 goto Send_ETX;
  211.  
  212.     wait
  213.         "Host Name:"    goto PPPRecover,
  214.         "~"             goto PPPDone,
  215.         %mdm_Failure    goto CIS_No_Carrier
  216.     until 300;
  217.  
  218.     send "^C";
  219.     PPPTries = PPPTries - 1;
  220.     goto RetryPPP;
  221.  
  222. PPPDone:
  223.     define %PPP = "1";
  224.     exit %Success;
  225.         
  226.  
  227. Process_Log_Msg:
  228.     wait
  229.         "INE"   goto Bad_ID,
  230.         "ISX"   goto Bad_ID_Syntax,
  231.         "CAI"   goto Cannot_Auto_Irun,
  232.         "SIL"   goto System_Unavailable,
  233.         "SIU"   goto System_Unavailable,
  234.         "SNA"   goto System_Unavailable,
  235.         "STU"   goto Check_User_ID,
  236.         "INS"   goto Bad_ID_Syntax,
  237.         "UTL"   goto Too_Many_Users
  238.     until 50;
  239.  
  240.     FailStr = "Konnte Verbindung mit dem Host nicht aufbauen";
  241.     goto Scan_Error;
  242.  
  243. Process_IPX_Msg:
  244.     define %ErrorCode = 23;
  245.     FailStr = "InfoPlex nicht verfⁿgbar, spΣter versuchen";
  246.     goto Scan_Error;
  247.  
  248. Process_Net_Msg:
  249.     define %GatewayFailure = 1;
  250.     define %ErrorCode = 31;
  251.     FailStr = "PPP-Verbindungsfehler, bitte erneut versuchen";
  252.  
  253. Scan_Error:
  254.     wait
  255.         "^M"    goto Found_Error
  256.     until 15;
  257.  
  258.     goto Return_Fatal_Msg;
  259.  
  260. Found_Error:
  261.     if %Scanned = "" goto Return_Fatal_Msg;
  262.     FailStr = %Scanned;
  263.     goto Return_Fatal_Msg;
  264.  
  265. Send_AccountID:
  266.     send %AccountID & %CR;
  267.     goto Logon_Wait;
  268.  
  269. Too_Many_Users:
  270.     if Tries = 0 goto Users_Failure;
  271.     show "Zuviele User gleichzeitig, neuer Versuch";
  272.     goto Start_Connect;
  273.  
  274. Users_Failure:
  275.     define %FailureMsg = "Zuviele User gleichzeitig";
  276.     define %ErrorCode = 29;
  277.     exit %Fatal;
  278.  
  279. Cannot_Auto_Irun:
  280.     define %FailureMsg = "Konnte 'Auto Irun HMI server' nicht starten";
  281.     exit %Fatal;
  282.  
  283. Bad_ID:
  284.     define %ErrorCode = 24;
  285.     FailStr = "User-ID oder Passwort ungⁿltig";
  286.     goto Try_Again;
  287.  
  288. Bad_ID_Syntax:
  289.     define %ErrorCode = 25;
  290.     FailStr = "User-ID Syntax ungⁿltig";
  291.  
  292. Try_Again:
  293.     if not FirstTry goto CIS_Fatal;
  294.     send "^C";
  295.     FirstTry = %FALSE;
  296.  
  297.     wait
  298.         "User ID"       goto Send_ID,
  299.         %mdm_Failure    goto CIS_No_Carrier
  300.     until 140;
  301.  
  302.     goto CIS_Fatal;
  303.  
  304.  
  305. System_Unavailable:
  306.     define %ErrorCode = 23;
  307.     FailStr = "Host nicht verfⁿgbar, spΣter versuchen";
  308.     goto Scan_Error;
  309.  
  310. Check_User_ID:
  311.     define %ErrorCode = 26;
  312.     define %FailureMsg = "System nicht verfugbar, bitte User-ID uberprufen";
  313.     exit %Fatal;
  314.  
  315. Process_800:
  316.     wait
  317.         "is not" goto No_800,
  318.         "rates" goto Access_Rates
  319.     until 25;
  320.     goto Logon_Wait;
  321.  
  322.  
  323. No_800:
  324.     define %FailureMsg = "Fⁿr dieses Konto ist das WΣhlen einer 800-Nummer nicht erlaubt";
  325.     define %ErrorCode = 4;
  326.     exit %Fatal;
  327.  
  328. Access_Rates:
  329.     show "Zugangsgebⁿhren fⁿr Direktwahl einer 800-Nummer aktiviert";
  330.     goto Logon_Wait;
  331.  
  332.  
  333. Logon_Failure:
  334.     define %ErrorCode = 27;
  335.     FailStr = "Host ist vorⁿbergehend nicht verfⁿgbar";
  336.     goto Scan_Error;
  337.  
  338. Send_OK_Cmd:
  339.     if %OKCmd = "" goto Logon_Wait;
  340.     send %OKCmd & %CR;
  341.     goto Logon_Wait;
  342.  
  343. Send_Response:
  344.     define %State = 8;
  345.     sendi %ESCIResponse;
  346.     exit %Success;
  347.  
  348. CIS_Error:
  349.     define %ErrorCode = 20;
  350. CIS_Failure:
  351.     if %Network <> Internet goto No_Retry;
  352.     if %ErrorCode = 34 goto No_Retry;
  353.     define %GatewayFailure = 1;
  354.  
  355. No_Retry:
  356.     if FailStr <> "" goto Return_Fail_Msg;
  357.     define %FailureMsg = "Konnte Verbindung mit dem Host nicht aufbauen";
  358.     exit %Failure;
  359.  
  360. CIS_No_Carrier:
  361.     define %ErrorCode = 28;
  362.     if FailStr <> "" goto Return_Fail_Msg;
  363.     define %FailureMsg = "Modemverbindung wurde abgebrochen";
  364.     exit %Failure;
  365.  
  366. CIS_Fatal:
  367.     if FailStr <> "" goto Return_Fatal_Msg;
  368.     define %FailureMsg = "Konnte Verbindung mit dem Host nicht aufbauen";
  369.     exit %Fatal;
  370.  
  371. Return_Fail_Msg:
  372.     define %FailureMsg = FailStr;
  373.     exit %Failure;
  374.  
  375. Return_Fatal_Msg:
  376.     define %FailureMsg = FailStr;
  377.     exit %Fatal;
  378.  
  379. Return_Success:
  380.     define %State = 8;
  381.     exit %Success;
  382.  
  383. Return_Cancel:
  384.     exit %Cancel;
  385.  
  386.  
  387. Handle_Secure_Login:
  388.     if %MicroChallenge = "" goto Connect_Wait;
  389.  
  390.     call %Dir & "seclog.scr" () : FailCode;
  391.  
  392.     if FailCode = 0 goto Logon_Wait;
  393.     if FailCode = 1 goto Return_Cancel;
  394.     if FailCode = 3 goto CIS_No_Carrier;
  395.  
  396.     ! Failure condition.
  397.     FailStr = %SecFailTemp;
  398.     SecureTries = SecureTries - 1;
  399.     if SecureTries = 0 goto CIS_Failure;
  400.  
  401.     show %SecFailTemp & ", neuer Versuch...";
  402.     goto Start_Connect;
  403.  
  404.  
  405. Login_DatexJ:
  406.    count = 6;
  407.    Second_Time = %FALSE;
  408.    on cancel goto Return_Cancel;
  409.    show "Verbindungsaufbau mit Datex-J";
  410.  
  411.  
  412. Send_Kennung:
  413.     wait until 10;
  414.     send "000327278259";
  415.     show "Datex-J Teilnehmernummer wird ⁿbertragen";
  416.  
  417.  
  418. Wait_DatexJ_Connect:
  419.     if count = 0 goto DatexJ_Failure;
  420.     count = count - 1;
  421.     wait    
  422.         "sicht"         goto DatexJ_Send_CR,
  423.         "aufbau mit"    goto DatexJ_Send_CR,
  424.         "gabeseite"     goto DatexJ_Send_11,
  425.         "Host Name:"    goto Match_Host_Name,
  426.         "User ID:"      goto Match_Host_Name,
  427.         %mdm_Failure    goto CIS_No_Carrier
  428.  
  429.     until 300;
  430.     
  431.     if Second_Time = %TRUE goto Send_11;
  432.     Second_Time = %TRUE;
  433.     goto Send_CR;
  434.  
  435.  
  436. DatexJ_Send_CR:
  437.     wait
  438.         %mdm_Failure    goto DatexJ_Failure,
  439.         "User ID:"      goto Match_Host_Name,
  440.         "Host Name:"    goto Match_Host_Name
  441.     until 10;
  442.     
  443.     send %CR;
  444.  
  445.     goto Wait_DatexJ_Connect;
  446.  
  447.  
  448. DatexJ_Send_11:
  449.     wait
  450.         %mdm_Failure    goto DatexJ_Failure,
  451.         "User ID:"      goto Match_Host_Name,
  452.         "Host Name:"    goto Match_Host_Name
  453.     until 10;
  454.     
  455.     Second_Time = %FALSE;
  456.     send "11";
  457.  
  458.     goto Wait_DatexJ_Connect;
  459.  
  460.  
  461. DatexJ_Failure:
  462.     define %FailureMsg = "Datex-J antwortet nicht";
  463.     exit %Failure;
  464.  
  465. Match_Host_Name:
  466.     wait
  467.         "Host Name:"    goto Match_Host_Name
  468.     until 10;
  469.  
  470. Return_Success:
  471.     send %CR;
  472.     goto Login_CIS;
  473.