YAZ
5.34.0
|
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_setprint_noclose (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) |
int | odr_offset (ODR o) |
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 200 of file odr.c.
References Odr_private::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_noclose(), odr::op, Odr_private::pos, Odr_private::size, Odr_private::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(), replace_node(), yaz_retrieval_create(), yaz_url_create(), zget_init_diagnostics_octet(), ZOOM_API(), ZOOM_connection_connect(), ZOOM_connection_create(), ZOOM_connection_package(), ZOOM_connection_scan1(), ZOOM_memcached_add(), ZOOM_memcached_hitcount(), ZOOM_query_create(), ZOOM_record_clone(), and ZOOM_resultset_create().
void odr_destroy | ( | ODR | o | ) |
Definition at line 253 of file odr.c.
References Odr_private::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(), replace_node(), resultset_destroy(), yaz_retrieval_destroy(), yaz_url_destroy(), zget_init_diagnostics_octet(), ZOOM_API(), ZOOM_connection_connect(), ZOOM_connection_destroy(), ZOOM_memcached_add(), ZOOM_memcached_hitcount(), 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 157 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_constack::len.
Referenced by odr_setprint(), and odr_setprint_noclose().
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_perror().
char* odr_getbuf | ( | ODR | o, |
int * | len, | ||
int * | size | ||
) |
Definition at line 277 of file odr.c.
References Odr_private::buf, odr::op, Odr_private::size, and Odr_private::top.
Referenced by compare_attr(), encode_ill_request(), process_gdu_response(), send_APDU(), yaz_url_exec(), zget_init_diagnostics_octet(), ZOOM_memcached_add(), ZOOM_memcached_hitcount(), ZOOM_package_send(), ZOOM_record_clone(), and ZOOM_send_GDU().
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(), yaz_sort_spec(), yaz_xml2query_operator(), yaz_xml2query_term(), z_Term_create(), zget_Segment(), and ztest_esrequest().
int odr_offset | ( | ODR | o | ) |
Definition at line 285 of file odr.c.
References Odr_private::bp, Odr_private::buf, and odr::op.
Referenced by do_read(), ir_read(), 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_private::buf, ODR_VISIBLESTRING, odr::op, Odr_private::print, Odr_private::stream_write, and yaz_vsnprintf().
Referenced by dump_http_package(), 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 226 of file odr.c.
References Odr_private::bp, Odr_private::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_private::top, yaz_iconv(), yaz_log(), and yaz_log_module_level().
Referenced by do_read(), encode_APDU(), generate(), ir_read(), odr_createmem(), process_gdu_response(), send_APDU(), yaz_retrieval_reset(), yaz_url_exec(), ZOOM_package_send(), ZOOM_query_sortby2(), ZOOM_send_GDU(), and ztest_esrequest().
int odr_set_charset | ( | ODR | o, |
const char * | to, | ||
const char * | from | ||
) |
Definition at line 185 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 174 of file odr.c.
References odr::op, Odr_private::print, Odr_private::stream_close, and Odr_private::stream_write.
Referenced by odr_setprint(), odr_setprint_noclose(), and ZOOM_API().
void odr_setbuf | ( | ODR | o, |
char * | buf, | ||
int | len, | ||
int | can_grow | ||
) |
Definition at line 267 of file odr.c.
References Odr_private::bp, Odr_private::buf, Odr_private::can_grow, odr_seterror(), ONONE, odr::op, Odr_private::pos, Odr_private::size, and Odr_private::top.
Referenced by do_read(), encode_ill_request(), ir_read(), process_gdu_response(), yaz_url_exec(), ZOOM_memcached_lookup(), ZOOM_memcached_search(), 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 164 of file odr.c.
References odr_FILE_close(), odr_FILE_write(), and odr_set_stream().
Referenced by create_association(), encode_APDU(), and ZOOM_connection_connect().
void odr_setprint_noclose | ( | ODR | o, |
FILE * | file | ||
) |
Definition at line 169 of file odr.c.
References odr_FILE_write(), and odr_set_stream().
Referenced by cql_transform_parse_tok_line(), odr_createmem(), and ZOOM_connection_connect().
|
static |
Definition at line 25 of file odr.c.
Referenced by odr_createmem(), odr_destroy(), and odr_reset().
|
static |
Definition at line 26 of file odr.c.
Referenced by odr_createmem(), and odr_reset().
char* odr_errlist[] |
Definition at line 35 of file odr.c.
Referenced by odr_errmsg(), and odr_perror().
Definition at line 28 of file odr.c.
Referenced by odr_nullval().