2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _SMBSRV_DYNDNS_H
2N/A#define _SMBSRV_DYNDNS_H
2N/A
2N/A#include <smbsrv/libsmbns.h>
2N/A
2N/A/*
2N/A * Header section format:
2N/A *
2N/A * The header contains the following fields:
2N/A *
2N/A * 1 1 1 1 1 1
2N/A * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
2N/A * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
2N/A * | ID |
2N/A * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
2N/A * |QR| Opcode |AA|TC|RD|RA| Z | RCODE |
2N/A * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
2N/A * | QDCOUNT |
2N/A * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
2N/A * | ANCOUNT |
2N/A * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
2N/A * | NSCOUNT |
2N/A * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
2N/A * | ARCOUNT |
2N/A * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
2N/A *
2N/A * where:
2N/A *
2N/A * ID A 16 bit identifier assigned by the program that
2N/A * generates any kind of query. This identifier is copied
2N/A * the corresponding reply and can be used by the requester
2N/A * to match up replies to outstanding queries.
2N/A *
2N/A * QR A one bit field that specifies whether this message is a
2N/A * query (0), or a response (1).
2N/A *
2N/A * OPCODE A four bit field that specifies kind of query in this
2N/A * message. This value is set by the originator of a query
2N/A * and copied into the response. The values are:
2N/A *
2N/A * 0 a standard query (QUERY)
2N/A *
2N/A * 1 an inverse query (IQUERY)
2N/A *
2N/A * 2 a server status request (STATUS)
2N/A *
2N/A * 3-15 reserved for future use
2N/A *
2N/A * AA Authoritative Answer - this bit is valid in responses,
2N/A * and specifies that the responding name server is an
2N/A * authority for the domain name in question section.
2N/A *
2N/A * Note that the contents of the answer section may have
2N/A * multiple owner names because of aliases. The AA bit
2N/A *
2N/A * corresponds to the name which matches the query name, or
2N/A * the first owner name in the answer section.
2N/A *
2N/A * TC TrunCation - specifies that this message was truncated
2N/A * due to length greater than that permitted on the
2N/A * transmission channel.
2N/A *
2N/A * RD Recursion Desired - this bit may be set in a query and
2N/A * is copied into the response. If RD is set, it directs
2N/A * the name server to pursue the query recursively.
2N/A * Recursive query support is optional.
2N/A *
2N/A * RA Recursion Available - this be is set or cleared in a
2N/A * response, and denotes whether recursive query support is
2N/A * available in the name server.
2N/A *
2N/A * Z Reserved for future use. Must be zero in all queries
2N/A * and responses.
2N/A *
2N/A * RCODE Response code - this 4 bit field is set as part of
2N/A * responses. The values have the following
2N/A * interpretation:
2N/A *
2N/A * 0 No error condition
2N/A *
2N/A * 1 Format error - The name server was
2N/A * unable to interpret the query.
2N/A *
2N/A * 2 Server failure - The name server was
2N/A * unable to process this query due to a
2N/A * problem with the name server.
2N/A *
2N/A * 3 Name Error - Meaningful only for
2N/A * responses from an authoritative name
2N/A * server, this code signifies that the
2N/A * domain name referenced in the query does
2N/A * not exist.
2N/A *
2N/A * 4 Not Implemented - The name server does
2N/A * not support the requested kind of query.
2N/A *
2N/A * 5 Refused - The name server refuses to
2N/A * perform the specified operation for
2N/A * policy reasons. For example, a name
2N/A * server may not wish to provide the
2N/A * information to the particular requester,
2N/A * or a name server may not wish to perform
2N/A * a particular operation (e.g., zone
2N/A *
2N/A * transfer) for particular data.
2N/A *
2N/A * 6-15 Reserved for future use.
2N/A *
2N/A * QDCOUNT an unsigned 16 bit integer specifying the number of
2N/A * entries in the question section.
2N/A *
2N/A * ANCOUNT an unsigned 16 bit integer specifying the number of
2N/A * resource records in the answer section.
2N/A *
2N/A * NSCOUNT an unsigned 16 bit integer specifying the number of name
2N/A * server resource records in the authority records
2N/A * section.
2N/A *
2N/A * ARCOUNT an unsigned 16 bit integer specifying the number of
2N/A * resource records in the additional records section.
2N/A */
2N/A
2N/A#include <sys/types.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/* DNS Update semantics, per RFC 2136 section 2.5 */
2N/Atypedef enum dyndns_update_op {
2N/A DYNDNS_UPDATE_ADD = 1, /* Add RRs to an RRset */
2N/A DYNDNS_UPDATE_DEL_ALL = 2, /* Delete an RRset */
2N/A DYNDNS_UPDATE_DEL_CLEAR = 3, /* Delete all RRsets from a name */
2N/A DYNDNS_UPDATE_DEL_ONE = 4 /* Delete an RR from an RRset */
2N/A} dyndns_update_op_t;
2N/A
2N/Atypedef enum dyndns_zone_dir {
2N/A DYNDNS_ZONE_REV = 0, /* Update reverse lookup zone */
2N/A DYNDNS_ZONE_FWD /* Update forward lookup zone */
2N/A} dyndns_zone_dir_t;
2N/A
2N/Atypedef enum dyndns_check_opt {
2N/A DYNDNS_CHECK_NONE = 0, /* Don't check DNS for entry */
2N/A DYNDNS_CHECK_EXIST /* Check DNS for entry */
2N/A} dyndns_check_opt_t;
2N/A
2N/A/* DNS TKEY modes, standard values, per RFC 2930 section 2.5 */
2N/Atypedef enum dyndns_tkey_mode {
2N/A DYNDNS_TKEY_MODE_SERVER = 1, /* server assignment (optional) */
2N/A DYNDNS_TKEY_MODE_DH = 2, /* Diffie-Hellman exchange (required) */
2N/A DYNDNS_TKEY_MODE_GSS = 3, /* GSS-API negotiation (optional) */
2N/A DYNDNS_TKEY_MODE_RESOLVER = 4, /* resolver assignment (optional) */
2N/A DYNDNS_TKEY_MODE_KEYDEL = 5 /* key deletion (required) */
2N/A} dyndns_tkey_mode_t;
2N/A
2N/A/* DNS TKEY RDATA fields, per RFC 2930 section 2 */
2N/Atypedef struct dyndns_tkey_rdata {
2N/A const char *tk_alg_name;
2N/A uint32_t tk_incept_time;
2N/A uint32_t tk_expire_time;
2N/A uint16_t tk_mode;
2N/A uint16_t tk_error;
2N/A uint16_t tk_key_size;
2N/A const uchar_t *tk_key_data;
2N/A uint16_t tk_other_size;
2N/A const uchar_t *tk_other_data;
2N/A} dyndns_tkey_rdata_t;
2N/A
2N/A/* Fixed offsets in TKEY RDATA, after algorithm name, per RFC 2930 section 2 */
2N/A#define DYNDNS_TKEY_OFFSET_INCEPTION 0
2N/A#define DYNDNS_TKEY_OFFSET_EXPIRATION 4
2N/A#define DYNDNS_TKEY_OFFSET_MODE 8
2N/A#define DYNDNS_TKEY_OFFSET_ERROR 10
2N/A#define DYNDNS_TKEY_OFFSET_KEYSIZE 12
2N/A#define DYNDNS_TKEY_OFFSET_KEYDATA 14
2N/A
2N/A/* DNS TSIG RDATA fields, per RFC 2845 section 2.3 */
2N/Atypedef struct dyndns_tsig_rdata {
2N/A const char *ts_alg_name;
2N/A uint64_t ts_sign_time; /* encoded as 48 bits on wire */
2N/A uint16_t ts_fudge_time;
2N/A uint16_t ts_mac_size;
2N/A const uchar_t *ts_mac_data;
2N/A uint16_t ts_orig_id;
2N/A uint16_t ts_error;
2N/A uint16_t ts_other_size;
2N/A const uchar_t *ts_other_data;
2N/A} dyndns_tsig_rdata_t;
2N/A
2N/Atypedef enum dyndns_digest_data {
2N/A DYNDNS_DIGEST_UNSIGNED = 0, /* digest includes unsigned data */
2N/A DYNDNS_DIGEST_SIGNED /* digest includes signed data */
2N/A} dyndns_digest_data_t;
2N/A
2N/A/* Flags to indicate whether to attempt non-secure or secure updates */
2N/A#define DYNDNS_SECURITY_NONE 0x00000001U
2N/A#define DYNDNS_SECURITY_GSS 0x00000002U
2N/A#define DYNDNS_SECURITY_ALL 0xffffffffU
2N/A
2N/Aint dyndns_update_nameaddr(dyndns_update_op_t, dyndns_zone_dir_t,
2N/A const char *, int, const void *, uint32_t, dyndns_check_opt_t,
2N/A const char *);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _SMBSRV_DYNDNS_H */