[PATCH v4 18/35] monitor: use dynamic cast in QMP commands