xref: /onnv-gate/usr/src/lib/smbsrv/libsmbns/common/smbns_dyndns.h (revision 7052:efa04b030974)
15331Samw /*
25331Samw  * CDDL HEADER START
35331Samw  *
45331Samw  * The contents of this file are subject to the terms of the
55331Samw  * Common Development and Distribution License (the "License").
65331Samw  * You may not use this file except in compliance with the License.
75331Samw  *
85331Samw  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
95331Samw  * or http://www.opensolaris.org/os/licensing.
105331Samw  * See the License for the specific language governing permissions
115331Samw  * and limitations under the License.
125331Samw  *
135331Samw  * When distributing Covered Code, include this CDDL HEADER in each
145331Samw  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
155331Samw  * If applicable, add the following below this CDDL HEADER, with the
165331Samw  * fields enclosed by brackets "[]" replaced with your own identifying
175331Samw  * information: Portions Copyright [yyyy] [name of copyright owner]
185331Samw  *
195331Samw  * CDDL HEADER END
205331Samw  */
215331Samw /*
22*5772Sas200622  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
235331Samw  * Use is subject to license terms.
245331Samw  */
255331Samw 
265331Samw #ifndef _SMBSRV_DYNDNS_H
275331Samw #define	_SMBSRV_DYNDNS_H
285331Samw 
295331Samw #pragma ident	"%Z%%M%	%I%	%E% SMI"
305331Samw 
315331Samw #include <smbsrv/libsmbns.h>
325331Samw 
335331Samw /*
345331Samw  * Header section format:
355331Samw  *
365331Samw  * The header contains the following fields:
375331Samw  *
385331Samw  *                                     1  1  1  1  1  1
395331Samw  *       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
405331Samw  *     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
415331Samw  *     |                      ID                       |
425331Samw  *     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
435331Samw  *     |QR|   Opcode  |AA|TC|RD|RA|   Z    |   RCODE   |
445331Samw  *     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
455331Samw  *     |                    QDCOUNT                    |
465331Samw  *     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
475331Samw  *     |                    ANCOUNT                    |
485331Samw  *     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
495331Samw  *     |                    NSCOUNT                    |
505331Samw  *     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
515331Samw  *     |                    ARCOUNT                    |
525331Samw  *     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
535331Samw  *
545331Samw  * where:
555331Samw  *
565331Samw  * ID              A 16 bit identifier assigned by the program that
575331Samw  *                 generates any kind of query.  This identifier is copied
585331Samw  *                 the corresponding reply and can be used by the requester
595331Samw  *                 to match up replies to outstanding queries.
605331Samw  *
615331Samw  * QR              A one bit field that specifies whether this message is a
625331Samw  *                 query (0), or a response (1).
635331Samw  *
645331Samw  * OPCODE          A four bit field that specifies kind of query in this
655331Samw  *                 message.  This value is set by the originator of a query
665331Samw  *                 and copied into the response.  The values are:
675331Samw  *
685331Samw  *                 0               a standard query (QUERY)
695331Samw  *
705331Samw  *                 1               an inverse query (IQUERY)
715331Samw  *
725331Samw  *                 2               a server status request (STATUS)
735331Samw  *
745331Samw  *                 3-15            reserved for future use
755331Samw  *
765331Samw  * AA              Authoritative Answer - this bit is valid in responses,
775331Samw  *                 and specifies that the responding name server is an
785331Samw  *                 authority for the domain name in question section.
795331Samw  *
805331Samw  *                 Note that the contents of the answer section may have
815331Samw  *                 multiple owner names because of aliases.  The AA bit
825331Samw  *
835331Samw  *                 corresponds to the name which matches the query name, or
845331Samw  *                 the first owner name in the answer section.
855331Samw  *
865331Samw  * TC              TrunCation - specifies that this message was truncated
875331Samw  *                 due to length greater than that permitted on the
885331Samw  *                 transmission channel.
895331Samw  *
905331Samw  * RD              Recursion Desired - this bit may be set in a query and
915331Samw  *                 is copied into the response.  If RD is set, it directs
925331Samw  *                 the name server to pursue the query recursively.
935331Samw  *                 Recursive query support is optional.
945331Samw  *
955331Samw  * RA              Recursion Available - this be is set or cleared in a
965331Samw  *                 response, and denotes whether recursive query support is
975331Samw  *                 available in the name server.
985331Samw  *
995331Samw  * Z               Reserved for future use.  Must be zero in all queries
1005331Samw  *                 and responses.
1015331Samw  *
1025331Samw  * RCODE           Response code - this 4 bit field is set as part of
1035331Samw  *                 responses.  The values have the following
1045331Samw  *                 interpretation:
1055331Samw  *
1065331Samw  *                 0               No error condition
1075331Samw  *
1085331Samw  *                 1               Format error - The name server was
1095331Samw  *                                 unable to interpret the query.
1105331Samw  *
1115331Samw  *                 2               Server failure - The name server was
1125331Samw  *                                 unable to process this query due to a
1135331Samw  *                                 problem with the name server.
1145331Samw  *
1155331Samw  *                 3               Name Error - Meaningful only for
1165331Samw  *                                 responses from an authoritative name
1175331Samw  *                                 server, this code signifies that the
1185331Samw  *                                 domain name referenced in the query does
1195331Samw  *                                 not exist.
1205331Samw  *
1215331Samw  *                 4               Not Implemented - The name server does
1225331Samw  *                                 not support the requested kind of query.
1235331Samw  *
1245331Samw  *                 5               Refused - The name server refuses to
1255331Samw  *                                 perform the specified operation for
1265331Samw  *                                 policy reasons.  For example, a name
1275331Samw  *                                 server may not wish to provide the
1285331Samw  *                                 information to the particular requester,
1295331Samw  *                                 or a name server may not wish to perform
1305331Samw  *                                 a particular operation (e.g., zone
1315331Samw  *
1325331Samw  *                                 transfer) for particular data.
1335331Samw  *
1345331Samw  *                 6-15            Reserved for future use.
1355331Samw  *
1365331Samw  * QDCOUNT         an unsigned 16 bit integer specifying the number of
1375331Samw  *                 entries in the question section.
1385331Samw  *
1395331Samw  * ANCOUNT         an unsigned 16 bit integer specifying the number of
1405331Samw  *                 resource records in the answer section.
1415331Samw  *
1425331Samw  * NSCOUNT         an unsigned 16 bit integer specifying the number of name
1435331Samw  *                 server resource records in the authority records
1445331Samw  *                 section.
1455331Samw  *
1465331Samw  * ARCOUNT         an unsigned 16 bit integer specifying the number of
1475331Samw  *                 resource records in the additional records section.
1485331Samw  */
1495331Samw 
1505331Samw #include <sys/types.h>
1515331Samw 
1525331Samw #ifdef __cplusplus
1535331Samw extern "C" {
1545331Samw #endif
1555331Samw 
1565331Samw /* Other definitions: */
1575331Samw #define	REQ_QUERY	1	/* DNS query request */
1585331Samw #define	REQ_UPDATE	0	/* DNS update request */
1595331Samw #define	UPDATE_FORW	1	/* Update forward lookup zone */
1605331Samw #define	UPDATE_REV	0	/* Update reverse lookup zone */
1615331Samw #define	UPDATE_ADD	1	/* Update add request */
1625331Samw #define	UPDATE_DEL	0	/* Update remove request */
1635331Samw #define	MODE_GSS_API	3	/* Key negotiation mode */
1645331Samw 
1655331Samw /* Max buffer size for send and receive buffer */
1665331Samw #define	MAX_BUF_SIZE	2000
1675331Samw #define	MAX_RETRIES	3	/* Max number of send retries if no response */
1685331Samw #define	TSIG_SIGNED	1	/* TSIG contains signed data */
1695331Samw #define	TSIG_UNSIGNED	0	/* TSIG does not conain signed data */
1705331Samw #define	DNS_CHECK	1	/* Check DNS for entry */
1715331Samw #define	DNS_NOCHECK	0	/* Don't check DNS for entry */
1725331Samw #define	MAX_TCP_SIZE 	2000	/* max tcp DNS message size */
1735331Samw 
1745331Samw /* Delete 1 entry */
1755331Samw #define	DEL_ONE		1
1765331Samw /* Delete all entries of the same resource name */
1775331Samw #define	DEL_ALL		0
1785331Samw 
1795331Samw #define	DNSF_RECUR_SUPP 0x80    /* Server can do recursive queries */
1805331Samw #define	DNSF_RECUR_QRY  0x100   /* Query is recursive */
1815331Samw 
1825331Samw #define	BUFLEN_TCP(x, y) (MAX_TCP_SIZE-(x-y))
1835331Samw #define	BUFLEN_UDP(x, y) (NS_PACKETSZ-(x-y))
1845331Samw 
1855331Samw /*
1865331Samw  * DDNS_TTL is the time to live in DNS caches. Note that this
1875331Samw  * does not affect the entry in the authoritative DNS database.
1885331Samw  */
1895331Samw #define	DDNS_TTL	1200
1905331Samw 
1915331Samw #ifdef __cplusplus
1925331Samw }
1935331Samw #endif
1945331Samw 
1955331Samw #endif /* _SMBSRV_DYNDNS_H */
196