xrdp-ng: stream utils refactoring