FileDocCategorySizeDatePackage
DHTUDPPacketReplyFindValue.javaAPI DocAzureus 3.0.3.44694Tue Jan 02 22:13:38 GMT 2007com.aelitis.azureus.core.dht.transport.udp.impl

DHTUDPPacketReplyFindValue

public class DHTUDPPacketReplyFindValue extends DHTUDPPacketReply
author
parg

Fields Summary
public static final int
DHT_FIND_VALUE_HEADER_SIZE
public static final int
DHT_FIND_VALUE_TV_HEADER_SIZE
private com.aelitis.azureus.core.dht.transport.DHTTransportContact[]
contacts
private com.aelitis.azureus.core.dht.transport.DHTTransportValue[]
values
private boolean
has_continuation
private byte
diversification_type
Constructors Summary
public DHTUDPPacketReplyFindValue(DHTTransportUDPImpl transport, int trans_id, long conn_id, com.aelitis.azureus.core.dht.transport.DHTTransportContact local_contact, com.aelitis.azureus.core.dht.transport.DHTTransportContact remote_contact)

	
	
	
				
								
							
				
				 
	
		super( transport, DHTUDPPacketHelper.ACT_REPLY_FIND_VALUE, trans_id, conn_id, local_contact, remote_contact );
	
protected DHTUDPPacketReplyFindValue(com.aelitis.azureus.core.dht.transport.udp.impl.packethandler.DHTUDPPacketNetworkHandler network_handler, DataInputStream is, int trans_id)

		super( network_handler, is, DHTUDPPacketHelper.ACT_REPLY_FIND_VALUE, trans_id );
		
		if ( getProtocolVersion() >= DHTTransportUDP.PROTOCOL_VERSION_DIV_AND_CONT ){
						
			has_continuation	= is.readBoolean();
		}
		
		boolean	is_value = is.readBoolean();
		
		if ( is_value ){
			
			if ( getProtocolVersion() >= DHTTransportUDP.PROTOCOL_VERSION_DIV_AND_CONT ){
								
				diversification_type	= is.readByte();
			}

			values = DHTUDPUtils.deserialiseTransportValues( this, is, 0 );
			
		}else{
			
			contacts = DHTUDPUtils.deserialiseContacts( getTransport(), is );
			
			if ( getProtocolVersion() >= DHTTransportUDP.PROTOCOL_VERSION_VIVALDI_FINDVALUE ){

				DHTUDPUtils.deserialiseVivaldi( this, is );
			}
		}
	
Methods Summary
protected com.aelitis.azureus.core.dht.transport.DHTTransportContact[]getContacts()

		return( contacts );
	
protected bytegetDiversificationType()

		return( diversification_type );
	
public java.lang.StringgetString()

		return( super.getString() + ",contacts=" + (contacts==null?"null":(""+contacts.length ))); 
	
protected com.aelitis.azureus.core.dht.transport.DHTTransportValue[]getValues()

		return( values );
	
public booleanhasContinuation()

		return( has_continuation );
	
public voidserialise(java.io.DataOutputStream os)

		super.serialise(os);
		
		if ( getProtocolVersion() >= DHTTransportUDP.PROTOCOL_VERSION_DIV_AND_CONT ){
			
			os.writeBoolean( has_continuation );
		}
		
		os.writeBoolean( values != null );
		
		if ( values == null ){
			
			DHTUDPUtils.serialiseContacts( os, contacts );
			
			if ( getProtocolVersion() >= DHTTransportUDP.PROTOCOL_VERSION_VIVALDI_FINDVALUE ){

				DHTUDPUtils.serialiseVivaldi( this, os );
			}
		}else{
			
			if ( getProtocolVersion() >= DHTTransportUDP.PROTOCOL_VERSION_DIV_AND_CONT ){
								
				os.writeByte( diversification_type );
			}

			// values returned to a caller are adjusted by - skew
			
			try{
				DHTUDPUtils.serialiseTransportValues( this, os, values, -getClockSkew());
				
			}catch( DHTTransportException e ){
				
				throw( new IOException( e.getMessage()));
			}
		}
	
protected voidsetContacts(com.aelitis.azureus.core.dht.transport.DHTTransportContact[] _contacts)

		contacts	= _contacts;
	
protected voidsetValues(com.aelitis.azureus.core.dht.transport.DHTTransportValue[] _values, byte _diversification_type, boolean _has_continuation)

		has_continuation		= _has_continuation;
		diversification_type	= _diversification_type;
		values					= _values;