You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dns_wrapper.h 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* This file is part of Netsukuku
  2. * (c) Copyright 2005 Andrea Lo Pumo aka AlpT <alpt@freaknet.org>
  3. *
  4. * This source code is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as published
  6. * by the Free Software Foundation; either version 2 of the License,
  7. * or (at your option) any later version.
  8. *
  9. * This source code is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. * Please refer to the GNU Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Public License along with
  15. * this source code; if not, write to:
  16. * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18. #ifndef DNS_WRAPPER_H
  19. #define DNS_WRAPPER_H
  20. #define DNS_WRAPPER_PORT 53
  21. #define MAX_DNS_PKT_SZ 512
  22. #define MIN_PKT_SZ 7
  23. /* DNS wrapper resolver api */
  24. void resolver_process(const char *question, unsigned question_length,
  25. char *answer, unsigned *answer_length,
  26. int (*callback) (const char *name, uint32_t * ip));
  27. /*
  28. * dns_exec_pkt_argv is the struct passed to dns_exec_pkt() as argument
  29. */
  30. struct dns_exec_pkt_argv {
  31. char *rpkt; /* Received dns query pkt */
  32. ssize_t rpkt_sz;
  33. int sk;
  34. struct sockaddr from;
  35. socklen_t from_len;
  36. };
  37. pthread_mutex_t dns_exec_lock;
  38. /* * * Functions declarations * * */
  39. void *dns_wrapper_thread(void *null);
  40. #endif /*DNS_WRAPPER_H */