resolv.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /**
  2. * \addtogroup resolv
  3. * @{
  4. */
  5. /**
  6. * \file
  7. * DNS resolver code header file.
  8. * \author Adam Dunkels <adam@dunkels.com>
  9. */
  10. /*
  11. * Copyright (c) 2002-2003, Adam Dunkels.
  12. * All rights reserved.
  13. *
  14. * Redistribution and use in source and binary forms, with or without
  15. * modification, are permitted provided that the following conditions
  16. * are met:
  17. * 1. Redistributions of source code must retain the above copyright
  18. * notice, this list of conditions and the following disclaimer.
  19. * 2. Redistributions in binary form must reproduce the above copyright
  20. * notice, this list of conditions and the following disclaimer in the
  21. * documentation and/or other materials provided with the distribution.
  22. * 3. The name of the author may not be used to endorse or promote
  23. * products derived from this software without specific prior
  24. * written permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
  27. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  28. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  30. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  32. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  33. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  34. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  35. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  36. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  37. *
  38. * This file is part of the uIP TCP/IP stack.
  39. *
  40. * $Id: resolv.h,v 1.4 2006/06/11 21:46:37 adam Exp $
  41. *
  42. */
  43. #ifndef __RESOLV_H__
  44. #define __RESOLV_H__
  45. typedef int uip_udp_appstate_t;
  46. void resolv_appcall(void);
  47. #define UIP_UDP_APPCALL resolv_appcall
  48. #include "uipopt.h"
  49. /**
  50. * Callback function which is called when a hostname is found.
  51. *
  52. * This function must be implemented by the module that uses the DNS
  53. * resolver. It is called when a hostname is found, or when a hostname
  54. * was not found.
  55. *
  56. * \param name A pointer to the name that was looked up. \param
  57. * ipaddr A pointer to a 4-byte array containing the IP address of the
  58. * hostname, or NULL if the hostname could not be found.
  59. */
  60. void resolv_found(char *name, u16_t *ipaddr);
  61. /* Functions. */
  62. void resolv_conf(u16_t *dnsserver);
  63. u16_t *resolv_getserver(void);
  64. void resolv_init(void);
  65. u16_t *resolv_lookup(char *name);
  66. void resolv_query(char *name);
  67. #endif /* __RESOLV_H__ */
  68. /** @} */