Operation *op = arg_v;
SlapReply rs = {REP_RESULT};
ber_tag_t tag = op->o_tag;
- int opidx = -1;
+ slap_op_t opidx = SLAP_OP_LAST;
Connection *conn = op->o_conn;
void *memctx = NULL;
void *memctx_null = NULL;
}
}
- switch ( tag ) {
- case LDAP_REQ_BIND:
- opidx = SLAP_OP_BIND;
- break;
-
- case LDAP_REQ_UNBIND:
- opidx = SLAP_OP_UNBIND;
- break;
-
- case LDAP_REQ_ADD:
- opidx = SLAP_OP_ADD;
- break;
-
- case LDAP_REQ_DELETE:
- opidx = SLAP_OP_DELETE;
- break;
-
- case LDAP_REQ_MODRDN:
- opidx = SLAP_OP_MODRDN;
- break;
-
- case LDAP_REQ_MODIFY:
- opidx = SLAP_OP_MODIFY;
- break;
-
- case LDAP_REQ_COMPARE:
- opidx = SLAP_OP_COMPARE;
- break;
-
- case LDAP_REQ_SEARCH:
- opidx = SLAP_OP_SEARCH;
- break;
-
- case LDAP_REQ_ABANDON:
- opidx = SLAP_OP_ABANDON;
- break;
-
- case LDAP_REQ_EXTENDED:
- opidx = SLAP_OP_EXTENDED;
- break;
-
- default:
- /* not reachable */
- assert( 0 );
- }
-
- assert( opidx > -1 );
+ opidx = slap_req2op( tag );
+ assert( opidx != SLAP_OP_LAST );
INCR_OP_INITIATED( opidx );
rc = (*(opfun[opidx]))( op, &rs );
if ( rc == SLAPD_DISCONNECT ) {
tag = LBER_ERROR;
- } else if ( opidx > -1 ) {
+ } else if ( opidx != SLAP_OP_LAST ) {
/* increment completed operations count
* only if operation was initiated
* and rc != SLAPD_DISCONNECT */
return( op );
}
+
+slap_op_t
+slap_req2op( ber_tag_t tag )
+{
+ switch ( tag ) {
+ case LDAP_REQ_BIND:
+ return SLAP_OP_BIND;
+ case LDAP_REQ_UNBIND:
+ return SLAP_OP_UNBIND;
+ case LDAP_REQ_ADD:
+ return SLAP_OP_ADD;
+ case LDAP_REQ_DELETE:
+ return SLAP_OP_DELETE;
+ case LDAP_REQ_MODRDN:
+ return SLAP_OP_MODRDN;
+ case LDAP_REQ_MODIFY:
+ return SLAP_OP_MODIFY;
+ case LDAP_REQ_COMPARE:
+ return SLAP_OP_COMPARE;
+ case LDAP_REQ_SEARCH:
+ return SLAP_OP_SEARCH;
+ case LDAP_REQ_ABANDON:
+ return SLAP_OP_ABANDON;
+ case LDAP_REQ_EXTENDED:
+ return SLAP_OP_EXTENDED;
+ }
+
+ return SLAP_OP_LAST;
+}
LDAP_SLAPD_F (int) slap_op_add LDAP_P(( Operation **olist, Operation *op ));
LDAP_SLAPD_F (int) slap_op_remove LDAP_P(( Operation **olist, Operation *op ));
LDAP_SLAPD_F (Operation *) slap_op_pop LDAP_P(( Operation **olist ));
+LDAP_SLAPD_F (slap_op_t) slap_req2op LDAP_P(( ber_tag_t tag ));
/*
* operational.c