⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 back-sql.h

📁 ldap服务器源码
💻 H
📖 第 1 页 / 共 2 页
字号:
#else /* ! BACKSQL_ARBITRARY_KEY */#define BACKSQL_ENTRYID_INIT { 0, 0, 0, BER_BVNULL, BER_BVNULL, NULL }#endif /* BACKSQL_ARBITRARY_KEY *//* * "structural" objectClass mapping structure */typedef struct backsql_oc_map_rec {	/*	 * Structure of corresponding LDAP objectClass definition	 */	ObjectClass		*bom_oc;#define BACKSQL_OC_NAME(ocmap)	((ocmap)->bom_oc->soc_cname.bv_val)		struct berval		bom_keytbl;	struct berval		bom_keycol;	/* expected to return keyval of newly created entry */	char			*bom_create_proc;	/* in case create_proc does not return the keyval of the newly	 * created row */	char			*bom_create_keyval;	/* supposed to expect keyval as parameter and delete 	 * all the attributes as well */	char			*bom_delete_proc;	/* flags whether delete_proc is a function (whether back-sql 	 * should bind first parameter as output for return code) */	int			bom_expect_return;	unsigned long		bom_id;	Avlnode			*bom_attrs;	AttributeDescription	*bom_create_hint;} backsql_oc_map_rec;/* * attributeType mapping structure */typedef struct backsql_at_map_rec {	/* Description of corresponding LDAP attribute type */	AttributeDescription	*bam_ad;	/* ObjectClass if bam_ad is objectClass */	ObjectClass		*bam_oc;	struct berval	bam_from_tbls;	struct berval	bam_join_where;	struct berval	bam_sel_expr;	/* TimesTen, or, if a uppercase function is defined,	 * an uppercased version of bam_sel_expr */	struct berval	bam_sel_expr_u;	/* supposed to expect 2 binded values: entry keyval 	 * and attr. value to add, like "add_name(?,?,?)" */	char		*bam_add_proc;	/* supposed to expect 2 binded values: entry keyval 	 * and attr. value to delete */	char		*bam_delete_proc;	/* for optimization purposes attribute load query 	 * is preconstructed from parts on schemamap load time */	char		*bam_query;#ifdef BACKSQL_COUNTQUERY	char		*bam_countquery;#endif /* BACKSQL_COUNTQUERY */	/* following flags are bitmasks (first bit used for add_proc, 	 * second - for delete_proc) */	/* order of parameters for procedures above; 	 * 1 means "data then keyval", 0 means "keyval then data" */	int 		bam_param_order;	/* flags whether one or more of procedures is a function 	 * (whether back-sql should bind first parameter as output 	 * for return code) */	int 		bam_expect_return;	/* next mapping for attribute */	struct backsql_at_map_rec	*bam_next;} backsql_at_map_rec;#define BACKSQL_AT_MAP_REC_INIT { NULL, NULL, BER_BVC(""), BER_BVC(""), BER_BVNULL, BER_BVNULL, NULL, NULL, NULL, 0, 0, NULL }/* define to uppercase filters only if the matching rule requires it * (currently broken) *//* #define	BACKSQL_UPPERCASE_FILTER */#define	BACKSQL_AT_CANUPPERCASE(at)	( !BER_BVISNULL( &(at)->bam_sel_expr_u ) )/* defines to support bitmasks above */#define BACKSQL_ADD	0x1#define BACKSQL_DEL	0x2#define BACKSQL_IS_ADD(x)	( ( BACKSQL_ADD & (x) ) == BACKSQL_ADD )#define BACKSQL_IS_DEL(x)	( ( BACKSQL_DEL & (x) ) == BACKSQL_DEL )#define BACKSQL_NCMP(v1,v2)	ber_bvcmp((v1),(v2))#define BACKSQL_CONCAT/* * berbuf structure: a berval with a buffer size associated */typedef struct berbuf {	struct berval	bb_val;	ber_len_t	bb_len;} BerBuffer;#define BB_NULL		{ BER_BVNULL, 0 }/* the function must collect the entry associated to nbase */#define BACKSQL_ISF_GET_ID	0x1U#define BACKSQL_ISF_GET_ENTRY	( 0x2U | BACKSQL_ISF_GET_ID )#define BACKSQL_ISF_MATCHED	0x4U#define BACKSQL_IS_GET_ID(f) \	( ( (f) & BACKSQL_ISF_GET_ID ) == BACKSQL_ISF_GET_ID )#define BACKSQL_IS_GET_ENTRY(f) \	( ( (f) & BACKSQL_ISF_GET_ENTRY ) == BACKSQL_ISF_GET_ENTRY )#define BACKSQL_IS_MATCHED(f) \	( ( (f) & BACKSQL_ISF_MATCHED ) == BACKSQL_ISF_MATCHED )typedef struct backsql_srch_info {	Operation		*bsi_op;	SlapReply		*bsi_rs;	unsigned		bsi_flags;#define	BSQL_SF_NONE			0x0000U#define	BSQL_SF_ALL_USER		0x0001U#define	BSQL_SF_ALL_OPER		0x0002U#define	BSQL_SF_ALL_ATTRS		(BSQL_SF_ALL_USER|BSQL_SF_ALL_OPER)#define BSQL_SF_FILTER_HASSUBORDINATE	0x0010U#define BSQL_SF_FILTER_ENTRYUUID	0x0020U#define BSQL_SF_FILTER_ENTRYCSN		0x0040U#define BSQL_SF_RETURN_ENTRYUUID	(BSQL_SF_FILTER_ENTRYUUID << 8)#define	BSQL_ISF(bsi, f)		( ( (bsi)->bsi_flags & f ) == f )#define	BSQL_ISF_ALL_USER(bsi)		BSQL_ISF(bsi, BSQL_SF_ALL_USER)#define	BSQL_ISF_ALL_OPER(bsi)		BSQL_ISF(bsi, BSQL_SF_ALL_OPER)#define	BSQL_ISF_ALL_ATTRS(bsi)		BSQL_ISF(bsi, BSQL_SF_ALL_ATTRS)	struct berval		*bsi_base_ndn;	int			bsi_use_subtree_shortcut;	backsql_entryID		bsi_base_id;	int			bsi_scope;/* BACKSQL_SCOPE_BASE_LIKE can be set by API in ors_scope * whenever the search base DN contains chars that cannot * be mapped into the charset used in the RDBMS; so they're * turned into '%' and an approximate ('LIKE') condition * is used */#define BACKSQL_SCOPE_BASE_LIKE		( LDAP_SCOPE_BASE | 0x1000 )	Filter			*bsi_filter;	time_t			bsi_stoptime;	backsql_entryID		*bsi_id_list,				**bsi_id_listtail,				*bsi_c_eid;	int			bsi_n_candidates;	int			bsi_status;	backsql_oc_map_rec	*bsi_oc;	struct berbuf		bsi_sel,				bsi_from,				bsi_join_where,				bsi_flt_where;	ObjectClass		*bsi_filter_oc;	SQLHDBC			bsi_dbh;	AttributeName		*bsi_attrs;	Entry			*bsi_e;} backsql_srch_info;/* * Backend private data structure */typedef struct backsql_info {	char		*sql_dbhost;	int		sql_dbport;	char		*sql_dbuser;	char		*sql_dbpasswd;	char		*sql_dbname; 	/*	 * SQL condition for subtree searches differs in syntax:	 * "LIKE CONCAT('%',?)" or "LIKE '%'+?" or "LIKE '%'||?"	 * or smtg else 	 */	struct berval	sql_subtree_cond;	struct berval	sql_children_cond;	char		*sql_oc_query,			*sql_at_query;	char		*sql_insentry_stmt,			*sql_delentry_stmt,			*sql_renentry_stmt,			*sql_delobjclasses_stmt;	char		*sql_id_query;	char		*sql_has_children_query;	MatchingRule	*sql_caseIgnoreMatch;	MatchingRule	*sql_telephoneNumberMatch;	struct berval	sql_upper_func;	struct berval	sql_upper_func_open;	struct berval	sql_upper_func_close;	BerVarray	sql_concat_func;	struct berval	sql_strcast_func;	struct berval	sql_aliasing;	struct berval	sql_aliasing_quote;	struct berval	sql_dn_oc_aliasing;	AttributeName	*sql_anlist;	unsigned int	sql_flags;#define	BSQLF_SCHEMA_LOADED		0x0001#define	BSQLF_UPPER_NEEDS_CAST		0x0002#define	BSQLF_CREATE_NEEDS_SELECT	0x0004#define	BSQLF_FAIL_IF_NO_MAPPING	0x0008#define BSQLF_HAS_LDAPINFO_DN_RU	0x0010#define BSQLF_DONTCHECK_LDAPINFO_DN_RU	0x0020#define BSQLF_USE_REVERSE_DN		0x0040#define BSQLF_ALLOW_ORPHANS		0x0080#define BSQLF_USE_SUBTREE_SHORTCUT	0x0100#define BSQLF_FETCH_ALL_USERATTRS	0x0200#define BSQLF_FETCH_ALL_OPATTRS		0x0400#define	BSQLF_FETCH_ALL_ATTRS		(BSQLF_FETCH_ALL_USERATTRS|BSQLF_FETCH_ALL_OPATTRS)#define BSQLF_CHECK_SCHEMA		0x0800#define BACKSQL_ISF(si, f) \	(((si)->sql_flags & f) == f)#define	BACKSQL_SCHEMA_LOADED(si) \	BACKSQL_ISF(si, BSQLF_SCHEMA_LOADED)#define BACKSQL_UPPER_NEEDS_CAST(si) \	BACKSQL_ISF(si, BSQLF_UPPER_NEEDS_CAST)#define BACKSQL_CREATE_NEEDS_SELECT(si) \	BACKSQL_ISF(si, BSQLF_CREATE_NEEDS_SELECT)#define BACKSQL_FAIL_IF_NO_MAPPING(si) \	BACKSQL_ISF(si, BSQLF_FAIL_IF_NO_MAPPING)#define BACKSQL_HAS_LDAPINFO_DN_RU(si) \	BACKSQL_ISF(si, BSQLF_HAS_LDAPINFO_DN_RU)#define BACKSQL_DONTCHECK_LDAPINFO_DN_RU(si) \	BACKSQL_ISF(si, BSQLF_DONTCHECK_LDAPINFO_DN_RU)#define BACKSQL_USE_REVERSE_DN(si) \	BACKSQL_ISF(si, BSQLF_USE_REVERSE_DN)#define BACKSQL_CANUPPERCASE(si) \	(!BER_BVISNULL( &(si)->sql_upper_func ))#define BACKSQL_ALLOW_ORPHANS(si) \	BACKSQL_ISF(si, BSQLF_ALLOW_ORPHANS)#define BACKSQL_USE_SUBTREE_SHORTCUT(si) \	BACKSQL_ISF(si, BSQLF_USE_SUBTREE_SHORTCUT)#define BACKSQL_FETCH_ALL_USERATTRS(si) \	BACKSQL_ISF(si, BSQLF_FETCH_ALL_USERATTRS)#define BACKSQL_FETCH_ALL_OPATTRS(si) \	BACKSQL_ISF(si, BSQLF_FETCH_ALL_OPATTRS)#define BACKSQL_FETCH_ALL_ATTRS(si) \	BACKSQL_ISF(si, BSQLF_FETCH_ALL_ATTRS)#define BACKSQL_CHECK_SCHEMA(si) \	BACKSQL_ISF(si, BSQLF_CHECK_SCHEMA)	Entry		*sql_baseObject;#ifdef BACKSQL_ARBITRARY_KEY#define BACKSQL_BASEOBJECT_IDSTR	"baseObject"#define BACKSQL_BASEOBJECT_KEYVAL	BACKSQL_BASEOBJECT_IDSTR#define	BACKSQL_IS_BASEOBJECT_ID(id)	(bvmatch((id), &backsql_baseObject_bv))#else /* ! BACKSQL_ARBITRARY_KEY */#define BACKSQL_BASEOBJECT_ID		0#define BACKSQL_BASEOBJECT_IDSTR	LDAP_XSTRING(BACKSQL_BASEOBJECT_ID)#define BACKSQL_BASEOBJECT_KEYVAL	0#define	BACKSQL_IS_BASEOBJECT_ID(id)	(*(id) == BACKSQL_BASEOBJECT_ID)#endif /* ! BACKSQL_ARBITRARY_KEY */#define BACKSQL_BASEOBJECT_OC		0		Avlnode		*sql_db_conns;	Avlnode		*sql_oc_by_oc;	Avlnode		*sql_oc_by_id;	ldap_pvt_thread_mutex_t		sql_dbconn_mutex;	ldap_pvt_thread_mutex_t		sql_schema_mutex; 	SQLHENV		sql_db_env;	backsql_api	*sql_api;} backsql_info;#define BACKSQL_SUCCESS( rc ) \	( (rc) == SQL_SUCCESS || (rc) == SQL_SUCCESS_WITH_INFO )#define BACKSQL_AVL_STOP		0#define BACKSQL_AVL_CONTINUE		1/* see ldap.h for the meaning of the macros and of the values */#define BACKSQL_LEGAL_ERROR( rc ) \	( LDAP_RANGE( (rc), 0x00, 0x0e ) \	  || LDAP_ATTR_ERROR( (rc) ) \	  || LDAP_NAME_ERROR( (rc) ) \	  || LDAP_SECURITY_ERROR( (rc) ) \	  || LDAP_SERVICE_ERROR( (rc) ) \	  || LDAP_UPDATE_ERROR( (rc) ) )#define BACKSQL_SANITIZE_ERROR( rc ) \	( BACKSQL_LEGAL_ERROR( (rc) ) ? (rc) : LDAP_OTHER )#endif /* __BACKSQL_H__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -