5106 lines · 126.3 KB · C
RawDownload
	PyModule_AddIntConstant(m, "AI_ALL", AI_ALL);#endif#ifdef AI_V4MAPPED_CFG	PyModule_AddIntConstant(m, "AI_V4MAPPED_CFG", AI_V4MAPPED_CFG);#endif#ifdef AI_ADDRCONFIG	PyModule_AddIntConstant(m, "AI_ADDRCONFIG", AI_ADDRCONFIG);#endif#ifdef AI_V4MAPPED	PyModule_AddIntConstant(m, "AI_V4MAPPED", AI_V4MAPPED);#endif#ifdef AI_DEFAULT	PyModule_AddIntConstant(m, "AI_DEFAULT", AI_DEFAULT);#endif#ifdef NI_MAXHOST	PyModule_AddIntConstant(m, "NI_MAXHOST", NI_MAXHOST);#endif#ifdef NI_MAXSERV	PyModule_AddIntConstant(m, "NI_MAXSERV", NI_MAXSERV);#endif#ifdef NI_NOFQDN	PyModule_AddIntConstant(m, "NI_NOFQDN", NI_NOFQDN);#endif#ifdef NI_NUMERICHOST	PyModule_AddIntConstant(m, "NI_NUMERICHOST", NI_NUMERICHOST);#endif#ifdef NI_NAMEREQD	PyModule_AddIntConstant(m, "NI_NAMEREQD", NI_NAMEREQD);#endif#ifdef NI_NUMERICSERV	PyModule_AddIntConstant(m, "NI_NUMERICSERV", NI_NUMERICSERV);#endif#ifdef NI_DGRAM	PyModule_AddIntConstant(m, "NI_DGRAM", NI_DGRAM);#endif 	/* shutdown() parameters */#ifdef SHUT_RD	PyModule_AddIntConstant(m, "SHUT_RD", SHUT_RD);#elif defined(SD_RECEIVE)	PyModule_AddIntConstant(m, "SHUT_RD", SD_RECEIVE);#else	PyModule_AddIntConstant(m, "SHUT_RD", 0);#endif#ifdef SHUT_WR	PyModule_AddIntConstant(m, "SHUT_WR", SHUT_WR);#elif defined(SD_SEND)	PyModule_AddIntConstant(m, "SHUT_WR", SD_SEND);#else	PyModule_AddIntConstant(m, "SHUT_WR", 1);#endif#ifdef SHUT_RDWR	PyModule_AddIntConstant(m, "SHUT_RDWR", SHUT_RDWR);#elif defined(SD_BOTH)	PyModule_AddIntConstant(m, "SHUT_RDWR", SD_BOTH);#else	PyModule_AddIntConstant(m, "SHUT_RDWR", 2);#endif 	/* Initialize gethostbyname lock */#if defined(USE_GETHOSTBYNAME_LOCK) || defined(USE_GETADDRINFO_LOCK)	netdb_lock = PyThread_allocate_lock();#endif}  #ifndef HAVE_INET_PTON /* Simplistic emulation code for inet_pton that only works for IPv4 *//* These are not exposed because they do not set errno properly */ intinet_pton(int af, const char *src, void *dst){	if (af == AF_INET) {		long packed_addr;		packed_addr = inet_addr(src);		if (packed_addr == INADDR_NONE)			return 0;#ifdef PLAN9APE		if(packed_addr == 0)			return 0;#endif		memcpy(dst, &packed_addr, 4);		return 1;	}	/* Should set errno to EAFNOSUPPORT */	return -1;} const char *inet_ntop(int af, const void *src, char *dst, socklen_t size){	if (af == AF_INET) {		struct in_addr packed_addr;		if (size < 16)			/* Should set errno to ENOSPC. */			return NULL;		memcpy(&packed_addr, src, sizeof(packed_addr));		return strncpy(dst, inet_ntoa(packed_addr), size);	}	/* Should set errno to EAFNOSUPPORT */	return NULL;} #endif

Lines 5001–5106 of 5106. Previous lines