/*
* Copyright (C) 2011-2013, 2015-2017 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id$ */
#ifndef DNS_RPZ_H
#include <isc/deprecated.h>
#include <isc/refcount.h>
#include <dns/fixedname.h>
/*
* Sub-zones of various trigger types.
*/
/*
* Special policies.
*/
typedef enum {
/*
* Require DNS_RPZ_POLICY_PASSTHRU < DNS_RPZ_POLICY_DROP
* < DNS_RPZ_POLICY_TCP_ONLY DNS_RPZ_POLICY_NXDOMAIN < DNS_RPZ_POLICY_NODATA
* < DNS_RPZ_POLICY_CNAME to choose among competing policies.
*/
typedef enum {
#if DNS_RPZ_MAX_ZONES > 32
# if DNS_RPZ_MAX_ZONES > 64
# error "rpz zone bit masks must fit in a word"
# endif
#else
#endif
/*
* Mask of the specified and higher numbered policy zones
* Avoid hassles with (1<<33) or (1<<65)
*/
0 : (1<<((n)+1))) -1))
/*
* The trigger counter type.
*/
/*
* The number of triggers of each type in a response policy zone.
*/
struct dns_rpz_triggers {
};
/*
* A single response policy zone.
*/
struct dns_rpz_zone {
};
/*
* Radix tree node for response policy IP addresses
*/
/*
* Bitfields indicating which policy zones have policies of
* which type.
*/
struct dns_rpz_have {
};
/*
* Policy options
*/
struct dns_rpz_popt {
unsigned int min_ns_labels;
};
/*
* Response policy zones known to a view.
*/
struct dns_rpz_zones {
/*
* RPZ policy version number (initially 0, increases whenever
* the server is reconfigured with new zones or policy)
*/
int rpz_ver;
dns_rpz_zbits_t defined;
/*
* The set of records for a policy zone are in one of these states:
* never loaded load_begun=0 have=0
* during initial loading load_begun=1 have=0
* and rbtdb->rpzsp == rbtdb->load_rpzsp
* after good load load_begun=1 have!=0
* after failed initial load load_begun=1 have=0
* and rbtdb->load_rpzsp == NULL
* reloading after failure load_begun=1 have=0
* reloading after success
* main rpzs load_begun=1 have!=0
* load rpzs load_begun=1 have=0
*/
/*
* total_triggers maintains the total number of triggers in all
* policy zones in the view. It is only used to print summary
* statistics after a zone load of how the trigger counts
* changed.
*/
/*
* One lock for short term read-only search that guarantees the
* consistency of the pointers.
* A second lock for maintenance that guarantees no other thread
* is adding or deleting nodes.
*/
};
/*
* context for finding the best policy
*/
typedef struct {
unsigned int state;
/*
* Best match so far.
*/
struct {
} m;
/*
* State for chasing IP addresses and NS names including recursion.
*/
struct {
unsigned int label;
} r;
/*
* State of real query while recursing for NSIP or NSDNAME.
*/
struct {
} q;
/*
* A copy of the 'have' and 'p' structures and the RPZ
* policy version as of the beginning of RPZ processing,
* used to avoid problems when policy is updated while
* RPZ recursion is ongoing.
*/
int rpz_ver;
/*
* p_name: current policy owner name
* r_name: recursing for this name to possible policy triggers
* f_name: saved found name from before recursion
*/
} dns_rpz_st_t;
/*
* So various response policy zone messages can be turned up or down.
*/
const char *
dns_rpz_str2policy(const char *str);
const char *
void
void
void
#endif /* DNS_RPZ_H */