PPP Dialler Software Functional Specification


    Distribution: COMPANY CONFIDENTIAL

    Project:      NC Model 1
    Issue:        0.02
    Author(s):    Kevin Bracey, Steve Cormie (edited by DWalker)
    Date:         18-Sep-97
    Last Issue:   0.01
  

Contents.


History

	0.01 SMC 04-Mar-96 Created from Kevin Bracey's spec.

Outstanding issues


Overview

The present PPP module is only capable of communicating over an established modem link; there is no standardised mechanism for establishing, maintaining and terminating the link.

It it suggested that a new PPP Dialler module be created that can perform the following functions:


Technical background

The dialler communicates via standard blockdrivers - it maintains either a pointer to an existing blockdriver (eg the PPP module's driver) or has its own blockdriver loaded.

It also keeps copies of the scripts/filenames last set for dialling, hanging up and answering, so further calls to Dialler_Dial (for example) can be made with all registers set to zero for a redial. The default settings are:

      Dialling script:  Resources:$.Resources.Dialler.Scripts.Dial
      Hangup script:    Resources:$.Resources.Dialler.Scripts.HangUp
      Answering script: Resources:$.Resources.Dialler.Scripts.Answer
      Blockdriver:      Resources:$.Resources.Dialler.Driver

If these aren't present, an error will be generated if a zero parameter is used. The dialler will only maintain a single link at a time. Scripts are basically send-expect strings, of the form:

"" ATZ
OK ATC1&C1&D1&3
OK ATDT9258666
ogin: fred
assword: jim
rotocol: PPP

Where the first parameter of a send-expect pair specifies what to wait for, and the second specifies what to send. There are also TIMEOUT and ABORT commands (more info later).


User interface

The PPP module will be enhanced to offer a dial on the PPPConnect command and to provide dial-on-demand. New options will be added to the PPPConnect command:

connect "X"

This will specify a dial script that will be sent to Dialler_Dial. When the dial completes, the PPP link will be established.

hangup "X"

If the connect option is specified, a hangup script can also be provided. This will be used when the PPP module wishes to hang up.


Programmer interface

Dialler_Dial (SWI &4C6C0)

On entry:
  R0: flags word
        bit 0: if set, R1 points to a loaded blockdriver, else to a filename
        bit 1: if set, R2 points to a script, else to the filename of a script
        bit 2: if set, R3 points to a script, else to the filename of a script
        bit 3: if set, scripts pointed to by R2 and R3 can be used in situ
        bits 4-31: reserved (must be 0)
  R1->blockdriver in RMA or filename of blockdriver. (0 means use current)
  R2->script or filename of script for dialling. (0 means use current)
  R3->script or filename of script for hanging up. (0 means use current)
  R4:serial speed (in bps), 0 means current
On exit:
  All registers preserved.

This starts a dial operation. If the link is currently established, it will hangup first. The dial takes place in the background; you may call Dialler_Status to monitor the state of the dial, or wait for the service call Service_Dialler.

If bits 1 or 2 of the flags word are set, the dialler will use scripts held in memory - it will copy scripts into its own workspace unless bit 3 of the flags is set. If a caller sets bit 3, it must ensure that the scripts remain in memory as long as the Dialler is active, or until the dialler is reconfigured.

If the dialler is passed the filename of a script, it will be read directly from the file. The file will be kept open by the dialler as long as necessary.

If bit 0 is set, the blockdriver pointed to by R1 will be called directly - its current settings will be used. This blockdriver must remain where it is as long as the Dialler is active, or until the dialler is reconfigured.

Dialler_HangUp (SWI &4C6C1)

On entry:
  R0: flags word (must be 0)
On exit:
  All registers preserved.

This attempts to hang up the modem, using the last-specified hangup script.

Dialler_Status (SWI &4C6C2)

On entry:
  R0: flags word (must be 0)
On exit:
  R0=current status.

The defined states are:

            Disconnected              0
            Executing dial script     1
            Connected (outgoing call) 2
            Executing hangup script   3
            Executing answer script   4
            Connected (incoming call) 5
            Error occurred during script  &1xx [This means it is disconnected]

When a TIMEOUT or ABORT occurs in a script, the status will go to &100 by default. The TIMEOUT and ABORT commands will have an optional extra parameter to specify an error code - this will form the lower byte of the status. This will allow the generator of scripts to come up with his own error-classification scheme.

No retries will be attempted by the Dialler module - this will be the job of the Dialler module's caller on receipt of the Error status report.

Dialler_Answering (SWI &4C6C3)

On entry: 
  R0: flags word
        bit 0: if set, R1 points to a loaded blockdriver, else to a filename
        bit 1: if set, R2 points to a script, else to the filename of a script
        bit 2: if set, R3 points to a script, else to the filename of a script
        bit 3: if set, scripts pointed to by R2 and R3 can be used in situ
        bits 4-31: reserved (must be 0)
  R1->blockdriver in RMA or filename of blockdriver (0 means use current)
  R2->script or filename of script for answering. (0 means use current)
  R3->script or filename of script for hanging up. (0 means use current)
  R4:serial speed (in bps), 0 means current
  R5:     0: disable answering
          1: enable answering
         -1: don't change
On exit:
  R5=previous state of answering

This call enables or disables the dialler's answering facility. While enabled, all input from the relevant device will be swallowed, except when the link is in the connected state.

Dialler_Configure (SWI &4C6C4)

On entry: 
  R0: flags word
        bit 0: if set, R1 points to a loaded blockdriver, else to a filename
        bit 1: if set, R2 points to a script, else to the filename of a script
        bit 2: if set, R3 points to a script, else to the filename of a script
        bit 3: if set, scripts pointed to by R2 and R3 can be used in situ
        bits 4-31: reserved (must be 0)
  R1->blockdriver in RMA or filename of blockdriver (0 means use current)
  R2->script or filename of script for dialling. (0 means use current)
  R3->script or filename of script for hanging up. (0 means use current)
  R4:serial speed (in bps), 0 means current
On exit:
  All registers preserved.

This call sets up the dialler's various options, without actually performing a dial. This is useful if you only ever want to call Dialler_Dial with zero parameters.

Service_DiallerStatus (Service call &B4)

On entry:
  R1=&B4 (reason code)
  R2=New state of link (see Dialler_Status)
On exit:
  R1 preserved to pass on (do not claim)

This call is made whenever the state of a modem link changes.

PPP_Autodial (SWI &4B620)

On entry:
  R0: flags word
  R1: Current state: 0 disable
                     1 enable (fixed IP)
                     2 enable (dynamic IP)
                     -1 read current state
  R2: Disconnect period (in seconds). 0 means no auto-disconnect.
On exit:
  R1: current state

With autodial enabled, the PPP module will detect the link going down, and silently note this. The interface will remain ifconfiged up. The next time a packet is sent via the PPP interface, the PPP module will cause a redial (using Dialler_Dial - the dialler must previously have been set up using Dialler_Dial, Dialler_Configure, or by using the connect option to *PPPConnect). If a fixed IP address is in use, packets will be queued until the dial is successful (although there is a limited amount of buffer space).

If a dynamic IP address is in use, the packets cannot be queued, as when the dial has been made the interface's IP address will have changed. Instead the module will return the error ENETDOWN.

This will be a signal for the transmitting application to retry later, by which time the link should have been remade and the new local IP address configured.

If an disconnect period is set, the PPP module will monitor its link, and if no packets have been transmitted within the given period, it will hang up (using Dialler_HangUp).

PPP_Answering (SWI &4B621)

On entry:
  R0: flags word
  R1: State:    0 disable
                1 enable
                -1 read current state
  R2: Disconnect period (in seconds). 0 means no auto-disconnect
  R3: Pointer to parameter string (as *PPPConnect)

This SWI can be used to enable the answering of the modem. The Dialler module will be configured to answer, and the PPP module will respond to the Service_DiallerStatus by issuing a *PPPConnect.

Some means of logging calls will be provided.