seda.sandStorm.lib.Gnutella
Class GnutellaPongPacket

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

public class GnutellaPongPacket
extends GnutellaPacket

A Gnutella network pong packet.


Field Summary
private  java.net.InetAddress address
           
private static boolean DEBUG
           
private  int numfiles
           
private  int numkb
           
private  int port
           
 
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
GnutellaPongPacket(byte[] payload)
          Create a pong packet with the given payload.
GnutellaPongPacket(GnutellaGUID guid, int port, java.net.InetAddress address, int numfiles, int numkb)
          Create a pong packet with the given port, address, numfiles and numkb.
GnutellaPongPacket(GnutellaGUID guid, int numfiles, int numkb)
          Create a pong packet with the given numfiles and numkb, with the default port and local host address.
GnutellaPongPacket(GnutellaGUID guid, int ttl, int hops, byte[] payload)
          Create a pong packet with the given GUID, TTL, hops, and payload.
 
Method Summary
 java.lang.String getHost()
          Return a string "host:port" represented by this packet.
 java.net.InetAddress getInetAddress()
          Return the address represented by this packet.
 int getNumFiles()
          Return the number of files shared by the machine from which this packet originated.
 int getNumKB()
          Return the number of kilobytes of files shared by the machine from which this packet originated.
 int getPort()
          Return the port represented by this 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

port

private int port

address

private java.net.InetAddress address

numfiles

private int numfiles

numkb

private int numkb
Constructor Detail

GnutellaPongPacket

public GnutellaPongPacket(byte[] payload)
                   throws java.net.UnknownHostException
Create a pong packet with the given payload.

Throws:
java.net.UnknownHostException

GnutellaPongPacket

public GnutellaPongPacket(GnutellaGUID guid,
                          int ttl,
                          int hops,
                          byte[] payload)
                   throws java.net.UnknownHostException
Create a pong packet with the given GUID, TTL, hops, and payload.

Throws:
java.net.UnknownHostException

GnutellaPongPacket

public GnutellaPongPacket(GnutellaGUID guid,
                          int numfiles,
                          int numkb)
                   throws java.net.UnknownHostException
Create a pong packet with the given numfiles and numkb, with the default port and local host address.

Throws:
java.net.UnknownHostException

GnutellaPongPacket

public GnutellaPongPacket(GnutellaGUID guid,
                          int port,
                          java.net.InetAddress address,
                          int numfiles,
                          int numkb)
                   throws java.net.UnknownHostException
Create a pong packet with the given port, address, numfiles and numkb.

Throws:
java.net.UnknownHostException
Method Detail

toString

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

prepareForSend

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

Overrides:
prepareForSend in class GnutellaPacket

parsePayload

private void parsePayload()
                   throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException

getInetAddress

public java.net.InetAddress getInetAddress()
Return the address represented by this packet.


getPort

public int getPort()
Return the port represented by this packet.


getHost

public java.lang.String getHost()
Return a string "host:port" represented by this packet.


getNumFiles

public int getNumFiles()
Return the number of files shared by the machine from which this packet originated.


getNumKB

public int getNumKB()
Return the number of kilobytes of files shared by the machine from which this packet originated.