LimeWire Consolidated API

com.limegroup.gnutella.messages.vendor
Class AbstractVendorMessage

java.lang.Object
  extended by com.limegroup.gnutella.messages.AbstractMessage
      extended by com.limegroup.gnutella.messages.vendor.AbstractVendorMessage
All Implemented Interfaces:
Message, VendorMessage, Comparable<Message>
Direct Known Subclasses:
CapabilitiesVMImpl, ContentRequest, ContentResponse, DHTContactsMessage, HeaderUpdateVendorMessage, HeadPing, HeadPongImpl, HopsFlowVendorMessage, InspectionResponse, LimeACKVendorMessage, MessagesSupportedVendorMessage, OOBProxyControlVendorMessage, PushProxyAcknowledgement, PushProxyRequest, QueryStatusRequest, QueryStatusResponse, ReplyNumberVendorMessage, RoutableGGEPMessage, SimppRequestVM, SimppVM, TCPConnectBackRedirect, TCPConnectBackVendorMessage, UDPConnectBackRedirect, UDPConnectBackVendorMessage, UDPCrawlerPing, UDPCrawlerPong, UpdateRequest, UpdateResponse

public abstract class AbstractVendorMessage
extends AbstractMessage
implements VendorMessage


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.limegroup.gnutella.messages.vendor.VendorMessage
VendorMessage.ControlMessage
 
Nested classes/interfaces inherited from interface com.limegroup.gnutella.messages.Message
Message.MessageCounter, Message.Network
 
Field Summary
 
Fields inherited from interface com.limegroup.gnutella.messages.vendor.VendorMessage
F_ADVANCED_TOGGLE, F_BEAR_VENDOR_ID, F_CAPABILITIES, F_CONTENT_REQ, F_CONTENT_RESP, F_CRAWLER_PING, F_CRAWLER_PONG, F_DHT_CONTACTS, F_GIVE_STATS, F_GTKG_VENDOR_ID, F_HEADER_UPDATE, F_HOPS_FLOW, F_INSPECTION_REQ, F_INSPECTION_RESP, F_LIME_ACK, F_LIME_VENDOR_ID, F_MESSAGES_SUPPORTED, F_NULL_VENDOR_ID, F_OOB_PROXYING_CONTROL, F_PUSH_PROXY_ACK, F_PUSH_PROXY_REQ, F_REPLY_NUMBER, F_SIMPP, F_SIMPP_REQ, F_STATISTICS, F_TCP_CONNECT_BACK, F_UDP_CONNECT_BACK, F_UDP_CONNECT_BACK_REDIR, F_UDP_HEAD_PING, F_UDP_HEAD_PONG, F_UPDATE_REQ, F_UPDATE_RESP, LENGTH_MINUS_PAYLOAD
 
Fields inherited from interface com.limegroup.gnutella.messages.Message
F_PING, F_PING_REPLY, F_PUSH, F_QUERY, F_QUERY_REPLY, F_ROUTE_TABLE_UPDATE, F_UDP_CONNECTION, F_VENDOR_MESSAGE, F_VENDOR_MESSAGE_STABLE
 
Constructor Summary
protected AbstractVendorMessage(byte[] guid, byte ttl, byte hops, byte[] vendorID, int selector, int version, byte[] payload, Message.Network network)
          Constructs a new VendorMessage with data from the network.
protected AbstractVendorMessage(byte[] vendorIDBytes, int selector, int version, byte[] payload)
          Constructs a new VendorMessage with the given data.
protected AbstractVendorMessage(byte[] vendorIDBytes, int selector, int version, byte[] payload, Message.Network network)
          Constructs a new VendorMessage with the given data.
 
Method Summary
 boolean equals(Object other)
           
protected  byte[] getPayload()
          Allows subclasses to make changes gain access to the payload.
 int getVersion()
           
 int hashCode()
           
protected  void writePayload(OutputStream out)
           
protected  void writeVendorPayload(OutputStream out)
           
 
Methods inherited from class com.limegroup.gnutella.messages.AbstractMessage
compareTo, getCreationTime, getFunc, getGUID, getHandlerClass, getHops, getLength, getNetwork, getPriority, getTotalLength, getTTL, hop, isMulticast, isTCP, isUDP, isUnknownNetwork, makeGuid, repOk, setGUID, setHops, setPriority, setTTL, toString, updateLength, write, write, writeQuickly
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.limegroup.gnutella.messages.Message
getCreationTime, getFunc, getGUID, getHandlerClass, getHops, getLength, getNetwork, getPriority, getTotalLength, getTTL, hop, isMulticast, isTCP, isUDP, isUnknownNetwork, setHops, setPriority, setTTL, write, write, writeQuickly
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

AbstractVendorMessage

protected AbstractVendorMessage(byte[] vendorIDBytes,
                                int selector,
                                int version,
                                byte[] payload)
Constructs a new VendorMessage with the given data. Each Vendor Message class delegates to this constructor (or the one also taking a network parameter) to construct new locally generated VMs.

Parameters:
vendorIDBytes - The Vendor ID of this message (bytes).
selector - The selector of the message.
version - The version of this message.
payload - The payload (not including vendorIDBytes, selector, and version.
Throws:
NullPointerException - Thrown if payload or vendorIDBytes are null.

AbstractVendorMessage

protected AbstractVendorMessage(byte[] vendorIDBytes,
                                int selector,
                                int version,
                                byte[] payload,
                                Message.Network network)
Constructs a new VendorMessage with the given data. Each Vendor Message class delegates to this constructor (or the one that doesn't take the network parameter) to construct new locally generated VMs.

Parameters:
vendorIDBytes - The Vendor ID of this message (bytes).
selector - The selector of the message.
version - The version of this message.
payload - The payload (not including vendorIDBytes, selector, and version.
network - The network this VM is to be written on.
Throws:
NullPointerException - Thrown if payload or vendorIDBytes are null.

AbstractVendorMessage

protected AbstractVendorMessage(byte[] guid,
                                byte ttl,
                                byte hops,
                                byte[] vendorID,
                                int selector,
                                int version,
                                byte[] payload,
                                Message.Network network)
                         throws BadPacketException
Constructs a new VendorMessage with data from the network. Primarily built for the convenience of the class Message. Subclasses must extend this (or the above constructor that doesn't takes a network parameter) and use getPayload() to parse the payload and do anything else they need to.

Throws:
BadPacketException
Method Detail

getPayload

protected byte[] getPayload()
Allows subclasses to make changes gain access to the payload. They can: 1) change the contents 2) parse the contents. In general, 1) is discouraged, 2) is necessary. Subclasses CANNOT re-init the payload.


getVersion

public int getVersion()
Specified by:
getVersion in interface VendorMessage

equals

public boolean equals(Object other)
Overrides:
equals in class Object
Returns:
true if the two VMPs have identical signatures - no more, no less. Does not take version into account, but if different versions have different payloads, they'll differ.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

writePayload

protected void writePayload(OutputStream out)
                     throws IOException
Specified by:
writePayload in class AbstractMessage
Throws:
IOException

writeVendorPayload

protected void writeVendorPayload(OutputStream out)
                           throws IOException
Throws:
IOException

LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.