Structure of a proton-powered molecular motor that drives protein transport and gliding motility