Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00034 #include "config.h"
00035 #include "adapter/adapi.h"
00036 #include "shared/duration.h"
00037 #include "shared/log.h"
00038 #include "shared/status.h"
00039 #include "shared/util.h"
00040 #include "signer/zone.h"
00041
00042 #include <ldns/ldns.h>
00043
00044 static const char* adapi_str = "adapter";
00045
00046
00051 uint32_t
00052 adapi_get_serial(zone_type* zone)
00053 {
00054 if (!zone || !zone->zonedata) {
00055 ods_log_error("[%s] unable to get serial: "
00056 "no zone data", adapi_str);
00057 return 0;
00058 }
00059 ods_log_assert(zone);
00060 ods_log_assert(zone->zonedata);
00061 return zone->zonedata->inbound_serial;
00062 }
00063
00064
00069 void
00070 adapi_set_serial(zone_type* zone, uint32_t serial)
00071 {
00072 if (!zone || !zone->zonedata) {
00073 ods_log_error("[%s] unable to set serial: "
00074 "no zone data", adapi_str);
00075 return;
00076 }
00077 ods_log_assert(zone);
00078 ods_log_assert(zone->zonedata);
00079 zone->zonedata->inbound_serial = serial;
00080 return;
00081 }
00082
00083
00088 ldns_rdf*
00089 adapi_get_origin(zone_type* zone)
00090 {
00091 if (!zone) {
00092 ods_log_error("[%s] unable to get origin: "
00093 "no zone", adapi_str);
00094 return NULL;
00095 }
00096 ods_log_assert(zone);
00097 return zone->dname;
00098 }
00099
00100
00105 uint32_t
00106 adapi_get_ttl(zone_type* zone)
00107 {
00108 if (!zone || !zone->zonedata) {
00109 ods_log_error("[%s] unable to get ttl: "
00110 "no zone data", adapi_str);
00111 return 0;
00112 }
00113 ods_log_assert(zone);
00114 ods_log_assert(zone->zonedata);
00115 return zone->zonedata->default_ttl;
00116 }
00117
00118
00119
00120
00121
00122
00123 ods_status
00124 adapi_trans_full(zone_type* zone)
00125 {
00126 if (!zone || !zone->zonedata) {
00127 ods_log_error("[%s] unable to start full zone transaction: "
00128 "no zone data", adapi_str);
00129 return ODS_STATUS_ASSERT_ERR;
00130 }
00131 ods_log_assert(zone);
00132 ods_log_assert(zone->zonedata);
00133 if (!zone->signconf) {
00134 ods_log_error("[%s] unable to start full zone transaction: "
00135 "no signer configuration", adapi_str);
00136 return ODS_STATUS_ASSERT_ERR;
00137 }
00138 ods_log_assert(zone->signconf);
00139
00140 return zonedata_diff(zone->zonedata, zone->signconf->keys);
00141 }
00142
00143
00144
00145
00146
00147
00148 ods_status
00149 adapi_trans_diff(zone_type* zone)
00150 {
00151 if (!zone || !zone->zonedata) {
00152 ods_log_error("[%s] unable to start incremental zone transaction: "
00153 "no zone data", adapi_str);
00154 return ODS_STATUS_ASSERT_ERR;
00155 }
00156 ods_log_assert(zone);
00157 ods_log_assert(zone->zonedata);
00158
00159 return ODS_STATUS_OK;
00160 }
00161
00162
00167 ods_status
00168 adapi_add_rr(zone_type* zone, ldns_rr* rr)
00169 {
00170 return zone_add_rr(zone, rr, 1);
00171 }
00172
00173
00178 ods_status
00179 adapi_del_rr(zone_type* zone, ldns_rr* rr)
00180 {
00181 return zone_del_rr(zone, rr, 1);
00182 }