Add buf_set_hdr and start using it to set the TDS header.