blob: 5906aa35369bb4c5014f9a372f24ea2a1a52e1dd [file] [log] [blame]
Jeff Thompson8b666002013-07-08 01:16:26 -07001/**
2 * Define error codes and ndn_getErrorString to convert to a string.
Jeff Thompson7687dc02013-09-13 11:54:07 -07003 * Copyright (C) 2013 Regents of the University of California.
4 * @author, Jeff Thompson <jefft0@remap.ucla.edu>
Jeff Thompson8b666002013-07-08 01:16:26 -07005 * See COPYING for copyright and distribution information.
6 */
7
8#ifndef NDN_ERRORS_H
Jeff Thompsona0d18c92013-08-06 13:55:32 -07009#define NDN_ERRORS_H
Jeff Thompson8b666002013-07-08 01:16:26 -070010
Jeff Thompsona0d18c92013-08-06 13:55:32 -070011#ifdef __cplusplus
Jeff Thompson8b666002013-07-08 01:16:26 -070012extern "C" {
13#endif
14
15typedef 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,
Jeff Thompsone7ab9442013-12-10 19:34:06 -080026 NDN_ERROR_attempt_to_add_a_component_past_the_maximum_number_of_components_allowed_in_the_name,
Jeff Thompsonf3263612013-07-09 12:23:36 -070027 NDN_ERROR_read_an_entry_past_the_maximum_number_of_entries_allowed_in_the_exclude,
Jeff Thompson8b666002013-07-08 01:16:26 -070028 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 Thompson10ad12a2013-09-24 16:19:11 -070033 NDN_ERROR_DynamicUInt8Array_realloc_function_pointer_not_supplied,
34 NDN_ERROR_DynamicUInt8Array_realloc_failed,
Jeff Thompson07029ec2013-07-11 11:12:44 -070035 NDN_ERROR_unrecognized_ndn_ExcludeType,
Jeff Thompson7ed3e272013-08-16 19:15:30 -070036 NDN_ERROR_unrecognized_ndn_ContentType,
Jeff Thompsonc2db1e42013-07-11 11:24:50 -070037 NDN_ERROR_unrecognized_ndn_KeyLocatorType,
Jeff Thompson7329a132013-08-16 15:57:37 -070038 NDN_ERROR_unrecognized_ndn_KeyNameType,
Jeff Thompsonf0fea002013-07-30 17:22:42 -070039 NDN_ERROR_decodeBinaryXmlKeyLocator_unrecognized_key_locator_type,
Jeff Thompson0aa754a2013-07-17 17:42:28 -070040 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 Thompson432c8be2013-08-09 16:16:08 -070045 NDN_ERROR_SocketTransport_error_in_poll,
Jeff Thompson57963882013-08-05 16:01:25 -070046 NDN_ERROR_SocketTransport_error_in_recv,
Jeff Thompson0bcc7862013-10-08 12:34:54 -070047 NDN_ERROR_SocketTransport_error_in_close,
Jeff Thompsonea946202013-10-18 14:35:32 -070048 NDN_ERROR_Name_component_does_not_begin_with_the_expected_marker,
Jeff Thompsonf51f9a52013-10-18 16:21:48 -070049 NDN_ERROR_Time_functions_are_not_supported_by_the_standard_library,
50 NDN_ERROR_Calendar_time_value_out_of_range
Jeff Thompson8b666002013-07-08 01:16:26 -070051} ndn_Error;
52
53/**
54 * Convert the error code to its string.
55 * @param error the error code
56 * @return the error string or "unrecognized ndn_Error code"
57 */
58char *ndn_getErrorString(int error);
59
Jeff Thompsona0d18c92013-08-06 13:55:32 -070060#ifdef __cplusplus
Jeff Thompson8b666002013-07-08 01:16:26 -070061}
62#endif
63
Jeff Thompson7687dc02013-09-13 11:54:07 -070064#endif