typedef struct pdns_ffi_record
{
const char* name;
+ size_t name_len;
const char* content;
size_t content_len;
uint32_t ttl;
typedef struct pdns_postresolve_ffi_handle pdns_postresolve_ffi_handle_t;
const char* pdns_postresolve_ffi_handle_get_qname(pdns_postresolve_ffi_handle_t* ref) __attribute__((visibility("default")));
+ void pdns_postresolve_ffi_handle_get_qname_raw(pdns_postresolve_ffi_handle_t* ref, const char** qname, size_t* qnameSize) __attribute__((visibility("default")));
uint16_t pdns_postresolve_ffi_handle_get_qtype(const pdns_postresolve_ffi_handle_t* ref) __attribute__((visibility("default")));
uint16_t pdns_postresolve_ffi_handle_get_rcode(const pdns_postresolve_ffi_handle_t* ref) __attribute__((visibility("default")));
+ void pdns_postresolve_ffi_handle_set_rcode(const pdns_postresolve_ffi_handle_t* ref, uint16_t rcode) __attribute__((visibility("default")));
pdns_policy_kind_t pdns_postresolve_ffi_handle_get_appliedpolicy_kind(const pdns_postresolve_ffi_handle_t* ref) __attribute__((visibility("default")));
void pdns_postresolve_ffi_handle_set_appliedpolicy_kind(pdns_postresolve_ffi_handle_t* ref, pdns_policy_kind_t kind) __attribute__((visibility("default")));
bool pdns_postresolve_ffi_handle_get_record(pdns_postresolve_ffi_handle_t* ref, unsigned int i, pdns_ffi_record_t* record, bool raw) __attribute__((visibility("default")));
const char* pdns_postresolve_ffi_handle_get_authip(pdns_postresolve_ffi_handle_t* ref) __attribute__((visibility("default")));
void pdns_postresolve_ffi_handle_get_authip_raw(pdns_postresolve_ffi_handle_t* ref, const void** addr, size_t* addrSize) __attribute__((visibility("default")));
}
+
+#undef PDNS_VISIBILITY
return str->c_str();
}
+void pdns_postresolve_ffi_handle_get_qname_raw(pdns_postresolve_ffi_handle_t* ref, const char** qname, size_t* qnameSize)
+{
+ const auto& storage = ref->handle.d_dq.qname.getStorage();
+ *qname = storage.data();
+ *qnameSize = storage.size();
+}
+
uint16_t pdns_postresolve_ffi_handle_get_qtype(const pdns_postresolve_ffi_handle_t* ref)
{
return ref->handle.d_dq.qtype;
return ref->handle.d_dq.rcode;
}
+void pdns_postresolve_ffi_handle_set_rcode(const pdns_postresolve_ffi_handle_t* ref, uint16_t rcode)
+{
+ ref->handle.d_dq.rcode = rcode;
+}
+
pdns_policy_kind_t pdns_postresolve_ffi_handle_get_appliedpolicy_kind(const pdns_postresolve_ffi_handle_t* ref)
{
return static_cast<pdns_policy_kind_t>(ref->handle.d_dq.appliedPolicy->d_kind);
}
try {
DNSRecord& r = ref->handle.d_dq.currentRecords->at(i);
- record->name = ref->insert(r.d_name.toStringNoDot())->c_str();
+ if (raw) {
+ const auto& storage = r.d_name.getStorage();
+ record->name = storage.data();
+ record->name_len = storage.size();
+ } else {
+ std::string name = r.d_name.toStringNoDot();
+ record->name_len = name.size();
+ record->name = ref->insert(std::move(name))->c_str();
+ }
if (raw) {
auto content = ref->insert(r.d_content->serialize(r.d_name, true));
record->content = content->data();
typedef struct pdns_ffi_record {
const char* name;
+ size_t name_len;
const char* content;
- const size_t content_len;
+ size_t content_len;
uint32_t ttl;
pdns_record_place_t place;
uint16_t type;
} pdns_ffi_record_t;
const char* pdns_postresolve_ffi_handle_get_qname(pdns_postresolve_ffi_handle_t* ref);
+ const char* pdns_postresolve_ffi_handle_get_qname_raw(pdns_postresolve_ffi_handle_t* ref, const char** name, size_t* len);
uint16_t pdns_postresolve_ffi_handle_get_qtype(const pdns_postresolve_ffi_handle_t* ref);
uint16_t pdns_postresolve_ffi_handle_get_rcode(const pdns_postresolve_ffi_handle_t* ref);
+ void pdns_postresolve_ffi_handle_set_rcode(const pdns_postresolve_ffi_handle_t* ref, uint16_t rcode);
void pdns_postresolve_ffi_handle_set_appliedpolicy_kind(pdns_postresolve_ffi_handle_t* ref, pdns_policy_kind_t kind);
bool pdns_postresolve_ffi_handle_get_record(pdns_postresolve_ffi_handle_t* ref, unsigned int i, pdns_ffi_record_t *record, bool raw);
bool pdns_postresolve_ffi_handle_set_record(pdns_postresolve_ffi_handle_t* ref, unsigned int i, const char* content, size_t contentLen, bool raw);