da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER START
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The contents of this file are subject to the terms of the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Common Development and Distribution License (the "License").
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You may not use this file except in compliance with the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * or http://www.opensolaris.org/os/licensing.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * See the License for the specific language governing permissions
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and limitations under the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * When distributing Covered Code, include this CDDL HEADER in each
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If applicable, add the following below this CDDL HEADER, with the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * fields enclosed by brackets "[]" replaced with your own identifying
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * information: Portions Copyright [yyyy] [name of copyright owner]
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER END
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Use is subject to license terms.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#ifndef _SMBSRV_DYNDNS_H
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define _SMBSRV_DYNDNS_H
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#pragma ident "%Z%%M% %I% %E% SMI"
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#include <smbsrv/libsmbns.h>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Header section format:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The header contains the following fields:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 1 1 1 1 1 1
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * | ID |
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * |QR| Opcode |AA|TC|RD|RA| Z | RCODE |
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * | QDCOUNT |
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * | ANCOUNT |
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * | NSCOUNT |
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * | ARCOUNT |
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * where:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ID A 16 bit identifier assigned by the program that
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * generates any kind of query. This identifier is copied
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the corresponding reply and can be used by the requester
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * to match up replies to outstanding queries.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * QR A one bit field that specifies whether this message is a
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * query (0), or a response (1).
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * OPCODE A four bit field that specifies kind of query in this
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * message. This value is set by the originator of a query
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and copied into the response. The values are:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 0 a standard query (QUERY)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 1 an inverse query (IQUERY)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 2 a server status request (STATUS)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 3-15 reserved for future use
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * AA Authoritative Answer - this bit is valid in responses,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and specifies that the responding name server is an
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * authority for the domain name in question section.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Note that the contents of the answer section may have
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * multiple owner names because of aliases. The AA bit
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * corresponds to the name which matches the query name, or
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the first owner name in the answer section.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * TC TrunCation - specifies that this message was truncated
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * due to length greater than that permitted on the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * transmission channel.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * RD Recursion Desired - this bit may be set in a query and
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * is copied into the response. If RD is set, it directs
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the name server to pursue the query recursively.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Recursive query support is optional.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * RA Recursion Available - this be is set or cleared in a
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * response, and denotes whether recursive query support is
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * available in the name server.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Z Reserved for future use. Must be zero in all queries
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and responses.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * RCODE Response code - this 4 bit field is set as part of
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * responses. The values have the following
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * interpretation:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 0 No error condition
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 1 Format error - The name server was
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * unable to interpret the query.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 2 Server failure - The name server was
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * unable to process this query due to a
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * problem with the name server.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 3 Name Error - Meaningful only for
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * responses from an authoritative name
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * server, this code signifies that the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * domain name referenced in the query does
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * not exist.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 4 Not Implemented - The name server does
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * not support the requested kind of query.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 5 Refused - The name server refuses to
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * perform the specified operation for
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * policy reasons. For example, a name
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * server may not wish to provide the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * information to the particular requester,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * or a name server may not wish to perform
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * a particular operation (e.g., zone
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * transfer) for particular data.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 6-15 Reserved for future use.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * QDCOUNT an unsigned 16 bit integer specifying the number of
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * entries in the question section.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ANCOUNT an unsigned 16 bit integer specifying the number of
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * resource records in the answer section.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * NSCOUNT an unsigned 16 bit integer specifying the number of name
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * server resource records in the authority records
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * section.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ARCOUNT an unsigned 16 bit integer specifying the number of
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * resource records in the additional records section.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#include <sys/types.h>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#ifdef __cplusplus
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwextern "C" {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#endif
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/* Other definitions: */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define REQ_QUERY 1 /* DNS query request */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define REQ_UPDATE 0 /* DNS update request */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define UPDATE_FORW 1 /* Update forward lookup zone */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define UPDATE_REV 0 /* Update reverse lookup zone */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define UPDATE_ADD 1 /* Update add request */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define UPDATE_DEL 0 /* Update remove request */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define MODE_GSS_API 3 /* Key negotiation mode */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/* Max buffer size for send and receive buffer */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define MAX_BUF_SIZE 2000
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define MAX_RETRIES 3 /* Max number of send retries if no response */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define TSIG_SIGNED 1 /* TSIG contains signed data */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define TSIG_UNSIGNED 0 /* TSIG does not conain signed data */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define DNS_CHECK 1 /* Check DNS for entry */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define DNS_NOCHECK 0 /* Don't check DNS for entry */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define MAX_TCP_SIZE 2000 /* max tcp DNS message size */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/* Delete 1 entry */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define DEL_ONE 1
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/* Delete all entries of the same resource name */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define DEL_ALL 0
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define DNSF_RECUR_SUPP 0x80 /* Server can do recursive queries */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define DNSF_RECUR_QRY 0x100 /* Query is recursive */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define BUFLEN_TCP(x, y) (MAX_TCP_SIZE-(x-y))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define BUFLEN_UDP(x, y) (NS_PACKETSZ-(x-y))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * DDNS_TTL is the time to live in DNS caches. Note that this
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * does not affect the entry in the authoritative DNS database.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define DDNS_TTL 1200
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#ifdef __cplusplus
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw}
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#endif
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#endif /* _SMBSRV_DYNDNS_H */