: Interface PPPEventListener

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.dalsemi.tininet.ppp
Interface PPPEventListener

public interface PPPEventListener
extends EventListener

Propagates `PPPEvents`.

It is easiest to understand the operation of PPP as a Finite State Machine (FSM). Note that there are actually two Finite State Machines at work here. The true PPP FSM that is implemented as part of the network stack beneath the IP module and the high level state machine implemented by a `PPPEventListener` whose state transitions are driven by events generated by the PPP deamon thread and method invocations on a PPP object. The PPP FSM is more complex than the event listener FSM and includes several additional states. For the most part the arcane details of native implementation are hidden from the application developer by the PPP class. The purpose of the `PPPEventListener` interface is to provide a mechanism to drive a much simpler, higher level state machine that gives the application an opportunity to control the physical data link, user authentication and handling of error information.

After creating a new PPP object the FSM is in the `INIT` state. At this point there is no PPP traffic traveling across the physical link. To transition to the `STARTING` state the owner of the PPP object invokes the `PPP.open` method.

The `STARTING` state provides the application with a chance to intialize the physical data link, a serial port object. Intialization of the physical link can be as simple as openeing the port and setting the speed and bit counts or as complicated as initializing a modem and initiating or accepting a call. Once the physical layer has been initialized and the application is prepared to start PPP link negotiation the application invokes the `PPP.up` method passing a serial port object as the argument. Once the serial port reference is passed to PPP it assumes exclusive access to the serial port. At this point PPP attempts to bring up the link. If any error occurs during the link negotiation phase PPP will issue a `STOPPED` event at which point the user application can examine the error code associated with the `STOPPED` event.

Most errors are fatal with the exception of timeouts. In the event of a timeout the user application can re-envoke the `ppp.UP` method. Error codes and thier descriptions can be found in the `PPP.event` class documentation.

Once the initial negotiation has completed and if this peer has been configured to request authentication from the remote peer an `AUTHENTICATION_REQUESTED` event will be generated when the remote peer presents it's authentication password and username. After the application has examined the authentication infromation the application then invokes `PPP.authenticate` with an argument of `true` to signal the lower level FSM that link negotiation can continue or with and argument with `false` argument indicating that link negotiation should be terminated.

When link negotiation is successfuly completed an `UP` event is generated at which point the application should add the PPP interface to the network interface table by invoking the `PPP.addInterface()` method.

## Figure1. PPP "client/server" FSM Diagram

                      +-----------+
                      |           |
                      |   INIT    |
                      |           |
                      +-----------+
                            |
                            | open()
                            V
                      +-----------+
              open()  |           |       up()
           +--------->|   START   |------------------OR---------------------+
           |          |           |                  |                      |
           |          +-----------+                  | "server" operation   |
           |                |                        V with authentication  |
     +-----------+          |                  +-----------+                |
     |           |          | Link             |           |                |
     |  CLOSED   |          | Negotiation      |   AUTH    |                |
     |           |          | Error            |           |                |
     +-----------+          |                  +-----------+                |
           ^                |                    |      |                   |
           |                V                    |      |     "server" or   |
           |          +-----------+              |      |      "client"     |
           |  close() |           |              |      |      operation    |
           +----------|  STOPPED  |<-------------+      |      with out     |
           |          |           | authenticate(false) |    authentication |
           |          +-----------+                     |                   |
           |                ^                           |                   |
           |                | remote termination        |                   |
           |                |                           |                   |
           |          +-----------+ authenticate(true)  |                   |
           |  close() |           |<--------------------+                   |
           +----------|    UP     |                                         |
                      |           |<----------------------------------------+
                      +-----------+

See Also:
  `PPP`, `PPPEvent`

Method Summary
`void` | `pppEvent(PPPEvent ev)` Propagates a PPPEvent event.

Method Detail

### pppEvent

    public void pppEvent(PPPEvent ev)

  Propagates a PPPEvent event.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD