Residence times and other functionals of reflected Brownian motion.