registerCodecs();
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_NAT_REPLY:
{
return( new NetworkAdminNATUDPReply(is, transaction_id ));
}
default:
{
throw( new IOException( "Unrecognised action '" + action + "'" ));
}
}
}
};
Map reply_decoders = new HashMap();
reply_decoders.put( new Integer( ACT_NAT_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_NAT_REQUEST:
{
return( new NetworkAdminNATUDPRequest(is, connection_id, transaction_id ));
}
default:
{
throw( new IOException( "unsupported request type"));
}
}
}
};
Map request_decoders = new HashMap();
request_decoders.put( new Integer( ACT_NAT_REQUEST ), request_decoder );
PRUDPPacketRequest.registerDecoders( request_decoders );