resolve_host moved to the more appropriate place;

v0.5.xx
Alexander Vdolainen 10 years ago
parent 38279f8769
commit 6e18271550

@ -162,25 +162,8 @@ static long __cmp_ulong(const void *a, const void *b)
return *(ulong_t *)a - *(ulong_t *)b;
}
static int __resolvehost(const char *hostname, char *buf, int buf_len,
struct hostent **rhp)
{
struct hostent *hostbuf = malloc(sizeof(struct hostent));
struct hostent *hp = *rhp = NULL;
int herr = 0, hres = 0;
if(!hostbuf) return NO_ADDRESS;
hres = gethostbyname_r(hostname, hostbuf,
buf, buf_len, &hp, &herr);
if (!hp) return NO_ADDRESS;
if(hres) return NO_ADDRESS;
*rhp = hp;
return NETDB_SUCCESS;
}
extern int __resolvehost(const char *hostname, char *buf, int buf_len,
struct hostent **rhp);
static void __destroy_rpc_list_tree(usrtc_t *tree)
{

@ -46,6 +46,27 @@ char *__generate_uuid(void)
return uuidc;
}
/* networking helpers */
int __resolvehost(const char *hostname, char *buf, int buf_len,
struct hostent **rhp)
{
struct hostent *hostbuf = malloc(sizeof(struct hostent));
struct hostent *hp = *rhp = NULL;
int herr = 0, hres = 0;
if(!hostbuf) return NO_ADDRESS;
hres = gethostbyname_r(hostname, hostbuf,
buf, buf_len, &hp, &herr);
if (!hp) return NO_ADDRESS;
if(hres) return NO_ADDRESS;
*rhp = hp;
return NETDB_SUCCESS;
}
/* sexp helpers */
int sexp_list_car(sexp_t *expr, sexp_t **sx)
{

Loading…
Cancel
Save