This is a step towards making replication a library, such that the 5.6 rpl-lib can be plugged into the 5.5 core [WL#5675]. We replace function arguments of type THD* by MYSQL_THD* for all functions the Binlog class. This is needed because THD is not stable. We also add functions to core that read any information that Binlog needs from MYSQL_THD objects. The sub-task of removing THD from Binlog::log_statement is expected to be relatively big, and has will therefore be done in a separate worklog: WL#5792.
