OpenAFS
OpenAFS distributed network file system
|
00001 /* Copyright 2000, International Business Machines Corporation and others. 00002 * All Rights Reserved. 00003 * 00004 * This software has been released under the terms of the IBM Public 00005 * License. For details, see the LICENSE file in the top-level source 00006 * directory or online at http://www.openafs.org/dl/license10.html 00007 */ 00008 00009 #ifndef __DNS_AFS_private_h_env_ 00010 #define __DNS_AFS_private_h_env_ 00011 00012 #ifdef KERNEL 00013 #define SOCKET struct osi_socket * 00014 #else 00015 #define SOCKET int 00016 #endif 00017 00018 #define SOCKADDR_IN struct sockaddr_in 00019 00020 #include <stdio.h> 00021 #include <string.h> 00022 00023 00024 #define BUFSIZE 2048 00025 00026 /* 00027 * AFS Server List (a list of host names and their count) 00028 */ 00029 #define MAX_AFS_SRVS 20 00030 typedef struct afs_srvlist 00031 { 00032 unsigned short count; /* number of host names */ 00033 char host[MAX_AFS_SRVS][256];/* array of hosts*/ 00034 } AFS_SRV_LIST, *PAFS_SRV_LIST; 00035 00036 00037 /* 00038 * DNS Message Header 00039 */ 00040 typedef struct dns_hdr 00041 { 00042 unsigned short id; /* client query ID number */ 00043 unsigned short flags; /* qualify contents <see below> */ 00044 unsigned short q_count; /* number of questions */ 00045 unsigned short rr_count; /* number of answer RRs */ 00046 unsigned short auth_count; /* number of authority RRs */ 00047 unsigned short add_count; /* number of additional RRs */ 00048 } DNS_HDR, *PDNS_HDR; 00049 00050 #define DNS_HDR_LEN sizeof(DNS_HDR) 00051 00052 00053 00054 /* THESE WERE ALSO WRONG !!!! */ 00055 #define DNS_FLAG_RD 0x0100 00056 00057 /* 00058 * DNS query class and response type for the tail of the query packet 00059 */ 00060 typedef struct dns_qtail 00061 { 00062 unsigned short qtype; /* Query type (2bytes) - for responses */ 00063 unsigned short qclass; /* Query Class (2bytes) - for questions */ 00064 } DNS_QTAIL, *PDNS_QTAIL; 00065 00066 #define DNS_QTAIL_LEN sizeof(DNS_QTAIL) 00067 00068 /* DNS Generic Resource Record format (from RFC 1034 and 1035) 00069 * 00070 * NOTE: The first field in the DNS RR Record header is always 00071 * the domain name in QNAME format (see earlier description) 00072 */ 00073 typedef struct dns_rr_hdr 00074 { 00075 unsigned short rr_type; /* RR type code (e.g. A, MX, NS, etc.) */ 00076 unsigned short rr_class; /* RR class code (IN for Internet) */ 00077 unsigned long rr_ttl; /* Time-to-live for resource */ 00078 unsigned short rr_rdlength; /* length of RDATA field (in octets) */ 00079 } DNS_RR_HDR, *PDNS_RR_HDR; 00080 00081 #define DNS_RR_HDR_LEN sizeof(DNS_RR_HDR) 00082 00083 #define DNS_RRTYPE_A 1 00084 #define DNS_RRTYPE_NS 2 00085 #define DNS_RRTYPE_CNAME 5 00086 #define DNS_RRTYPE_SOA 6 00087 #define DNS_RRTYPE_WKS 11 00088 #define DNS_RRTYPE_PTR 12 00089 #define DNS_RRTYPE_HINFO 13 00090 #define DNS_RRTYPE_MX 15 00091 #define DNS_RRTYPE_AFSDB 18 00092 00093 00094 #define DNS_RRCLASS_IN 1 // Internet 00095 #define DNS_RRCLASS_CS 2 // CSNET 00096 #define DNS_RRCLASS_CH 3 // CHAOS Net 00097 #define DNS_RRCLASS_HS 4 // Hesiod 00098 #define DNS_RRCLASS_WILD 255 // WildCard - all classes 00099 00100 /* 00101 * DNS AFSDB Resource Data Field 00102 */ 00103 typedef struct dns_afsdb_rr_hdr 00104 { 00105 unsigned short rr_type; /* RR type code (e.g. A, MX, NS, etc.) */ 00106 unsigned short rr_class; /* RR class code (IN for Internet) */ 00107 unsigned long rr_ttl; /* Time-to-live for resource */ 00108 unsigned short rr_rdlength; /* length of RDATA field (in octets) */ 00109 unsigned short rr_afsdb_class; /* 1-AFS , 2-DCE */ 00110 } DNS_AFSDB_RR_HDR, *PDNS_AFSDB_RR_HDR; 00111 00112 #define DNS_AFSDB_RR_HDR_LEN sizeof(DNS_AFSDB_RR_HDR) 00113 00114 /* 00115 * DNS A Resource Data Field 00116 */ 00117 typedef struct dns_a_rr_hdr 00118 { 00119 unsigned short rr_type; /* RR type code (e.g. A, MX, NS, etc.) */ 00120 unsigned short rr_class; /* RR class code (IN for Internet) */ 00121 unsigned long rr_ttl; /* Time-to-live for resource */ 00122 unsigned short rr_rdlength; /* length of RDATA field (in octets) */ 00123 unsigned long rr_addr; /* Resolved host address */ 00124 } DNS_A_RR_HDR, *PDNS_A_RR_HDR; 00125 00126 #define DNS_A_RR_LEN 14 //sizeof(DNS_A_RR_HDR) 00127 #define DNS_A_RR_HDR_LEN 10 //(DNS_A_RR_LEN - sizeof(unsigned long)) 00128 00129 int putQName( char *pszHostName, char *pQName ); 00130 unsigned char * printRRQName( unsigned char *pQName, PDNS_HDR buffer ); 00131 unsigned char * skipRRQName(unsigned char *pQName); 00132 /* void printReplyBuffer_AFSDB(PDNS_HDR replyBuff); */ 00133 00134 #endif //__DNS_AFS_private_h_env_ 00135