1 /* 2 * Copyright (C) 2011 - 2012 Vivien Malerba <malerba@gnome-db.org> 3 * Copyright (C) 2012 Daniel Espinosa <despinosa@src.gnome.org> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef __GDA_DATA_MODEL_LDAP_H__ 22 #define __GDA_DATA_MODEL_LDAP_H__ 23 24 #include <libgda/gda-data-model.h> 25 26 G_BEGIN_DECLS 27 28 #define GDA_TYPE_DATA_MODEL_LDAP (gda_data_model_ldap_get_type()) 29 #define GDA_DATA_MODEL_LDAP(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GDA_TYPE_DATA_MODEL_LDAP, GdaDataModelLdap)) 30 #define GDA_DATA_MODEL_LDAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, GDA_TYPE_DATA_MODEL_LDAP, GdaDataModelLdapClass)) 31 #define GDA_IS_DATA_MODEL_LDAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE(obj, GDA_TYPE_DATA_MODEL_LDAP)) 32 #define GDA_IS_DATA_MODEL_LDAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GDA_TYPE_DATA_MODEL_LDAP)) 33 34 typedef struct _GdaDataModelLdap GdaDataModelLdap; 35 typedef struct _GdaDataModelLdapClass GdaDataModelLdapClass; 36 typedef struct _GdaDataModelLdapPrivate GdaDataModelLdapPrivate; 37 38 struct _GdaDataModelLdap { 39 GObject object; 40 GdaDataModelLdapPrivate *priv; 41 }; 42 43 struct _GdaDataModelLdapClass { 44 GObjectClass parent_class; 45 46 /*< private >*/ 47 /* Padding for future expansion */ 48 void (*_gda_reserved1) (void); 49 void (*_gda_reserved2) (void); 50 void (*_gda_reserved3) (void); 51 void (*_gda_reserved4) (void); 52 }; 53 54 /** 55 * GdaLdapSearchScope: 56 * @GDA_LDAP_SEARCH_BASE: search of the base object only 57 * @GDA_LDAP_SEARCH_ONELEVEL: search of immediate children of the base object, but does not include the base object itself 58 * @GDA_LDAP_SEARCH_SUBTREE: search of the base object and the entire subtree below the base object 59 * 60 * Defines the search scope of an LDAP search command, relative to the base object. 61 */ 62 typedef enum { 63 GDA_LDAP_SEARCH_BASE = 1, 64 GDA_LDAP_SEARCH_ONELEVEL = 2, 65 GDA_LDAP_SEARCH_SUBTREE = 3 66 } GdaLdapSearchScope; 67 68 /** 69 * SECTION:gda-data-model-ldap 70 * @short_description: GdaDataModel to extract LDAP information 71 * @title: GdaDataModelLdap 72 * @stability: Unstable 73 * @see_also: #GdaDataModel 74 * 75 * The #GdaDataModelLdap object allows to perform LDAP searches. 76 * 77 * Note: this type of data model is available only if the LDAP library was found at compilation time and 78 * if the LDAP provider is correctly installed. 79 */ 80 81 GType gda_data_model_ldap_get_type (void) G_GNUC_CONST; 82 GdaDataModel *gda_data_model_ldap_new (GdaConnection *cnc, 83 const gchar *base_dn, const gchar *filter, 84 const gchar *attributes, GdaLdapSearchScope scope); 85 GdaDataModelLdap *gda_data_model_ldap_new_with_config (GdaConnection *cnc, 86 const gchar *base_dn, const gchar *filter, 87 const gchar *attributes, GdaLdapSearchScope scope); 88 89 GList *gda_data_model_ldap_compute_columns (GdaConnection *cnc, const gchar *attributes); 90 91 G_END_DECLS 92 93 #endif 94