seda.sandStorm.lib.Gnutella
Class GnutellaQueryPacket

java.lang.Object
  extended by seda.sandStorm.lib.Gnutella.GnutellaPacket
      extended by seda.sandStorm.lib.Gnutella.GnutellaQueryPacket
All Implemented Interfaces:
QueueElementIF, GnutellaConst

public class GnutellaQueryPacket
extends GnutellaPacket

A Gnutella query packet.


Field Summary
private static boolean DEBUG
           
(package private)  int minspeed
           
(package private)  java.lang.String searchterm
           
 
Fields inherited from class seda.sandStorm.lib.Gnutella.GnutellaPacket
function, gc, guid, hops, NUM_ALLOC, payload, payload_length, ttl
 
Fields inherited from interface seda.sandStorm.lib.Gnutella.GnutellaConst
DEFAULT_DOWNLOAD_PORT, DEFAULT_GNUTELLA_PORT, DEFAULT_HOPS, DEFAULT_PING_INTERVAL, DEFAULT_SPEED, DEFAULT_TTL, GNUTELLA_CONNECT, GNUTELLA_FN_PING, GNUTELLA_FN_PONG, GNUTELLA_FN_PUSH, GNUTELLA_FN_QUERY, GNUTELLA_FN_QUERYHITS, GNUTELLA_OK, MAX_PAYLOAD_SIZE, PACKET_HEADER_SIZE, WRITE_CLOG_THRESHOLD
 
Constructor Summary
GnutellaQueryPacket(byte[] payload)
          Create a query packet with the given payload.
GnutellaQueryPacket(GnutellaGUID guid, int ttl, int hops, byte[] payload)
          Create a query packet with the given GUID, TTL, hops, and payload.
GnutellaQueryPacket(java.lang.String searchterm, int minspeed)
          Create a query packet with the given search term and minspeed.
 
Method Summary
 void debug(java.io.PrintStream out)
           
 int getMinSpeed()
          Return the minimum speed requested by this query packet.
 java.lang.String getSearchTerm()
          Return the search term contained in this query packet.
private  void parsePayload()
           
protected  void prepareForSend()
          Implemented by subclasses to prepare for sending
 java.lang.String toString()
           
 
Methods inherited from class seda.sandStorm.lib.Gnutella.GnutellaPacket
finalize, getBuffer, getConnection, getGUID, getSize, readLEInt, readLEShort, setConnection, writeLEInt, writeLEShort
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

minspeed

int minspeed

searchterm

java.lang.String searchterm
Constructor Detail

GnutellaQueryPacket

public GnutellaQueryPacket(byte[] payload)
Create a query packet with the given payload. The payload should conform to the format specified by the Gnutella protocol.


GnutellaQueryPacket

public GnutellaQueryPacket(GnutellaGUID guid,
                           int ttl,
                           int hops,
                           byte[] payload)
Create a query packet with the given GUID, TTL, hops, and payload.


GnutellaQueryPacket

public GnutellaQueryPacket(java.lang.String searchterm,
                           int minspeed)
Create a query packet with the given search term and minspeed.

Method Detail

parsePayload

private void parsePayload()

prepareForSend

protected void prepareForSend()
Description copied from class: GnutellaPacket
Implemented by subclasses to prepare for sending

Overrides:
prepareForSend in class GnutellaPacket

toString

public java.lang.String toString()
Overrides:
toString in class GnutellaPacket

debug

public void debug(java.io.PrintStream out)

getSearchTerm

public java.lang.String getSearchTerm()
Return the search term contained in this query packet.


getMinSpeed

public int getMinSpeed()
Return the minimum speed requested by this query packet.