1
0

dns_srv.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * dns_srv.h
  3. *
  4. */
  5. #ifndef DNS_SRV_H_
  6. #define DNS_SRV_H_
  7. #ifndef NO_DNS
  8. #include "types.h"
  9. typedef struct
  10. {
  11. uint32_t random_weight;
  12. uint16_t priority;
  13. uint16_t weight;
  14. char serverName[260];
  15. } kms_server_dns_t, *kms_server_dns_ptr;
  16. typedef struct
  17. {
  18. uint16_t priority;
  19. uint16_t weight;
  20. uint16_t port;
  21. unsigned char name[1];
  22. } dns_srv_record_t, *dns_srv_record_ptr;
  23. #if __OpenBSD__
  24. typedef enum __ns_type {
  25. ns_t_invalid = 0, /*%< Cookie. */
  26. ns_t_a = 1, /*%< Host address. */
  27. ns_t_ns = 2, /*%< Authoritative server. */
  28. ns_t_md = 3, /*%< Mail destination. */
  29. ns_t_mf = 4, /*%< Mail forwarder. */
  30. ns_t_cname = 5, /*%< Canonical name. */
  31. ns_t_soa = 6, /*%< Start of authority zone. */
  32. ns_t_mb = 7, /*%< Mailbox domain name. */
  33. ns_t_mg = 8, /*%< Mail group member. */
  34. ns_t_mr = 9, /*%< Mail rename name. */
  35. ns_t_null = 10, /*%< Null resource record. */
  36. ns_t_wks = 11, /*%< Well known service. */
  37. ns_t_ptr = 12, /*%< Domain name pointer. */
  38. ns_t_hinfo = 13, /*%< Host information. */
  39. ns_t_minfo = 14, /*%< Mailbox information. */
  40. ns_t_mx = 15, /*%< Mail routing information. */
  41. ns_t_txt = 16, /*%< Text strings. */
  42. ns_t_rp = 17, /*%< Responsible person. */
  43. ns_t_afsdb = 18, /*%< AFS cell database. */
  44. ns_t_x25 = 19, /*%< X_25 calling address. */
  45. ns_t_isdn = 20, /*%< ISDN calling address. */
  46. ns_t_rt = 21, /*%< Router. */
  47. ns_t_nsap = 22, /*%< NSAP address. */
  48. ns_t_nsap_ptr = 23, /*%< Reverse NSAP lookup (deprecated). */
  49. ns_t_sig = 24, /*%< Security signature. */
  50. ns_t_key = 25, /*%< Security key. */
  51. ns_t_px = 26, /*%< X.400 mail mapping. */
  52. ns_t_gpos = 27, /*%< Geographical position (withdrawn). */
  53. ns_t_aaaa = 28, /*%< Ip6 Address. */
  54. ns_t_loc = 29, /*%< Location Information. */
  55. ns_t_nxt = 30, /*%< Next domain (security). */
  56. ns_t_eid = 31, /*%< Endpoint identifier. */
  57. ns_t_nimloc = 32, /*%< Nimrod Locator. */
  58. ns_t_srv = 33, /*%< Server Selection. */
  59. ns_t_atma = 34, /*%< ATM Address */
  60. ns_t_naptr = 35, /*%< Naming Authority PoinTeR */
  61. ns_t_kx = 36, /*%< Key Exchange */
  62. ns_t_cert = 37, /*%< Certification record */
  63. ns_t_a6 = 38, /*%< IPv6 address (deprecated, use ns_t_aaaa) */
  64. ns_t_dname = 39, /*%< Non-terminal DNAME (for IPv6) */
  65. ns_t_sink = 40, /*%< Kitchen sink (experimentatl) */
  66. ns_t_opt = 41, /*%< EDNS0 option (meta-RR) */
  67. ns_t_apl = 42, /*%< Address prefix list (RFC3123) */
  68. ns_t_tkey = 249, /*%< Transaction key */
  69. ns_t_tsig = 250, /*%< Transaction signature. */
  70. ns_t_ixfr = 251, /*%< Incremental zone transfer. */
  71. ns_t_axfr = 252, /*%< Transfer zone of authority. */
  72. ns_t_mailb = 253, /*%< Transfer mailbox records. */
  73. ns_t_maila = 254, /*%< Transfer mail agent records. */
  74. ns_t_any = 255, /*%< Wildcard match. */
  75. ns_t_zxfr = 256, /*%< BIND-specific, nonstandard. */
  76. ns_t_max = 65536
  77. } ns_type;
  78. typedef enum __ns_class {
  79. ns_c_invalid = 0, /*%< Cookie. */
  80. ns_c_in = 1, /*%< Internet. */
  81. ns_c_2 = 2, /*%< unallocated/unsupported. */
  82. ns_c_chaos = 3, /*%< MIT Chaos-net. */
  83. ns_c_hs = 4, /*%< MIT Hesiod. */
  84. /* Query class values which do not appear in resource records */
  85. ns_c_none = 254, /*%< for prereq. sections in update requests */
  86. ns_c_any = 255, /*%< Wildcard match. */
  87. ns_c_max = 65536
  88. } ns_class;
  89. #endif
  90. int getKmsServerList(kms_server_dns_ptr** serverlist, const char *restrict query);
  91. void sortSrvRecords(kms_server_dns_ptr* serverlist, const int answers);
  92. #endif // NO_DNS
  93. #endif /* DNS_SRV_H_ */