]> git.sur5r.net Git - openldap/commitdiff
slapi_op_type_to_string/slapi_op_get_type implementation
authorLuke Howard <lukeh@openldap.org>
Tue, 26 Jul 2005 04:34:23 +0000 (04:34 +0000)
committerLuke Howard <lukeh@openldap.org>
Tue, 26 Jul 2005 04:34:23 +0000 (04:34 +0000)
include/slapi-plugin.h
servers/slapd/slapi/slapi_utils.c

index 1772c44a3da0e527febf132e516b0bb47d22017a..b63138779eb725f580fd2c8262f4f7a5b5a7b3e6 100644 (file)
@@ -221,6 +221,13 @@ void slapi_register_supported_saslmechanism(char *mechanism);
 char **slapi_get_supported_saslmechanisms();
 char **slapi_get_supported_extended_ops(void);
 
+/* operation */
+int slapi_op_abandoned( Slapi_PBlock *pb );
+unsigned long slapi_op_get_type(Slapi_Operation * op);
+void slapi_operation_set_flag(Slapi_Operation *op, unsigned long flag);
+void slapi_operation_clear_flag(Slapi_Operation *op, unsigned long flag);
+int slapi_operation_is_flag_set(Slapi_Operation *op, unsigned long flag);
+char *slapi_op_type_to_string(unsigned long type);
 
 /* send ldap result back */
 void slapi_send_ldap_result( Slapi_PBlock *pb, int err, char *matched,
index 151634327518caf9401461b22141fd05acd20e9c..a12dc57d84b32a9c61cf7bbddcc35b002f7329b1 100644 (file)
@@ -3354,5 +3354,117 @@ slapi_int_count_controls( LDAPControl **ctrls )
        return i;
 }
 
+int
+slapi_op_abandoned( Slapi_PBlock *pb )
+{
+       if ( pb->pb_op == NULL )
+               return 0;
+
+       return ( pb->pb_op->o_abandon );
+}
+
+char *
+slapi_op_type_to_string(unsigned long type)
+{
+       char *str;
+
+       switch (type) {
+       case SLAPI_OPERATION_BIND:
+               str = "bind";
+               break;
+       case SLAPI_OPERATION_UNBIND:
+               str = "unbind";
+               break;
+       case SLAPI_OPERATION_SEARCH:
+               str = "search";
+               break;
+       case SLAPI_OPERATION_MODIFY:
+               str = "modify";
+               break;
+       case SLAPI_OPERATION_ADD:
+               str = "add";
+               break;
+       case SLAPI_OPERATION_DELETE:
+               str = "delete";
+               break;
+       case SLAPI_OPERATION_MODDN:
+               str = "modrdn";
+               break;
+       case SLAPI_OPERATION_COMPARE:
+               str = "compare";
+               break;
+       case SLAPI_OPERATION_ABANDON:
+               str = "abandon";
+               break;
+       case SLAPI_OPERATION_EXTENDED:
+               str = "extended";
+               break;
+       default:
+               str = "unknown operation type";
+               break;
+       }
+       return str;
+}
+
+unsigned long
+slapi_op_get_type(Slapi_Operation * op)
+{
+       unsigned long type;
+
+       switch ( op->o_tag ) {
+       case LDAP_REQ_BIND:
+               type = SLAPI_OPERATION_BIND;
+               break;
+       case LDAP_REQ_UNBIND:
+               type = SLAPI_OPERATION_UNBIND;
+               break;
+       case LDAP_REQ_SEARCH:
+               type = SLAPI_OPERATION_SEARCH;
+               break;
+       case LDAP_REQ_MODIFY:
+               type = SLAPI_OPERATION_MODIFY;
+               break;
+       case LDAP_REQ_ADD:
+               type = SLAPI_OPERATION_ADD;
+               break;
+       case LDAP_REQ_DELETE:
+               type = SLAPI_OPERATION_DELETE;
+               break;
+       case LDAP_REQ_MODRDN:
+               type = SLAPI_OPERATION_MODDN;
+               break;
+       case LDAP_REQ_COMPARE:
+               type = SLAPI_OPERATION_COMPARE;
+               break;
+       case LDAP_REQ_ABANDON:
+               type = SLAPI_OPERATION_ABANDON;
+               break;
+       case LDAP_REQ_EXTENDED:
+               type = SLAPI_OPERATION_EXTENDED;
+               break;
+       default:
+               type = SLAPI_OPERATION_NONE;
+               break;
+       }
+       return type;
+}
+
+#if 0
+void
+slapi_operation_set_flag(Slapi_Operation *op, unsigned long flag)
+{
+}
+
+void
+slapi_operation_clear_flag(Slapi_Operation *op, unsigned long flag)
+{
+}
+
+int
+slapi_operation_is_flag_set(Slapi_Operation *op, unsigned long flag)
+{
+}
+#endif
+
 #endif /* LDAP_SLAPI */