FileDocCategorySizeDatePackage
DHTUDPPacketReplyError.javaAPI DocAzureus 3.0.3.43757Fri Mar 03 10:26:48 GMT 2006com.aelitis.azureus.core.dht.transport.udp.impl

DHTUDPPacketReplyError

public class DHTUDPPacketReplyError extends DHTUDPPacketReply
author
parg

Fields Summary
public static final int
ET_UNKNOWN
public static final int
ET_ORIGINATOR_ADDRESS_WRONG
public static final int
ET_KEY_BLOCKED
private int
error_type
private InetSocketAddress
originator_address
private byte[]
key_block_request
private byte[]
key_block_signature
Constructors Summary
public DHTUDPPacketReplyError(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_ERROR, trans_id, conn_id, local_contact, remote_contact );
	
protected DHTUDPPacketReplyError(com.aelitis.azureus.core.dht.transport.udp.impl.packethandler.DHTUDPPacketNetworkHandler network_handler, DataInputStream is, int trans_id)

		super( network_handler, is, DHTUDPPacketHelper.ACT_REPLY_ERROR, trans_id );
		
		error_type = is.readInt();
		
		if ( error_type == ET_ORIGINATOR_ADDRESS_WRONG ){
			
			originator_address	= DHTUDPUtils.deserialiseAddress( is );
			
		}else if( error_type == ET_KEY_BLOCKED ){
			
			key_block_request	= DHTUDPUtils.deserialiseByteArray( is, 255 );
			key_block_signature = DHTUDPUtils.deserialiseByteArray( is, 65535 );
		}
	
Methods Summary
protected intgetErrorType()

		return( error_type );
	
protected byte[]getKeyBlockRequest()

		return( key_block_request );
	
protected byte[]getKeyBlockSignature()

   		return( key_block_signature );
   	
protected java.net.InetSocketAddressgetOriginatingAddress()

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

		super.serialise(os);
	
		os.writeInt( error_type );
		
		if ( error_type == ET_ORIGINATOR_ADDRESS_WRONG ){

			try{
				DHTUDPUtils.serialiseAddress( os, originator_address );
				
			}catch( DHTTransportException e ){
				
				Debug.printStackTrace( e );
				
				throw( new IOException( e.getMessage()));
			}
		}else if( error_type == ET_KEY_BLOCKED ){
			
			DHTUDPUtils.serialiseByteArray( os, key_block_request, 255 );
			DHTUDPUtils.serialiseByteArray( os, key_block_signature, 65535 );
		}
	
protected voidsetErrorType(int error)

		error_type	= error;
	
protected voidsetKeyBlockDetails(byte[] kbr, byte[] sig)

		key_block_request	= kbr;
		key_block_signature = sig;
	
protected voidsetOriginatingAddress(java.net.InetSocketAddress a)

		originator_address = a;