"Fossies" - the Fresh Open Source Software Archive

Member "nsd-4.3.7/difffile.h" (22 Jul 2021, 5120 Bytes) of package /linux/misc/dns/nsd-4.3.7.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "difffile.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 4.3.6_vs_4.3.7.

    1 /*
    2  * difffile.h - nsd.diff file handling header file. Read/write diff files.
    3  *
    4  * Copyright (c) 2001-2006, NLnet Labs. All rights reserved.
    5  *
    6  * See LICENSE for the license.
    7  *
    8  */
    9 #ifndef DIFFFILE_H
   10 #define DIFFFILE_H
   11 
   12 #include "rbtree.h"
   13 #include "namedb.h"
   14 #include "options.h"
   15 #include "udb.h"
   16 struct nsd;
   17 struct nsdst;
   18 
   19 #define DIFF_PART_XXFR ('X'<<24 | 'X'<<16 | 'F'<<8 | 'R')
   20 #define DIFF_PART_XFRF ('X'<<24 | 'F'<<16 | 'R'<<8 | 'F')
   21 
   22 /* write an xfr packet data to the diff file, type=IXFR.
   23    The diff file is created if necessary, with initial header(notcommitted). */
   24 void diff_write_packet(const char* zone, const char* pat, uint32_t old_serial,
   25     uint32_t new_serial, uint32_t seq_nr, uint8_t* data, size_t len,
   26     struct nsd* nsd, uint64_t filenumber);
   27 
   28 /*
   29  * Overwrite header of diff file with committed vale and other data.
   30  * append log string.
   31  */
   32 void diff_write_commit(const char* zone, uint32_t old_serial,
   33     uint32_t new_serial, uint32_t num_parts, uint8_t commit,
   34     const char* log_msg, struct nsd* nsd, uint64_t filenumber);
   35 
   36 /*
   37  * These functions read parts of the diff file.
   38  */
   39 int diff_read_32(FILE *in, uint32_t* result);
   40 int diff_read_8(FILE *in, uint8_t* result);
   41 int diff_read_str(FILE* in, char* buf, size_t len);
   42 
   43 /* delete the RRs for a zone from memory */
   44 void delete_zone_rrs(namedb_type* db, zone_type* zone);
   45 /* delete an RR */
   46 int delete_RR(namedb_type* db, const dname_type* dname,
   47     uint16_t type, uint16_t klass,
   48     buffer_type* packet, size_t rdatalen, zone_type *zone,
   49     region_type* temp_region, struct udb_ptr* udbz, int* softfail);
   50 /* add an RR */
   51 int add_RR(namedb_type* db, const dname_type* dname,
   52     uint16_t type, uint16_t klass, uint32_t ttl,
   53     buffer_type* packet, size_t rdatalen, zone_type *zone,
   54     struct udb_ptr* udbz, int* softfail);
   55 
   56 /* task udb structure */
   57 struct task_list_d {
   58     /** next task in list */
   59     udb_rel_ptr next;
   60     /** task type */
   61     enum {
   62         /** expire or un-expire a zone */
   63         task_expire,
   64         /** apply an ixfr or axfr to a zone */
   65         task_apply_xfr,
   66         /** soa info for zone */
   67         task_soa_info,
   68         /** check mtime of zonefiles and read them, done on SIGHUP */
   69         task_check_zonefiles,
   70         /** write zonefiles (if changed) */
   71         task_write_zonefiles,
   72         /** set verbosity */
   73         task_set_verbosity,
   74         /** statistic info */
   75         task_stat_info,
   76         /** add a zone */
   77         task_add_zone,
   78         /** delete zone */
   79         task_del_zone,
   80         /** add TSIG key */
   81         task_add_key,
   82         /** delete TSIG key */
   83         task_del_key,
   84         /** add pattern */
   85         task_add_pattern,
   86         /** delete pattern */
   87         task_del_pattern,
   88         /** options change */
   89         task_opt_change,
   90         /** zonestat increment */
   91         task_zonestat_inc,
   92         /** add a new cookie secret */
   93         task_add_cookie_secret,
   94         /** drop the oldest cookie secret */
   95         task_drop_cookie_secret,
   96         /** make staging cookie secret active */
   97         task_activate_cookie_secret,
   98     } task_type;
   99     uint32_t size; /* size of this struct */
  100 
  101     /** soainfo: zonename dname, soaRR wireform */
  102     /** expire: zonename, boolyesno */
  103     /** apply_xfr: zonename, serials, yesno is filenamecounter */
  104     uint32_t oldserial, newserial;
  105     /** general variable.  for some used to see if zname is present. */
  106     uint64_t yesno;
  107     struct dname zname[0];
  108 };
  109 #define TASKLIST(ptr) ((struct task_list_d*)UDB_PTR(ptr))
  110 /** create udb for tasks */
  111 struct udb_base* task_file_create(const char* file);
  112 void task_remap(udb_base* udb);
  113 void task_process_sync(udb_base* udb);
  114 void task_clear(udb_base* udb);
  115 void task_new_soainfo(udb_base* udb, udb_ptr* last, struct zone* z, int gone);
  116 void task_new_expire(udb_base* udb, udb_ptr* last,
  117     const struct dname* z, int expired);
  118 void* task_new_stat_info(udb_base* udb, udb_ptr* last, struct nsdst* stat,
  119     size_t child_count);
  120 void task_new_check_zonefiles(udb_base* udb, udb_ptr* last,
  121     const dname_type* zone);
  122 void task_new_write_zonefiles(udb_base* udb, udb_ptr* last,
  123     const dname_type* zone);
  124 void task_new_set_verbosity(udb_base* udb, udb_ptr* last, int v);
  125 void task_new_add_zone(udb_base* udb, udb_ptr* last, const char* zone,
  126     const char* pattern, unsigned zonestatid);
  127 void task_new_del_zone(udb_base* udb, udb_ptr* last, const dname_type* dname);
  128 void task_new_add_key(udb_base* udb, udb_ptr* last, struct key_options* key);
  129 void task_new_del_key(udb_base* udb, udb_ptr* last, const char* name);
  130 void task_new_add_pattern(udb_base* udb, udb_ptr* last,
  131     struct pattern_options* p);
  132 void task_new_del_pattern(udb_base* udb, udb_ptr* last, const char* name);
  133 void task_new_opt_change(udb_base* udb, udb_ptr* last, struct nsd_options* opt);
  134 void task_new_zonestat_inc(udb_base* udb, udb_ptr* last, unsigned sz);
  135 void task_new_add_cookie_secret(udb_base* udb, udb_ptr* last, const char* secret);
  136 void task_new_drop_cookie_secret(udb_base* udb, udb_ptr* last);
  137 void task_new_activate_cookie_secret(udb_base* udb, udb_ptr* last);
  138 int task_new_apply_xfr(udb_base* udb, udb_ptr* last, const dname_type* zone,
  139     uint32_t old_serial, uint32_t new_serial, uint64_t filenumber);
  140 void task_process_in_reload(struct nsd* nsd, udb_base* udb, udb_ptr *last_task,
  141     udb_ptr* task);
  142 void task_process_expire(namedb_type* db, struct task_list_d* task);
  143 
  144 #endif /* DIFFFILE_H */