1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _SMBSRV_DYNDNS_H 27 #define _SMBSRV_DYNDNS_H 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 #include <smbsrv/libsmbns.h> 32 33 /* 34 * Header section format: 35 * 36 * The header contains the following fields: 37 * 38 * 1 1 1 1 1 1 39 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 40 * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 41 * | ID | 42 * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 43 * |QR| Opcode |AA|TC|RD|RA| Z | RCODE | 44 * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 45 * | QDCOUNT | 46 * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 47 * | ANCOUNT | 48 * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 49 * | NSCOUNT | 50 * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 51 * | ARCOUNT | 52 * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 53 * 54 * where: 55 * 56 * ID A 16 bit identifier assigned by the program that 57 * generates any kind of query. This identifier is copied 58 * the corresponding reply and can be used by the requester 59 * to match up replies to outstanding queries. 60 * 61 * QR A one bit field that specifies whether this message is a 62 * query (0), or a response (1). 63 * 64 * OPCODE A four bit field that specifies kind of query in this 65 * message. This value is set by the originator of a query 66 * and copied into the response. The values are: 67 * 68 * 0 a standard query (QUERY) 69 * 70 * 1 an inverse query (IQUERY) 71 * 72 * 2 a server status request (STATUS) 73 * 74 * 3-15 reserved for future use 75 * 76 * AA Authoritative Answer - this bit is valid in responses, 77 * and specifies that the responding name server is an 78 * authority for the domain name in question section. 79 * 80 * Note that the contents of the answer section may have 81 * multiple owner names because of aliases. The AA bit 82 * 83 * corresponds to the name which matches the query name, or 84 * the first owner name in the answer section. 85 * 86 * TC TrunCation - specifies that this message was truncated 87 * due to length greater than that permitted on the 88 * transmission channel. 89 * 90 * RD Recursion Desired - this bit may be set in a query and 91 * is copied into the response. If RD is set, it directs 92 * the name server to pursue the query recursively. 93 * Recursive query support is optional. 94 * 95 * RA Recursion Available - this be is set or cleared in a 96 * response, and denotes whether recursive query support is 97 * available in the name server. 98 * 99 * Z Reserved for future use. Must be zero in all queries 100 * and responses. 101 * 102 * RCODE Response code - this 4 bit field is set as part of 103 * responses. The values have the following 104 * interpretation: 105 * 106 * 0 No error condition 107 * 108 * 1 Format error - The name server was 109 * unable to interpret the query. 110 * 111 * 2 Server failure - The name server was 112 * unable to process this query due to a 113 * problem with the name server. 114 * 115 * 3 Name Error - Meaningful only for 116 * responses from an authoritative name 117 * server, this code signifies that the 118 * domain name referenced in the query does 119 * not exist. 120 * 121 * 4 Not Implemented - The name server does 122 * not support the requested kind of query. 123 * 124 * 5 Refused - The name server refuses to 125 * perform the specified operation for 126 * policy reasons. For example, a name 127 * server may not wish to provide the 128 * information to the particular requester, 129 * or a name server may not wish to perform 130 * a particular operation (e.g., zone 131 * 132 * transfer) for particular data. 133 * 134 * 6-15 Reserved for future use. 135 * 136 * QDCOUNT an unsigned 16 bit integer specifying the number of 137 * entries in the question section. 138 * 139 * ANCOUNT an unsigned 16 bit integer specifying the number of 140 * resource records in the answer section. 141 * 142 * NSCOUNT an unsigned 16 bit integer specifying the number of name 143 * server resource records in the authority records 144 * section. 145 * 146 * ARCOUNT an unsigned 16 bit integer specifying the number of 147 * resource records in the additional records section. 148 */ 149 150 #include <sys/types.h> 151 152 #ifdef __cplusplus 153 extern "C" { 154 #endif 155 156 /* Other definitions: */ 157 #define REQ_QUERY 1 /* DNS query request */ 158 #define REQ_UPDATE 0 /* DNS update request */ 159 #define UPDATE_FORW 1 /* Update forward lookup zone */ 160 #define UPDATE_REV 0 /* Update reverse lookup zone */ 161 #define UPDATE_ADD 1 /* Update add request */ 162 #define UPDATE_DEL 0 /* Update remove request */ 163 #define MODE_GSS_API 3 /* Key negotiation mode */ 164 165 /* Max buffer size for send and receive buffer */ 166 #define MAX_BUF_SIZE 2000 167 #define MAX_RETRIES 3 /* Max number of send retries if no response */ 168 #define TSIG_SIGNED 1 /* TSIG contains signed data */ 169 #define TSIG_UNSIGNED 0 /* TSIG does not conain signed data */ 170 #define DNS_CHECK 1 /* Check DNS for entry */ 171 #define DNS_NOCHECK 0 /* Don't check DNS for entry */ 172 #define MAX_TCP_SIZE 2000 /* max tcp DNS message size */ 173 174 /* Delete 1 entry */ 175 #define DEL_ONE 1 176 /* Delete all entries of the same resource name */ 177 #define DEL_ALL 0 178 179 #define DNSF_RECUR_SUPP 0x80 /* Server can do recursive queries */ 180 #define DNSF_RECUR_QRY 0x100 /* Query is recursive */ 181 182 #define BUFLEN_TCP(x, y) (MAX_TCP_SIZE-(x-y)) 183 #define BUFLEN_UDP(x, y) (NS_PACKETSZ-(x-y)) 184 185 /* 186 * DDNS_TTL is the time to live in DNS caches. Note that this 187 * does not affect the entry in the authoritative DNS database. 188 */ 189 #define DDNS_TTL 1200 190 191 #ifdef __cplusplus 192 } 193 #endif 194 195 #endif /* _SMBSRV_DYNDNS_H */ 196