void SocketUnixCreateFd(int const fd, TSocket ** const socketPP) { TSocket * socketP; const char * error; if (connected(fd)) { TChannel * channelP; struct abyss_unix_chaninfo * channelInfoP; ChannelUnixCreateFd(fd, &channelP, &channelInfoP, &error); if (!error) SocketCreateChannel(channelP, channelInfoP, &socketP); } else { TChanSwitch * chanSwitchP; ChanSwitchUnixCreateFd(fd, &chanSwitchP, &error); if (!error) SocketCreateChanSwitch(chanSwitchP, &socketP); } if (error) { *socketPP = NULL; xmlrpc_strfree(error); } else *socketPP = socketP; }
static void createSwitchFromOsSocket(TOsSocket const osSocket, TChanSwitch ** const chanSwitchPP, const char ** const errorP) { #ifdef _WIN32 ChanSwitchWinCreateWinsock(osSocket, chanSwitchPP, errorP); #else ChanSwitchUnixCreateFd(osSocket, chanSwitchPP, errorP); #endif }
static void chanSwitchCreateOsSocket(TOsSocket const socketFd, TChanSwitch ** const chanSwitchPP, const char ** const errorP) { #ifdef _WIN32 ChanSwitchWinCreateWinsock(socketFd, chanSwitchPP, errorP); #else ChanSwitchUnixCreateFd(socketFd, chanSwitchPP, errorP); #endif }