No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

from-wire.cpp 821B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include <Rcpp.h>
  2. #include <getdns/getdns.h>
  3. #include <getdns/getdns_extra.h>
  4. #include <arpa/inet.h>
  5. using namespace Rcpp;
  6. // [[Rcpp::export]]
  7. CharacterVector int_dns_wire_to_list(SEXP buf) {
  8. getdns_return_t r;
  9. bool ok = true;
  10. getdns_dict *resp;
  11. std::string out;
  12. r = getdns_wire2msg_dict(RAW(buf), LENGTH(buf), &resp);
  13. if (r == GETDNS_RETURN_GOOD) {
  14. char *charout = getdns_print_json_dict(resp, 0);
  15. if (charout) {
  16. out = std::string(charout);
  17. free(charout);
  18. } else {
  19. ok = false;
  20. }
  21. } else {
  22. ok = false;
  23. }
  24. if (resp) getdns_dict_destroy(resp);
  25. if (ok) return(wrap(out)); else return(CharacterVector());
  26. }
  27. // getdns_wire2rr_dict ( const uint8_t * wire,
  28. // size_t wire_sz,
  29. // getdns_dict ** rr_dict
  30. // )