struct hostent * ROKEN_LIB_FUNCTION getipnodebyaddr (const void *src, size_t len, int af, int *error_num) { struct hostent *tmp; tmp = gethostbyaddr (src, len, af); if (tmp == NULL) { switch (h_errno) { case HOST_NOT_FOUND : case TRY_AGAIN : case NO_RECOVERY : *error_num = h_errno; break; case NO_DATA : *error_num = NO_ADDRESS; break; default : *error_num = NO_RECOVERY; break; } return NULL; } tmp = copyhostent (tmp); if (tmp == NULL) { *error_num = TRY_AGAIN; return NULL; } return tmp; }
ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL getipnodebyname (const char *name, int af, int flags, int *error_num) { struct hostent *tmp; #ifdef HAVE_GETHOSTBYNAME2 tmp = gethostbyname2 (name, af); #else if (af != AF_INET) { *error_num = NO_ADDRESS; return NULL; } tmp = gethostbyname (name); #endif if (tmp == NULL) { switch (h_errno) { case HOST_NOT_FOUND : case TRY_AGAIN : case NO_RECOVERY : *error_num = h_errno; break; case NO_DATA : *error_num = NO_ADDRESS; break; default : *error_num = NO_RECOVERY; break; } return NULL; } tmp = copyhostent (tmp); if (tmp == NULL) { *error_num = TRY_AGAIN; return NULL; } return tmp; }