fe.h revision 1
1N/A * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 1N/A * Get context const . Used to retreive info in context : fe_get_ctx 1N/A * Return values depend on requested info : 1N/A /* return value is (char *) */ 1N/A /* return value is (int *) */ 1N/A /* return value is (char **) */ 1N/A /* return value is (FE_Table *) */ 1N/A /* !! This is not a copy */ 1N/A /* third parameter is the variable name (char *) */ 1N/A#
define TABLE_NAME 1 /* table or subsection name, return value is (char *) */ 1N/A /* third parms is null */ 1N/A /* third parms is null */ 1N/A /* third parameter is the variable name (char *) */ 1N/A /* return value is an array of string (char **) */ 1N/A#
define TABLE_FEATTR 5 /* to get the attribute definition. If no attribute name */ 1N/A /* is provided to get the list of attributes */ 1N/A /* third parms is the attribute name */ 1N/A /* return a FE_Attr * if attribute name provided */ 1N/A /* return a char ** (null term) if no attribute name provided */ 1N/A * This struct is used to run regex with "reg_expression" 1N/A * and assigned values (braelist) with "token" links 1N/A * Functional schema : 1N/A * step(input,reg_expression) 1N/A * => token[0] = braslist[0]..braelist[0] 1N/A * => token[1] = braslist[1]..braelist[1] 1N/A * => token[i] = braslist[i]..braelist[i] 1N/A int *
Token_ID;
/* Tokens place (index) in input value */ 1N/A * Tokens definition, including input attribute and number of expressions 1N/A * and link to each rule. 1N/A int attr_ID;
/* Attributes ID (in SD or FE Table) */ 1N/A /* Used as input in regular expression */ 1N/A int NbRules;
/* Number of expressions separated by | */ 1N/A * Attribute mapping definition. SD attributes are composed of FE attributes and 1N/A /* Key || Exist || Frozen */ 1N/A /* Key is used to generate wizard filter */ 1N/A /* Exist is used to generate wizard filter */ 1N/A /* Frozen is used control access on attribute */ 1N/A int NbItem;
/* Nb Attributes & Tokens need to build val */ 1N/A int *
AttrID;
/* Set of attributes including tokens */ 1N/A * Builder_map : defined builder expression 1N/A int *
Input_ID;
/* List of attr ID to used as input in semtence */ 1N/A char *
prefix;
/* string2instances and reverse : prefix */ 1N/A /* exclude : val 2 exclude */ 1N/A int Parm_ID;
/* only for exclude funct : ID of val 2 exclude */ 1N/A * Builder tokens : used to build special value (named builder token) from other tokens 1N/A * or input value. They look like ouput attributes, but they allow to apply rules, if 1N/A * input value does exist. They also permit to split input sentence into attribute instances 1N/A * Full definition of table mapping. 1N/A char **
Values;
/* Null terminated array of instance */ 1N/A int opType;
/* Extrac, Cond, split, str2ins, ins2str, */ 1N/A /* getrdn, exclude */ 1N/A int NbExpr;
/* Nb rules found use only in extract & cond */ 1N/A int *
NbItems;
/* Nb variable in expression, usefull for */ 1N/A /* extract and cond. IT's a null terminated */ 1N/A /* array which contains the Number of var in */ 1N/A char **
ConstVal;
/* use when funct parm are const not used for */ 1N/A /* extract and cond cases */ 1N/A char **
VarName;
/* Var can be 1)DynRule 2)InputData 3)Common */ 1N/A int nb_cust;
/* Nb custom attributes in common section */ 1N/A/* Entries values definition */ 1N/A/* Instance values definition */ 1N/A/* Attribute value definition */ 1N/A/* Full entry definition */ 1N/A * libfe.a exported functions 1N/A * Read config file and create "fe_name" context 1N/A * NB : This init read all tables mapping 1N/A * libldap context use : before all action 1N/A * Free All fe context all tables ... 1N/A * libldap context usage : ldap_close 1N/A * Return the pointer to requested item in context 1N/A * libldap context usage : before all action 1N/A * libldap context usage : ldap_* 1N/A * Set tables item is mainly used for communication items. other information 1N/A * sets will be forbid 1N/A * libldap context usage : after ldap_open or ldap_bind 1N/Aextern int fe_table_set(FE_Table *MapTable, int FieldID, void *Void); 1N/A * You have the attribute name ?! fe_ent_get_attr returns pointer to the requested 1N/A * attributes with instances, status... from a specific entry 1N/A * libldap context usage : after ldap_search 1N/A * Create the entry according to the "schema" defined in mapping file for a specific table 1N/A * libladp context usage : before ldap_add 1N/A * Add new attributes in a new entry 1N/A * libladp context usage : before ldap_add 1N/A * Add new instance value 1N/A * libladp context usage : before ldap_add 1N/A * explode DN into an attributes array 1N/A * libladp context usage : after ldap_search 1N/A * free entry (including attributes) 1N/A * Substitute all vars defined in inputString (with syntax ${varName}) by values found in 1N/A * fe_couple array. For errors returned check the errors consts upper 1N/A * Split a sentence, add prefix (for each token) and suffix (exept for the last) 1N/A * Dynamic translation, use only definition in dynamic section 1N/A * Return the translated attribute. TableType is the original table of AttrName. 1N/A * if translation rules is one to one translation, the function return a copy of translated 1N/A * else the function return a copy of the rules 1N/A * Return the translated SD entry 1N/A * libladp context usage : after ldap_search 1N/A * Return the translated FE entry 1N/A * libladp context usage : after ldap_search 1N/A * Close to "fe_trans_all_sds2fe" but output is Entry pointer as defined in SunDS server 1N/A/* An example an example .... 1N/A * Translation from fe to sunds 1N/A * FE_Context *MyContext = NULL; 1N/A * FE_Table *HostTable = NULL; 1N/A * FE_Entry *fe_entry = NULL; 1N/A * FE_Attr *fe_attr = NULL; 1N/A * Entry *lentry = NULL; 1N/A * ldaplog(LDAP_DEBUG_CONFIG,"Can't load mapping file\n", 0, 0, 0); 1N/A * if((HostTable = fe_ctx_get(MyContext,CTX_TABLEPTR,"dummy")) == NULL) 1N/A * ldaplog(LDAP_DEBUG_CONFIG,"Can't retreive HOSTS table\n", 0, 0, 0); 1N/A * if((fe_entry = fe_ent_create(HostTable, FETABLE))==NULL) 1N/A * ldaplog(LDAP_DEBUG_CONFIG,"Can't create entry\n", 0, 0, 0); 1N/A * if ((fe_attr = fe_ent_add_attr_val(HostTable, fe_entry, "niskey", 16, "109.107.179.131")) == NULL) 1N/A * ldaplog(LDAP_DEBUG_CONFIG,"Can't add attr=%s, val=%s\n", "niskey", "109.107.179.131", 0); 1N/A * if((fe_attr = fe_ent_add_attr_val(HostTable, 1N/A * strlen("olivaw OLIVAW oLiVaW # regis Host") +1, 1N/A * "olivaw OLIVAW oLiVaW # regis Host")) == NULL) 1N/A * if((lentry = fe_trans_all_fe2sunds(HostTable, fe_entry)) ==NULL) 1N/A * ldaplog(LDAP_DEBUG_CONFIG,".... \n", 0);