1 /* Copyright 2000, International Business Machines Corporation and others.
4 * This software has been released under the terms of the IBM Public
5 * License. For details, see the LICENSE file in the top-level source
6 * directory or online at http://www.openafs.org/dl/license10.html
9 #ifndef __DNS_AFS_private_h_env_
10 #define __DNS_AFS_private_h_env_
13 #define SOCKET struct osi_socket *
18 #define SOCKADDR_IN struct sockaddr_in
27 * AFS Server List (a list of host names and their count)
29 #define MAX_AFS_SRVS 20
30 typedef struct afs_srvlist
32 unsigned short count; /* number of host names */
33 char host[MAX_AFS_SRVS][256];/* array of hosts*/
34 } AFS_SRV_LIST, *PAFS_SRV_LIST;
40 typedef struct dns_hdr
42 unsigned short id; /* client query ID number */
43 unsigned short flags; /* qualify contents <see below> */
44 unsigned short q_count; /* number of questions */
45 unsigned short rr_count; /* number of answer RRs */
46 unsigned short auth_count; /* number of authority RRs */
47 unsigned short add_count; /* number of additional RRs */
50 #define DNS_HDR_LEN sizeof(DNS_HDR)
54 /* THESE WERE ALSO WRONG !!!! */
55 #define DNS_FLAG_RD 0x0100
58 * DNS query class and response type for the tail of the query packet
60 typedef struct dns_qtail
62 unsigned short qtype; /* Query type (2bytes) - for responses */
63 unsigned short qclass; /* Query Class (2bytes) - for questions */
64 } DNS_QTAIL, *PDNS_QTAIL;
66 #define DNS_QTAIL_LEN sizeof(DNS_QTAIL)
68 /* DNS Generic Resource Record format (from RFC 1034 and 1035)
70 * NOTE: The first field in the DNS RR Record header is always
71 * the domain name in QNAME format (see earlier description)
73 typedef struct dns_rr_hdr
75 unsigned short rr_type; /* RR type code (e.g. A, MX, NS, etc.) */
76 unsigned short rr_class; /* RR class code (IN for Internet) */
77 unsigned long rr_ttl; /* Time-to-live for resource */
78 unsigned short rr_rdlength; /* length of RDATA field (in octets) */
79 } DNS_RR_HDR, *PDNS_RR_HDR;
81 #define DNS_RR_HDR_LEN sizeof(DNS_RR_HDR)
83 #define DNS_RRTYPE_A 1
84 #define DNS_RRTYPE_NS 2
85 #define DNS_RRTYPE_CNAME 5
86 #define DNS_RRTYPE_SOA 6
87 #define DNS_RRTYPE_WKS 11
88 #define DNS_RRTYPE_PTR 12
89 #define DNS_RRTYPE_HINFO 13
90 #define DNS_RRTYPE_MX 15
91 #define DNS_RRTYPE_AFSDB 18
94 #define DNS_RRCLASS_IN 1 // Internet
95 #define DNS_RRCLASS_CS 2 // CSNET
96 #define DNS_RRCLASS_CH 3 // CHAOS Net
97 #define DNS_RRCLASS_HS 4 // Hesiod
98 #define DNS_RRCLASS_WILD 255 // WildCard - all classes
101 * DNS AFSDB Resource Data Field
103 typedef struct dns_afsdb_rr_hdr
105 unsigned short rr_type; /* RR type code (e.g. A, MX, NS, etc.) */
106 unsigned short rr_class; /* RR class code (IN for Internet) */
107 unsigned long rr_ttl; /* Time-to-live for resource */
108 unsigned short rr_rdlength; /* length of RDATA field (in octets) */
109 unsigned short rr_afsdb_class; /* 1-AFS , 2-DCE */
110 } DNS_AFSDB_RR_HDR, *PDNS_AFSDB_RR_HDR;
112 #define DNS_AFSDB_RR_HDR_LEN sizeof(DNS_AFSDB_RR_HDR)
115 * DNS A Resource Data Field
117 typedef struct dns_a_rr_hdr
119 unsigned short rr_type; /* RR type code (e.g. A, MX, NS, etc.) */
120 unsigned short rr_class; /* RR class code (IN for Internet) */
121 unsigned long rr_ttl; /* Time-to-live for resource */
122 unsigned short rr_rdlength; /* length of RDATA field (in octets) */
123 unsigned long rr_addr; /* Resolved host address */
124 } DNS_A_RR_HDR, *PDNS_A_RR_HDR;
126 #define DNS_A_RR_LEN 14 //sizeof(DNS_A_RR_HDR)
127 #define DNS_A_RR_HDR_LEN 10 //(DNS_A_RR_LEN - sizeof(unsigned long))
129 int putQName( char *pszHostName, char *pQName );
130 unsigned char * printRRQName( unsigned char *pQName, PDNS_HDR buffer );
131 unsigned char * skipRRQName(unsigned char *pQName);
132 /* void printReplyBuffer_AFSDB(PDNS_HDR replyBuff); */
134 #endif //__DNS_AFS_private_h_env_