From edc575888c45d33d7f841d06d865f52e3a83da63 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Tue, 26 Jul 2005 04:34:23 +0000 Subject: [PATCH] slapi_op_type_to_string/slapi_op_get_type implementation --- include/slapi-plugin.h | 7 ++ servers/slapd/slapi/slapi_utils.c | 112 ++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) diff --git a/include/slapi-plugin.h b/include/slapi-plugin.h index 1772c44a3d..b63138779e 100644 --- a/include/slapi-plugin.h +++ b/include/slapi-plugin.h @@ -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, diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index 1516343275..a12dc57d84 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -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 */ -- 2.39.5