blob: 1f9de7645ec068fcfa3b0cc66444cea401d4f9f3 [file] [log] [blame]
Jeff Thompson8b666002013-07-08 01:16:26 -07001/**
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
Jeff Thompsona0d18c92013-08-06 13:55:32 -07008#define NDN_ERRORS_H
Jeff Thompson8b666002013-07-08 01:16:26 -07009
Jeff Thompsona0d18c92013-08-06 13:55:32 -070010#ifdef __cplusplus
Jeff Thompson8b666002013-07-08 01:16:26 -070011extern "C" {
12#endif
13
14typedef 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,
Jeff Thompsonf3263612013-07-09 12:23:36 -070026 NDN_ERROR_read_an_entry_past_the_maximum_number_of_entries_allowed_in_the_exclude,
Jeff Thompson8b666002013-07-08 01:16:26 -070027 NDN_ERROR_findElementEnd_unexpected_close_tag,
28 NDN_ERROR_cannot_store_more_header_bytes_than_the_size_of_headerBuffer,
29 NDN_ERROR_findElementEnd_cannot_read_header_type_and_value,
30 NDN_ERROR_findElementEnd_unrecognized_header_type,
31 NDN_ERROR_findElementEnd_unrecognized_state,
32 NDN_ERROR_DynamicUCharArray_realloc_function_pointer_not_supplied,
Jeff Thompsonf2e9aa02013-07-09 12:13:09 -070033 NDN_ERROR_DynamicUCharArray_realloc_failed,
Jeff Thompson07029ec2013-07-11 11:12:44 -070034 NDN_ERROR_unrecognized_ndn_ExcludeType,
Jeff Thompsonc2db1e42013-07-11 11:24:50 -070035 NDN_ERROR_unrecognized_ndn_KeyLocatorType,
Jeff Thompsonf0fea002013-07-30 17:22:42 -070036 NDN_ERROR_decodeBinaryXmlKeyLocator_unrecognized_key_locator_type,
Jeff Thompson0aa754a2013-07-17 17:42:28 -070037 NDN_ERROR_unrecognized_ndn_SocketTransport,
38 NDN_ERROR_SocketTransport_error_in_getaddrinfo,
39 NDN_ERROR_SocketTransport_cannot_connect_to_socket,
40 NDN_ERROR_SocketTransport_socket_is_not_open,
41 NDN_ERROR_SocketTransport_error_in_send,
Jeff Thompson57963882013-08-05 16:01:25 -070042 NDN_ERROR_SocketTransport_error_in_recv,
43 NDN_ERROR_SocketTransport_error_in_close
Jeff Thompson8b666002013-07-08 01:16:26 -070044} ndn_Error;
45
46/**
47 * Convert the error code to its string.
48 * @param error the error code
49 * @return the error string or "unrecognized ndn_Error code"
50 */
51char *ndn_getErrorString(int error);
52
Jeff Thompsona0d18c92013-08-06 13:55:32 -070053#ifdef __cplusplus
Jeff Thompson8b666002013-07-08 01:16:26 -070054}
55#endif
56
57#endif