YAZ  5.23.1
Functions | Variables
odr.c File Reference

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_nullodr_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_nullODR_NULLVAL = (Odr_null *) "NULL"
 
char * odr_errlist []
 

Detailed Description

Implements fundamental ODR functionality.

Definition in file odr.c.

Function Documentation

ODR odr_createmem ( int  direction)
void odr_destroy ( ODR  o)
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)
char* odr_getbuf ( ODR  o,
int *  len,
int *  size 
)
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  )
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,
  ... 
)
void odr_reset ( ODR  o)
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 
)
void odr_setbuf ( ODR  o,
char *  buf,
int  len,
int  can_grow 
)
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 
)
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().

Variable Documentation

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[]
Initial value:
=
{
"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().