10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * 3*3857Sstevel * Copyright 1999 Sun Microsystems, Inc. All rights reserved. 4*3857Sstevel * Use is subject to license terms. 50Sstevel@tonic-gate * 60Sstevel@tonic-gate */ 70Sstevel@tonic-gate 80Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 90Sstevel@tonic-gate 100Sstevel@tonic-gate #ifndef _FE_H 110Sstevel@tonic-gate #define _FE_H 120Sstevel@tonic-gate 130Sstevel@tonic-gate /* 140Sstevel@tonic-gate * Get context const . Used to retreive info in context : fe_get_ctx 150Sstevel@tonic-gate * Return values depend on requested info : 160Sstevel@tonic-gate */ 170Sstevel@tonic-gate #define CTX_FENAME 1 /* To get the Front End name */ 180Sstevel@tonic-gate /* return value is (char *) */ 190Sstevel@tonic-gate #define CTX_NBTABLE 2 /* To get the number of sub-section */ 200Sstevel@tonic-gate /* return value is (int *) */ 210Sstevel@tonic-gate #define CTX_TABLENAME 3 /* To get name(s) of sub section */ 220Sstevel@tonic-gate /* return value is (char **) */ 230Sstevel@tonic-gate #define CTX_TABLEPTR 4 /* To get the ptr to a sub section definition */ 240Sstevel@tonic-gate /* return value is (FE_Table *) */ 250Sstevel@tonic-gate /* !! This is not a copy */ 260Sstevel@tonic-gate #define CTX_CUSTOMS 5 /* get customs attributes */ 270Sstevel@tonic-gate /* third parameter is the variable name (char *) */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate /* 300Sstevel@tonic-gate * Get Tables const 310Sstevel@tonic-gate */ 320Sstevel@tonic-gate #define TABLE_NAME 1 /* table or subsection name, return value is (char *) */ 330Sstevel@tonic-gate /* third parms is null */ 340Sstevel@tonic-gate #define TABLE_OBJ_LST 2 /* object class list, return value is (char **) */ 350Sstevel@tonic-gate /* third parms is null */ 360Sstevel@tonic-gate #define TABLE_COM_HLD 3 /* stored ldap, connection return value is (LDAP *) */ 370Sstevel@tonic-gate #define TABLE_CUSTOMS 4 /* get customs attributes */ 380Sstevel@tonic-gate /* third parameter is the variable name (char *) */ 390Sstevel@tonic-gate /* return value is an array of string (char **) */ 400Sstevel@tonic-gate #define TABLE_FEATTR 5 /* to get the attribute definition. If no attribute name */ 410Sstevel@tonic-gate /* is provided to get the list of attributes */ 420Sstevel@tonic-gate /* third parms is the attribute name */ 430Sstevel@tonic-gate /* return a FE_Attr * if attribute name provided */ 440Sstevel@tonic-gate /* return a char ** (null term) if no attribute name provided */ 450Sstevel@tonic-gate 460Sstevel@tonic-gate #define TABLE_SUNDSATTR 6 /* idem TABLE_FEATTR but for SunDS definition */ 470Sstevel@tonic-gate 480Sstevel@tonic-gate /* 490Sstevel@tonic-gate * Tokens/Attributes 500Sstevel@tonic-gate */ 510Sstevel@tonic-gate #define FETABLE 0 520Sstevel@tonic-gate #define SUNDSTABLE 1 530Sstevel@tonic-gate #define SUNDSATTRLIST 2 540Sstevel@tonic-gate #define SUNDSTOKENLIST 3 550Sstevel@tonic-gate #define FEATTRLIST 4 560Sstevel@tonic-gate #define FETOKENLIST 5 570Sstevel@tonic-gate #define FEBUILDLIST 6 580Sstevel@tonic-gate #define SUNDSBUILDLIST 7 590Sstevel@tonic-gate 600Sstevel@tonic-gate /* 610Sstevel@tonic-gate * Errors consts 620Sstevel@tonic-gate */ 630Sstevel@tonic-gate #define NOERROR 0 640Sstevel@tonic-gate #define INVALID_PARMS 1 650Sstevel@tonic-gate #define VALUE_NOT_FOUND 2 660Sstevel@tonic-gate #define CREATE_FAILED 3 670Sstevel@tonic-gate #define SYNTAX_ERROR 4 680Sstevel@tonic-gate 690Sstevel@tonic-gate /* 700Sstevel@tonic-gate * SPLIT way 710Sstevel@tonic-gate */ 720Sstevel@tonic-gate #define LEFT2RIGHT 0 730Sstevel@tonic-gate #define RIGHT2LEFT 1 740Sstevel@tonic-gate /* 750Sstevel@tonic-gate * Data structures 760Sstevel@tonic-gate */ 770Sstevel@tonic-gate 780Sstevel@tonic-gate /* 790Sstevel@tonic-gate * This struct is used to run regex with "reg_expression" 800Sstevel@tonic-gate * and assigned values (braelist) with "token" links 810Sstevel@tonic-gate * Functional schema : 820Sstevel@tonic-gate * step(input,reg_expression) 830Sstevel@tonic-gate * => token[0] = braslist[0]..braelist[0] 840Sstevel@tonic-gate * => token[1] = braslist[1]..braelist[1] 850Sstevel@tonic-gate * => ... 860Sstevel@tonic-gate * => token[i] = braslist[i]..braelist[i] 870Sstevel@tonic-gate */ 880Sstevel@tonic-gate typedef struct _reg_mapp { 890Sstevel@tonic-gate char *reg_expression; /* Compiled regular expression */ 900Sstevel@tonic-gate int Nbra; /* nbra result */ 910Sstevel@tonic-gate int NbToken_Defined; /* Nb tokens defined in reg_expression */ 920Sstevel@tonic-gate int *Token_ID; /* Tokens place (index) in input value */ 930Sstevel@tonic-gate } Reg_Map; 940Sstevel@tonic-gate 950Sstevel@tonic-gate /* 960Sstevel@tonic-gate * Tokens definition, including input attribute and number of expressions 970Sstevel@tonic-gate * and link to each rule. 980Sstevel@tonic-gate */ 990Sstevel@tonic-gate typedef struct _tokens_def { 1000Sstevel@tonic-gate int attr_ID; /* Attributes ID (in SD or FE Table) */ 1010Sstevel@tonic-gate /* Used as input in regular expression */ 1020Sstevel@tonic-gate int NbRules; /* Number of expressions seperated by | */ 1030Sstevel@tonic-gate Reg_Map **TokenRules; /* Array of tokens rules */ 1040Sstevel@tonic-gate } Token_Def; 1050Sstevel@tonic-gate 1060Sstevel@tonic-gate /* 1070Sstevel@tonic-gate * Attribute mapping definition. SD attributes are composed of FE attributes and 1080Sstevel@tonic-gate * SD tokens. 1090Sstevel@tonic-gate */ 1100Sstevel@tonic-gate typedef struct _attr_mapping { 1110Sstevel@tonic-gate char *AttrName; /* Attribute Name */ 1120Sstevel@tonic-gate char *Expr; /* Value expression */ 1130Sstevel@tonic-gate int AttrStatus; /* Store several attr's info such as */ 1140Sstevel@tonic-gate /* Key || Exist || Frozen */ 1150Sstevel@tonic-gate /* Key is used to generate wizard filter */ 1160Sstevel@tonic-gate /* Exist is used to generate wizard filter */ 1170Sstevel@tonic-gate /* Frozen is used control access on attribute */ 1180Sstevel@tonic-gate int NbItem; /* Nb Attributes & Tokens need to build val */ 1190Sstevel@tonic-gate int *AttrID; /* Set of attributes including tokens */ 1200Sstevel@tonic-gate } Attr_Mapping; 1210Sstevel@tonic-gate 1220Sstevel@tonic-gate /* 1230Sstevel@tonic-gate * Builder_map : defined builder expression 1240Sstevel@tonic-gate */ 1250Sstevel@tonic-gate typedef struct _builder_map { 1260Sstevel@tonic-gate char *build_exp; /* the sentence to build */ 1270Sstevel@tonic-gate int NbInput; 1280Sstevel@tonic-gate int *Input_ID; /* List of attr ID to used as input in semtence */ 1290Sstevel@tonic-gate }Builder_map; 1300Sstevel@tonic-gate 1310Sstevel@tonic-gate /* 1320Sstevel@tonic-gate * Data used for split/string2instances/instances2string/exclude functions 1330Sstevel@tonic-gate */ 1340Sstevel@tonic-gate typedef struct _builder_fct { 1350Sstevel@tonic-gate int Input_ID; 1360Sstevel@tonic-gate char *value; /* input data */ 1370Sstevel@tonic-gate char *prefix; /* string2instances and reverse : prefix */ 1380Sstevel@tonic-gate /* exclude : val 2 exclude */ 1390Sstevel@tonic-gate int Parm_ID; /* only for exclude funct : ID of val 2 exclude */ 1400Sstevel@tonic-gate char *suffix; 1410Sstevel@tonic-gate char *separator; 1420Sstevel@tonic-gate int readIndicator; 1430Sstevel@tonic-gate } Builder_fct; 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate /* 1460Sstevel@tonic-gate * Builder tokens : used to build special value (named builder token) from other tokens 1470Sstevel@tonic-gate * or input value. They look like ouput attributes, but they allow to apply rules, if 1480Sstevel@tonic-gate * input value does exist. They also permit to split input sentence into attribute instances 1490Sstevel@tonic-gate */ 1500Sstevel@tonic-gate typedef struct _builder { 1510Sstevel@tonic-gate char *builder_name; 1520Sstevel@tonic-gate int builder_ID; 1530Sstevel@tonic-gate int NbRules; 1540Sstevel@tonic-gate int BuilderType; 1550Sstevel@tonic-gate Builder_map *Mapp; 1560Sstevel@tonic-gate Builder_fct *Fct; 1570Sstevel@tonic-gate } Build_def; 1580Sstevel@tonic-gate 1590Sstevel@tonic-gate 1600Sstevel@tonic-gate /* 1610Sstevel@tonic-gate * Full definition of table mapping. 1620Sstevel@tonic-gate */ 1630Sstevel@tonic-gate typedef struct _table_mapping { 1640Sstevel@tonic-gate int NbTokens; /* Nb extract tokens defined */ 1650Sstevel@tonic-gate int NbAttributes; /* Nb attributes in the entry */ 1660Sstevel@tonic-gate int NbBuilder; /* Nb builder tokens defined */ 1670Sstevel@tonic-gate Token_Def **Tokens_list; /* Array of tokens needed for translation */ 1680Sstevel@tonic-gate Build_def *Build_list; /* Array of builder tokens */ 1690Sstevel@tonic-gate Attr_Mapping **Attr_list; /* Array of Attributes defined in an entry */ 1700Sstevel@tonic-gate } Table_Mapping; 1710Sstevel@tonic-gate 1720Sstevel@tonic-gate typedef struct _custo_info { 1730Sstevel@tonic-gate char *InfoName; 1740Sstevel@tonic-gate int NbValues; 1750Sstevel@tonic-gate char **Values; /* Null terminated array of instance */ 1760Sstevel@tonic-gate } Cust_Info; 1770Sstevel@tonic-gate 1780Sstevel@tonic-gate typedef struct _sds_com { 1790Sstevel@tonic-gate LDAP *lhd; /* LDAP communication handle */ 1800Sstevel@tonic-gate char **fe_object_list; /* Array of ObjectClasses (null term list) */ 1810Sstevel@tonic-gate } SDS_Com; 1820Sstevel@tonic-gate 1830Sstevel@tonic-gate typedef struct _dynrule { 1840Sstevel@tonic-gate char *ResName; /* Result (or Rule) name */ 1850Sstevel@tonic-gate int opType; /* Extrac, Cond, split, str2ins, ins2str, */ 1860Sstevel@tonic-gate /* getrdn, exclude */ 1870Sstevel@tonic-gate int NbExpr; /* Nb rules found use only in extract & cond */ 1880Sstevel@tonic-gate int *NbItems; /* Nb variable in expression, usefull for */ 1890Sstevel@tonic-gate /* extract and cond. IT's a null terminated */ 1900Sstevel@tonic-gate /* array which contains the Number of var in */ 1910Sstevel@tonic-gate char **Expression; /* The sentence (make sense only in cond) */ 1920Sstevel@tonic-gate char **ConstVal; /* use when funct parm are const not used for */ 1930Sstevel@tonic-gate /* extract and cond cases */ 1940Sstevel@tonic-gate char **VarName; /* Var can be 1)DynRule 2)InputData 3)Common */ 1950Sstevel@tonic-gate } DynRule; 1960Sstevel@tonic-gate 1970Sstevel@tonic-gate typedef struct _fe_table { 1980Sstevel@tonic-gate char *fe_section; /* Section table name */ 1990Sstevel@tonic-gate int nb_fe_attr; /* Nb FE attributes defined */ 2000Sstevel@tonic-gate int nb_sds_attr; /* Nb SDS attributes defined */ 2010Sstevel@tonic-gate int nb_fe_tokens; /* Nb tokens defined in FE section */ 2020Sstevel@tonic-gate int nb_sds_tokens; /* Nb tokens defined in SunDS section */ 2030Sstevel@tonic-gate int nb_cust; /* Nb custom attributes in common section */ 2040Sstevel@tonic-gate int nb_fe_build; /* Nb tokens build in FE section */ 2050Sstevel@tonic-gate int nb_sds_build; /* Nb tokens build in SUNDS section */ 2060Sstevel@tonic-gate int nb_dyn_rules; /* Nb dynamic rules in Dynamic section */ 2070Sstevel@tonic-gate char **fe_token_list; /* Array of FE token */ 2080Sstevel@tonic-gate char **sds_token_list; /* List of SunDS token */ 2090Sstevel@tonic-gate char **fe_attr_list; /* Array of attributes (null term list) */ 2100Sstevel@tonic-gate char **sds_attr_list; /* Array of attributes (null term list) */ 2110Sstevel@tonic-gate char **fe_build_list; /* Array of FE build */ 2120Sstevel@tonic-gate char **sds_build_list; /* List of SunDS build */ 2130Sstevel@tonic-gate Table_Mapping *sds_schema; /* SDS attributes definition */ 2140Sstevel@tonic-gate Table_Mapping *fe_schema; /* FE attributes definition */ 2150Sstevel@tonic-gate SDS_Com *comm_items; /* Communication attributes */ 2160Sstevel@tonic-gate Cust_Info **custo_info; /* Customs info */ 2170Sstevel@tonic-gate DynRule *dyn_rules; /* Ordered dynamic rules */ 2180Sstevel@tonic-gate } FE_Table; 2190Sstevel@tonic-gate 2200Sstevel@tonic-gate typedef struct _fe_context { 2210Sstevel@tonic-gate char *fe_name; /* Is it really usefull ?? */ 2220Sstevel@tonic-gate int NbSection; /* Nb section */ 2230Sstevel@tonic-gate int NbGlobals; /* Nb global customs info */ 2240Sstevel@tonic-gate Cust_Info **globals; /* Customs info */ 2250Sstevel@tonic-gate FE_Table **fe_section_list; /* All sub-section in mapping file */ 2260Sstevel@tonic-gate } FE_Context; 2270Sstevel@tonic-gate 2280Sstevel@tonic-gate /* Entries values definition */ 2290Sstevel@tonic-gate /* Instance values definition */ 2300Sstevel@tonic-gate typedef struct _fe_values { 2310Sstevel@tonic-gate int Length; 2320Sstevel@tonic-gate void *Val; 2330Sstevel@tonic-gate } FE_Values; 2340Sstevel@tonic-gate 2350Sstevel@tonic-gate /* Attribute value definition */ 2360Sstevel@tonic-gate typedef struct _fe_attr { 2370Sstevel@tonic-gate char *AttrType; 2380Sstevel@tonic-gate int NbInstance; 2390Sstevel@tonic-gate FE_Values **ValInstances; 2400Sstevel@tonic-gate } FE_Attr; 2410Sstevel@tonic-gate 2420Sstevel@tonic-gate /* Full entry definition */ 2430Sstevel@tonic-gate typedef struct _fe_entry { 2440Sstevel@tonic-gate char *DN; 2450Sstevel@tonic-gate int Nb_items; 2460Sstevel@tonic-gate FE_Attr **AttributesArray; 2470Sstevel@tonic-gate } FE_Entry; 2480Sstevel@tonic-gate 2490Sstevel@tonic-gate typedef struct _fe_couple { 2500Sstevel@tonic-gate char *Value2Subst; 2510Sstevel@tonic-gate char *SubstValue; 2520Sstevel@tonic-gate } FE_Couple; 2530Sstevel@tonic-gate 2540Sstevel@tonic-gate /* 2550Sstevel@tonic-gate * libfe.a exported functions 2560Sstevel@tonic-gate */ 2570Sstevel@tonic-gate 2580Sstevel@tonic-gate /* 2590Sstevel@tonic-gate * Read config file and create "fe_name" context 2600Sstevel@tonic-gate * NB : This init read all tables mapping 2610Sstevel@tonic-gate * libldap context use : before all action 2620Sstevel@tonic-gate */ 2630Sstevel@tonic-gate extern FE_Context *fe_ctx_init(char *config_path, char *fe_name); 2640Sstevel@tonic-gate 2650Sstevel@tonic-gate /* 2660Sstevel@tonic-gate * Free All fe context all tables ... 2670Sstevel@tonic-gate * libldap context usage : ldap_close 2680Sstevel@tonic-gate */ 2690Sstevel@tonic-gate extern int fe_ctx_free(FE_Context **Ctx); 2700Sstevel@tonic-gate 2710Sstevel@tonic-gate /* 2720Sstevel@tonic-gate * Return the pointer to requested item in context 2730Sstevel@tonic-gate * libldap context usage : before all action 2740Sstevel@tonic-gate */ 2750Sstevel@tonic-gate extern void *fe_ctx_get(FE_Context *Ctx, int FieldID, void *Value); 2760Sstevel@tonic-gate 2770Sstevel@tonic-gate /* 2780Sstevel@tonic-gate * Search for information from Subsection/Table ? 2790Sstevel@tonic-gate * You can check also Get/Table/Paragraph 2800Sstevel@tonic-gate * libldap context usage : ldap_* 2810Sstevel@tonic-gate */ 2820Sstevel@tonic-gate extern void *fe_table_get(FE_Table *MapTable, int FieldID, void *Void); 2830Sstevel@tonic-gate 2840Sstevel@tonic-gate /* 2850Sstevel@tonic-gate * Set tables item is mainly used for communication items. other information 2860Sstevel@tonic-gate * sets will be forbid 2870Sstevel@tonic-gate * libldap context usage : after ldap_open or ldap_bind 2880Sstevel@tonic-gate */ 2890Sstevel@tonic-gate /* 2900Sstevel@tonic-gate extern int fe_table_set(FE_Table *MapTable, int FieldID, void *Void); 2910Sstevel@tonic-gate */ 2920Sstevel@tonic-gate /* 2930Sstevel@tonic-gate * You have the attribute name ?! fe_ent_get_attr returns pointer to the requested 2940Sstevel@tonic-gate * attributes with instances, status... from a specific entry 2950Sstevel@tonic-gate * libldap context usage : after ldap_search 2960Sstevel@tonic-gate */ 2970Sstevel@tonic-gate extern FE_Attr *fe_ent_get_attr(FE_Table *MapTable, FE_Entry *fe_item, char *AttrName); 2980Sstevel@tonic-gate 2990Sstevel@tonic-gate /* 3000Sstevel@tonic-gate * Create the entry according to the "schema" defined in mapping file for a specific table 3010Sstevel@tonic-gate * libladp context usage : before ldap_add 3020Sstevel@tonic-gate */ 3030Sstevel@tonic-gate extern FE_Entry *fe_ent_create(FE_Table *MapTable, int TableType); 3040Sstevel@tonic-gate 3050Sstevel@tonic-gate /* 3060Sstevel@tonic-gate * Add new attributes in a new entry 3070Sstevel@tonic-gate * libladp context usage : before ldap_add 3080Sstevel@tonic-gate */ 3090Sstevel@tonic-gate extern FE_Attr *fe_ent_get_attr(FE_Table *MapTable,FE_Entry *Entry, char *AttrName); 3100Sstevel@tonic-gate 3110Sstevel@tonic-gate /* 3120Sstevel@tonic-gate * Add new instance value 3130Sstevel@tonic-gate * libladp context usage : before ldap_add 3140Sstevel@tonic-gate */ 3150Sstevel@tonic-gate extern int fe_ent_add_val(FE_Table *MapTable, FE_Attr *attr, int ValLength, void *Val); 3160Sstevel@tonic-gate extern FE_Attr *fe_ent_add_attr_val(FE_Table *MapTable, FE_Entry *Entry, char *AttrName, int ValLength, void *Val); 3170Sstevel@tonic-gate 3180Sstevel@tonic-gate /* 3190Sstevel@tonic-gate * explode DN into an attributes array 3200Sstevel@tonic-gate * libladp context usage : after ldap_search 3210Sstevel@tonic-gate */ 3220Sstevel@tonic-gate extern FE_Attr **fe_ent_show_dn(FE_Table *MapTable, FE_Entry *Entry); 3230Sstevel@tonic-gate 3240Sstevel@tonic-gate /* 3250Sstevel@tonic-gate * free entry (including attributes) 3260Sstevel@tonic-gate */ 3270Sstevel@tonic-gate extern void fe_ent_free(FE_Entry **Entry); 3280Sstevel@tonic-gate 3290Sstevel@tonic-gate /* 3300Sstevel@tonic-gate * Substitute all vars defined in inputString (with syntax ${varName}) by values found in 3310Sstevel@tonic-gate * fe_couple array. For errors returned check the errors consts upper 3320Sstevel@tonic-gate */ 3330Sstevel@tonic-gate extern int fe_subst(char *inputString, char **outputString, FE_Couple **fe_couple); 3340Sstevel@tonic-gate 3350Sstevel@tonic-gate /* 3360Sstevel@tonic-gate * Split a sentence, add prefix (for each token) and suffix (exept for the last) 3370Sstevel@tonic-gate */ 3380Sstevel@tonic-gate extern char *fe_split(char *inputData, char *Separator, char *Prefix, char *Suffix, int way ); 3390Sstevel@tonic-gate 3400Sstevel@tonic-gate /* 3410Sstevel@tonic-gate * Dynamic translation, use only definition in dynamic section 3420Sstevel@tonic-gate */ 3430Sstevel@tonic-gate extern char **fe_dynamic(FE_Table *MapTable, char *Var2stop, char **DynVal); 3440Sstevel@tonic-gate 3450Sstevel@tonic-gate /* 3460Sstevel@tonic-gate * Return the translated attribute. TableType is the original table of AttrName. 3470Sstevel@tonic-gate * if translation rules is one to one translation, the function return a copy of translated 3480Sstevel@tonic-gate * attribute name. 3490Sstevel@tonic-gate * else the function return a copy of the rules 3500Sstevel@tonic-gate */ 3510Sstevel@tonic-gate extern char **fe_trans_attrName(FE_Table *MapTable, char *AttrName, int TableType); 3520Sstevel@tonic-gate extern int *fe_trans_attrID(FE_Table *MapTable, char *AttrName, int TableType); 3530Sstevel@tonic-gate 3540Sstevel@tonic-gate /* 3550Sstevel@tonic-gate * Return the translated SD entry 3560Sstevel@tonic-gate * libladp context usage : after ldap_search 3570Sstevel@tonic-gate */ 3580Sstevel@tonic-gate extern FE_Entry *fe_trans_all_sds2fe(FE_Table *MapTable, LDAP *ld, LDAPMessage *sd_entry); 3590Sstevel@tonic-gate 3600Sstevel@tonic-gate /* 3610Sstevel@tonic-gate * Return the translated FE entry 3620Sstevel@tonic-gate * libladp context usage : after ldap_search 3630Sstevel@tonic-gate */ 3640Sstevel@tonic-gate extern LDAPMod **fe_trans_all_fe2sds(FE_Table *MapTable, LDAP *ld, FE_Entry *fe_entry); 3650Sstevel@tonic-gate 3660Sstevel@tonic-gate /* 3670Sstevel@tonic-gate * Close to "fe_trans_all_sds2fe" but output is Entry pointer as defined in SunDS server 3680Sstevel@tonic-gate */ 3690Sstevel@tonic-gate extern FE_Entry *fe_trans_all_sunds2fe(FE_Table *MapTable, Entry *sd_entry); 3700Sstevel@tonic-gate extern Entry *fe_trans_all_fe2sunds(FE_Table *MapTable, FE_Entry *fe_entry); 3710Sstevel@tonic-gate 3720Sstevel@tonic-gate /* An example an example .... 3730Sstevel@tonic-gate * Translation from fe to sunds 3740Sstevel@tonic-gate * 3750Sstevel@tonic-gate * FE_Context *MyContext = NULL; 3760Sstevel@tonic-gate * FE_Table *HostTable = NULL; 3770Sstevel@tonic-gate * FE_Entry *fe_entry = NULL; 3780Sstevel@tonic-gate * FE_Attr *fe_attr = NULL; 3790Sstevel@tonic-gate * Entry *lentry = NULL; 3800Sstevel@tonic-gate * 3810Sstevel@tonic-gate * if((MyContext = fe_ctx_init("..../sunds_map.conf","NIS")) == NULL){ 3820Sstevel@tonic-gate * ldaplog(LDAP_DEBUG_CONFIG,"Can't load mapping file\n", 0, 0, 0); 3830Sstevel@tonic-gate * exit(1); 3840Sstevel@tonic-gate * } 3850Sstevel@tonic-gate * if((HostTable = fe_ctx_get(MyContext,CTX_TABLEPTR,"dummy")) == NULL) 3860Sstevel@tonic-gate * { 3870Sstevel@tonic-gate * ldaplog(LDAP_DEBUG_CONFIG,"Can't retreive HOSTS table\n", 0, 0, 0); 3880Sstevel@tonic-gate * exit(1); 3890Sstevel@tonic-gate * } 3900Sstevel@tonic-gate * if((fe_entry = fe_ent_create(HostTable, FETABLE))==NULL) 3910Sstevel@tonic-gate * { 3920Sstevel@tonic-gate * ldaplog(LDAP_DEBUG_CONFIG,"Can't create entry\n", 0, 0, 0); 3930Sstevel@tonic-gate * exit(1); 3940Sstevel@tonic-gate * } 3950Sstevel@tonic-gate * if ((fe_attr = fe_ent_add_attr_val(HostTable, fe_entry, "niskey", 16, "109.107.179.131")) == NULL) 3960Sstevel@tonic-gate * { 3970Sstevel@tonic-gate * ldaplog(LDAP_DEBUG_CONFIG,"Can't add attr=%s, val=%s\n", "niskey", "109.107.179.131", 0); 3980Sstevel@tonic-gate * exit(1); 3990Sstevel@tonic-gate * } 4000Sstevel@tonic-gate * if((fe_attr = fe_ent_add_attr_val(HostTable, 4010Sstevel@tonic-gate * fe_entry, 4020Sstevel@tonic-gate * "NISVALUE", 4030Sstevel@tonic-gate * strlen("olivaw OLIVAW oLiVaW # regis Host") +1, 4040Sstevel@tonic-gate * "olivaw OLIVAW oLiVaW # regis Host")) == NULL) 4050Sstevel@tonic-gate * { 4060Sstevel@tonic-gate * ldaplog(...); 4070Sstevel@tonic-gate * exit(1); 4080Sstevel@tonic-gate * } 4090Sstevel@tonic-gate * if((lentry = fe_trans_all_fe2sunds(HostTable, fe_entry)) ==NULL) 4100Sstevel@tonic-gate * { 4110Sstevel@tonic-gate * ldaplog(LDAP_DEBUG_CONFIG,".... \n", 0); 4120Sstevel@tonic-gate * } 4130Sstevel@tonic-gate * 4140Sstevel@tonic-gate */ 4150Sstevel@tonic-gate 4160Sstevel@tonic-gate #endif /* _FE_H */ 4170Sstevel@tonic-gate 4180Sstevel@tonic-gate 4190Sstevel@tonic-gate 4200Sstevel@tonic-gate 421