|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectconfutil.ConfClient
This class encapsulates the main configuration client functionality. It offers methods to connect to a Linksys box where a configuration server runs, authenticate a user, get, set and unset configuration variables that reside in the NVRAM of the box and control the function of the P2PWNC protocol modules that run on the Linksys WRT54GS wireless router. The configuration client and server programs communicate by exchanging simpe text messages over TCP.
Title: P2PWNC configuration utility
Description: Linksys WRT54GS P2PWNC configuration utility
Copyright: Copyright (c) 2005
Company:
Field Summary | |
static int |
ACTION_ACK
"ACK" message. |
static int |
ACTION_AUTH
"AUT" message. |
static int |
ACTION_AUTH_ERR
"AER" message. |
static int |
ACTION_AUTH_OK
"AOK" message. |
static int |
ACTION_ERR
"ERR" message. |
static int |
ACTION_GET
"GET" message. |
static int |
ACTION_SET
"SET" message. |
static int |
ACTION_UNSET
"UST" message. |
static int |
CONF_SERVER_PORT
Default port where a configuration server listens for client messages. |
protected java.net.InetAddress |
serverAddr
Configuration server IP address. |
Constructor Summary | |
(package private) |
ConfClient(java.net.InetAddress addr)
Constructs a ConfClient object using addr as the configuration server address. |
Method Summary | |
boolean |
authenticateUser(java.lang.String passwd,
java.net.Socket socket)
Sends an "AUT" message to the server and gets the server response. |
java.net.Socket |
connectToServer()
Connect to the configuration server. |
static void |
main(java.lang.String[] args)
|
java.lang.String |
makeMessage(int action,
java.lang.String var,
java.lang.String val)
Constructs a text message to be sent to the server. |
java.lang.String |
parseMessage(java.lang.String text)
Parses a text message received by the server. |
ConfMsg |
readMessage(java.net.Socket socket)
Reads a text message from socket and returns the correspondent ConfMsg object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ACTION_GET
public static final int ACTION_SET
public static final int ACTION_UNSET
public static final int ACTION_ACK
public static final int ACTION_ERR
public static final int ACTION_AUTH
public static final int ACTION_AUTH_OK
public static final int ACTION_AUTH_ERR
public static final int CONF_SERVER_PORT
protected java.net.InetAddress serverAddr
Constructor Detail |
ConfClient(java.net.InetAddress addr)
addr
- InetAddress
Configuration server address. This is the IP address of the Linksys WRT54GS router where
the server runs.Method Detail |
public java.lang.String makeMessage(int action, java.lang.String var, java.lang.String val)
action
- int
The message type (ACTION_GET, ACTION_UNSET, ACTION_SET, ACTION_AUTHvar
- String
The "VAR" message field. In case of a "GET", "SET" or "UST" message it specifies
the variable whose value is to be retrieved, set or unset. In case of an "AUT" message,
var specifies the Linksys router's administrator password.val
- String
The "VAL" message field. It is used only in "SET" messages, where it represents the value of the
variable to be set.
public java.lang.String parseMessage(java.lang.String text)
text
- String
The text message to be parsed.
public ConfMsg readMessage(java.net.Socket socket)
socket
- Socket
Socket where the data will be read from.
public boolean authenticateUser(java.lang.String passwd, java.net.Socket socket)
passwd
- String
The Linksys WRT54GS router administrator password sent by the user.socket
- Socket
The socket over which the message will be sent.
public java.net.Socket connectToServer()
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |