gen_ho.c revision 9525b14bcdeb5b5f6f95ab27c2f48f18bd2ec829
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996,1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#endif /* LIBC_SCCS and not lint */
/* Imports */
#include "port_before.h"
#include <errno.h>
#include <stdlib.h>
#include <netdb.h>
#include <resolv.h>
#include <stdio.h>
#include <string.h>
#include <isc/memcluster.h>
#include <irs.h>
#include "port_after.h"
#include "irs_p.h"
#include "gen_p.h"
/* Definitions */
struct pvt {
struct __res_state * res;
void (*free_res)(void *);
};
/* Forwards */
int af);
struct __res_state *res,
void (*free_res)(void *));
/* Exports */
struct irs_ho *
return (NULL);
}
return (NULL);
}
return (ho);
}
/* Methods. */
static void
}
static struct hostent *
int therrno = NETDB_INTERNAL;
int softerror = 0;
return (NULL);
errno = 0;
return (rval);
if (softerror == 0 &&
softerror = 1;
}
continue;
/*
* The value TRY_AGAIN can mean that the service
* is not available, or just that this particular name
* cannot be resolved now. We use the errno ECONNREFUSED
* to distinguish. If a lookup sets that errno when
* H_ERRNO is TRY_AGAIN, we continue to try other lookup
* functions, otherwise we return the TRY_AGAIN error.
*/
break;
}
return (NULL);
}
static struct hostent *
int therrno = NETDB_INTERNAL;
int softerror = 0;
return (NULL);
errno = 0;
return (rval);
if (softerror == 0 &&
softerror = 1;
}
continue;
/*
* See the comments in ho_byname() explaining
* the interpretation of TRY_AGAIN and ECONNREFUSED.
*/
break;
}
return (NULL);
}
static struct hostent *
int therrno = NETDB_INTERNAL;
int softerror = 0;
return (NULL);
errno = 0;
return (rval);
if (softerror == 0 &&
softerror = 1;
}
continue;
/*
* See the comments in ho_byname() explaining
* the interpretation of TRY_AGAIN and ECONNREFUSED.
*/
break;
}
return (NULL);
}
static struct hostent *
if (rval)
return (rval);
break;
}
}
return (NULL);
}
static void
}
}
static void
}
}
static struct __res_state *
struct __res_state *res;
if (!res) {
return (NULL);
}
}
}
static void
void (*free_res)(void *)) {
}
}
}
static struct addrinfo *
{
int therrno = NETDB_INTERNAL;
int softerror = 0;
return (NULL);
errno = 0;
continue;
return (rval);
if (softerror == 0 &&
softerror = 1;
}
continue;
/*
* See the comments in ho_byname() explaining
* the interpretation of TRY_AGAIN and ECONNREFUSED.
*/
errno != ECONNREFUSED)
break;
}
return (NULL);
}
static int
return (-1);
return (-1);
return (0);
}
/*! \file */