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. |
Jeff Thompson | 7687dc0 | 2013-09-13 11:54:07 -0700 | [diff] [blame] | 3 | * Copyright (C) 2013 Regents of the University of California. |
| 4 | * @author, Jeff Thompson <jefft0@remap.ucla.edu> |
Jeff Thompson | 8b66600 | 2013-07-08 01:16:26 -0700 | [diff] [blame] | 5 | * See COPYING for copyright and distribution information. |
| 6 | */ |
| 7 | |
| 8 | #ifndef NDN_ERRORS_H |
Jeff Thompson | a0d18c9 | 2013-08-06 13:55:32 -0700 | [diff] [blame] | 9 | #define NDN_ERRORS_H |
Jeff Thompson | 8b66600 | 2013-07-08 01:16:26 -0700 | [diff] [blame] | 10 | |
Jeff Thompson | a0d18c9 | 2013-08-06 13:55:32 -0700 | [diff] [blame] | 11 | #ifdef __cplusplus |
Jeff Thompson | 8b66600 | 2013-07-08 01:16:26 -0700 | [diff] [blame] | 12 | extern "C" { |
| 13 | #endif |
| 14 | |
| 15 | typedef enum { |
| 16 | NDN_ERROR_success = 0, |
| 17 | NDN_ERROR_element_of_value_is_not_a_decimal_digit, |
| 18 | NDN_ERROR_read_past_the_end_of_the_input, |
| 19 | NDN_ERROR_the_first_header_octet_may_not_be_zero, |
| 20 | NDN_ERROR_header_type_is_not_a_DTAG, |
| 21 | NDN_ERROR_did_not_get_the_expected_DTAG, |
| 22 | NDN_ERROR_did_not_get_the_expected_element_close, |
| 23 | NDN_ERROR_item_is_not_UDATA, |
| 24 | NDN_ERROR_header_type_is_out_of_range, |
| 25 | NDN_ERROR_encodeTypeAndValue_miscalculated_N_encoding_bytes, |
| 26 | NDN_ERROR_read_a_component_past_the_maximum_number_of_components_allowed_in_the_name, |
Jeff Thompson | f326361 | 2013-07-09 12:23:36 -0700 | [diff] [blame] | 27 | NDN_ERROR_read_an_entry_past_the_maximum_number_of_entries_allowed_in_the_exclude, |
Jeff Thompson | 8b66600 | 2013-07-08 01:16:26 -0700 | [diff] [blame] | 28 | NDN_ERROR_findElementEnd_unexpected_close_tag, |
| 29 | NDN_ERROR_cannot_store_more_header_bytes_than_the_size_of_headerBuffer, |
| 30 | NDN_ERROR_findElementEnd_cannot_read_header_type_and_value, |
| 31 | NDN_ERROR_findElementEnd_unrecognized_header_type, |
| 32 | NDN_ERROR_findElementEnd_unrecognized_state, |
Jeff Thompson | 10ad12a | 2013-09-24 16:19:11 -0700 | [diff] [blame^] | 33 | NDN_ERROR_DynamicUInt8Array_realloc_function_pointer_not_supplied, |
| 34 | NDN_ERROR_DynamicUInt8Array_realloc_failed, |
Jeff Thompson | 07029ec | 2013-07-11 11:12:44 -0700 | [diff] [blame] | 35 | NDN_ERROR_unrecognized_ndn_ExcludeType, |
Jeff Thompson | 7ed3e27 | 2013-08-16 19:15:30 -0700 | [diff] [blame] | 36 | NDN_ERROR_unrecognized_ndn_ContentType, |
Jeff Thompson | c2db1e4 | 2013-07-11 11:24:50 -0700 | [diff] [blame] | 37 | NDN_ERROR_unrecognized_ndn_KeyLocatorType, |
Jeff Thompson | 7329a13 | 2013-08-16 15:57:37 -0700 | [diff] [blame] | 38 | NDN_ERROR_unrecognized_ndn_KeyNameType, |
Jeff Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 39 | NDN_ERROR_decodeBinaryXmlKeyLocator_unrecognized_key_locator_type, |
Jeff Thompson | 0aa754a | 2013-07-17 17:42:28 -0700 | [diff] [blame] | 40 | NDN_ERROR_unrecognized_ndn_SocketTransport, |
| 41 | NDN_ERROR_SocketTransport_error_in_getaddrinfo, |
| 42 | NDN_ERROR_SocketTransport_cannot_connect_to_socket, |
| 43 | NDN_ERROR_SocketTransport_socket_is_not_open, |
| 44 | NDN_ERROR_SocketTransport_error_in_send, |
Jeff Thompson | 432c8be | 2013-08-09 16:16:08 -0700 | [diff] [blame] | 45 | NDN_ERROR_SocketTransport_error_in_poll, |
Jeff Thompson | 5796388 | 2013-08-05 16:01:25 -0700 | [diff] [blame] | 46 | NDN_ERROR_SocketTransport_error_in_recv, |
| 47 | NDN_ERROR_SocketTransport_error_in_close |
Jeff Thompson | 8b66600 | 2013-07-08 01:16:26 -0700 | [diff] [blame] | 48 | } ndn_Error; |
| 49 | |
| 50 | /** |
| 51 | * Convert the error code to its string. |
| 52 | * @param error the error code |
| 53 | * @return the error string or "unrecognized ndn_Error code" |
| 54 | */ |
| 55 | char *ndn_getErrorString(int error); |
| 56 | |
Jeff Thompson | a0d18c9 | 2013-08-06 13:55:32 -0700 | [diff] [blame] | 57 | #ifdef __cplusplus |
Jeff Thompson | 8b66600 | 2013-07-08 01:16:26 -0700 | [diff] [blame] | 58 | } |
| 59 | #endif |
| 60 | |
Jeff Thompson | 7687dc0 | 2013-09-13 11:54:07 -0700 | [diff] [blame] | 61 | #endif |