# Dial-in script for Linux using DIP-3.3.7o-uri and above.
# By Uri Blumenthal (uri@watson.ibm.com).
# 
# Utilized Linux script offered by Advantis.
#
# Makes connection to IBM network (using SecureIP mode).
# No, your system does not have to support IPSEC - it's
# on the Advantis side (they give you a tunnel).
# 
# Modem string is for USR Sportster V.34+ 33.6 Data/Fax.

main:
  echo on

  # Set the desired serial port and speed.
  # Note - you should NOT use cua devices!
  port ttyS1
  speed 115200
  parity n
  databits 8


  # Put in an appropriate modem string
# init ATZ\r
  send AT&F&D2&C1X4V1Q0S7=70&K1&M4&H1&B1\r
  # Note! "Standard" pre-defined "errlevel" values:
  #       0 - OK
  #       1 - CONNECT
  #       2 - ERROR
  #
  # You can change those grep'ping for "addchat()" in *.c...
  chatkey       NO\sCARRIER     4
  chatkey       NO\sDIALTONE    5
  chatkey       BUSY            6

  # your local access number
  dial 555-1212
  if $errlvl != 1 goto modem_trouble

# We are connected.  Login to the system.

login:
  sleep 2
  send &
  sleep 1
  wait ==> 20
  if $errlvl != 0 goto hello_error
  send 2.0\r
  wait ==> 20
  if $errlvl != 0 goto conn_error
  send N\r
  wait ==> 20
  if $errlvl != 0 goto password_error

  #send (account) (userid) (password)\r
  send ACCOUNT USERID PASSWORD\r
  wait ==> 20
  if $errlvl != 0 goto password_error
  send SECUREIP\r
  sleep 1
  get $locip  remote 35
  if $errlvl != 0 goto no_locip
  send \r
  get $rmtip remote 35
  if $errlvl != 0 goto no_rmtip

loggedin:
  get $mtu 1500
  netmask 255.255.255.0
  default

done:
  print \n
  print CSLIP CONNECTED local $locip ---> remote $rmtip
  mode CSLIP
  goto exit

prompt_error:
  print TIME-OUT waiting for SLIPlogin to fire up...
  goto error

hello_error:
  print No Welcome message from IGN...
  goto error

conn_error:
  print IGN did not ask us INTERNET or SecureIP...
  goto error

login_trouble:
  print Trouble waiting for the Login: prompt...
  goto error

password_error:
  print IGN does not want to as for (account) (uid) (passwd)...
  goto error

modem_trouble:
  print Trouble ocurred with the modem...

error:
  print CONNECT FAILED to $remote
  quit

no_locip:
  print Remote side did not give me my IP address!
  quit

no_rmtip:
  print Remote side did not give me its own IP address!
  quit

exit:
  exit
