YAZ  5.34.0
Functions
ber_len.c File Reference

Implements BER length octet encoding and decoding. More...

#include <stdio.h>
#include "odr-priv.h"

Go to the source code of this file.

Functions

int ber_enclen (ODR o, int len, int lenlen, int exact)
 
int ber_declen (const char *buf, int *len, int max)
 

Detailed Description

Implements BER length octet encoding and decoding.

This source file implements BER encoding and decoding of the length octets.

Definition in file ber_len.c.

Function Documentation

◆ ber_declen()

int ber_declen ( const char *  buf,
int *  len,
int  max 
)

ber_declen: Decode BER length octets. Returns

0 : number of bytes read

-1 : not enough room to read bytes within max bytes -2 : other error

After return: len = -1 indefinite length. len >= 0 definite length

Definition at line 93 of file ber_len.c.

Referenced by ber_bitstring(), ber_boolean(), ber_decinteger(), ber_octetstring(), ber_oidc(), completeBER_n(), do_dumpBER(), and odr_constructed_begin().

◆ ber_enclen()

int ber_enclen ( ODR  o,
int  len,
int  lenlen,
int  exact 
)

ber_enclen: Encode BER length octets. If exact, lenlen is the exact desired encoding size, else, lenlen is the max available space. Len < 0 = Indefinite encoding. Returns: >0 success, number of bytes encoded. Returns: =0 success, indefinite start-marker set. 1 byte encoded. Returns: -1 failure, out of bounds.

Definition at line 30 of file ber_len.c.

References odr_putc, ODR_S_END, ODR_S_SET, odr_seek(), and odr_tell.

Referenced by ber_bitstring(), ber_boolean(), ber_encinteger(), ber_octetstring(), ber_oidc(), and odr_constructed_end().