Add #ifdefs around code specific to file and pipe protocols