libfreerdp-rail: refactor and update RAIL code