com.dalsemi.tininet.ppp
Class Protocol

java.lang.Object
  |
  +--com.dalsemi.tininet.ppp.Protocol
Direct Known Subclasses:
Chap, Ipcp, Lcp, Pap

public abstract class Protocol
extends java.lang.Object

Base class used to implement PPP protocols.


Field Summary
protected static int ACK_RCVD
          Acknowledge received state constant.
protected static int ACK_SENT
          Acknowledge sent state constant.
protected static int CLOSED
          Closed state constant.
protected static int CLOSING
          Closing state constant.
protected static int CODE_POS
          Position of code octet within message.
protected static int ID_POS
          Position of message identifier octet within message.
protected static int INITIAL
          Initial state constant.
protected static int interfaceNumber
          Native interface index for this instance
protected static int LENGTH_LSB_POS
          Position of message length LSB within message.
protected static int LENGTH_MSB_POS
          Position of message length MSB within message.
protected  boolean opened
          True if this protocol is opened
protected static int OPENED
          Opened state constant.
protected static int OPTION_START_POS
          Start position of message options.
protected static int PACKET_OVERHEAD
          Number of overhead bytes in a packet.
protected  int packetID
          Packet ID
protected static java.lang.String PASSWORD_FILE
          Password file name
protected static int PROTOCOL_LSB_POS
          Position of protocol number LSB within message.
protected static int PROTOCOL_MSB_POS
          Position of protocol number MSB within message.
protected  int protocolNum
          The protocol number
protected static Queue queue
          Queue object
protected static int REQ_SENT
          Request sent state constant.
protected static int STARTING
          Starting state constant.
protected  int state
          State of protocol FSM
protected static int STOPPED
          Stopped state constant.
protected static int STOPPING
          Stopped state constant.
protected  int timeoutCount
          Timeout count
protected  int timeoutCounter
          Timeout counter
protected  int timeoutInterval
          Timeout interval
protected static Timer timer
          Timer object
 
Constructor Summary
Protocol()
           
 
Method Summary
protected  java.lang.String findPassword(java.lang.String name)
          Return password for name or null if not found or password file does not exist.
protected  byte[] formatMsg(int code, int id)
          Format a message with no options.
protected  byte[] formatMsg(int code, int id, byte[] optionData)
          Format a message using a byte array for option data.
protected  byte[] formatMsg(int code, int id, java.util.Vector options)
          Format a message using a vector for option data.
abstract  void newPacket(byte[] msg)
          Invoked when this protocol has a new packet.
protected  void queueAdd(int event)
          Add an event to the queue.
protected  void queueAdd(int event, int data)
          Add an event to the queue.
protected  void queueAdd(int event, java.lang.String data)
          Add an event to the queue.
protected  void sendPacket(byte[] buf)
          Send a packet.
protected  void startTimer(TimerEventListener proto)
          Start the timeout timer.
protected  void stopTimer(TimerEventListener proto)
          Stop the timeout timer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROTOCOL_MSB_POS

protected static final int PROTOCOL_MSB_POS
Position of protocol number MSB within message.

PROTOCOL_LSB_POS

protected static final int PROTOCOL_LSB_POS
Position of protocol number LSB within message.

CODE_POS

protected static final int CODE_POS
Position of code octet within message.

ID_POS

protected static final int ID_POS
Position of message identifier octet within message.

LENGTH_MSB_POS

protected static final int LENGTH_MSB_POS
Position of message length MSB within message.

LENGTH_LSB_POS

protected static final int LENGTH_LSB_POS
Position of message length LSB within message.

OPTION_START_POS

protected static final int OPTION_START_POS
Start position of message options.

INITIAL

protected static final int INITIAL
Initial state constant.

STARTING

protected static final int STARTING
Starting state constant.

CLOSED

protected static final int CLOSED
Closed state constant.

STOPPED

protected static final int STOPPED
Stopped state constant.

CLOSING

protected static final int CLOSING
Closing state constant.

STOPPING

protected static final int STOPPING
Stopped state constant.

REQ_SENT

protected static final int REQ_SENT
Request sent state constant.

ACK_RCVD

protected static final int ACK_RCVD
Acknowledge received state constant.

ACK_SENT

protected static final int ACK_SENT
Acknowledge sent state constant.

OPENED

protected static final int OPENED
Opened state constant.

PACKET_OVERHEAD

protected static final int PACKET_OVERHEAD
Number of overhead bytes in a packet.

PASSWORD_FILE

protected static final java.lang.String PASSWORD_FILE
Password file name

state

protected int state
State of protocol FSM

opened

protected boolean opened
True if this protocol is opened

packetID

protected int packetID
Packet ID

interfaceNumber

protected static int interfaceNumber
Native interface index for this instance

timer

protected static Timer timer
Timer object

queue

protected static Queue queue
Queue object

timeoutInterval

protected int timeoutInterval
Timeout interval

timeoutCount

protected int timeoutCount
Timeout count

timeoutCounter

protected int timeoutCounter
Timeout counter

protocolNum

protected int protocolNum
The protocol number
Constructor Detail

Protocol

public Protocol()
Method Detail

newPacket

public abstract void newPacket(byte[] msg)
Invoked when this protocol has a new packet.

queueAdd

protected void queueAdd(int event)
Add an event to the queue.
Parameters:
event - encoded event

queueAdd

protected void queueAdd(int event,
                        int data)
Add an event to the queue.
Parameters:
event - encoded event
data - event data

queueAdd

protected void queueAdd(int event,
                        java.lang.String data)
Add an event to the queue.
Parameters:
event - encoded event
data - event data

sendPacket

protected void sendPacket(byte[] buf)
Send a packet.
Parameters:
buf - packet to be sent

formatMsg

protected byte[] formatMsg(int code,
                           int id)
Format a message with no options.
Parameters:
code - message code
id - message identification number
Returns:
formatted message

formatMsg

protected byte[] formatMsg(int code,
                           int id,
                           byte[] optionData)
Format a message using a byte array for option data.
Parameters:
code - message code
id - message identification number
optionData - message option data
Returns:
formatted message

formatMsg

protected byte[] formatMsg(int code,
                           int id,
                           java.util.Vector options)
Format a message using a vector for option data.
Parameters:
code - message code
id - message identification number
options - message option data
Returns:
formatted message

findPassword

protected java.lang.String findPassword(java.lang.String name)
Return password for name or null if not found or password file does not exist.
Parameters:
name - name to search for
Returns:
passowrd or null if not found

startTimer

protected void startTimer(TimerEventListener proto)
Start the timeout timer.
Parameters:
proto - protocol to receive notification

stopTimer

protected void stopTimer(TimerEventListener proto)
Stop the timeout timer.
Parameters:
proto - protocol to receive notification


Also see:
o TINI 1.16 API
o TINI Home Page
o 1-Wire API

o JDK 1.1

Last update Wed Jun 8 17:19:36 CDT 2005