Abstracted out parts of tf_recv in preparation for tf_recv_file. Also move a define from .c to .h