From: Hallvard Furuseth Date: Wed, 4 Nov 1998 23:51:31 +0000 (+0000) Subject: Added ldap_msgtype() and ldap_msgid() X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~1207 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f81ee9b63e70837931204eac46b7145320b52e13;p=openldap Added ldap_msgtype() and ldap_msgid() --- diff --git a/doc/man/man3/ldap.3 b/doc/man/man3/ldap.3 index d98f7afa55..7403bddd53 100644 --- a/doc/man/man3/ldap.3 +++ b/doc/man/man3/ldap.3 @@ -401,6 +401,12 @@ depreciated - use ldap_modrdn2_s(3) .SM ldap_msgfree(3) free results allocated by ldap_result(3) .TP +.SM ldap_msgtype(3) +return the message type of a message from ldap_result(3) +.TP +.SM ldap_msgid(3) +return the message id of a message from ldap_result(3) +.TP .SM ldap_search(3) asynchronously search the directory .TP diff --git a/doc/man/man3/ldap_result.3 b/doc/man/man3/ldap_result.3 index 4a3039b896..860e473199 100644 --- a/doc/man/man3/ldap_result.3 +++ b/doc/man/man3/ldap_result.3 @@ -19,6 +19,16 @@ LDAPMessage **result; int ldap_msgfree(msg) .ft LDAPMessage *msg; +.LP +.ft B +int ldap_msgtype(msg) +.ft +LDAPMessage *msg; +.LP +.ft B +int ldap_msgid(msg) +.ft +LDAPMessage *msg; .SH DESCRIPTION The .B ldap_result() @@ -92,10 +102,22 @@ or and friends. It takes a pointer to the result to be freed and returns the type of the message it freed. +.LP +The +.B ldap_msgtype() +routine returns the type of a message. +.LP +The +.B ldap_msgid() +routine returns the message id of a message. .SH ERRORS .B ldap_result() returns -1 if something bad happens, and zero if the timeout specified was exceeded. +.B ldap_msgtype() +and +.B ldap_msgid() +return -1 on error. .SH NOTES This routine mallocs memory for results that it receives. The memory can be freed by calling diff --git a/doc/man/man3/ldap_result.3.links b/doc/man/man3/ldap_result.3.links index ca9f245f21..1394c6c2f2 100644 --- a/doc/man/man3/ldap_result.3.links +++ b/doc/man/man3/ldap_result.3.links @@ -1 +1,3 @@ ldap_msgfree.3 +ldap_msgtype.3 +ldap_msgid.3 diff --git a/include/ldap.h b/include/ldap.h index 30cad17b75..a0b0edc161 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -608,6 +608,8 @@ LDAP_F void ldap_value_free_len LDAP_P(( struct berval **vals )); */ LDAP_F int ldap_result LDAP_P(( LDAP *ld, int msgid, int all, struct timeval *timeout, LDAPMessage **result )); +LDAP_F int ldap_msgtype LDAP_P(( LDAPMessage *lm )); +LDAP_F int ldap_msgid LDAP_P(( LDAPMessage *lm )); LDAP_F int ldap_msgfree LDAP_P(( LDAPMessage *lm )); LDAP_F int ldap_msgdelete LDAP_P(( LDAP *ld, int msgid )); diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c index 6714209e2b..e961efe847 100644 --- a/libraries/libldap/result.c +++ b/libraries/libldap/result.c @@ -612,6 +612,19 @@ ldap_select1( LDAP *ld, struct timeval *timeout ) #endif /* !LDAP_REFERRALS */ +int +ldap_msgtype( LDAPMessage *lm ) +{ + return( lm ? lm->lm_msgtype : -1 ); +} + +int +ldap_msgid( LDAPMessage *lm ) +{ + return( lm ? lm->lm_msgid : -1 ); +} + + int ldap_msgfree( LDAPMessage *lm ) {