Implements fundamental ODR functionality. More...
#include <assert.h>#include <stdio.h>#include <stdlib.h>#include <stdarg.h>#include <yaz/xmalloc.h>#include <yaz/log.h>#include <yaz/snprintf.h>#include "odr-priv.h"Go to the source code of this file.
Functions | |
| Odr_null * | odr_nullval (void) |
| char * | odr_errmsg (int n) |
| void | odr_perror (ODR o, const char *message) |
| int | odr_geterror (ODR o) |
| int | odr_geterrorx (ODR o, int *x) |
| const char * | odr_getelement (ODR o) |
| const char ** | odr_get_element_path (ODR o) |
| void | odr_seterror (ODR o, int error, int id) |
| void | odr_setelement (ODR o, const char *element) |
| void | odr_FILE_write (ODR o, void *handle, int type, const char *buf, int len) |
| void | odr_FILE_close (void *handle) |
| void | odr_setprint (ODR o, FILE *file) |
| void | odr_set_stream (ODR o, void *handle, void(*stream_write)(ODR o, void *handle, int type, const char *buf, int len), void(*stream_close)(void *handle)) |
| int | odr_set_charset (ODR o, const char *to, const char *from) |
| ODR | odr_createmem (int direction) |
| void | odr_reset (ODR o) |
| void | odr_destroy (ODR o) |
| void | odr_setbuf (ODR o, char *buf, int len, int can_grow) |
| char * | odr_getbuf (ODR o, int *len, int *size) |
| void | odr_printf (ODR o, const char *fmt,...) |
Variables | |
| static int | log_level = 0 |
| static int | log_level_initialized = 0 |
| Odr_null * | ODR_NULLVAL = (Odr_null *) "NULL" |
| char * | odr_errlist [] |
Implements fundamental ODR functionality.
Definition in file odr.c.
| ODR odr_createmem | ( | int | direction | ) |
Definition at line 204 of file odr.c.
References odr::buf, Odr_private::can_grow, odr::direction, Odr_private::enable_bias, Odr_private::iconv_handle, Odr_ber_tag::lclass, log_level, log_level_initialized, odr::mem, nmem_create(), Odr_private::odr_ber_tag, odr_reset(), odr_setprint(), odr::op, odr::pos, odr::size, odr::top, xmalloc, yaz_log(), and yaz_log_module_level().
Referenced by compare_attr(), cql_transform_parse_tok_line(), create_association(), create_update_package(), encode_APDU(), yaz_retrieval_create(), zget_init_diagnostics_octet(), ZOOM_connection_connect(), ZOOM_connection_create(), ZOOM_connection_package(), ZOOM_connection_scan1(), ZOOM_query_create(), ZOOM_record_clone(), and ZOOM_resultset_create().
| void odr_destroy | ( | ODR | o | ) |
Definition at line 257 of file odr.c.
References odr::buf, Odr_private::can_grow, Odr_private::iconv_handle, log_level, odr::mem, nmem_destroy(), odr::op, Odr_private::print, Odr_private::stream_close, xfree, yaz_iconv_close(), and yaz_log().
Referenced by compare_attr(), cql_transform_parse_tok_line(), create_update_package(), destroy_association(), encode_APDU(), resultset_destroy(), yaz_retrieval_destroy(), zget_init_diagnostics_octet(), ZOOM_connection_connect(), ZOOM_connection_destroy(), ZOOM_package_destroy(), ZOOM_query_destroy(), ZOOM_record_clone(), ZOOM_record_release(), and ZOOM_scanset_destroy().
| char* odr_errmsg | ( | int | n | ) |
Definition at line 52 of file odr.c.
References odr_errlist.
Referenced by ir_read(), process_gdu_response(), and ztest_esrequest().
| void odr_FILE_close | ( | void * | handle | ) |
Definition at line 166 of file odr.c.
Referenced by odr_setprint().
| void odr_FILE_write | ( | ODR | o, | |
| void * | handle, | |||
| int | type, | |||
| const char * | buf, | |||
| int | len | |||
| ) |
Definition at line 134 of file odr.c.
References odr_get_element_path(), and ODR_OCTETSTRING.
Referenced by odr_setprint().
| const char** odr_get_element_path | ( | ODR | o | ) |
Definition at line 95 of file odr.c.
References odr_constack::name, odr_malloc(), odr::op, odr_constack::prev, Odr_private::stack_top, Odr_private::tmp_names_buf, and Odr_private::tmp_names_sz.
Referenced by odr_FILE_write(), and odr_perror().
| char* odr_getbuf | ( | ODR | o, | |
| int * | len, | |||
| int * | size | |||
| ) |
Definition at line 282 of file odr.c.
References odr::buf, odr::size, and odr::top.
Referenced by compare_attr(), encode_ill_request(), process_gdu_response(), send_APDU(), send_srw(), send_SRW_redirect(), zget_init_diagnostics_octet(), ZOOM_package_send(), and ZOOM_record_clone().
| const char* odr_getelement | ( | ODR | o | ) |
Definition at line 90 of file odr.c.
References Odr_private::element, and odr::op.
Referenced by do_read(), ir_read(), odr_perror(), and process_gdu_response().
| int odr_geterror | ( | ODR | o | ) |
Definition at line 78 of file odr.c.
References odr::error.
Referenced by ir_read(), process_gdu_response(), and ztest_esrequest().
| int odr_geterrorx | ( | ODR | o, | |
| int * | x | |||
| ) |
Definition at line 83 of file odr.c.
References odr::error, Odr_private::error_id, and odr::op.
Referenced by do_read(), and odr_perror().
| Odr_null* odr_nullval | ( | void | ) |
Definition at line 30 of file odr.c.
References ODR_NULLVAL.
Referenced by create_admin_package(), get_attributeList(), odr_null(), odr_sequence_x(), pack_records(), rpn_complex(), rpn_term_attributes(), yaz_sort_spec(), yaz_xml2query_operator(), yaz_xml2query_term(), zget_Segment(), and ztest_esrequest().
| void odr_perror | ( | ODR | o, | |
| const char * | message | |||
| ) |
Definition at line 57 of file odr.c.
References odr_errlist, odr_get_element_path(), odr_getelement(), and odr_geterrorx().
| void odr_printf | ( | ODR | o, | |
| const char * | fmt, | |||
| ... | ||||
| ) |
Definition at line 290 of file odr.c.
References ODR_VISIBLESTRING, odr::op, Odr_private::print, Odr_private::stream_write, and yaz_vsnprintf().
Referenced by odr_any(), odr_bitstring(), odr_bool(), odr_choice(), odr_constructed_begin(), odr_constructed_end(), odr_cstring(), odr_enum(), odr_iconv_string(), odr_integer(), odr_null(), odr_octetstring(), odr_oid(), odr_prname(), yaz_encode_http_request(), and yaz_encode_http_response().
| void odr_reset | ( | ODR | o | ) |
Definition at line 230 of file odr.c.
References odr::bp, odr::buf, Odr_private::choice_bias, Odr_private::iconv_handle, Odr_private::indent, Odr_private::lenlen, log_level, log_level_initialized, odr::mem, nmem_reset(), ODR_S_SET, odr_seek(), odr_seterror(), ONONE, odr::op, Odr_private::stack_first, Odr_private::stack_top, Odr_private::t_class, Odr_private::t_tag, Odr_private::tmp_names_buf, Odr_private::tmp_names_sz, odr::top, yaz_iconv(), yaz_log(), and yaz_log_module_level().
Referenced by do_read(), encode_APDU(), ir_read(), odr_createmem(), process_gdu_response(), send_APDU(), send_srw(), send_SRW_redirect(), yaz_retrieval_reset(), ZOOM_package_send(), and ztest_esrequest().
| int odr_set_charset | ( | ODR | o, | |
| const char * | to, | |||
| const char * | from | |||
| ) |
Definition at line 189 of file odr.c.
References Odr_private::iconv_handle, odr::op, yaz_iconv_close(), and yaz_iconv_open().
| void odr_set_stream | ( | ODR | o, | |
| void * | handle, | |||
| void(*)(ODR o, void *handle, int type, const char *buf, int len) | stream_write, | |||
| void(*)(void *handle) | stream_close | |||
| ) |
Definition at line 178 of file odr.c.
References odr::op, Odr_private::print, Odr_private::stream_close, and Odr_private::stream_write.
Referenced by odr_setprint().
| void odr_setbuf | ( | ODR | o, | |
| char * | buf, | |||
| int | len, | |||
| int | can_grow | |||
| ) |
Definition at line 271 of file odr.c.
References odr::bp, odr::buf, Odr_private::can_grow, odr_seterror(), ONONE, odr::op, odr::pos, odr::size, and odr::top.
Referenced by do_read(), encode_ill_request(), ir_read(), process_gdu_response(), ZOOM_record_clone(), and ztest_esrequest().
| void odr_setelement | ( | ODR | o, | |
| const char * | element | |||
| ) |
Definition at line 125 of file odr.c.
References Odr_private::element, and odr::op.
Referenced by ber_tag(), and odr_missing().
| void odr_seterror | ( | ODR | o, | |
| int | error, | |||
| int | id | |||
| ) |
Definition at line 118 of file odr.c.
References Odr_private::element, odr::error, Odr_private::error_id, and odr::op.
Referenced by ber_any(), ber_bitstring(), ber_boolean(), ber_integer(), ber_null(), ber_octetstring(), ber_oidc(), ber_tag(), odr_constructed_begin(), odr_constructed_end(), odr_enum(), odr_iconv_string(), odr_integer(), odr_missing(), odr_null(), odr_octetstring(), odr_oid(), odr_peektag(), odr_reset(), odr_seek(), odr_sequence_x(), odr_setbuf(), and odr_write().
| void odr_setprint | ( | ODR | o, | |
| FILE * | file | |||
| ) |
Definition at line 173 of file odr.c.
References odr_FILE_close(), odr_FILE_write(), and odr_set_stream().
Referenced by cql_transform_parse_tok_line(), create_association(), encode_APDU(), odr_createmem(), ZOOM_connection_connect(), and ZOOM_connection_destroy().
int log_level = 0 [static] |
Definition at line 25 of file odr.c.
Referenced by odr_createmem(), odr_destroy(), and odr_reset().
int log_level_initialized = 0 [static] |
Definition at line 26 of file odr.c.
Referenced by odr_createmem(), and odr_reset().
| char* odr_errlist[] |
{
"No (unknown) error",
"Memory allocation failed",
"System error",
"No space in buffer",
"Required data element missing",
"Unexpected tag",
"Other error",
"Protocol error",
"Malformed data",
"Stack overflow",
"Length of constructed type different from sum of members",
"Overflow writing definite length of constructed type",
"Bad HTTP Request"
}
Definition at line 35 of file odr.c.
Referenced by odr_errmsg(), and odr_perror().
| Odr_null* ODR_NULLVAL = (Odr_null *) "NULL" |
Definition at line 28 of file odr.c.
Referenced by odr_nullval().
1.6.3