19 #define DNS_TYPE_CNAME 5
20 #define DNS_TYPE_ANY 255
22 #define DNS_CLASS_IN 1
23 #define DNS_CLASS_CS 2
24 #define DNS_CLASS_CH 3
25 #define DNS_CLASS_HS 4
27 #define DNS_FLAG_QUERY ( 0x00 << 15 )
28 #define DNS_FLAG_RESPONSE ( 0x01 << 15 )
29 #define DNS_FLAG_QR(flags) ( (flags) & ( 0x01 << 15 ) )
30 #define DNS_FLAG_OPCODE_QUERY ( 0x00 << 11 )
31 #define DNS_FLAG_OPCODE_IQUERY ( 0x01 << 11 )
32 #define DNS_FLAG_OPCODE_STATUS ( 0x02 << 11 )
33 #define DNS_FLAG_OPCODE(flags) ( (flags) & ( 0x0f << 11 ) )
34 #define DNS_FLAG_RD ( 0x01 << 8 )
35 #define DNS_FLAG_RA ( 0x01 << 7 )
36 #define DNS_FLAG_RCODE_OK ( 0x00 << 0 )
37 #define DNS_FLAG_RCODE_NX ( 0x03 << 0 )
38 #define DNS_FLAG_RCODE(flags) ( (flags) & ( 0x0f << 0 ) )
41 #define DNS_MAX_RETRIES 3
42 #define DNS_MAX_CNAME_RECURSION 0x30
45 * DNS protocol structures
55 } __attribute__ (( packed ));
57 struct dns_query_info {
60 } __attribute__ (( packed ));
63 struct dns_header dns;
64 char payload[ 256 + sizeof ( struct dns_query_info ) ];
65 } __attribute__ (( packed ));
67 struct dns_rr_info_common {
72 } __attribute__ (( packed ));
74 struct dns_rr_info_a {
75 struct dns_rr_info_common common;
76 struct in_addr in_addr;
77 } __attribute__ (( packed ));
79 struct dns_rr_info_cname {
80 struct dns_rr_info_common common;
82 } __attribute__ (( packed ));
85 struct dns_rr_info_common common;
86 struct dns_rr_info_a a;
87 struct dns_rr_info_cname cname;
90 extern struct sockaddr_tcpip nameserver;
92 #endif /* _GPXE_DNS_H */