@Override
    public void decode(final ByteBuffer buf, final int available, final StringBuilder log) throws Exception
    {
    	final byte service_code = buf.get();
    	final CNService reply = CNService.forCode(service_code);
    	if (reply == null)
    		throw new Exception("Received reply with unknown service code 0x" + Integer.toHexString(service_code));
    	if (! reply.isReply())
    		throw new Exception("Expected reply, got " + reply);
    	
    	final int reserved = buf.get();
    	status = buf.get();
    	final int ext_status_size = buf.get();
		ext_status = new int[ext_status_size];
		for (int i=0; i<ext_status_size; ++i)
			ext_status[i] = buf.getShort();
    	
    	//  Followed by data...
    	if (log != null)
        {
        	log.append("MR Response\n");
        	log.append("USINT service           : ").append(reply).append("\n");
        	log.append("USINT reserved          : 0x").append(Integer.toHexString(reserved)).append("\n");
        	log.append("USINT status            : 0x").append(Integer.toHexString(status)).append(" (").append(decodeStatus()).append(")\n");
        	log.append("USINT ext. stat. size   : 0x").append(Integer.toHexString(ext_status_size)).append("\n");
        	for (int ext : ext_status)
            	log.append("USINT ext status        : 0x").append(Integer.toHexString(ext)).append(" (").append(decodeExtendedStatus(ext)).append(")\n");
        }
        final CNService expected_reply = service.getReply();
        if (expected_reply != null  &&  expected_reply!= reply)
            throw new Exception("Expected " + expected_reply + ", got " + reply);
    	
    	body.decode(buf, available - 4 - 2*ext_status_size, log);
    }