Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include/bind9/dns
File: diff.h
/*
[0] Fix | Delete
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
[1] Fix | Delete
*
[2] Fix | Delete
* This Source Code Form is subject to the terms of the Mozilla Public
[3] Fix | Delete
* License, v. 2.0. If a copy of the MPL was not distributed with this
[4] Fix | Delete
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
[5] Fix | Delete
*
[6] Fix | Delete
* See the COPYRIGHT file distributed with this work for additional
[7] Fix | Delete
* information regarding copyright ownership.
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
[11] Fix | Delete
#ifndef DNS_DIFF_H
[12] Fix | Delete
#define DNS_DIFF_H 1
[13] Fix | Delete
[14] Fix | Delete
/*****
[15] Fix | Delete
***** Module Info
[16] Fix | Delete
*****/
[17] Fix | Delete
[18] Fix | Delete
/*! \file dns/diff.h
[19] Fix | Delete
* \brief
[20] Fix | Delete
* A diff is a convenience type representing a list of changes to be
[21] Fix | Delete
* made to a database.
[22] Fix | Delete
*/
[23] Fix | Delete
[24] Fix | Delete
/***
[25] Fix | Delete
*** Imports
[26] Fix | Delete
***/
[27] Fix | Delete
[28] Fix | Delete
#include <isc/lang.h>
[29] Fix | Delete
#include <isc/magic.h>
[30] Fix | Delete
[31] Fix | Delete
#include <dns/name.h>
[32] Fix | Delete
#include <dns/rdata.h>
[33] Fix | Delete
#include <dns/types.h>
[34] Fix | Delete
[35] Fix | Delete
/***
[36] Fix | Delete
*** Types
[37] Fix | Delete
***/
[38] Fix | Delete
[39] Fix | Delete
/*%
[40] Fix | Delete
* A dns_difftuple_t represents a single RR being added or deleted.
[41] Fix | Delete
* The RR type and class are in the 'rdata' member; the class is always
[42] Fix | Delete
* the real one, not a DynDNS meta-class, so that the rdatas can be
[43] Fix | Delete
* compared using dns_rdata_compare(). The TTL is significant
[44] Fix | Delete
* even for deletions, because a deletion/addition pair cannot
[45] Fix | Delete
* be canceled out if the TTL differs (it might be an explicit
[46] Fix | Delete
* TTL update).
[47] Fix | Delete
*
[48] Fix | Delete
* Tuples are also used to represent complete RRs with owner
[49] Fix | Delete
* names for a couple of other purposes, such as the
[50] Fix | Delete
* individual RRs of a "RRset exists (value dependent)"
[51] Fix | Delete
* prerequisite set. In this case, op==DNS_DIFFOP_EXISTS,
[52] Fix | Delete
* and the TTL is ignored.
[53] Fix | Delete
*
[54] Fix | Delete
* DNS_DIFFOP_*RESIGN will cause the 'resign' attribute of the resulting
[55] Fix | Delete
* RRset to be recomputed to be 'resign' seconds before the earliest RRSIG
[56] Fix | Delete
* timeexpire.
[57] Fix | Delete
*/
[58] Fix | Delete
[59] Fix | Delete
typedef enum {
[60] Fix | Delete
DNS_DIFFOP_ADD = 0, /*%< Add an RR. */
[61] Fix | Delete
DNS_DIFFOP_DEL = 1, /*%< Delete an RR. */
[62] Fix | Delete
DNS_DIFFOP_EXISTS = 2, /*%< Assert RR existence. */
[63] Fix | Delete
DNS_DIFFOP_ADDRESIGN = 4, /*%< ADD + RESIGN. */
[64] Fix | Delete
DNS_DIFFOP_DELRESIGN = 5 /*%< DEL + RESIGN. */
[65] Fix | Delete
} dns_diffop_t;
[66] Fix | Delete
[67] Fix | Delete
typedef struct dns_difftuple dns_difftuple_t;
[68] Fix | Delete
[69] Fix | Delete
#define DNS_DIFFTUPLE_MAGIC ISC_MAGIC('D','I','F','T')
[70] Fix | Delete
#define DNS_DIFFTUPLE_VALID(t) ISC_MAGIC_VALID(t, DNS_DIFFTUPLE_MAGIC)
[71] Fix | Delete
[72] Fix | Delete
struct dns_difftuple {
[73] Fix | Delete
unsigned int magic;
[74] Fix | Delete
isc_mem_t *mctx;
[75] Fix | Delete
dns_diffop_t op;
[76] Fix | Delete
dns_name_t name;
[77] Fix | Delete
dns_ttl_t ttl;
[78] Fix | Delete
dns_rdata_t rdata;
[79] Fix | Delete
ISC_LINK(dns_difftuple_t) link;
[80] Fix | Delete
/* Variable-size name data and rdata follows. */
[81] Fix | Delete
};
[82] Fix | Delete
[83] Fix | Delete
/*%
[84] Fix | Delete
* A dns_diff_t represents a set of changes being applied to
[85] Fix | Delete
* a zone. Diffs are also used to represent "RRset exists
[86] Fix | Delete
* (value dependent)" prerequisites.
[87] Fix | Delete
*/
[88] Fix | Delete
typedef struct dns_diff dns_diff_t;
[89] Fix | Delete
[90] Fix | Delete
#define DNS_DIFF_MAGIC ISC_MAGIC('D','I','F','F')
[91] Fix | Delete
#define DNS_DIFF_VALID(t) ISC_MAGIC_VALID(t, DNS_DIFF_MAGIC)
[92] Fix | Delete
[93] Fix | Delete
struct dns_diff {
[94] Fix | Delete
unsigned int magic;
[95] Fix | Delete
isc_mem_t * mctx;
[96] Fix | Delete
ISC_LIST(dns_difftuple_t) tuples;
[97] Fix | Delete
};
[98] Fix | Delete
[99] Fix | Delete
/* Type of comparison function for sorting diffs. */
[100] Fix | Delete
typedef int dns_diff_compare_func(const void *, const void *);
[101] Fix | Delete
[102] Fix | Delete
/***
[103] Fix | Delete
*** Functions
[104] Fix | Delete
***/
[105] Fix | Delete
[106] Fix | Delete
ISC_LANG_BEGINDECLS
[107] Fix | Delete
[108] Fix | Delete
/**************************************************************************/
[109] Fix | Delete
/*
[110] Fix | Delete
* Manipulation of diffs and tuples.
[111] Fix | Delete
*/
[112] Fix | Delete
[113] Fix | Delete
isc_result_t
[114] Fix | Delete
dns_difftuple_create(isc_mem_t *mctx,
[115] Fix | Delete
dns_diffop_t op, dns_name_t *name, dns_ttl_t ttl,
[116] Fix | Delete
dns_rdata_t *rdata, dns_difftuple_t **tp);
[117] Fix | Delete
/*%<
[118] Fix | Delete
* Create a tuple. Deep copies are made of the name and rdata, so
[119] Fix | Delete
* they need not remain valid after the call.
[120] Fix | Delete
*
[121] Fix | Delete
* Requires:
[122] Fix | Delete
*\li *tp != NULL && *tp == NULL.
[123] Fix | Delete
*
[124] Fix | Delete
* Returns:
[125] Fix | Delete
*\li ISC_R_SUCCESS
[126] Fix | Delete
* \li ISC_R_NOMEMORY
[127] Fix | Delete
*/
[128] Fix | Delete
[129] Fix | Delete
void
[130] Fix | Delete
dns_difftuple_free(dns_difftuple_t **tp);
[131] Fix | Delete
/*%<
[132] Fix | Delete
* Free a tuple.
[133] Fix | Delete
*
[134] Fix | Delete
* Requires:
[135] Fix | Delete
* \li **tp is a valid tuple.
[136] Fix | Delete
*
[137] Fix | Delete
* Ensures:
[138] Fix | Delete
* \li *tp == NULL
[139] Fix | Delete
* \li All memory used by the tuple is freed.
[140] Fix | Delete
*/
[141] Fix | Delete
[142] Fix | Delete
isc_result_t
[143] Fix | Delete
dns_difftuple_copy(dns_difftuple_t *orig, dns_difftuple_t **copyp);
[144] Fix | Delete
/*%<
[145] Fix | Delete
* Copy a tuple.
[146] Fix | Delete
*
[147] Fix | Delete
* Requires:
[148] Fix | Delete
* \li 'orig' points to a valid tuple
[149] Fix | Delete
*\li copyp != NULL && *copyp == NULL
[150] Fix | Delete
*/
[151] Fix | Delete
[152] Fix | Delete
void
[153] Fix | Delete
dns_diff_init(isc_mem_t *mctx, dns_diff_t *diff);
[154] Fix | Delete
/*%<
[155] Fix | Delete
* Initialize a diff.
[156] Fix | Delete
*
[157] Fix | Delete
* Requires:
[158] Fix | Delete
* \li 'diff' points to an uninitialized dns_diff_t
[159] Fix | Delete
* \li allocated by the caller.
[160] Fix | Delete
*
[161] Fix | Delete
* Ensures:
[162] Fix | Delete
* \li '*diff' is a valid, empty diff.
[163] Fix | Delete
*/
[164] Fix | Delete
[165] Fix | Delete
void
[166] Fix | Delete
dns_diff_clear(dns_diff_t *diff);
[167] Fix | Delete
/*%<
[168] Fix | Delete
* Clear a diff, destroying all its tuples.
[169] Fix | Delete
*
[170] Fix | Delete
* Requires:
[171] Fix | Delete
* \li 'diff' points to a valid dns_diff_t.
[172] Fix | Delete
*
[173] Fix | Delete
* Ensures:
[174] Fix | Delete
* \li Any tuples in the diff are destroyed.
[175] Fix | Delete
* The diff now empty, but it is still valid
[176] Fix | Delete
* and may be reused without calling dns_diff_init
[177] Fix | Delete
* again. The only memory used is that of the
[178] Fix | Delete
* dns_diff_t structure itself.
[179] Fix | Delete
*
[180] Fix | Delete
* Notes:
[181] Fix | Delete
* \li Managing the memory of the dns_diff_t structure itself
[182] Fix | Delete
* is the caller's responsibility.
[183] Fix | Delete
*/
[184] Fix | Delete
[185] Fix | Delete
void
[186] Fix | Delete
dns_diff_append(dns_diff_t *diff, dns_difftuple_t **tuple);
[187] Fix | Delete
/*%<
[188] Fix | Delete
* Append a single tuple to a diff.
[189] Fix | Delete
*
[190] Fix | Delete
*\li 'diff' is a valid diff.
[191] Fix | Delete
* \li '*tuple' is a valid tuple.
[192] Fix | Delete
*
[193] Fix | Delete
* Ensures:
[194] Fix | Delete
*\li *tuple is NULL.
[195] Fix | Delete
*\li The tuple has been freed, or will be freed when the diff is cleared.
[196] Fix | Delete
*/
[197] Fix | Delete
[198] Fix | Delete
void
[199] Fix | Delete
dns_diff_appendminimal(dns_diff_t *diff, dns_difftuple_t **tuple);
[200] Fix | Delete
/*%<
[201] Fix | Delete
* Append 'tuple' to 'diff', removing any duplicate
[202] Fix | Delete
* or conflicting updates as needed to create a minimal diff.
[203] Fix | Delete
*
[204] Fix | Delete
* Requires:
[205] Fix | Delete
*\li 'diff' is a minimal diff.
[206] Fix | Delete
*
[207] Fix | Delete
* Ensures:
[208] Fix | Delete
*\li 'diff' is still a minimal diff.
[209] Fix | Delete
* \li *tuple is NULL.
[210] Fix | Delete
* \li The tuple has been freed, or will be freed when the diff is cleared.
[211] Fix | Delete
*
[212] Fix | Delete
*/
[213] Fix | Delete
[214] Fix | Delete
isc_result_t
[215] Fix | Delete
dns_diff_sort(dns_diff_t *diff, dns_diff_compare_func *compare);
[216] Fix | Delete
/*%<
[217] Fix | Delete
* Sort 'diff' in-place according to the comparison function 'compare'.
[218] Fix | Delete
*/
[219] Fix | Delete
[220] Fix | Delete
isc_result_t
[221] Fix | Delete
dns_diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver);
[222] Fix | Delete
isc_result_t
[223] Fix | Delete
dns_diff_applysilently(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver);
[224] Fix | Delete
/*%<
[225] Fix | Delete
* Apply 'diff' to the database 'db'.
[226] Fix | Delete
*
[227] Fix | Delete
* dns_diff_apply() logs warnings about updates with no effect or
[228] Fix | Delete
* with inconsistent TTLs; dns_diff_applysilently() does not.
[229] Fix | Delete
*
[230] Fix | Delete
* For efficiency, the diff should be sorted by owner name.
[231] Fix | Delete
* If it is not sorted, operation will still be correct,
[232] Fix | Delete
* but less efficient.
[233] Fix | Delete
*
[234] Fix | Delete
* Requires:
[235] Fix | Delete
*\li *diff is a valid diff (possibly empty), containing
[236] Fix | Delete
* tuples of type #DNS_DIFFOP_ADD and/or
[237] Fix | Delete
* For #DNS_DIFFOP_DEL tuples, the TTL is ignored.
[238] Fix | Delete
*
[239] Fix | Delete
*/
[240] Fix | Delete
[241] Fix | Delete
isc_result_t
[242] Fix | Delete
dns_diff_load(dns_diff_t *diff, dns_addrdatasetfunc_t addfunc,
[243] Fix | Delete
void *add_private);
[244] Fix | Delete
/*%<
[245] Fix | Delete
* Like dns_diff_apply, but for use when loading a new database
[246] Fix | Delete
* instead of modifying an existing one. This bypasses the
[247] Fix | Delete
* database transaction mechanisms.
[248] Fix | Delete
*
[249] Fix | Delete
* Requires:
[250] Fix | Delete
*\li 'addfunc' is a valid dns_addradatasetfunc_t obtained from
[251] Fix | Delete
* dns_db_beginload()
[252] Fix | Delete
*
[253] Fix | Delete
*\li 'add_private' points to a corresponding dns_dbload_t *
[254] Fix | Delete
* (XXX why is it a void pointer, then?)
[255] Fix | Delete
*/
[256] Fix | Delete
[257] Fix | Delete
isc_result_t
[258] Fix | Delete
dns_diff_print(dns_diff_t *diff, FILE *file);
[259] Fix | Delete
[260] Fix | Delete
/*%<
[261] Fix | Delete
* Print the differences to 'file' or if 'file' is NULL via the
[262] Fix | Delete
* logging system.
[263] Fix | Delete
*
[264] Fix | Delete
* Require:
[265] Fix | Delete
*\li 'diff' to be valid.
[266] Fix | Delete
*\li 'file' to refer to a open file or NULL.
[267] Fix | Delete
*
[268] Fix | Delete
* Returns:
[269] Fix | Delete
*\li #ISC_R_SUCCESS
[270] Fix | Delete
*\li #ISC_R_NOMEMORY
[271] Fix | Delete
*\li #ISC_R_UNEXPECTED
[272] Fix | Delete
*\li any error from dns_rdataset_totext()
[273] Fix | Delete
*/
[274] Fix | Delete
[275] Fix | Delete
ISC_LANG_ENDDECLS
[276] Fix | Delete
[277] Fix | Delete
#endif /* DNS_DIFF_H */
[278] Fix | Delete
[279] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function