|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.handshaking.HandshakeResponse
This class contains the necessary information to form a response to a connection handshake. It contains a status code, a status message, and the headers to use in the response. There are only two ways to create a HandshakeResponse. 1) Create an instance which defaults the status code and status message to be "200 OK". Only the headers used in the response need to be passed in. 2) Create an instance with a custom status code, status message, and the headers used in the response.
Field Summary | |
static java.lang.String |
AUTHENTICATING
Message indicating that we are trying to authenticate |
static int |
DEFAULT_BAD_STATUS_CODE
Default bad status code to be used while rejecting connections |
static java.lang.String |
DEFAULT_BAD_STATUS_MESSAGE
Default bad status message to be used while rejecting connections |
static int |
OK
The "default" status code in a connection handshake indicating that the handshake was successful and the connection can be established. |
static java.lang.String |
OK_MESSAGE
The "default" status message in a connection handshake indicating that the handshake was successful and the connection can be established. |
static int |
SHIELDED
The error code that a shielded leaf node should give to incoming connections. |
static java.lang.String |
SHIELDED_MESSAGE
The error message that a shielded leaf node should give to incoming connections. |
static int |
SLOTS_FULL
The error code that a node with no slots should give to incoming connections. |
static java.lang.String |
SLOTS_FULL_MESSAGE
The error message that a node with no slots should give to incoming connections. |
static java.lang.String |
UNABLE_TO_AUTHENTICATE
Message indicating that we are unable to authenticate |
static int |
UNAUTHORIZED_CODE
status code for unauthorized attempt |
static java.lang.String |
UNAUTHORIZED_MESSAGE
status message for unauthorized attempt |
Method Summary | |
static HandshakeResponse |
createEmptyResponse()
Creates an empty response with no headers. |
static HandshakeResponse |
createResponse(java.util.Properties headers)
Constructs the response from the other host during connection handshaking. |
static HandshakeResponse |
createResponse(java.lang.String line,
java.util.Properties headers)
Constructs the response from the other host during connection handshaking. |
java.lang.String |
getDomainsAuthenticated()
Returns the authenticated domains listed in the connection headers for this connection. |
byte |
getMaxTTL()
Returns the maximum TTL that queries originating from us and sent from this connection should have. |
int |
getNumIntraUltrapeerConnections()
Returns the number of intra-Ultrapeer connections this node maintains. |
java.lang.String |
getProperty(java.lang.String prop)
Accessor for an individual property. |
int |
getStatusCode()
Returns the response code. |
java.lang.String |
getStatusLine()
Returns the status code and status message together used in a status line. |
java.lang.String |
getStatusMessage()
Returns the status message. |
java.lang.String |
getUserAgent()
Returns the vendor string reported by this connection, i.e., the USER_AGENT property, or null if it wasn't set. |
java.lang.String |
getVersion()
|
java.lang.String |
getXTryUltrapeers()
Accessor for the X-Try-Ultrapeers header. |
boolean |
hasLeafGuidance()
Returns whether or not this host included leaf guidance, i.e., whether or not the host wrote: X-Ultrapeer-Needed: false |
boolean |
hasXTryUltrapeers()
This is a convenience method to see if the connection passed the X-Try-Ultrapeer header. |
boolean |
isAccepted()
Returns whether or not this connection was accepted -- whether or not the connection returned Gnutella/0.6 200 OK |
boolean |
isCrawler()
Determines whether or not this handshake is from the crawler. |
boolean |
isDeflateAccepted()
Returns whether or not this connection accepts deflate as an encoding. |
boolean |
isDeflateEnabled()
Returns whether or not this connnection is encoded in deflate. |
boolean |
isDynamicQueryConnection()
Returns whether or not the node on the other end of this connection uses dynamic querying. |
boolean |
isGoodLeaf()
Returns whether or not this is connection passed the headers to be considered a "good" leaf. |
boolean |
isGoodUltrapeer()
Returns whether or not this is connection passed the headers to be considered a "good" ultrapeer. |
boolean |
isGUESSCapable()
Returns whether or not this connection is to a client supporting GUESS. |
boolean |
isGUESSUltrapeer()
Returns whether or not this connection is to a ultrapeer supporting GUESS. |
boolean |
isHighDegreeConnection()
|
boolean |
isLeaf()
Returns true iff this connection wrote "X-Ultrapeer: false". |
boolean |
isQueryRoutingEnabled()
True if the remote host supports query routing (QRP). |
boolean |
isTempConnection()
Returns true iff this connection is a temporary connection as per the headers. |
boolean |
isUltrapeer()
Returns true iff this connection wrote "X-Ultrapeer: true". |
boolean |
isUltrapeerQueryRoutingConnection()
Returns whether or not this connection supports query routing between Ultrapeers at 1 hop. |
boolean |
notOKStatusCode()
Tells if the status returned was OK or not. |
java.util.Properties |
props()
Returns the headers as a Properties instance. |
boolean |
supportsGGEP()
Returns true if this supports GGEP'ed messages. |
boolean |
supportsPongCaching()
Returns whether or not this node supports pong caching. |
boolean |
supportsProbeQueries()
Accessor for whether or not this connection supports TTL=1 probe queries. |
boolean |
supportsVendorMessages()
Determines whether or not this node supports vendor messages. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int OK
public static final java.lang.String OK_MESSAGE
public static final int SHIELDED
public static final java.lang.String SHIELDED_MESSAGE
public static final int SLOTS_FULL
public static final java.lang.String SLOTS_FULL_MESSAGE
public static final int DEFAULT_BAD_STATUS_CODE
public static final java.lang.String DEFAULT_BAD_STATUS_MESSAGE
public static final int UNAUTHORIZED_CODE
public static final java.lang.String UNAUTHORIZED_MESSAGE
public static final java.lang.String UNABLE_TO_AUTHENTICATE
public static final java.lang.String AUTHENTICATING
Method Detail |
public static HandshakeResponse createEmptyResponse()
public static HandshakeResponse createResponse(java.util.Properties headers) throws java.io.IOException
java.io.IOException
public static HandshakeResponse createResponse(java.lang.String line, java.util.Properties headers) throws java.io.IOException
line
- the status line received from the connecting hostheaders
- the headers received from the other host
IOException
- if the status line could not be parsed
java.io.IOException
public int getStatusCode()
public java.lang.String getStatusMessage()
public boolean notOKStatusCode()
public boolean isAccepted()
public java.lang.String getStatusLine()
public java.util.Properties props()
public java.lang.String getProperty(java.lang.String prop)
public java.lang.String getUserAgent()
public byte getMaxTTL()
public java.lang.String getXTryUltrapeers()
public boolean hasXTryUltrapeers()
public boolean hasLeafGuidance()
public int getNumIntraUltrapeerConnections()
public boolean isHighDegreeConnection()
public boolean isGoodLeaf()
public boolean isDeflateEnabled()
public boolean isDeflateAccepted()
public boolean isGoodUltrapeer()
public boolean isUltrapeerQueryRoutingConnection()
public boolean isLeaf()
public boolean isUltrapeer()
public boolean isGUESSCapable()
public boolean isGUESSUltrapeer()
public boolean isTempConnection()
public boolean supportsGGEP()
public boolean supportsVendorMessages()
public boolean supportsPongCaching()
public java.lang.String getDomainsAuthenticated()
public java.lang.String getVersion()
public boolean isQueryRoutingEnabled()
public boolean isDynamicQueryConnection()
public boolean supportsProbeQueries()
public boolean isCrawler()
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |