home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / dns / ssu.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-09-17  |  4.8 KB  |  166 lines

  1. /*
  2.  * Copyright (C) 2004-2006  Internet Systems Consortium, Inc. ("ISC")
  3.  * Copyright (C) 2000, 2001, 2003  Internet Software Consortium.
  4.  *
  5.  * Permission to use, copy, modify, and distribute this software for any
  6.  * purpose with or without fee is hereby granted, provided that the above
  7.  * copyright notice and this permission notice appear in all copies.
  8.  *
  9.  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  10.  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  11.  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  12.  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  13.  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  14.  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15.  * PERFORMANCE OF THIS SOFTWARE.
  16.  */
  17.  
  18. /* $Id: ssu.h,v 1.13.18.4 2006/02/16 23:51:32 marka Exp $ */
  19.  
  20. #ifndef DNS_SSU_H
  21. #define DNS_SSU_H 1
  22.  
  23. /*! \file */
  24.  
  25. #include <isc/lang.h>
  26.  
  27. #include <dns/types.h>
  28.  
  29. ISC_LANG_BEGINDECLS
  30.  
  31. #define DNS_SSUMATCHTYPE_NAME 0
  32. #define DNS_SSUMATCHTYPE_SUBDOMAIN 1
  33. #define DNS_SSUMATCHTYPE_WILDCARD 2
  34. #define DNS_SSUMATCHTYPE_SELF 3
  35. #define DNS_SSUMATCHTYPE_SELFSUB 4
  36. #define DNS_SSUMATCHTYPE_SELFWILD 5
  37. #define DNS_SSUMATCHTYPE_MAX 5        /* maximum defined value */
  38.  
  39.  
  40. isc_result_t
  41. dns_ssutable_create(isc_mem_t *mctx, dns_ssutable_t **table);
  42. /*%<
  43.  *    Creates a table that will be used to store simple-secure-update rules.
  44.  *    Note: all locking must be provided by the client.
  45.  *
  46.  *    Requires:
  47.  *\li        'mctx' is a valid memory context
  48.  *\li        'table' is not NULL, and '*table' is NULL
  49.  *
  50.  *    Returns:
  51.  *\li        ISC_R_SUCCESS
  52.  *\li        ISC_R_NOMEMORY
  53.  */
  54.  
  55. void
  56. dns_ssutable_attach(dns_ssutable_t *source, dns_ssutable_t **targetp);
  57. /*%<
  58.  *    Attach '*targetp' to 'source'.
  59.  *
  60.  *    Requires:
  61.  *\li        'source' is a valid SSU table
  62.  *\li        'targetp' points to a NULL dns_ssutable_t *.
  63.  *
  64.  *    Ensures:
  65.  *\li        *targetp is attached to source.
  66.  */
  67.  
  68. void
  69. dns_ssutable_detach(dns_ssutable_t **tablep);
  70. /*%<
  71.  *    Detach '*tablep' from its simple-secure-update rule table.
  72.  *
  73.  *    Requires:
  74.  *\li        'tablep' points to a valid dns_ssutable_t
  75.  *
  76.  *    Ensures:
  77.  *\li        *tablep is NULL
  78.  *\li        If '*tablep' is the last reference to the SSU table, all
  79.  *            resources used by the table will be freed.
  80.  */
  81.  
  82. isc_result_t
  83. dns_ssutable_addrule(dns_ssutable_t *table, isc_boolean_t grant,
  84.              dns_name_t *identity, unsigned int matchtype,
  85.              dns_name_t *name, unsigned int ntypes,
  86.              dns_rdatatype_t *types);
  87. /*%<
  88.  *    Adds a new rule to a simple-secure-update rule table.  The rule
  89.  *    either grants or denies update privileges of an identity (or set of
  90.  *    identities) to modify a name (or set of names) or certain types present
  91.  *    at that name.
  92.  *
  93.  *    Notes:
  94.  *\li        If 'matchtype' is SELF, this rule only matches if the name
  95.  *        to be updated matches the signing identity.
  96.  *
  97.  *\li        If 'ntypes' is 0, this rule applies to all types except
  98.  *        NS, SOA, RRSIG, and NSEC.
  99.  *
  100.  *\li        If 'types' includes ANY, this rule applies to all types
  101.  *        except NSEC.
  102.  *
  103.  *    Requires:
  104.  *\li        'table' is a valid SSU table
  105.  *\li        'identity' is a valid absolute name
  106.  *\li        'matchtype' must be one of the defined constants.
  107.  *\li        'name' is a valid absolute name
  108.  *\li        If 'ntypes' > 0, 'types' must not be NULL
  109.  *
  110.  *    Returns:
  111.  *\li        ISC_R_SUCCESS
  112.  *\li        ISC_R_NOMEMORY
  113.  */
  114.  
  115. isc_boolean_t
  116. dns_ssutable_checkrules(dns_ssutable_t *table, dns_name_t *signer,
  117.             dns_name_t *name, dns_rdatatype_t type);
  118. /*%<
  119.  *    Checks that the attempted update of (name, type) is allowed according
  120.  *    to the rules specified in the simple-secure-update rule table.  If
  121.  *    no rules are matched, access is denied.  If signer is NULL, access
  122.  *    is denied.
  123.  *
  124.  *    Requires:
  125.  *\li        'table' is a valid SSU table
  126.  *\li        'signer' is NULL or a valid absolute name
  127.  *\li        'name' is a valid absolute name
  128.  */
  129.  
  130.  
  131. /*% Accessor functions to extract rule components */
  132. isc_boolean_t    dns_ssurule_isgrant(const dns_ssurule_t *rule);
  133. /*% Accessor functions to extract rule components */
  134. dns_name_t *    dns_ssurule_identity(const dns_ssurule_t *rule);
  135. /*% Accessor functions to extract rule components */
  136. unsigned int    dns_ssurule_matchtype(const dns_ssurule_t *rule);
  137. /*% Accessor functions to extract rule components */
  138. dns_name_t *    dns_ssurule_name(const dns_ssurule_t *rule);
  139. /*% Accessor functions to extract rule components */
  140. unsigned int    dns_ssurule_types(const dns_ssurule_t *rule,
  141.                   dns_rdatatype_t **types);
  142.  
  143. isc_result_t    dns_ssutable_firstrule(const dns_ssutable_t *table,
  144.                        dns_ssurule_t **rule);
  145. /*%<
  146.  * Initiates a rule iterator.  There is no need to maintain any state.
  147.  *
  148.  * Returns:
  149.  *\li    #ISC_R_SUCCESS
  150.  *\li    #ISC_R_NOMORE
  151.  */
  152.  
  153. isc_result_t    dns_ssutable_nextrule(dns_ssurule_t *rule,
  154.                       dns_ssurule_t **nextrule);
  155. /*%<
  156.  * Returns the next rule in the table.
  157.  *
  158.  * Returns:
  159.  *\li    #ISC_R_SUCCESS
  160.  *\li    #ISC_R_NOMORE
  161.  */
  162.  
  163. ISC_LANG_ENDDECLS
  164.  
  165. #endif /* DNS_SSU_H */
  166.