A complete characterization of local martingales which are functions of Brownian motion and its maximum