Lines Matching defs:ipkl

21 dns_ipkeylist_init(dns_ipkeylist_t *ipkl) {
22 ipkl->count = 0;
23 ipkl->allocated = 0;
24 ipkl->addrs = NULL;
25 ipkl->dscps = NULL;
26 ipkl->keys = NULL;
27 ipkl->labels = NULL;
31 dns_ipkeylist_clear(isc_mem_t *mctx, dns_ipkeylist_t *ipkl) {
34 REQUIRE(ipkl != NULL);
36 if (ipkl->allocated == 0)
39 if (ipkl->addrs != NULL)
40 isc_mem_put(mctx, ipkl->addrs,
41 ipkl->allocated * sizeof(isc_sockaddr_t));
43 if (ipkl->dscps != NULL)
44 isc_mem_put(mctx, ipkl->dscps,
45 ipkl->allocated * sizeof(isc_dscp_t));
47 if (ipkl->keys != NULL) {
48 for (i = 0; i < ipkl->allocated; i++) {
49 if (ipkl->keys[i] == NULL)
51 if (dns_name_dynamic(ipkl->keys[i]))
52 dns_name_free(ipkl->keys[i], mctx);
53 isc_mem_put(mctx, ipkl->keys[i], sizeof(dns_name_t));
55 isc_mem_put(mctx, ipkl->keys,
56 ipkl->allocated * sizeof(dns_name_t *));
59 if (ipkl->labels != NULL) {
60 for (i = 0; i < ipkl->allocated; i++) {
61 if (ipkl->labels[i] == NULL)
63 if (dns_name_dynamic(ipkl->labels[i]))
64 dns_name_free(ipkl->labels[i], mctx);
65 isc_mem_put(mctx, ipkl->labels[i], sizeof(dns_name_t));
67 isc_mem_put(mctx, ipkl->labels,
68 ipkl->allocated * sizeof(dns_name_t *));
71 dns_ipkeylist_init(ipkl);
165 dns_ipkeylist_resize(isc_mem_t *mctx, dns_ipkeylist_t *ipkl, unsigned int n) {
171 REQUIRE(ipkl != NULL);
172 REQUIRE(n > ipkl->count);
174 if (n <= ipkl->allocated)
190 if (ipkl->addrs != NULL) {
191 memmove(addrs, ipkl->addrs,
192 ipkl->allocated * sizeof(isc_sockaddr_t));
193 isc_mem_put(mctx, ipkl->addrs,
194 ipkl->allocated * sizeof(isc_sockaddr_t));
196 ipkl->addrs = addrs;
197 memset(&ipkl->addrs[ipkl->allocated], 0,
198 (n - ipkl->allocated) * sizeof(isc_sockaddr_t));
200 if (ipkl->dscps != NULL) {
201 memmove(dscps, ipkl->dscps,
202 ipkl->allocated * sizeof(isc_dscp_t));
203 isc_mem_put(mctx, ipkl->dscps,
204 ipkl->allocated * sizeof(isc_dscp_t));
206 ipkl->dscps = dscps;
207 memset(&ipkl->dscps[ipkl->allocated], 0,
208 (n - ipkl->allocated) * sizeof(isc_dscp_t));
210 if (ipkl->keys) {
211 memmove(keys, ipkl->keys,
212 ipkl->allocated * sizeof(dns_name_t *));
213 isc_mem_put(mctx, ipkl->keys,
214 ipkl->allocated * sizeof(dns_name_t *));
216 ipkl->keys = keys;
217 memset(&ipkl->keys[ipkl->allocated], 0,
218 (n - ipkl->allocated) * sizeof(dns_name_t *));
220 if (ipkl->labels != NULL) {
221 memmove(labels, ipkl->labels,
222 ipkl->allocated * sizeof(dns_name_t *));
223 isc_mem_put(mctx, ipkl->labels,
224 ipkl->allocated * sizeof(dns_name_t *));
226 ipkl->labels = labels;
227 memset(&ipkl->labels[ipkl->allocated], 0,
228 (n - ipkl->allocated) * sizeof(dns_name_t *));
230 ipkl->allocated = n;