Measurement of prompt D0, D+, D*+, and D+s production in p-Pb collisions at sqrt(s_NN) = 5.02 TeV