From e240135305c21e63b69c8f3b8db8fbab35e51cfe Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 9 Apr 2003 09:41:02 +0000 Subject: [PATCH] ITS#2434 ber accessors --- libraries/liblber/io.c | 27 +++++++++++++++++++++++++++ libraries/liblber/lber-int.h | 5 +++++ 2 files changed, 32 insertions(+) diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c index 4edfb3f9ad..16459782bf 100644 --- a/libraries/liblber/io.c +++ b/libraries/liblber/io.c @@ -681,3 +681,30 @@ done: assert( 0 ); /* ber structure is messed up ?*/ return LBER_DEFAULT; } + +char * +ber_start( BerElement* ber ) +{ + return ber->ber_buf; +} + +int +ber_len( BerElement* ber ) +{ + return ( ber->ber_end - ber->ber_buf ); +} + +int +ber_ptrlen( BerElement* ber ) +{ + return ( ber->ber_ptr - ber->ber_buf ); +} + +void +ber_rewind ( BerElement * ber ) +{ + ber->ber_rwptr = NULL; + ber->ber_sos = NULL; + ber->ber_end = ber->ber_ptr; + ber->ber_ptr = ber->ber_buf; +} diff --git a/libraries/liblber/lber-int.h b/libraries/liblber/lber-int.h index 9f7409544a..638c242acb 100644 --- a/libraries/liblber/lber-int.h +++ b/libraries/liblber/lber-int.h @@ -123,6 +123,11 @@ ber_realloc LDAP_P(( BerElement *ber, ber_len_t len )); +LBER_F (char *) ber_start LDAP_P(( BerElement * )); +LBER_F (int) ber_len LDAP_P(( BerElement * )); +LBER_F (int) ber_ptrlen LDAP_P(( BerElement * )); +LBER_F (void) ber_rewind LDAP_P(( BerElement * )); + /* * bprint.c */ -- 2.39.5