home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Buyer 1997 February
/
DPCB0297.iso
/
internet
/
CSI301
/
SCRIPTS.LIB
/
CONNECT.SCR
< prev
next >
Wrap
Text File
|
1996-09-23
|
10KB
|
434 lines
!
! Copyright (c) 1996
! by CompuServe Incorporated, Columbus, Ohio
!
! The information in this software is subject to change without
! notice and should not be construed as a commitment by CompuServe.
!
! CONNECT:
! Handles CompuServe and Direct.
!
! NOTE: It is recommended that the numeric codes for networks NOT be
! modified since other utility programs may assume the relationships
! of network names and network ids specified below.
!
!+V
! "3.9.1"
!-V
!+N
CompuServe = 1; ! "CompuServe"
AlaskaNet = 36; ! "AlaskaNet"
ArgNet = 37; ! "ARG-Net"
Chilepac= 28; ! "Chilepac"
CSIRnet = 16; ! "CSIR-Net"
DataPac = 4; ! "DataPac"
Datex_J = 19; ! "Datex-J"
Datex_P = 10; ! "Datex-P"
EIRPAC = 33; ! "EIRPAC"
FENICSII = 24; ! "FENICS II/IV"
FTConnect = 12; ! "FT-Connect"
Dialplus = 11; ! "GNS Dialplus"
PosServe = 27; ! "HANJIN-NET"
InfoNet_Europe = 5; ! "InfoNet-Euro"
InfoNet_Korea = 29; ! "InfoNet-Kor"
InfoNet_Mexico = 31; ! "InfoNet-Mex"
InfoNet_SAfrica = 32; ! "InfoNet-RSA"
InfoNet_Taiwan = 30; ! "InfoNet-Taiw"
InfoNet_World = 6; ! "InfoNet-Wrld"
Internet = 25; ! "Internet"
ISRAKAV = 17; ! "ISRAKAV"
LATA = 7; ! "LATA"
CTLATA = 8; ! "LATA-Ct"
Mercury = 15; ! "Mercury"
PacNet = 21; ! "PacNet"
SCITOR = 34; ! "SCITOR"
SEVA = 35; ! "SEVA"
Telenet = 2; ! "SprintNet"
Telepac = 9; ! "Telepac"
Transpac = 18; ! "Transpac"
TTNNet = 22; ! "TTN-Net"
Tymnet = 3; ! "Tymnet"
VNZNET = 23; ! "VNZ-Net"
Direct = 40; ! "Direct"
!-N
define %CR = "^M";
define %FALSE = 0;
define %TRUE = 1;
define %ErrorCode = 0;
define %PPP = "";
define %GatewayFailure = 0;
GatewayRetry = 0;
define %State = 1;
! %State defines the state of the connection:
! 1 - Opening port
! 2 - Initializing modem
! 3 - Dialing phone
! 4 - Connecting through alternate gateway
! 5 - Connecting to CompuServe network (Host Name:)
! 6 - Responding to User ID
! 7 - Responding to Password/Secure login
! 8 - Exited success
! 9 - Reserved
! 10 - Disconnecting Network
! 11 - Hanging up modem
! 12 - Exited success
hangup = 1;
UsingModem = %FALSE;
CISNetwork = %FALSE;
ifndef %App = "";
if (%App = "CID") and (%Network = Internet) goto Dialer;
Initialize:
!
! Main Program
!
init %Port, %BaudRate;
if %_init goto Continue_Connect;
define %FailureMsg = "Could not initialize port";
define %ErrorCode = 2;
if %Network <> Internet goto Connect_Fatal;
define %ErrorCode = 3;
goto Connect_Fatal;
Dialer:
define %Network = CompuServe;
goto Initialize;
Continue_Connect:
call %Dir & "first.scr" () : Result;
if Result = %Cancel goto Cancel_Connect;
if Result = %Failure goto Connect_Failure;
if Result = %Fatal goto Connect_Fatal;
on cancel goto Cancel_Connect;
DirectConnect = (%Network = Direct) or (%DialType = 2);
if DirectConnect goto Connect_Network;
call %Dir & "phone.scr" () : Result;
if Result = %Cancel goto Cancel_Connect;
if Result = %Failure goto Connect_Failure;
if Result = %Fatal goto Connect_Fatal;
UsingModem = %TRUE;
Connect_Network:
if %Network = CompuServe goto Connect_CIS;
if %Network = Direct goto Connect_CIS;
if %Network = Internet goto Connect_CIS;
if %Network = VNZNET goto Connect_CIS;
define %State = 4;
if %Network = Telenet goto Connect_Telenet;
if %Network = Tymnet goto Connect_Tymnet;
if %Network = DataPac goto Connect_DataPac;
if %Network = InfoNet_Europe goto Connect_InfoNet_Europe;
if %Network = InfoNet_Korea goto Connect_InfoNet_Korea;
if %Network = InfoNet_Taiwan goto Connect_InfoNet_Taiwan;
if %Network = InfoNet_Mexico goto Connect_InfoNet_Mexico;
if %Network = InfoNet_SAfrica goto Connect_InfoNet_SAfrica;
if %Network = InfoNet_World goto Connect_InfoNet_World;
if %Network = LATA goto Connect_LATA;
if %Network = CTLATA goto Connect_CTLATA;
if %Network = Telepac goto Connect_Telepac;
if %Network = Datex_P goto Connect_Datex_P;
if %Network = Datex_J goto Connect_Datex_J;
if %Network = Dialplus goto Connect_Dialplus;
if %Network = Mercury goto Connect_Mercury;
if %Network = CSIRnet goto Connect_CSIRnet;
if %Network = ISRAKAV goto Connect_ISRAKAV;
if %Network = Transpac goto Connect_Transpac;
if %Network = PacNet goto Connect_PacNet;
if %Network = PosServe goto Connect_PosServe;
if %Network = TTNNet goto Connect_TTNNet;
if %Network = FENICSII goto Connect_FENICSII;
if %Network = Chilepac goto Connect_Chilepac;
if %Network = EIRPAC goto Connect_EIRPAC;
if %Network = SCITOR goto Connect_SCITOR;
if %Network = SEVA goto Connect_SEVA;
if %Network = AlaskaNet goto Connect_AlaskaNet;
if %Network = ArgNet goto Connect_ArgNet;
if %Network = FTConnect goto Connect_FTConnect;
define %FailureMsg = "Network not supported";
goto Connect_Fatal;
!
! Connect to Telenet
!
Connect_Telenet:
call %Dir & "telenet.scr" () : Result;
goto Handle_Network_Return;
!
! Connect to Tymnet
!
Connect_Tymnet:
call %Dir & "tymnet.scr" (1) : Result;
goto Handle_Network_Return;
!
! Connect to DataPac
!
Connect_DataPac:
call %Dir & "datapac.scr" () : Result;
goto Handle_Network_Return;
!
! Connect to InfoNet World
!
Connect_InfoNet_World:
call %Dir & "infonet.scr" (0) : Result;
goto Handle_Network_Return;
!
! Connect to InfoNet Europe
!
Connect_InfoNet_Europe:
call %Dir & "infonet.scr" (1) : Result;
goto Handle_Network_Return;
!
! Connect to InfoNet Korea
!
Connect_InfoNet_Korea:
call %Dir & "infonet.scr" (2) : Result;
goto Handle_Network_Return;
!
! Connect to InfoNet Taiwan
!
Connect_InfoNet_Taiwan:
call %Dir & "infonet.scr" (3) : Result;
goto Handle_Network_Return;
!
! Connect to InfoNet Mexico
!
Connect_InfoNet_Mexico:
call %Dir & "infonet.scr" (4) : Result;
goto Handle_Network_Return;
!
! Connect to InfoNet South Africa
!
Connect_InfoNet_SAfrica:
call %Dir & "infonet.scr" (5) : Result;
goto Handle_Network_Return;
!
! Connect to LATA
!
Connect_LATA:
call %Dir & "lata.scr" (%TRUE) : Result;
goto Handle_Network_Return;
!
! Connect to Connecticut LATA
!
Connect_CTLATA:
call %Dir & "lata.scr" (%FALSE) : Result;
goto Handle_Network_Return;
!
! Connect to Telepac
!
Connect_Telepac:
call %Dir & "telepac.scr" () : Result;
goto Handle_Network_Return;
!
! Connect to Datex-P
!
Connect_Datex_P:
call %Dir & "datexp.scr" () : Result;
goto Handle_Network_Return;
!
! Connect to Datex-J
!
Connect_Datex_J:
call %Dir & "datexj.scr" () : Result;
goto Handle_Network_Return;
!
! Connect to Dialplus
!
Connect_Dialplus:
call %Dir & "dialplus.scr" () : Result;
goto Handle_Network_Return;
!
! Connect to FT-Connect
!
Connect_FTConnect:
call %Dir & "ftconn.scr" () : Result;
goto Handle_Network_Return;
!
! Connect to Mercury
!
Connect_Mercury:
call %Dir & "mercury.scr" () : Result;
goto Handle_Network_Return;
!
! Connect to CSIR-Net
!
Connect_CSIRnet:
call %Dir & "csirnet.scr" () : Result;
goto Handle_Network_Return;
!
! Connect to ISRAKAV
!
Connect_ISRAKAV:
call %Dir & "israkav.scr" () : Result;
goto Handle_Network_Return;
!
! Connect to Transpac
!
Connect_Transpac:
call %Dir & "transpac.scr" () : Result;
goto Handle_Network_Return;
!
! Connect to AlaskaNet
!
Connect_AlaskaNet:
call %Dir & "tymnet.scr" (2) : Result;
goto Handle_Network_Return;
!
! Connect to ArgNet
!
Connect_ArgNet:
call %Dir & "argnet.scr" () : Result;
goto Handle_Network_Return;
!
! Connect to PacNet
!
Connect_PacNet:
call %Dir & "tymnet.scr" (3) : Result;
goto Handle_Network_Return;
!
! Connect to Pos-Serve
!
Connect_PosServe:
call %Dir & "posserve.scr" () : Result;
goto Handle_Network_Return;
!
! Connect to TTN-Net
!
Connect_TTNNet:
call %Dir & "ttnnet.scr" (3) : Result;
goto Handle_Network_Return;
!
! Connect to FENICS II
!
Connect_FENICSII:
call %Dir & "fenics2.scr" (3) : Result;
goto Handle_Network_Return;
!
! Connect to Chilepac
!
Connect_Chilepac:
call %Dir & "chilepac.scr" (3) : Result;
goto Handle_Network_Return;
!
! Connect to EIRPAC
!
Connect_EIRPAC:
call %Dir & "eirpac.scr" () : Result;
goto Handle_Network_Return;
!
! Connect to SCITOR
!
Connect_SCITOR:
call %Dir & "scitor.scr" () : Result;
goto Handle_Network_Return;
!
! Connect to SEVA
!
Connect_SEVA:
call %Dir & "seva.scr" () : Result;
goto Handle_Network_Return;
!
! Handle Network Return
!
Handle_Network_Return:
if Result = %Success goto Do_CIS_Script;
if Result = %Cancel goto Cancel_Connect;
if Result = %Fatal goto Connect_Fatal;
goto Connect_Failure;
!
! Connect to CIS
!
Connect_CIS:
CISNetwork = %TRUE;
send %CR;
Do_CIS_Script:
call %Dir & "cserve.scr" (DirectConnect, CISNetwork) : Result;
if Result = %Failure goto Connect_Failure;
if Result = %Cancel goto Cancel_Connect;
if Result = %Fatal goto Connect_Fatal;
exit %Success;
Connect_Failure:
if %GatewayFailure = 0 goto ExitFailure;
define %GatewayFailure = 0;
if GatewayRetry = 3 goto ExitFailure;
GatewayRetry = GatewayRetry + 1;
wait until 50;
reset;
goto Initialize;
ExitFailure:
gosub Hangup_Connect;
reset;
exit %Failure;
Connect_Fatal:
if %GatewayFailure = 0 goto Gateway_OK;
define %GatewayFailure = 0;
if GatewayRetry = 3 goto ExitFailure;
GatewayRetry = GatewayRetry + 1;
wait until 50;
reset;
goto Initialize;
Gateway_OK:
gosub Hangup_Connect;
reset;
exit %Fatal;
Hangup_Connect:
if not UsingModem goto Hangup_Done;
define %LOCAL = 1;
call %Dir & "disconct.scr" ();
Hangup_Done:
return;
Cancel_Connect:
show "Connect cancelled";
gosub Hangup_Connect;
reset;
define %ErrorCode = 1;
exit %Cancel;