ld_fld.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * LDAP Database Driver for SER
00005  *
00006  * Copyright (C) 2008 iptelorg GmbH
00007  *
00008  * This file is part of SER, a free SIP server.
00009  *
00010  * SER is free software; you can redistribute it and/or modify it under the
00011  * terms of the GNU General Public License as published by the Free Software
00012  * Foundation; either version 2 of the License, or (at your option) any later
00013  * version.
00014  *
00015  * SER is distributed in the hope that it will be useful, but WITHOUT ANY
00016  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00018  * details.
00019  *
00020  * You should have received a copy of the GNU General Public License along
00021  * with this program; if not, write to the Free Software Foundation, Inc.,
00022  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00023  */
00024 
00025 #ifndef _LD_FLD_H
00026 #define _LD_FLD_H
00027 
00037 #include "ld_cfg.h"
00038 
00039 struct ld_cfg;
00040 
00041 #include "../../lib/srdb2/db_gen.h"
00042 #include "../../lib/srdb2/db_fld.h"
00043 #include "../../lib/srdb2/db_cmd.h"
00044 
00045 #include <ldap.h>
00046 
00047 enum ld_syntax {
00048         LD_SYNTAX_STRING = 0,
00049         LD_SYNTAX_GENTIME,
00050         LD_SYNTAX_INT,
00051         LD_SYNTAX_BIT,
00052         LD_SYNTAX_BOOL,
00053         LD_SYNTAX_BIN,
00054         LD_SYNTAX_FLOAT
00055 };
00056 
00057 struct ld_fld {
00058         db_drv_t gen;
00059         str attr;               
00060         enum ld_syntax syntax;  
00061         struct berval** values; 
00062         unsigned int valuesnum;
00063         unsigned int index;
00064         db_fld_t** filter;      
00065         int client_side_filtering;  
00066 };
00067 
00068 
00077 int ld_fld(db_fld_t* fld, char* table);
00078 
00079 
00080 int ld_resolve_fld(db_fld_t* fld, struct ld_cfg* cfg);
00081 
00082 int ld_prepare_ldap_filter(char** filter, db_cmd_t* cmd, str* add);
00083 
00084 int ld_incindex(db_fld_t* fld);
00085 
00086 int ld_ldap2fldinit(db_fld_t* fld, LDAP* ldap, LDAPMessage* msg);
00087 
00088 int ld_ldap2fld(db_fld_t* fld, LDAP* ldap, LDAPMessage* msg);
00089 
00090 int ld_ldap2fldex(db_fld_t* fld, LDAP* ldap, LDAPMessage* msg, int init);
00091 
00094 #endif /* _LD_FLD_H */