dns.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. void (*dns_success)(int); /* is called if the dns request succeeds */
  16. void (*dns_failure)(int); /* is called if it fails */
  17. char *host; /* hostname */
  18. char *cbuf; /* temporary buffer. Memory will be free'd
  19. as soon as dns_info is free'd */
  20. char *cptr; /* temporary pointer */
  21. IP ip; /* IP address */
  22. int ibuf; /* temporary buffer for one integer */
  23. char dns_type; /* lookup type, e.g. RES_HOSTBYIP */
  24. struct dcc_table *type; /* type of the dcc table we are making the
  25. lookup for */
  26. };
  27. typedef struct {
  28. char *name;
  29. void (*event)(IP, 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. u_8bit_t lookup; /* RES_IPBYHOST or RES_HOSTBYIP */
  39. union {
  40. IP ip_addr; /* IP address */
  41. char *hostname; /* Hostname */
  42. } res_data;
  43. void *other; /* Data specific to the event type */
  44. } devent_t;
  45. void block_dns_hostbyip(IP);
  46. void block_dns_ipbyhost(char *);
  47. void call_hostbyip(IP, char *, int);
  48. void call_ipbyhost(char *, IP, int);
  49. void dcc_dnshostbyip(IP);
  50. void dcc_dnsipbyhost(char *);
  51. #endif /* _EGG_DNS_H */