1 /* operation.c - routines to deal with pending ldap operations */
3 * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include <ac/string.h>
12 #include <ac/socket.h>
18 slap_op_free( Operation *op )
20 assert( op->o_next == NULL );
22 if ( op->o_ber != NULL ) {
23 ber_free( op->o_ber, 1 );
25 if ( op->o_dn != NULL ) {
28 if ( op->o_ndn != NULL ) {
31 if ( op->o_authmech != NULL ) {
32 free( op->o_authmech );
34 if ( op->o_ctrls != NULL ) {
35 ldap_controls_free( op->o_ctrls );
38 ldap_pvt_thread_mutex_destroy( &op->o_abandonmutex );
53 op = (Operation *) ch_calloc( 1, sizeof(Operation) );
55 ldap_pvt_thread_mutex_init( &op->o_abandonmutex );
64 op->o_authmech = NULL;
67 op->o_time = slap_get_time();
81 for ( tmp = olist; *tmp != NULL; tmp = &(*tmp)->o_next )
90 slap_op_remove( Operation **olist, Operation *op )
94 for ( tmp = olist; *tmp != NULL && *tmp != op; tmp = &(*tmp)->o_next )
98 Debug( LDAP_DEBUG_ANY, "op_delete: can't find op %ld\n",
99 (long) op->o_msgid, 0, 0 );
103 *tmp = (*tmp)->o_next;
109 Operation * slap_op_pop( Operation **olist )
111 Operation *tmp = *olist;
114 *olist = tmp->o_next;