We introduce a novel approach to routing based on the so called pairwise packet delivery ratio matrix whose entries represent the probability that a given user decodes the packet transmitted by any other user. We show that this leads naturally to a model in which routing algorithms are described by the evolution of a Markov chain enabling the definition of deliverability criteria in terms of absorbing states. We further introduce optimal routing protocols by selecting the routing matrix from a convex polygon containing all feasible routing matrices. The criteria of optimality include minimization of the packet error probability for a given delay bound and the minimization of the average packet delay. These metrics are correspondingly meaningful in the context of real time transmissions - e.g., voice and/or video - and delay insensitive data - e.g., file transfers.