|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object seda.sandStorm.lib.Gnutella.GnutellaPacket
public abstract class GnutellaPacket
This is the base class for all Gnutella network packets.
Field Summary | |
---|---|
private static boolean |
DEBUG
|
protected int |
function
|
protected GnutellaConnection |
gc
|
protected GnutellaGUID |
guid
|
int |
hops
|
static int |
NUM_ALLOC
|
protected byte[] |
payload
|
protected int |
payload_length
|
int |
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 | |
---|---|
protected |
GnutellaPacket(GnutellaGUID guid,
int function,
byte[] payload)
|
protected |
GnutellaPacket(GnutellaGUID guid,
int function,
int ttl,
int hops,
byte[] payload)
|
protected |
GnutellaPacket(int function,
byte[] payload)
|
Method Summary | |
---|---|
void |
finalize()
|
(package private) BufferElement |
getBuffer()
Render the packet as a BufferElement which can be pushed to an aSocket connection. |
GnutellaConnection |
getConnection()
Return the GnutellaConnection from which this packet arrived. |
GnutellaGUID |
getGUID()
Return the GUID associated with this packet. |
int |
getSize()
|
protected void |
prepareForSend()
Implemented by subclasses to prepare for sending |
protected static int |
readLEInt(byte[] barr,
int offset)
|
protected static int |
readLEShort(byte[] barr,
int offset)
|
(package private) void |
setConnection(GnutellaConnection gc)
Used by GnutellaServer when creating a new packet. |
java.lang.String |
toString()
|
protected static void |
writeLEInt(int i,
byte[] barr,
int offset)
|
protected static void |
writeLEShort(int i,
byte[] barr,
int offset)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final boolean DEBUG
public static int NUM_ALLOC
protected GnutellaConnection gc
protected GnutellaGUID guid
protected int function
public int ttl
public int hops
protected int payload_length
protected byte[] payload
Constructor Detail |
---|
protected GnutellaPacket(GnutellaGUID guid, int function, int ttl, int hops, byte[] payload)
protected GnutellaPacket(int function, byte[] payload)
protected GnutellaPacket(GnutellaGUID guid, int function, byte[] payload)
Method Detail |
---|
public void finalize()
finalize
in class java.lang.Object
void setConnection(GnutellaConnection gc)
public GnutellaConnection getConnection()
public GnutellaGUID getGUID()
protected void prepareForSend()
BufferElement getBuffer()
public int getSize()
protected static void writeLEInt(int i, byte[] barr, int offset)
protected static int readLEInt(byte[] barr, int offset)
protected static void writeLEShort(int i, byte[] barr, int offset)
protected static int readLEShort(byte[] barr, int offset)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |