PageRenderTime 64ms CodeModel.GetById 35ms RepoModel.GetById 2ms app.codeStats 0ms

/libs/ldns/error.c

https://github.com/yirenjie/FreeSWITCH
C | 105 lines | 90 code | 6 blank | 9 comment | 1 complexity | 24121ab8c89a35c8bc12968f6a4e8cca MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, LGPL-2.1
  1. /*
  2. * a error2str function to make sense of all the
  3. * error codes we have laying ardoun
  4. *
  5. * a Net::DNS like library for C
  6. * LibDNS Team @ NLnet Labs
  7. * (c) NLnet Labs, 2005-2006
  8. * See the file LICENSE for the license
  9. */
  10. #include <ldns/config.h>
  11. #include <ldns/ldns.h>
  12. ldns_lookup_table ldns_error_str[] = {
  13. { LDNS_STATUS_OK, "All OK" },
  14. { LDNS_STATUS_EMPTY_LABEL, "Empty label" },
  15. { LDNS_STATUS_LABEL_OVERFLOW, "Label length overflow" },
  16. { LDNS_STATUS_DOMAINNAME_OVERFLOW, "Domainname length overflow" },
  17. { LDNS_STATUS_DOMAINNAME_UNDERFLOW, "Domainname length underflow (zero length)" },
  18. { LDNS_STATUS_DDD_OVERFLOW, "\\DDD sequence overflow (>255)" },
  19. { LDNS_STATUS_PACKET_OVERFLOW, "Packet size overflow" },
  20. { LDNS_STATUS_INVALID_POINTER, "Invalid compression pointer" },
  21. { LDNS_STATUS_MEM_ERR, "General memory error" },
  22. { LDNS_STATUS_INTERNAL_ERR, "Internal error, this should not happen" },
  23. { LDNS_STATUS_SSL_ERR, "Error in SSL library" },
  24. { LDNS_STATUS_ERR, "General LDNS error" },
  25. { LDNS_STATUS_INVALID_INT, "Conversion error, integer expected" },
  26. { LDNS_STATUS_INVALID_IP4, "Conversion error, ip4 addr expected" },
  27. { LDNS_STATUS_INVALID_IP6, "Conversion error, ip6 addr expected" },
  28. { LDNS_STATUS_INVALID_STR, "Conversion error, string expected" },
  29. { LDNS_STATUS_INVALID_B64, "Conversion error, b64 encoding expected" },
  30. { LDNS_STATUS_INVALID_HEX, "Conversion error, hex encoding expected" },
  31. { LDNS_STATUS_INVALID_TIME, "Conversion error, time encoding expected" },
  32. { LDNS_STATUS_NETWORK_ERR, "Could not send or receive, because of network error" },
  33. { LDNS_STATUS_ADDRESS_ERR, "Could not start AXFR, because of address error" },
  34. { LDNS_STATUS_FILE_ERR, "Could not open the files" },
  35. { LDNS_STATUS_UNKNOWN_INET, "Uknown address family" },
  36. { LDNS_STATUS_NOT_IMPL, "This function is not implemented (yet), please notify the developers - or not..." },
  37. { LDNS_STATUS_NULL, "Supplied value pointer null" },
  38. { LDNS_STATUS_CRYPTO_UNKNOWN_ALGO, "Unknown cryptographic algorithm" },
  39. { LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL, "Cryptographic algorithm not implemented" },
  40. { LDNS_STATUS_CRYPTO_NO_RRSIG, "No DNSSEC signature(s)" },
  41. { LDNS_STATUS_CRYPTO_NO_DNSKEY, "No DNSSEC public key(s)" },
  42. { LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR, "The signature does not cover this RRset" },
  43. { LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY, "No signatures found for trusted DNSSEC public key(s)" },
  44. { LDNS_STATUS_CRYPTO_NO_DS, "No DS record(s)" },
  45. { LDNS_STATUS_CRYPTO_NO_TRUSTED_DS, "Could not validate DS record(s)" },
  46. { LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY, "No keys with the keytag and algorithm from the RRSIG found" },
  47. { LDNS_STATUS_CRYPTO_VALIDATED, "Valid DNSSEC signature" },
  48. { LDNS_STATUS_CRYPTO_BOGUS, "Bogus DNSSEC signature" },
  49. { LDNS_STATUS_CRYPTO_SIG_EXPIRED, "DNSSEC signature has expired" },
  50. { LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED, "DNSSEC signature not incepted yet" },
  51. { LDNS_STATUS_CRYPTO_TSIG_BOGUS, "Bogus TSIG signature" },
  52. { LDNS_STATUS_CRYPTO_TSIG_ERR, "Could not create TSIG signature" },
  53. { LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION, "DNSSEC signature has expiration date earlier than inception date" },
  54. { LDNS_STATUS_ENGINE_KEY_NOT_LOADED, "Unable to load private key from engine" },
  55. { LDNS_STATUS_NSEC3_ERR, "Error in NSEC3 denial of existence proof" },
  56. { LDNS_STATUS_RES_NO_NS, "No (valid) nameservers defined in the resolver" },
  57. { LDNS_STATUS_RES_QUERY, "No correct query given to resolver" },
  58. { LDNS_STATUS_WIRE_INCOMPLETE_HEADER, "header section incomplete" },
  59. { LDNS_STATUS_WIRE_INCOMPLETE_QUESTION, "question section incomplete" },
  60. { LDNS_STATUS_WIRE_INCOMPLETE_ANSWER, "answer section incomplete" },
  61. { LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY, "authority section incomplete" },
  62. { LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL, "additional section incomplete" },
  63. { LDNS_STATUS_NO_DATA, "No data" },
  64. { LDNS_STATUS_CERT_BAD_ALGORITHM, "Bad algorithm type for CERT record" },
  65. { LDNS_STATUS_SYNTAX_TYPE_ERR, "Syntax error, could not parse the RR's type" },
  66. { LDNS_STATUS_SYNTAX_CLASS_ERR, "Syntax error, could not parse the RR's class" },
  67. { LDNS_STATUS_SYNTAX_TTL_ERR, "Syntax error, could not parse the RR's TTL" },
  68. { LDNS_STATUS_SYNTAX_INCLUDE_ERR_NOTIMPL, "Syntax error, $INCLUDE not implemented" },
  69. { LDNS_STATUS_SYNTAX_RDATA_ERR, "Syntax error, could not parse the RR's rdata" },
  70. { LDNS_STATUS_SYNTAX_DNAME_ERR, "Syntax error, could not parse the RR's dname(s)" },
  71. { LDNS_STATUS_SYNTAX_VERSION_ERR, "Syntax error, version mismatch" },
  72. { LDNS_STATUS_SYNTAX_ALG_ERR, "Syntax error, algorithm unknown or non parseable" },
  73. { LDNS_STATUS_SYNTAX_KEYWORD_ERR, "Syntax error, unknown keyword in input" },
  74. { LDNS_STATUS_SYNTAX_ERR, "Syntax error, could not parse the RR" },
  75. { LDNS_STATUS_SYNTAX_EMPTY, "Empty line was returned" },
  76. { LDNS_STATUS_SYNTAX_TTL, "$TTL directive was seen in the zone" },
  77. { LDNS_STATUS_SYNTAX_ORIGIN, "$ORIGIN directive was seen in the zone" },
  78. { LDNS_STATUS_SYNTAX_INCLUDE, "$INCLUDE directive was seen in the zone" },
  79. { LDNS_STATUS_SYNTAX_ITERATIONS_OVERFLOW, "Iterations count for NSEC3 record higher than maximum" },
  80. { LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR, "Syntax error, value expected" },
  81. { LDNS_STATUS_SYNTAX_INTEGER_OVERFLOW, "Syntax error, integer value too large" },
  82. { LDNS_STATUS_SYNTAX_BAD_ESCAPE, "Syntax error, bad escape sequence" },
  83. { LDNS_STATUS_SOCKET_ERROR, "Error creating socket" },
  84. { LDNS_STATUS_DNSSEC_EXISTENCE_DENIED, "Existence denied by NSEC" },
  85. { LDNS_STATUS_DNSSEC_NSEC_RR_NOT_COVERED, "RR not covered by the given NSEC RRs" },
  86. { LDNS_STATUS_DNSSEC_NSEC_WILDCARD_NOT_COVERED, "wildcard not covered by the given NSEC RRs" },
  87. { LDNS_STATUS_DNSSEC_NSEC3_ORIGINAL_NOT_FOUND, "original of NSEC3 hashed name could not be found" },
  88. { 0, NULL }
  89. };
  90. const char *
  91. ldns_get_errorstr_by_id(ldns_status err)
  92. {
  93. ldns_lookup_table *lt;
  94. lt = ldns_lookup_by_id(ldns_error_str, err);
  95. if (lt) {
  96. return lt->name;
  97. }
  98. return NULL;
  99. }