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
#include <sys/types.h>
14
#include <sys/socket.h>
15
#include <netinet/in.h>
18
#include <windows.h>*/
22
#define SOCKET struct osi_socket *
27
#define SOCKADDR_IN struct sockaddr_in
35
char *inet_ntoa(struct in_addr in)
39
unsigned long sVal,pVal;
44
pVal = ntohl(in.s_addr);
48
sprintf(out,"%ld",sVal);
53
sprintf(out,"%s.%ld",out,sVal);
58
sprintf(out,"%s.%ld",out,sVal);
63
sprintf(out,"%s.%ld",out,sVal);
68
unsigned long inet_addr(const char *cp)
82
for (i=0; i<=strlen(cp); i++)
92
//printf("%x\t%lx\n",sVal,val);
99
//printf("%x\t%lx\n",sVal,val);
109
* AFS Server List (a list of host names and their count)
111
#define MAX_AFS_SRVS 20
112
typedef struct afs_srvlist
114
unsigned short count; /* number of host names */
115
char host[MAX_AFS_SRVS][256];/* array of hosts*/
116
} AFS_SRV_LIST, *PAFS_SRV_LIST;
122
typedef struct dns_hdr
124
unsigned short id; /* client query ID number */
125
unsigned short flags; /* qualify contents <see below> */
126
unsigned short q_count; /* number of questions */
127
unsigned short rr_count; /* number of answer RRs */
128
unsigned short auth_count; /* number of authority RRs */
129
unsigned short add_count; /* number of additional RRs */
130
} DNS_HDR, *PDNS_HDR;
132
#define DNS_HDR_LEN sizeof(DNS_HDR)
136
/* THESE WERE ALSO WRONG !!!! */
137
#define DNS_FLAG_RD 0x0100
140
* DNS query class and response type for the tail of the query packet
142
typedef struct dns_qtail
144
unsigned short qtype; /* Query type (2bytes) - for responses */
145
unsigned short qclass; /* Query Class (2bytes) - for questions */
146
} DNS_QTAIL, *PDNS_QTAIL;
148
#define DNS_QTAIL_LEN sizeof(DNS_QTAIL)
150
/* DNS Generic Resource Record format (from RFC 1034 and 1035)
152
* NOTE: The first field in the DNS RR Record header is always
153
* the domain name in QNAME format (see earlier description)
155
typedef struct dns_rr_hdr
157
unsigned short rr_type; /* RR type code (e.g. A, MX, NS, etc.) */
158
unsigned short rr_class; /* RR class code (IN for Internet) */
159
unsigned long rr_ttl; /* Time-to-live for resource */
160
unsigned short rr_rdlength; /* length of RDATA field (in octets) */
161
} DNS_RR_HDR, *PDNS_RR_HDR;
163
#define DNS_RR_HDR_LEN sizeof(DNS_RR_HDR)
165
#define DNS_RRTYPE_A 1
166
#define DNS_RRTYPE_NS 2
167
#define DNS_RRTYPE_CNAME 5
168
#define DNS_RRTYPE_SOA 6
169
#define DNS_RRTYPE_WKS 11
170
#define DNS_RRTYPE_PTR 12
171
#define DNS_RRTYPE_HINFO 13
172
#define DNS_RRTYPE_MX 15
173
#define DNS_RRTYPE_AFSDB 18
176
#define DNS_RRCLASS_IN 1 // Internet
177
#define DNS_RRCLASS_CS 2 // CSNET
178
#define DNS_RRCLASS_CH 3 // CHAOS Net
179
#define DNS_RRCLASS_HS 4 // Hesiod
180
#define DNS_RRCLASS_WILD 255 // WildCard - all classes
183
* DNS AFSDB Resource Data Field
185
typedef struct dns_afsdb_rr_hdr
187
unsigned short rr_type; /* RR type code (e.g. A, MX, NS, etc.) */
188
unsigned short rr_class; /* RR class code (IN for Internet) */
189
unsigned long rr_ttl; /* Time-to-live for resource */
190
unsigned short rr_rdlength; /* length of RDATA field (in octets) */
191
unsigned short rr_afsdb_class; /* 1-AFS , 2-DCE */
192
} DNS_AFSDB_RR_HDR, *PDNS_AFSDB_RR_HDR;
194
#define DNS_AFSDB_RR_HDR_LEN sizeof(DNS_AFSDB_RR_HDR)
197
* DNS A Resource Data Field
199
typedef struct dns_a_rr_hdr
201
unsigned short rr_type; /* RR type code (e.g. A, MX, NS, etc.) */
202
unsigned short rr_class; /* RR class code (IN for Internet) */
203
unsigned long rr_ttl; /* Time-to-live for resource */
204
unsigned short rr_rdlength; /* length of RDATA field (in octets) */
205
unsigned long rr_addr; /* Resolved host address */
206
} DNS_A_RR_HDR, *PDNS_A_RR_HDR;
208
#define DNS_A_RR_LEN 14 //sizeof(DNS_A_RR_HDR)
209
#define DNS_A_RR_HDR_LEN 10 //(DNS_A_RR_LEN - sizeof(unsigned long))
211
int putQName( char *pszHostName, char *pQName );
212
unsigned char * printRRQName( unsigned char *pQName, PDNS_HDR buffer );
213
unsigned char * skipRRQName(unsigned char *pQName);
214
/* void printReplyBuffer_AFSDB(PDNS_HDR replyBuff); */
216
#endif //__DNS_AFS_private_h_env_