[Date Prev][Date Next] [Chronological] [Thread] [Top]

ldap_msgtype() and ldap_msgid()



[ Sorry if this is a repeat -- I sent it, but didn't receive a copy. ]

I couldn't reist this when I was adding draft-ietf-ldapext-ldap-c-api-01
stuff anyway -- 15 lines of code and 30 lines doc:-)


--- ldap/libraries/libldap/result.c~	Thu Aug 20 19:42:38 1998
+++ ldap/libraries/libldap/result.c	Thu Sep 17 22:48:23 1998
@@ -735,4 +735,17 @@
 
 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 )
 {
--- ldap/include/proto-ldap.h~	Sun Aug  9 00:43:13 1998
+++ ldap/include/proto-ldap.h	Thu Sep 17 22:56:26 1998
@@ -152,4 +153,6 @@
 LDAPFUNCDECL int ldap_result( LDAP *ld, int msgid, int all,
 	struct timeval *timeout, LDAPMessage **result );
+LDAPFUNCDECL int ldap_msgtype( LDAPMessage *lm );
+LDAPFUNCDECL int ldap_msgid( LDAPMessage *lm );
 LDAPFUNCDECL int ldap_msgfree( LDAPMessage *lm );
 LDAPFUNCDECL int ldap_msgdelete( LDAP *ld, int msgid );
diff -r -u2 ../devel.orig/ldap/doc/man/man3/ldap.3 ldap/doc/man/man3/ldap.3
--- ../devel.orig/ldap/doc/man/man3/ldap.3	Sun Aug  9 00:43:13 1998
+++ ldap/doc/man/man3/ldap.3	Thu Sep 17 22:29:48 1998
@@ -398,4 +398,10 @@
 .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)
--- ldap/doc/man/man3/ldap_result.3~	Sun Aug  9 00:43:13 1998
+++ ldap/doc/man/man3/ldap_result.3	Thu Sep 17 22:27:43 1998
@@ -20,4 +20,14 @@
 .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
@@ -93,8 +103,20 @@
 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
--- ldap/doc/man/man3/ldap_result.3.links~	Sun Aug  9 00:43:13 1998
+++ ldap/doc/man/man3/ldap_result.3.links	Thu Sep 17 23:10:30 1998
@@ -1 +1,3 @@
 ldap_msgfree.3
+ldap_msgtype.3
+ldap_msgid.3

-- 
Hallvard