|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--socks.server.Ident
Class Ident provides means to obtain user name of the owner of the socket on remote machine, providing remote machine runs identd daemon.
To use it:
Socket s = ss.accept();
Ident id = new Ident(s);
if(id.successful) goUseUser(id.userName);
else handleIdentError(id.errorCode,id.errorMessage)
Field Summary | |
static int |
connectionTimeout
Maximum amount of time we should wait before dropping the connection to identd server.Setting it to 0 implies infinit timeout. |
static int |
ERR_NO_CONNECT
Identd on port 113 can't be contacted |
static int |
ERR_PROTOCOL
Identd daemon responded with ERROR, in this case errorMessage contains the string explanation, as send by the daemon. |
static int |
ERR_PROTOCOL_INCORRECT
When parsing server response protocol error happened. |
static int |
ERR_TIMEOUT
Connection timed out |
int |
errorCode
Error code |
java.lang.String |
errorMessage
Error Message can be null. |
java.lang.String |
hostType
Host type as returned by daemon, can be null, if error happened |
boolean |
successful
If this is true then userName and hostType contain valid values. |
java.lang.String |
userName
User name as returned by the identd daemon, or null, if it failed |
Constructor Summary | |
Ident(java.net.Socket s)
Constructor tries to connect to Identd daemon on the host of the given socket, and retrieve user name of the owner of given socket connection on remote machine. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public java.lang.String errorMessage
public java.lang.String hostType
public java.lang.String userName
public boolean successful
public int errorCode
public static final int ERR_NO_CONNECT
public static final int ERR_TIMEOUT
public static final int ERR_PROTOCOL
public static final int ERR_PROTOCOL_INCORRECT
public static final int connectionTimeout
Constructor Detail |
public Ident(java.net.Socket s)
If user name was successfully retrieved successful is set to true, and userName and hostType are set to whatever server returned. If however for some reason user name was not obtained, successful is set to false and errorCode contains the code explaining the reason of failure, and errorMessage contains human readable explanation.
Constructor may block, for a while.
s
- Socket whose ownership on remote end should be obtained.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |