summaryrefslogtreecommitdiff
path: root/src/libstrongswan/resolver/rr_set.h
blob: bef3638896092d7fe1092dc788a8d23ecba26666 (plain)
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
/*
 * Copyright (C) 2012 Reto Guadagnini
 * HSR Hochschule fuer Technik Rapperswil
 *
 * 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 2 of the License, or (at your
 * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
 *
 * 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.
 */

/**
 * @defgroup rr_set rr_set
 * @{ @ingroup resolver
 */

#ifndef RR_SET_H_
#define RR_SET_H_

typedef struct rr_set_t rr_set_t;

#include <library.h>
#include <collections/enumerator.h>
#include <collections/linked_list.h>

/**
 * A set of DNS Resource Records.
 *
 * Represents a RRset as defined in RFC 2181. This RRset consists of a set of
 * Resource Records with the same label, class and type but different data.
 *
 * The DNSSEC signature Resource Records (RRSIGs) which sign the RRs of this set
 * are also part of an object of this type.
 */
struct rr_set_t {

	/**
	 * Create an enumerator over all Resource Records of this RRset.
	 *
	 * @note The enumerator's position is invalid before the first call
	 * to enumerate().
	 *
	 * @return			enumerator over Resource Records
	 */
	enumerator_t *(*create_rr_enumerator)(rr_set_t *this);

	/**
	 * Create an enumerator over all RRSIGs of this RRset
	 *
	 * @note The enumerator's position is invalid before the first call
	 * to enumerate().
	 *
	 * @return			enumerator over RRSIG Resource Records,
	 * 					NULL if there are no RRSIGs for this RRset
	 */
	enumerator_t *(*create_rrsig_enumerator)(rr_set_t *this);

	/**
	 * Destroy this RRset with all its Resource Records.
	 */
	void (*destroy) (rr_set_t *this);
};

/**
 * Create an rr_set instance.
 *
 * @param list_of_rr		list of Resource Records which form this RRset
 * @param list_of_rrsig		list of the signatures (RRSIGs) of the
 * 							Resource Records of this set
 * @return					Resource Record set, NULL on failure
 */
rr_set_t *rr_set_create(linked_list_t *list_of_rr,
						linked_list_t *list_of_rrsig);

#endif /** RR_SET_H_ @}*/