LDAP_BEGIN_DECL
+/*
+ * Attribute flags returned by slapi_attr_get_flags()
+ */
+#define SLAPI_ATTR_FLAG_SINGLE 0x0001
+#define SLAPI_ATTR_FLAG_OPATTR 0x0002
+#define SLAPI_ATTR_FLAG_READONLY 0x0004
+#define SLAPI_ATTR_FLAG_STD_ATTR SLAPI_ATTR_FLAG_READONLY
+#define SLAPI_ATTR_FLAG_OBSOLETE 0x0040
+#define SLAPI_ATTR_FLAG_COLLECTIVE 0x0080
+#define SLAPI_ATTR_FLAG_NOUSERMOD 0x0100
+
/*
* Plugin types universally supported by SLAPI
* implementations
return -1;
#endif /* defined(LDAP_SLAPI) */
}
+
+int slapi_attr_get_flags( Slapi_Attr *attr, unsigned long *flags )
+{
+#if defined( LDAP_SLAPI )
+ AttributeType *at;
+
+ if ( attr == NULL )
+ return LDAP_PARAM_ERROR;
+
+ at = attr->a_desc->ad_type;
+
+ *flags = SLAPI_ATTR_FLAG_STD_ATTR;
+
+ if ( is_at_single_value( at ) )
+ *flags |= SLAPI_ATTR_FLAG_SINGLE;
+ if ( is_at_operational( at ) )
+ *flags |= SLAPI_ATTR_FLAG_OPATTR;
+ if ( is_at_obsolete( at ) )
+ *flags |= SLAPI_ATTR_FLAG_OBSOLETE;
+ if ( is_at_collective( at ) )
+ *flags |= SLAPI_ATTR_FLAG_COLLECTIVE;
+ if ( is_at_no_user_mod( at ) )
+ *flags |= SLAPI_ATTR_FLAG_NOUSERMOD;
+
+ return LDAP_SUCCESS;
+#else
+ return -1;
+#endif /* defined(LDAP_SLAPI) */
+}
+
+int slapi_attr_flag_is_set( Slapi_Attr *attr, unsigned long flag )
+{
+#if defined( LDAP_SLAPI )
+ unsigned long flags;
+
+ if ( slapi_attr_get_flags( attr, &flags ) != 0 )
+ return 0;
+ return (flags & flag) ? 1 : 0;
+#else
+ return 0;
+#endif /* defined(LDAP_SLAPI) */
+}
Slapi_Entry *slapi_entry_alloc();
void slapi_entry_free( Slapi_Entry *e );
int slapi_attr_get_values( Slapi_Attr *attr, struct berval ***vals );
+int slapi_attr_get_flags( Slapi_Attr *attr, unsigned long *flags );
+int slapi_attr_flag_is_set( Slapi_Attr *attr, unsigned long flag );
char *slapi_ch_malloc( unsigned long size );
void slapi_ch_free( void **ptr );
char *slapi_ch_calloc( unsigned long nelem, unsigned long size );