This paper is mainly devoted to the determination of the travel time of a
photon as a function of the positions of the emitter and the receiver in a
large class of static, spherically symmetric spacetimes. Such a function -
often called time transfer function - is of crucial interest for testing metric
theories of gravity in the solar system. Until very recently, this function was
known only up to the second order in the Newtonian gravitational constant G
for a 3-parameter family of static, spherically symmetric metrics generalizing
the Schwarzschild metric. We present here two procedures enabling to determine
- at least in principle - the time transfer function at any order of
approximation when the components of the metric are expressible in power series
of the Schwarzschild radius of the central body divided by the radial
coordinate. These procedures exclusively work for light rays which may be
described as perturbations in power series in G of a Minkowskian null
geodesic passing through the positions of the emitter and the receiver. It is
shown that the two methodologies lead to the same expression for the time
transfer function up to the third order in G. The second procedure presents
the advantage of exclusively needing elementary integrations which may be
performed with any symbolic computer program whatever the order of
approximation. The vector functions characterizing the direction of light
propagation at the points of emission and reception are derived up to the third
order in G. The relevance of the third order terms in the time transfer
function is briefly discussed for some solar system experiments.