Windows: improved idle dead time handling
[openafs.git] / src / WINNT / afsd / cm_dns_private.h
1 /* Copyright 2000, International Business Machines Corporation and others.
2  * All Rights Reserved.
3  *
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
7  */
8
9 #ifndef __DNS_AFS_private_h_env_
10 #define __DNS_AFS_private_h_env_
11
12 #ifdef KERNEL
13 #define SOCKET struct osi_socket *
14 #else
15 #define SOCKET int
16 #endif
17
18 #define SOCKADDR_IN struct sockaddr_in
19
20 #include <stdio.h>
21 #include <string.h>
22
23
24 #define BUFSIZE                 2048
25
26 /*
27  * AFS Server List (a list of host names and their count)
28  */
29 #define MAX_AFS_SRVS 20
30 typedef struct afs_srvlist
31 {
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;
35
36
37 /*
38  * DNS Message Header
39  */
40 typedef struct dns_hdr
41 {
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 */
48 } DNS_HDR, *PDNS_HDR;
49
50 #define DNS_HDR_LEN sizeof(DNS_HDR)
51
52
53
54 /* THESE WERE ALSO WRONG !!!! */
55 #define DNS_FLAG_RD 0x0100
56
57 /*
58  * DNS query class and response type for the tail of the query packet
59  */
60 typedef struct dns_qtail
61 {
62         unsigned short qtype;                /* Query type (2bytes) - for responses */
63         unsigned short qclass;               /* Query Class (2bytes) - for questions */
64 } DNS_QTAIL, *PDNS_QTAIL;
65
66 #define DNS_QTAIL_LEN sizeof(DNS_QTAIL)
67
68 /* DNS Generic Resource Record format (from RFC 1034 and 1035)
69  *
70  *  NOTE: The first field in the DNS RR Record header is always
71  *   the domain name in QNAME format (see earlier description)
72  */
73 typedef struct dns_rr_hdr
74 {
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;
80
81 #define DNS_RR_HDR_LEN sizeof(DNS_RR_HDR)
82
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
92
93
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
99
100 /*
101  * DNS AFSDB Resource Data Field
102  */
103 typedef struct dns_afsdb_rr_hdr
104 {
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;
111
112 #define DNS_AFSDB_RR_HDR_LEN sizeof(DNS_AFSDB_RR_HDR)
113
114 /*
115  * DNS A Resource Data Field
116  */
117 typedef struct dns_a_rr_hdr
118 {
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;
125
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))
128
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); */
133
134 #endif //__DNS_AFS_private_h_env_
135