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; return *(ulong_t *)a - *(ulong_t *)b;
} }
static int __resolvehost(const char *hostname, char *buf, int buf_len, extern int __resolvehost(const char *hostname, char *buf, int buf_len,
struct hostent **rhp) 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;
}
static void __destroy_rpc_list_tree(usrtc_t *tree) static void __destroy_rpc_list_tree(usrtc_t *tree)
{ {

@ -46,6 +46,27 @@ char *__generate_uuid(void)
return uuidc; 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 */ /* sexp helpers */
int sexp_list_car(sexp_t *expr, sexp_t **sx) int sexp_list_car(sexp_t *expr, sexp_t **sx)
{ {

Loading…
Cancel
Save