A cargo vessel had been struck by a projectile near Oman, as Iran says all ships must pass with its permission.