dns.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * dns.h
  3. * stuff used by dns.c
  4. *
  5. */
  6. #ifndef _EGG_DNS_H
  7. #define _EGG_DNS_H
  8. #include "types.h"
  9. #include "dcc.h"
  10. /* Flags for dns_type
  11. */
  12. #define RES_HOSTBYIP 1 /* hostname to IP address */
  13. #define RES_IPBYHOST 2 /* IP address to hostname */
  14. struct dns_info {
  15. struct dcc_table *type; /* type of the dcc table we are making the
  16. lookup for */
  17. in_addr_t ip; /* IP address */
  18. int ibuf; /* temporary buffer for one integer */
  19. void (*dns_success)(int); /* is called if the dns request succeeds */
  20. void (*dns_failure)(int); /* is called if it fails */
  21. char *host; /* hostname */
  22. char *cbuf; /* temporary buffer. Memory will be free'd
  23. as soon as dns_info is free'd */
  24. char *cptr; /* temporary pointer */
  25. char dns_type; /* lookup type, e.g. RES_HOSTBYIP */
  26. };
  27. typedef struct {
  28. char *name;
  29. void (*event)(in_addr_t, char *, int, void *);
  30. } devent_type;
  31. typedef struct {
  32. char *proc; /* Tcl proc */
  33. char *paras; /* Additional parameters */
  34. } devent_tclinfo_t;
  35. typedef struct devent_str {
  36. struct devent_str *next; /* Pointer to next dns_event */
  37. devent_type *type;
  38. union {
  39. in_addr_t ip_addr; /* IP address */
  40. char *hostname; /* Hostname */
  41. } res_data;
  42. void *other; /* Data specific to the event type */
  43. u_8bit_t lookup; /* RES_IPBYHOST or RES_HOSTBYIP */
  44. } devent_t;
  45. void call_hostbyip(in_addr_t, char *, int);
  46. void call_ipbyhost(char *, in_addr_t, int);
  47. void dcc_dnshostbyip(in_addr_t);
  48. void dcc_dnsipbyhost(char *);
  49. #endif /* _EGG_DNS_H */