gnunet-service-dns-p.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #ifndef GN_DNS_SERVICE_P_H
  2. #define GN_DNS_SERVICE_P_H
  3. #include "gnunet_common.h"
  4. struct query_packet {
  5. struct GNUNET_MessageHeader hdr;
  6. /**
  7. * The IP-Address this query was originally sent to
  8. */
  9. unsigned orig_to:32 GNUNET_PACKED;
  10. /**
  11. * The IP-Address this query was originally sent from
  12. */
  13. unsigned orig_from:32 GNUNET_PACKED;
  14. /**
  15. * The UDP-Portthis query was originally sent from
  16. */
  17. unsigned src_port:16 GNUNET_PACKED;
  18. unsigned char data[1]; /* The DNS-Packet */
  19. };
  20. struct query_packet_list {
  21. struct query_packet_list* next GNUNET_PACKED;
  22. struct query_packet_list* prev GNUNET_PACKED;
  23. struct query_packet pkt;
  24. };
  25. enum GNUNET_DNS_ANSWER_Subtype {
  26. /**
  27. * Answers of this type contain a dns-packet that just has to be transmitted
  28. */
  29. GNUNET_DNS_ANSWER_TYPE_IP,
  30. /**
  31. * Answers of this type contain an incomplete dns-packet. The IP-Address
  32. * is all 0s. The addroffset points to it.
  33. */
  34. GNUNET_DNS_ANSWER_TYPE_SERVICE,
  35. /**
  36. * Answers of this type contain an incomplete dns-packet as answer to a
  37. * PTR-Query. The resolved name is not allocated. The addroffset points to it.
  38. */
  39. GNUNET_DNS_ANSWER_TYPE_REV,
  40. /**
  41. * Answers of this type contains an IP6-Address but traffic to this IP should
  42. * be routed through the GNUNet.
  43. */
  44. GNUNET_DNS_ANSWER_TYPE_REMOTE_AAAA,
  45. /**
  46. * Answers of this type contains an IP4-Address but traffic to this IP should
  47. * be routed through the GNUNet.
  48. */
  49. GNUNET_DNS_ANSWER_TYPE_REMOTE_A
  50. };
  51. struct GNUNET_vpn_service_descriptor {
  52. GNUNET_HashCode peer GNUNET_PACKED;
  53. GNUNET_HashCode service_descriptor GNUNET_PACKED;
  54. uint64_t ports GNUNET_PACKED;
  55. uint32_t service_type GNUNET_PACKED;
  56. };
  57. struct answer_packet {
  58. /* General data */
  59. struct GNUNET_MessageHeader hdr;
  60. enum GNUNET_DNS_ANSWER_Subtype subtype GNUNET_PACKED;
  61. unsigned from:32 GNUNET_PACKED;
  62. unsigned to:32 GNUNET_PACKED;
  63. unsigned dst_port:16 GNUNET_PACKED;
  64. /* -- */
  65. /* Data for GNUNET_DNS_ANSWER_TYPE_SERVICE */
  66. struct GNUNET_vpn_service_descriptor service_descr;
  67. /* -- */
  68. /* Data for GNUNET_DNS_ANSWER_TYPE_REV */
  69. /* The offsett in octets from the beginning of the struct to the field
  70. * in data where the IP-Address has to go. */
  71. uint16_t addroffset GNUNET_PACKED;
  72. /* -- */
  73. /* Data for GNUNET_DNS_ANSWER_TYPE_REMOTE */
  74. /* either 4 or 16 */
  75. char addrsize;
  76. unsigned char addr[16];
  77. /* -- */
  78. unsigned char data[1];
  79. };
  80. struct answer_packet_list {
  81. struct answer_packet_list* next GNUNET_PACKED;
  82. struct answer_packet_list* prev GNUNET_PACKED;
  83. struct answer_packet pkt;
  84. };
  85. #endif