From: Luke Howard Date: Fri, 24 Jan 2003 09:23:06 +0000 (+0000) Subject: Support slapi_entry_first_attr()/slapi_entry_next_attr() API X-Git-Tag: NO_SLAP_OP_BLOCKS~507 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fc55ee9edca2d904d31f716d66227f3802326986;p=openldap Support slapi_entry_first_attr()/slapi_entry_next_attr() API --- diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index 0922ae0138..73e34e29be 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -462,6 +462,42 @@ slapi_entry_attr_merge_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals #endif } +int +slapi_entry_first_attr( const Slapi_Entry *e, Slapi_Attr **attr ) +{ +#ifdef LDAP_SLAPI + if ( e == NULL ) { + return -1; + } + + *attr = e->e_attrs; + + return ( *attr != NULL ) ? 0 : -1; +#else + return -1; +#endif +} + +int +slapi_entry_next_attr( const Slapi_Entry *e, Slapi_Attr *prevattr, Slapi_Attr **attr ) +{ +#ifdef LDAP_SLAPI + if ( e == NULL ) { + return -1; + } + + if ( prevattr == NULL ) { + return -1; + } + + *attr = prevattr->a_next; + + return ( *attr != NULL ) ? 0 : -1; +#else + return -1; +#endif +} + int slapi_entry_attr_replace_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ) { diff --git a/servers/slapd/slapi/slapi_utils.h b/servers/slapd/slapi/slapi_utils.h index 2e31d54253..c8d4de45f1 100644 --- a/servers/slapd/slapi/slapi_utils.h +++ b/servers/slapd/slapi/slapi_utils.h @@ -55,6 +55,8 @@ int slapi_entry_attr_get_uint( const Slapi_Entry *e, const char *type ); int slapi_entry_attr_get_ulong( const Slapi_Entry *e, const char *type ); int slapi_entry_attr_hasvalue( Slapi_Entry *e, const char *type, const char *value ); int slapi_entry_attr_merge_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ); +int slapi_entry_first_attr( const Slapi_Entry *e, Slapi_Attr **attr ); +int slapi_entry_next_attr( const Slapi_Entry *e, Slapi_Attr *prevattr, Slapi_Attr **attr ); char *slapi_entry_get_dn( Slapi_Entry *e ); int slapi_x_entry_get_id( Slapi_Entry *e ); void slapi_entry_set_dn( Slapi_Entry *e, char *dn );