@Override
	public void decode(final ByteBuffer buf, final int available, final StringBuilder log) throws Exception
	{
		// Decode reply to ListServices
		final int count = buf.getShort();
		if (log != null)
		{
			log.append("ListServices Reply\n");
			log.append("UINT count      : ").append(count).append("\n");
		}
		services = new Service[count];
		for (int i=0; i<count; ++i)
		{
			final short type = buf.getShort();
			final short length = buf.getShort();
			final short version = buf.getShort();
			final short flags = buf.getShort();
			final byte[] name = new byte[length - 4];
			buf.get(name);
			
			final Service service = new Service(type, length, version, flags, name);
			if (log != null)
				log.append("Service ").append(i).append(":\n").append(service.toString()).append("\n");
			services[i] = service;
		}
	}