: Class PPPEvent

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
Class PPPEvent

    java.lang.Object
      |
      +--java.util.EventObject
            |
            +--com.dalsemi.tininet.ppp.PPPEvent

public class PPPEvent
extends EventObject

When a PPP object is created it starts a deamon thread to listen for events originating from the native PPP module. This thread generates the events that notify PPP event listeners of important changes in the state of a PPP connection. The events generated by the deamon thread are defined as integer constants and shown below:

- `STARTING`
- `AUTHENTICATION_REQUEST`
- `UP`
- `STOPPED`
- `CLOSED`

Each event object also includes an error code. The error codes generated are defined as integer constants and shown below:

- `NONE`
- `ADDR`
- `AUTH`
- `TIME`
- `REJECT`

See Also:
  `PPP`, `PPPEventListener`, Serialized Form

Field Summary
`static int` | `ADDR` Error code ADDR, one or both of the IP addresses could not be negotiated.
`static int` | `AUTH` Error code AUTH, remote peer rejected this peers authentication credentials.
`static int` | `AUTHENTICATION_REQUEST` Event AUTHENTICATION, PPP has received an authentication request from the remote peer.
`static int` | `CLOSED` Event CLOSED, PPP has entered the closed state.
`static int` | `NONE` Error code NONE, no error.
`static int` | `REJECT` Error code REJECT, link options have been rejected by remote peer.
`static int` | `STARTING` Event STARTING, PPP has enetered the starting state.
`static int` | `STOPPED` Event STOPPED, PPP has entered the stopped state.
`static int` | `TIME` Error code TIME, link negotiation timed out.
`static int` | `UP` Event UP, PPP has entered the up state.

Fields inherited from class java.util.EventObject
`source`

Method Summary
`int` | `getEventType()` Gets the event type for this PPPEvent
`int` | `getLastError()` Gets the error type for this PPPEvent

Methods inherited from class java.util.EventObject
`getSource, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### UP

    public static final int UP

  Event UP, PPP has entered the up state.

  An `UP` event is generated if the connection is successfully established. At this point the PPP connection is established and is read for IP network traffic. However the application must invoke the `PPP.addInterface` method before the TCP/IP stack will recognize the new PPP connection as a valid network interface. The interface name passed to `PPP.addInterface` is typically formed by appending the number of the serial port being used for PPP traffic to the lower case string 'ppp'.

### CLOSED

    public static final int CLOSED

  Event CLOSED, PPP has entered the closed state.

  The `CLOSED` event occurs when the PPP link is no longer available. The link can become unavailable because the link was shut down normally or as the result of an error. After receiving the `CLOSED` event the PPP listener frees any resources that were consumed establishing the connection. The listener should also call the `PPP.removeInterface` method to remove the PPP network interface.

### AUTHENTICATION_REQUEST

    public static final int AUTHENTICATION_REQUEST

  Event AUTHENTICATION, PPP has received an authentication request from the remote peer.

  An `AUTHENTICATION_REQESTED` event is generated if `PPP.setAuthenticate` is invoked with a parameters value of true. This will cause PPP to request authentication information from the remote peer during its negotiation of the connection. This event gives the application the chance to verify the login information. The `PPP.getRemoteUserName` and `PPP.getRemotePassword` methods are used to retreive the remote peer's login information. After the application examines the login information it invokes the `PPP.authenticate` method with a value of true if the remote peer's login information is acceptable. In this case PPP continues its negotiation of the connection. If the login information is invalid calling `PPP.authenticate` with a value of false will cause PPP to reject the clients connection request and generate a `STOPPED` event.

### STOPPED

    public static final int STOPPED

  Event STOPPED, PPP has entered the stopped state.

  The `STOPPED` event is typically generated in response to an error condition. Some of the possible sources of errors include problems negotiating connection options, rejections of authentication information, rejection of PAP authentication protocol or the remote peer explicitly closing the connection. The source of the error can determined by invoking the `PPP.getLastError` method on the `PPPEvent` object passed to the event listener.

### STARTING

    public static final int STARTING

  Event STARTING, PPP has enetered the starting state.

  A `STARTING` event is generated by the application invoking the `PPP.open` method. The `STARTING` event provides the application with a chance to bring up the physical communications link. At a minimum this involves initializing the serial port that will be used by all PPP traffic. If a modem is attached to the serial port the application also intializes the modem and either instructs it to dial a remote modem or waits for the modem to answer an incomming call. After the physical communication link has been established the application invokes `PPP.up` method. At this point PPP assumes exclusive use of the serial port. Any other attempt to read from or write to the serial port could disrupt the PPP connection and will likely result in a STOPPPED event being generated.

### NONE

    public static final int NONE

  Error code NONE, no error.

### ADDR

    public static final int ADDR

  Error code ADDR, one or both of the IP addresses could not be negotiated. Some of the possible causes of address errors while using TINI PPP as a server: Not configuring local and remote addresses before starting a PPP server session. Remote peer attempting to use a static IP which does not match the configured address. Some of the possible causes of address errors while using TINI PPP as a client: Attempting to use a static IP while the server is configured for dynamic address configuration. Using the wrong static IP.

### AUTH

    public static final int AUTH

  Error code AUTH, remote peer rejected this peers authentication credentials. Some of the possible causes of authentication errors are: Remote peer refuses to accept PAP authentication protocol, TINI PPP only implements PAP authentication protocol. Bad username and/or password.

### TIME

    public static final int TIME

  Error code TIME, link negotiation timed out. This error occurs when the remote peer does not respond to configuration messages within the timeout period specified by `PPP.setrestartPeriod`.

### REJECT

    public static final int REJECT

  Error code REJECT, link options have been rejected by remote peer. This error occurs when the link configuration options have not converged with the number of negotiation attempts specified by `PPP.setMaxFailure`.

Method Detail

### getEventType

    public int getEventType()

  Gets the event type for this PPPEvent
  Returns:
    event type

### getLastError

    public int getLastError()

  Gets the error type for this PPPEvent
  Returns:
    error type

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