Lines Matching refs:op
77 Operation *op;
87 static int connection_op_activate( Operation *op );
88 static void connection_op_queue( Operation *op );
759 Operation *o, *next, op = {0};
762 op.o_hdr = &ohdr;
763 op.o_conn = c;
764 op.o_connid = c->c_connid;
765 op.o_tag = LDAP_REQ_ABANDON;
771 op.orn_msgid = o->o_msgid;
773 op.o_bd = frontendDB;
774 frontendDB->be_abandon( &op, &rs );
971 * connection_activity - handle the request operation op on connection
980 ldap_pvt_thread_mutex_lock( &op->o_counters->sc_mutex ); \
981 ldap_pvt_mp_add_ulong(op->o_counters->sc_ops_initiated_[(index)], 1); \
982 ldap_pvt_thread_mutex_unlock( &op->o_counters->sc_mutex ); \
986 ldap_pvt_thread_mutex_lock( &op->o_counters->sc_mutex ); \
987 ldap_pvt_mp_add_ulong(op->o_counters->sc_ops_completed, 1); \
988 ldap_pvt_mp_add_ulong(op->o_counters->sc_ops_completed_[(index)], 1); \
989 ldap_pvt_thread_mutex_unlock( &op->o_counters->sc_mutex ); \
995 ldap_pvt_thread_mutex_lock( &op->o_counters->sc_mutex ); \
996 ldap_pvt_mp_add_ulong(op->o_counters->sc_ops_completed, 1); \
997 ldap_pvt_thread_mutex_unlock( &op->o_counters->sc_mutex ); \
1054 conn_counter_init( Operation *op, void *ctx )
1072 op->o_counters = vsc;
1079 Operation *op = arg_v;
1081 ber_tag_t tag = op->o_tag;
1083 Connection *conn = op->o_conn;
1088 conn_counter_init( op, ctx );
1089 ldap_pvt_thread_mutex_lock( &op->o_counters->sc_mutex );
1091 ldap_pvt_mp_add_ulong(op->o_counters->sc_ops_initiated, 1);
1092 ldap_pvt_thread_mutex_unlock( &op->o_counters->sc_mutex );
1094 op->o_threadctx = ctx;
1095 op->o_tid = ldap_pvt_thread_pool_tid( ctx );
1113 op->o_tag = LBER_ERROR;
1116 send_ldap_disconnect( op, &rs );
1125 send_ldap_error( op, &rs, LDAP_OPERATIONS_ERROR,
1140 op->o_tmpmemctx = NULL;
1141 op->o_tmpmfuncs = &ch_mfuncs;
1149 memsiz = ber_len( op->o_ber ) * 64;
1155 op->o_tmpmemctx = memctx;
1156 op->o_tmpmfuncs = &slap_sl_mfuncs;
1162 ber_set_option( op->o_ber, LBER_OPT_BER_MEMCTX, &memctx );
1169 rc = (*(opfun[opidx]))( op, &rs );
1187 cancel = op->o_cancel;
1190 op->o_cancel = rc == SLAPD_ABANDON
1201 } while ( (cancel = op->o_cancel) != SLAP_CANCEL_NONE
1204 } while ( (cancel = op->o_cancel) != SLAP_CANCEL_NONE
1208 ber_set_option( op->o_ber, LBER_OPT_BER_MEMCTX, &memctx_null );
1210 LDAP_STAILQ_REMOVE( &conn->c_ops, op, Operation, o_next);
1211 LDAP_STAILQ_NEXT(op, o_next) = NULL;
1226 slap_op_free( op, ctx );
1304 if( cri.op && !cri.nullop ) {
1305 rc = (long)connection_operation( ctx, cri.op );
1509 Operation *op;
1610 op = slap_op_alloc( ber, msgid, tag, conn->c_n_ops_received++, ctx );
1612 Debug( LDAP_DEBUG_TRACE, "op tag 0x%lx, time %ld\n", tag,
1613 (long) op->o_time, 0);
1615 op->o_conn = conn;
1622 op->o_res_ber = NULL;
1627 ber_str2bv( cdn, 0, 1, &op->o_dn );
1628 op->o_protocol = LDAP_VERSION2;
1630 op->o_res_ber = ber_alloc_t( LBER_USE_DER );
1631 if (op->o_res_ber == NULL) return 1;
1633 rc = ber_write( op->o_res_ber, (char *)&peeraddr,
1641 if (op->o_protocol == LDAP_VERSION2) {
1642 rc = ber_printf(op->o_res_ber, "{is{" /*}}*/, op->o_msgid, "");
1697 LDAP_STAILQ_INSERT_TAIL( &conn->c_pending_ops, op, o_next );
1704 * The first op will be processed in the same thread context,
1705 * as long as there is only one op total.
1709 if ( cri->op == NULL ) {
1711 connection_op_queue( op );
1712 cri->op = op;
1717 connection_operation, (void *) cri->op );
1719 connection_op_activate( op );
1737 Operation *op;
1755 while ((op = LDAP_STAILQ_FIRST( &conn->c_pending_ops )) != NULL) {
1759 LDAP_STAILQ_NEXT(op, o_next) = NULL;
1762 assert(!op->o_abandon);
1767 connection_op_activate( op );
1775 connection_init_log_prefix( Operation *op )
1777 if ( op->o_connid == (unsigned long)(-1) ) {
1778 snprintf( op->o_log_prefix, sizeof( op->o_log_prefix ),
1779 "conn=-1 op=%lu", op->o_opid );
1782 snprintf( op->o_log_prefix, sizeof( op->o_log_prefix ),
1783 "conn=%lu op=%lu", op->o_connid, op->o_opid );
1787 static int connection_bind_cleanup_cb( Operation *op, SlapReply *rs )
1789 op->o_conn->c_sasl_bindop = NULL;
1791 ch_free( op->o_callback );
1792 op->o_callback = NULL;
1797 static int connection_bind_cb( Operation *op, SlapReply *rs )
1799 ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
1800 op->o_conn->c_sasl_bind_in_progress =
1804 op->o_conn->c_sasl_bindop = NULL;
1805 if ( op->orb_method == LDAP_AUTH_SASL ) {
1807 ber_dupbv(&op->o_conn->c_dn, &op->orb_edn);
1808 if( !BER_BVISEMPTY( &op->orb_edn ) ) {
1810 ber_dupbv( &op->o_conn->c_ndn, &op->o_conn->c_dn );
1812 op->o_tmpfree( op->orb_edn.bv_val, op->o_tmpmemctx );
1813 BER_BVZERO( &op->orb_edn );
1814 op->o_conn->c_authmech = op->o_conn->c_sasl_bind_mech;
1815 BER_BVZERO( &op->o_conn->c_sasl_bind_mech );
1817 op->o_conn->c_sasl_ssf = op->orb_ssf;
1818 if( op->orb_ssf > op->o_conn->c_ssf ) {
1819 op->o_conn->c_ssf = op->orb_ssf;
1822 if( !BER_BVISEMPTY( &op->o_conn->c_dn ) ) {
1824 ber_sockbuf_ctrl( op->o_conn->c_sb,
1831 op->o_log_prefix,
1832 BER_BVISNULL( &op->o_conn->c_dn ) ? "<empty>" : op->o_conn->c_dn.bv_val,
1833 op->o_conn->c_authmech.bv_val,
1834 op->orb_ssf, op->o_conn->c_ssf );
1838 op->o_conn->c_authmech.bv_val,
1839 BER_BVISNULL( &op->o_conn->c_dn ) ? "<empty>" : op->o_conn->c_dn.bv_val,
1840 op->orb_ssf );
1843 if ( !BER_BVISNULL( &op->o_conn->c_sasl_bind_mech ) ) {
1844 free( op->o_conn->c_sasl_bind_mech.bv_val );
1845 BER_BVZERO( &op->o_conn->c_sasl_bind_mech );
1849 ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
1851 ch_free( op->o_callback );
1852 op->o_callback = NULL;
1857 static void connection_op_queue( Operation *op )
1859 ber_tag_t tag = op->o_tag;
1865 sc->sc_next = op->o_callback;
1866 op->o_callback = sc;
1867 op->o_conn->c_conn_state = SLAP_C_BINDING;
1870 if (!op->o_dn.bv_len) {
1871 op->o_authz = op->o_conn->c_authz;
1872 if ( BER_BVISNULL( &op->o_conn->c_sasl_authz_dn )) {
1873 ber_dupbv( &op->o_dn, &op->o_conn->c_dn );
1874 ber_dupbv( &op->o_ndn, &op->o_conn->c_ndn );
1876 ber_dupbv( &op->o_dn, &op->o_conn->c_sasl_authz_dn );
1877 ber_dupbv( &op->o_ndn, &op->o_conn->c_sasl_authz_dn );
1881 op->o_authtype = op->o_conn->c_authtype;
1882 ber_dupbv( &op->o_authmech, &op->o_conn->c_authmech );
1884 if (!op->o_protocol) {
1885 op->o_protocol = op->o_conn->c_protocol
1886 ? op->o_conn->c_protocol : LDAP_VERSION3;
1889 if (op->o_conn->c_conn_state == SLAP_C_INACTIVE &&
1890 op->o_protocol > LDAP_VERSION2)
1892 op->o_conn->c_conn_state = SLAP_C_ACTIVE;
1895 op->o_connid = op->o_conn->c_connid;
1896 connection_init_log_prefix( op );
1898 LDAP_STAILQ_INSERT_TAIL( &op->o_conn->c_ops, op, o_next );
1901 static int connection_op_activate( Operation *op )
1905 connection_op_queue( op );
1908 connection_operation, (void *) op );
1913 rc, op->o_connid, 0 );
1914 /* should move op to pending list */
1923 Operation *op;
1964 while ((op = LDAP_STAILQ_FIRST( &c->c_pending_ops )) != NULL) {
1969 LDAP_STAILQ_NEXT(op, o_next) = NULL;
1972 assert(!op->o_abandon);
1977 connection_op_activate( op );
1998 Operation op = {0};
2003 op.o_hdr = &ohdr;
2004 op.o_hdr->oh_extensions = eb->eb_op;
2006 op.o_conn = &conn;
2008 op.o_connid = -1;
2011 slapi_int_free_object_extensions( SLAPI_X_EXT_OPERATION, &op );
2028 Operation *op,
2033 op->o_tmpmemctx = slap_sl_mem_create(SLAP_SLAB_SIZE, SLAP_SLAB_STACK, ctx,
2035 op->o_tmpmfuncs = &slap_sl_mfuncs;
2036 op->o_threadctx = ctx;
2037 op->o_tid = ldap_pvt_thread_pool_tid( ctx );
2039 op->o_counters = &slap_counters;
2040 op->o_conn = conn;
2041 op->o_connid = op->o_conn->c_connid;
2042 connection_init_log_prefix( op );
2053 Operation *op = (Operation *) opbuf;
2067 op->o_hdr = &opbuf->ob_hdr;
2068 op->o_controls = opbuf->ob_controls;
2070 operation_fake_init( conn, op, ctx, newmem );
2082 slapi_int_create_object_extensions( SLAPI_X_EXT_OPERATION, op );
2084 eb->eb_op = op->o_hdr->oh_extensions;
2090 op->o_hdr->oh_extensions = eb->eb_op;
2095 slap_op_time( &op->o_time, &op->o_tincr );