Added packet loss measurements

Made a number of changes so that we are now getting packet loss
statistics. These changes largely revolved around running all of
the measurements from a c program using libcurl rather than using
curl