1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/*!
* \file changesets.h
*
* \author Lubos Slovak <lubos.slovak@nic.cz>
*
* \brief Structure for representing IXFR/DDNS changeset and its API.
*
* \addtogroup libknot
* @{
*/
/* Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KNOT_CHANGESETS_H_
#define _KNOT_CHANGESETS_H_
#include "rrset.h"
/*! \todo Changeset must be serializable/deserializable, so
* all data and pointers have to be changeset-exclusive,
* or more advanced structure serialization scheme has to be
* implemented.
*
* \todo Preallocation of space for changeset.
*/
typedef struct {
knot_rrset_t *soa_from;
knot_rrset_t **remove;
size_t remove_count;
size_t remove_allocated;
knot_rrset_t *soa_to;
knot_rrset_t **add;
size_t add_count;
size_t add_allocated;
uint8_t *data;
size_t size;
size_t allocated;
uint32_t serial_from;
uint32_t serial_to;
} knot_changeset_t;
/*----------------------------------------------------------------------------*/
typedef struct {
knot_changeset_t *sets;
size_t count;
size_t allocated;
knot_rrset_t *first_soa;
} knot_changesets_t;
/*----------------------------------------------------------------------------*/
typedef enum {
XFRIN_CHANGESET_ADD,
XFRIN_CHANGESET_REMOVE
} xfrin_changeset_part_t;
/*----------------------------------------------------------------------------*/
int knot_changeset_allocate(knot_changesets_t **changesets);
int knot_changeset_add_rrset(knot_rrset_t ***rrsets,
size_t *count, size_t *allocated,
knot_rrset_t *rrset);
int knot_changeset_add_rr(knot_rrset_t ***rrsets, size_t *count,
size_t *allocated, knot_rrset_t *rr);
int knot_changeset_add_new_rr(knot_changeset_t *changeset,
knot_rrset_t *rrset,
xfrin_changeset_part_t part);
void knot_changeset_store_soa(knot_rrset_t **chg_soa,
uint32_t *chg_serial, knot_rrset_t *soa);
int knot_changeset_add_soa(knot_changeset_t *changeset, knot_rrset_t *soa,
xfrin_changeset_part_t part);
int knot_changesets_check_size(knot_changesets_t *changesets);
void knot_free_changeset(knot_changeset_t **changeset);
void knot_free_changesets(knot_changesets_t **changesets);
#endif /* _KNOT_CHANGESETS_H_ */
/*! @} */
|