FileDocCategorySizeDatePackage
VersionCheckClientUDPCodecs.javaAPI DocAzureus 3.0.3.43139Tue Nov 14 14:54:38 GMT 2006com.aelitis.azureus.core.versioncheck

VersionCheckClientUDPCodecs

public class VersionCheckClientUDPCodecs extends Object

Fields Summary
public static final int
ACT_VERSION_REQUEST
public static final int
ACT_VERSION_REPLY
private static boolean
registered
Constructors Summary
Methods Summary
public static voidregisterCodecs()

	
	  
	
	
		if ( registered ){
			
			return;
		}
	
		registered	= true;
		
		PRUDPPacketReplyDecoder	reply_decoder =
			new PRUDPPacketReplyDecoder()
			{
				public PRUDPPacketReply
				decode(
					PRUDPPacketHandler	handler,
					DataInputStream		is,
					int					action,
					int					transaction_id )
				
					throws IOException
				{
					switch( action ){
					
						case ACT_VERSION_REPLY:
						{
							return( new VersionCheckClientUDPReply(is, transaction_id ));
						}
						default:
						{
							throw( new IOException( "Unrecognised action '" + action + "'" ));
						}
					}
				}
			};
					
		Map	reply_decoders = new HashMap();
		
		reply_decoders.put( new Integer( ACT_VERSION_REPLY ), reply_decoder );
		
		PRUDPPacketReply.registerDecoders( reply_decoders );
		
		PRUDPPacketRequestDecoder	request_decoder =
			new PRUDPPacketRequestDecoder()
			{
				public PRUDPPacketRequest
				decode(
					PRUDPPacketHandler	handler,
					DataInputStream		is,
					long				connection_id,
					int					action,
					int					transaction_id )
				
					throws IOException
				{
					switch( action ){
						case ACT_VERSION_REQUEST:
						{
							return( new VersionCheckClientUDPRequest(is, connection_id, transaction_id ));
						}
						default:
						{
							throw( new IOException( "unsupported request type"));
						}
					}
				}
			};

		Map	request_decoders = new HashMap();
		
		request_decoders.put( new Integer( ACT_VERSION_REQUEST ), request_decoder );
		
		PRUDPPacketRequest.registerDecoders( request_decoders );