Lines Matching defs:ixfr_store
951 struct ixfr_store* ixfr_store_start(struct zone* zone,
952 struct ixfr_store* ixfr_store_mem)
954 struct ixfr_store* ixfr_store = ixfr_store_mem;
955 memset(ixfr_store, 0, sizeof(*ixfr_store));
956 ixfr_store->zone = zone;
957 ixfr_store->data = xalloc_zero(sizeof(*ixfr_store->data));
958 return ixfr_store;
961 void ixfr_store_cancel(struct ixfr_store* ixfr_store)
963 ixfr_store->cancelled = 1;
964 ixfr_data_free(ixfr_store->data);
965 ixfr_store->data = NULL;
968 void ixfr_store_free(struct ixfr_store* ixfr_store)
970 if(!ixfr_store)
972 ixfr_data_free(ixfr_store->data);
998 static void ixfr_put_newsoa(struct ixfr_store* ixfr_store, uint8_t** rrs,
1003 if(!ixfr_store->data)
1005 soa = ixfr_store->data->newsoa;
1006 soa_len= ixfr_store->data->newsoa_len;
1009 log_msg(LOG_ERR, "ixfr_store addrr: cannot allocate space");
1010 ixfr_store_cancel(ixfr_store);
1028 void ixfr_store_finish_data(struct ixfr_store* ixfr_store)
1030 if(ixfr_store->data_trimmed)
1032 ixfr_store->data_trimmed = 1;
1035 ixfr_put_newsoa(ixfr_store, &ixfr_store->data->del,
1036 &ixfr_store->data->del_len, &ixfr_store->del_capacity);
1037 ixfr_put_newsoa(ixfr_store, &ixfr_store->data->add,
1038 &ixfr_store->data->add_len, &ixfr_store->add_capacity);
1042 if(!ixfr_store->data)
1044 ixfr_trim_capacity(&ixfr_store->data->del,
1045 &ixfr_store->data->del_len, &ixfr_store->del_capacity);
1046 ixfr_trim_capacity(&ixfr_store->data->add,
1047 &ixfr_store->data->add_len, &ixfr_store->add_capacity);
1050 void ixfr_store_finish(struct ixfr_store* ixfr_store, struct nsd* nsd,
1053 if(ixfr_store->cancelled) {
1054 ixfr_store_free(ixfr_store);
1058 ixfr_store_finish_data(ixfr_store);
1060 if(ixfr_store->cancelled) {
1061 ixfr_store_free(ixfr_store);
1065 if(log_buf && !ixfr_store->data->log_str)
1066 ixfr_store->data->log_str = strdup(log_buf);
1069 if(!ixfr_store->zone->ixfr)
1070 ixfr_store->zone->ixfr = zone_ixfr_create(nsd);
1071 zone_ixfr_make_space(ixfr_store->zone->ixfr, ixfr_store->zone,
1072 ixfr_store->data, ixfr_store);
1073 if(ixfr_store->cancelled) {
1074 ixfr_store_free(ixfr_store);
1077 zone_ixfr_add(ixfr_store->zone->ixfr, ixfr_store->data, 1);
1078 ixfr_store->data = NULL;
1081 ixfr_store_free(ixfr_store);
1091 log_msg(LOG_ERR, "ixfr_store: cannot parse soa nsname in packet");
1096 log_msg(LOG_ERR, "ixfr_store: cannot parse soa maintname in packet");
1146 void ixfr_store_add_newsoa(struct ixfr_store* ixfr_store, uint32_t ttl,
1155 if(ixfr_store->cancelled)
1157 if(ixfr_store->data->newsoa) {
1158 free(ixfr_store->data->newsoa);
1159 ixfr_store->data->newsoa = NULL;
1160 ixfr_store->data->newsoa_len = 0;
1165 sz = domain_dname(ixfr_store->zone->apex)->name_size;
1169 log_msg(LOG_ERR, "ixfr_store: not enough rdata space in packet");
1170 ixfr_store_cancel(ixfr_store);
1176 log_msg(LOG_ERR, "ixfr_store newsoa: cannot parse packet");
1177 ixfr_store_cancel(ixfr_store);
1183 ixfr_store->data->newserial = serial;
1186 ixfr_store->data->newsoa = xalloc(sz);
1187 ixfr_store->data->newsoa_len = sz;
1188 store_soa(ixfr_store->data->newsoa, ixfr_store->zone, ttl,
1195 void ixfr_store_add_oldsoa(struct ixfr_store* ixfr_store, uint32_t ttl,
1204 if(ixfr_store->cancelled)
1206 if(ixfr_store->data->oldsoa) {
1207 free(ixfr_store->data->oldsoa);
1208 ixfr_store->data->oldsoa = NULL;
1209 ixfr_store->data->oldsoa_len = 0;
1212 zone_ixfr_make_space(ixfr_store->zone->ixfr, ixfr_store->zone,
1213 ixfr_store->data, ixfr_store);
1214 if(ixfr_store->cancelled)
1219 sz = domain_dname(ixfr_store->zone->apex)->name_size;
1223 log_msg(LOG_ERR, "ixfr_store oldsoa: not enough rdata space in packet");
1224 ixfr_store_cancel(ixfr_store);
1230 log_msg(LOG_ERR, "ixfr_store oldsoa: cannot parse packet");
1231 ixfr_store_cancel(ixfr_store);
1237 ixfr_store->data->oldserial = serial;
1240 ixfr_store->data->oldsoa = xalloc(sz);
1241 ixfr_store->data->oldsoa_len = sz;
1242 store_soa(ixfr_store->data->oldsoa, ixfr_store->zone, ttl,
1285 void ixfr_store_putrr(struct ixfr_store* ixfr_store, const rr_type* rr,
1290 if(ixfr_store->cancelled)
1300 zone_ixfr_make_space(ixfr_store->zone->ixfr, ixfr_store->zone,
1301 ixfr_store->data, ixfr_store);
1302 if(ixfr_store->cancelled)
1310 log_msg(LOG_ERR, "ixfr_store addrr: cannot parse rdata format");
1312 log_msg(LOG_ERR, "ixfr_store addrr: cannot allocate space");
1313 ixfr_store_cancel(ixfr_store);
1318 void ixfr_store_delrr(struct ixfr_store* ixfr_store, const rr_type* rr)
1320 if(ixfr_store->cancelled)
1322 ixfr_store_putrr(ixfr_store, rr, &ixfr_store->data->del,
1323 &ixfr_store->data->del_len, &ixfr_store->del_capacity);
1326 void ixfr_store_addrr(struct ixfr_store* ixfr_store, const rr_type* rr)
1328 if(ixfr_store->cancelled)
1330 ixfr_store_putrr(ixfr_store, rr, &ixfr_store->data->add,
1331 &ixfr_store->data->add_len, &ixfr_store->add_capacity);
1334 int ixfr_store_addrr_rdatas(struct ixfr_store* ixfr_store, const rr_type *rr)
1336 if(ixfr_store->cancelled)
1340 if(ixfr_putrr(rr, &ixfr_store->data->add, &ixfr_store->data->add_len,
1341 &ixfr_store->add_capacity) <= 0)
1346 int ixfr_store_add_newsoa_rdatas(struct ixfr_store* ixfr_store,
1350 if(ixfr_store->cancelled)
1352 if(!retrieve_soa_rdata_serial(rr, &ixfr_store->data->newserial))
1354 if(ixfr_putrr(rr, &ixfr_store->data->newsoa,
1355 &ixfr_store->data->newsoa_len, &ixfr_store->add_capacity) <= 0)
1357 ixfr_trim_capacity(&ixfr_store->data->newsoa,
1358 &ixfr_store->data->newsoa_len, &capacity);
1396 int ixfr_store_delrr_uncompressed(struct ixfr_store* ixfr_store,
1400 if(ixfr_store->cancelled)
1405 ttl, rdata, rdata_len, &ixfr_store->data->del,
1406 &ixfr_store->data->del_len, &ixfr_store->del_capacity);
1426 int ixfr_store_oldsoa_uncompressed(struct ixfr_store* ixfr_store,
1432 if(ixfr_store->cancelled)
1435 ttl, rdata, rdata_len, &ixfr_store->data->oldsoa,
1436 &ixfr_store->data->oldsoa_len, &capacity))
1448 ixfr_store->data->oldserial = ntohl(serial);
1450 ixfr_trim_capacity(&ixfr_store->data->oldsoa,
1451 &ixfr_store->data->oldsoa_len, &capacity);
1546 struct ixfr_data* data, struct ixfr_store* ixfr_store)
1552 ixfr_store_cancel(ixfr_store);
1580 ixfr_store_cancel(ixfr_store);