Jeff Thompson | 8b66600 | 2013-07-08 01:16:26 -0700 | [diff] [blame^] | 1 | /** |
| 2 | * Define error codes and ndn_getErrorString to convert to a string. |
| 3 | * @author, Jeff Thompson |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #ifndef NDN_ERRORS_H |
| 8 | #define NDN_ERRORS_H |
| 9 | |
| 10 | #ifdef __cplusplus |
| 11 | extern "C" { |
| 12 | #endif |
| 13 | |
| 14 | typedef enum { |
| 15 | NDN_ERROR_success = 0, |
| 16 | NDN_ERROR_element_of_value_is_not_a_decimal_digit, |
| 17 | NDN_ERROR_read_past_the_end_of_the_input, |
| 18 | NDN_ERROR_the_first_header_octet_may_not_be_zero, |
| 19 | NDN_ERROR_header_type_is_not_a_DTAG, |
| 20 | NDN_ERROR_did_not_get_the_expected_DTAG, |
| 21 | NDN_ERROR_did_not_get_the_expected_element_close, |
| 22 | NDN_ERROR_item_is_not_UDATA, |
| 23 | NDN_ERROR_header_type_is_out_of_range, |
| 24 | NDN_ERROR_encodeTypeAndValue_miscalculated_N_encoding_bytes, |
| 25 | NDN_ERROR_read_a_component_past_the_maximum_number_of_components_allowed_in_the_name, |
| 26 | NDN_ERROR_findElementEnd_unexpected_close_tag, |
| 27 | NDN_ERROR_cannot_store_more_header_bytes_than_the_size_of_headerBuffer, |
| 28 | NDN_ERROR_findElementEnd_cannot_read_header_type_and_value, |
| 29 | NDN_ERROR_findElementEnd_unrecognized_header_type, |
| 30 | NDN_ERROR_findElementEnd_unrecognized_state, |
| 31 | NDN_ERROR_DynamicUCharArray_realloc_function_pointer_not_supplied, |
| 32 | NDN_ERROR_DynamicUCharArray_realloc_failed |
| 33 | } ndn_Error; |
| 34 | |
| 35 | /** |
| 36 | * Convert the error code to its string. |
| 37 | * @param error the error code |
| 38 | * @return the error string or "unrecognized ndn_Error code" |
| 39 | */ |
| 40 | char *ndn_getErrorString(int error); |
| 41 | |
| 42 | #ifdef __cplusplus |
| 43 | } |
| 44 | #endif |
| 45 | |
| 46 | #endif |