Factor out XDR en/decoding