dns_func.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2013 [email protected]
  5. *
  6. * Permission to use, copy, modify, and distribute this software for any
  7. * purpose with or without fee is hereby granted, provided that the above
  8. * copyright notice and this permission notice appear in all copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  11. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  13. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /*
  19. * DNS wrappers
  20. */
  21. /*
  22. * History:
  23. * --------
  24. * 2013-03 initial version (marius)
  25. */
  26. #include "dns_func.h"
  27. #include <netinet/in.h>
  28. #include <resolv.h>
  29. #include <sys/types.h>
  30. #include <netdb.h>
  31. struct hostent;
  32. struct dns_func_t dns_func = {
  33. res_init,
  34. res_search,
  35. gethostbyname,
  36. #ifdef HAVE_GETHOSTBYNAME2
  37. gethostbyname2
  38. #else
  39. NULL
  40. #endif
  41. };
  42. void load_dnsfunc(struct dns_func_t *d) {
  43. dns_func.sr_res_init = d->sr_res_init;
  44. dns_func.sr_res_search = d->sr_res_search;
  45. dns_func.sr_gethostbyname = d->sr_gethostbyname;
  46. dns_func.sr_gethostbyname2 = d->sr_gethostbyname2;
  47. }