|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--com.dalsemi.tininet.ppp.PPP
This class implements the Point-to-Point Protocol (PPP), which provides IP packet transport over a serial link. PPP exists as a layer between the IP network-layer and a physical interface. Being a point-to-point protocol, PPP does not distinguish between a client and a server operation. For the purposes of this documentation, a peer which requires a remote peer to authenticate and provides an IP address to the remote peer will be known as a server. A peer which does not require a remote peer to authenticate and uses a server assigned IP address will be know as a client. Many variations exist between these configurations and are not covered in this documentation.
To satisfy the physical interface requirement, user application code must open,
initialize and pass a serial port object to an instance of PPP. After passing
the serial port object to PPP, the user application should not attempt to read
or write operations on the serial port until PPP has signaled a closed event. This
does not preclude the application code from implementing the SerialPortEventListener
interface or from polling the serial port status signals.
An application that creates a PPP object must provide a listener to receive notification
of PPP events. The listener is an instance of a class that implements the PPPEventListener
interface.
(code example)
(code example)
(code example)
PPPEventListener
,
PPPEvent
,
SerialPort
Field Summary | |
static byte |
PEER_ID
Peer ID parameter to getUsernamePassword |
static byte |
PEER_PASSWORD
Peer password parameter to getUsernamePassword |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY,
MIN_PRIORITY,
NORM_PRIORITY |
Constructor Summary | |
PPP()
Default constructor |
Method Summary | |
void |
addEventListener(PPPEventListener eventListener)
Adds a PPP event listener. |
void |
addInterface(java.lang.String name)
Adds a PPP interface to the network interface table. |
void |
authenticate(boolean value)
Indicates if access should be granted to remote peer. |
void |
close()
Invoked to close PPP. |
void |
down()
Invoked when serial channel is no longer available for PPP traffic. |
int |
getACCM()
Gets the current Asynchronous Control Character Map (ACCM). |
boolean |
getAuthenticate()
Gets current value of remote peer authenticate flag. |
boolean |
getDefaultInterface()
Gets the current value of the default interface flag. |
byte[] |
getLocalAddress()
Gets the local IP address for this interface. |
int |
getMaxConfig()
Gets the maximum number of configuration retries allowed. |
int |
getMaxFailure()
Gets the maximum number of configuration failures allowed. |
int |
getMaxTerminate()
Gets the maximum number of termination retries allowed. |
boolean |
getPassive()
Gets the current state of the passive mode option. |
java.lang.String |
getPeerID()
Gets the remote peers authentication ID. |
java.lang.String |
getPeerPassword()
Gets the remote peers authentication password. |
byte[] |
getRemoteAddress()
Gets the IP address of the remote peer. |
int |
getRestartPeriod()
Gets the timeout period. |
static int |
getTransmitter(byte index)
Gets the transmitter routine. |
int |
getUsernamePassword(int option,
byte[] value)
Deprecated. Gets remote peers username/password. Used during authentication phase to retreive remote peers ID and password. Invoking this method with value as null returns length of option. |
void |
open()
Invoked to open PPP. |
void |
removeEventListener(PPPEventListener eventListener)
Removes a PPP event listener. |
void |
removeInterface(java.lang.String name)
Removes the named PPP interface from the network interface table. |
void |
run()
Implements PPP deamon thread which propagates pppEvents to event listeners. |
void |
setACCM(int newACCM)
Sets the value of the Asynchronous Control Character Map (ACCM). |
void |
setAuthenticate(boolean value)
Sets the remote peer authentication option. |
void |
setDefaultInterface(boolean value)
Sets the default interface flag. |
void |
setLocalAddress(byte[] address)
Sets the local IP address for this interface. |
void |
setMaxConfig(int count)
Sets the maximum number of unanswered configuration requests that will be sent (1 - 20). |
void |
setMaxFailure(int count)
Sets the maximum number of configuration failures allowed (1 - 20). |
void |
setMaxTerminate(int count)
Sets the maximum number of termination requests that will be sent (1 - 20). |
void |
setPassive(boolean value)
Sets passive mode option. |
void |
setPassword(java.lang.String password)
Sets the password sent to a remote peer during authentication. |
void |
setRemoteAddress(byte[] address)
Sets the IP address of the remote peer. |
void |
setRestartPeriod(int timeout)
Sets the restart time period in seconds (1 - 30). |
void |
setUsername(java.lang.String userName)
Sets the user name sent to a remote peer during authentication. |
void |
up(javax.comm.SerialPort sp)
Invoked when serial channel is ready for PPP traffic. |
Methods inherited from class java.lang.Thread |
activeCount,
checkAccess,
countStackFrames,
currentThread,
destroy,
dumpStack,
enumerate,
getName,
getPriority,
getThreadGroup,
interrupt,
interrupted,
isAlive,
isDaemon,
isInterrupted,
join,
join,
join,
resume,
setDaemon,
setName,
setPriority,
sleep,
sleep,
start,
stop,
stop,
suspend,
toString,
yield |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final byte PEER_ID
public static final byte PEER_PASSWORD
Constructor Detail |
public PPP()
Method Detail |
public static int getTransmitter(byte index)
index
- interface indexpublic void setACCM(int newACCM)
newACCM
- Asynchronous Control Character Map (ACCM)public int getACCM()
public void setAuthenticate(boolean value)
true
this peer will require the remote peer to authenticate before a connection is established.value
- true
if remote peer authentication is requiredpublic boolean getAuthenticate()
public void setDefaultInterface(boolean value)
true
this interface will be set to the default network interface once a connection
is established.value
- true
if this interface should be set a default network interfacepublic boolean getDefaultInterface()
public void setLocalAddress(byte[] address)
address
- local IP address, index 0 is MSB of four byte network addresspublic byte[] getLocalAddress()
public void setPassive(boolean value)
value
- true
for passive mode operationpublic boolean getPassive()
public void setPassword(java.lang.String password) throws PPPException
password
- user passwordpublic void setUsername(java.lang.String userName) throws PPPException
userName
- user namepublic void setRemoteAddress(byte[] address)
address
- remote IP address, index 0 is MSB of four byte network addresspublic byte[] getRemoteAddress()
public void setRestartPeriod(int timeout) throws PPPException
timeout
- restart time in secondspublic int getRestartPeriod()
public void setMaxConfig(int count) throws PPPException
count
- the maximum number of configuration retriespublic int getMaxConfig()
public void setMaxTerminate(int count) throws PPPException
count
- the maximum number of termination retriespublic int getMaxTerminate()
public void setMaxFailure(int count) throws PPPException
count
- the maximum number of failures allowedpublic int getMaxFailure()
public void addEventListener(PPPEventListener eventListener) throws java.util.TooManyListenersException
eventListener
- PPPEventListener objectpublic void removeEventListener(PPPEventListener eventListener)
eventListener
- PPPEventListener objectpublic final void run()
public void up(javax.comm.SerialPort sp)
sp
- SerialPort objectpublic void down()
public void open()
public void close()
public int getUsernamePassword(int option, byte[] value)
option
- indicates which value to retreive, PEER_ID or PEER_PASSWORDvalue
- receives option valuepublic void authenticate(boolean value)
value
- True to allows access, False to deny accessspublic void addInterface(java.lang.String name)
name
- interface namepublic void removeInterface(java.lang.String name)
name
- interface namepublic java.lang.String getPeerID()
public java.lang.String getPeerPassword()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |