Multiphoton scattering theory and generalized master equations