wac_network_dns_api.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef NULLSOFT_COMPONENT_WAC_NETWORK_DNS_H
  2. #define NULLSOFT_COMPONENT_WAC_NETWORK_DNS_H
  3. #include "bfc/dispatch.h"
  4. #include "bfc/platform/types.h"
  5. #define API_DNS_AUTODNS ((api_dns *)-1)
  6. enum
  7. {
  8. DNS_RESOLVE_UNRESOLVABLE = -1,
  9. DNS_RESOLVE_SUCCESS = 0,
  10. DNS_RESOLVE_WAIT = 1,
  11. };
  12. enum
  13. {
  14. DNS_REVERSE_UNRESOLVABLE = -1,
  15. DNS_REVERSE_SUCCESS = 0,
  16. DNS_REVERSE_WAIT = 1,
  17. };
  18. struct addrinfo;
  19. class NOVTABLE api_dns : public Dispatchable
  20. {
  21. protected:
  22. api_dns() {}
  23. ~api_dns() {}
  24. public:
  25. DISPATCH_CODES
  26. {
  27. API_DNS_RESOLVE = 11,
  28. API_DNS_REVERSE = 20,
  29. };
  30. int resolve( char *hostname, short port, addrinfo **addr, int sockettype ); // see DNS_RESOLVE_* for return values
  31. };
  32. inline int api_dns::resolve( char *hostname, short port, addrinfo **addr, int sockettype )
  33. {
  34. return _call( API_DNS_RESOLVE, (int)DNS_RESOLVE_UNRESOLVABLE, hostname, port, addr, sockettype );
  35. }
  36. // {F0435E72-5A1A-4d57-A9E2-3FDC421C1010}
  37. static const GUID dnsFactoryGUID =
  38. { 0xf0435e72, 0x5a1a, 0x4d57, { 0xa9, 0xe2, 0x3f, 0xdc, 0x42, 0x1c, 0x10, 0x10 } };
  39. #endif // !NULLSOFT_COMPONENT_WAC_NETWORK_DNS_H