Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief Enduro/X client & server environment configuration structures
0003  *
0004  * @file exenv.h
0005  */
0006 /* -----------------------------------------------------------------------------
0007  * Enduro/X Middleware Platform for Distributed Transaction Processing
0008  * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0009  * Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0010  * This software is released under one of the following licenses:
0011  * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0012  * See LICENSE file for full text.
0013  * -----------------------------------------------------------------------------
0014  * AGPL license:
0015  *
0016  * This program is free software; you can redistribute it and/or modify it under
0017  * the terms of the GNU Affero General Public License, version 3 as published
0018  * by the Free Software Foundation;
0019  *
0020  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
0021  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0022  * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0023  * for more details.
0024  *
0025  * You should have received a copy of the GNU Affero General Public License along 
0026  * with this program; if not, write to the Free Software Foundation, Inc.,
0027  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0028  *
0029  * -----------------------------------------------------------------------------
0030  * A commercial use license is available from Mavimax, Ltd
0031  * contact@mavimax.com
0032  * -----------------------------------------------------------------------------
0033  */
0034 #ifndef EXENV_H_
0035 #define EXENV_H_
0036 
0037 /*------------------------------Includes--------------------------------------*/
0038 #include <ndrstandard.h>
0039 #include <atmi.h>
0040 #include <exhash.h>
0041 /*------------------------------Externs---------------------------------------*/
0042 /*------------------------------Macros----------------------------------------*/
0043 
0044 /** unset field action */
0045 #define NDRX_ENV_ACTION_UNSET              0x0001
0046 /*------------------------------Enums-----------------------------------------*/
0047 /*------------------------------Typedefs--------------------------------------*/
0048 /* So we need following data structures:
0049  * 1. Linked list for storing key/values of the any group or process
0050  * 2. Hash list for storing group lists of envs
0051  * 3. Linked list for process storing key/values (could be structure 1.)
0052  * 4. Linked list for storing resolve links to 2. hashes for processing groups
0053  * firstly
0054  */
0055 
0056 /**
0057  * Linked list of env variable values
0058  */
0059 typedef struct ndrx_env_list ndrx_env_list_t;
0060 struct ndrx_env_list
0061 {
0062     /** env variable (allocated) */
0063     char *key;
0064     
0065     /** env value (allocated) */
0066     char *value;
0067     
0068     /** flags for the field */
0069     unsigned short flags;
0070     
0071     /** make it a linked list... */
0072     ndrx_env_list_t *next, *prev;
0073 };
0074 
0075 /**
0076  * Group hash of environment variables
0077  */
0078 typedef struct ndrx_env_group ndrx_env_group_t;
0079 struct ndrx_env_group
0080 {
0081     /** name of the group */
0082     char group[MAXTIDENT+1];
0083     /** List of environment variable groups */
0084     ndrx_env_list_t *envs;
0085     
0086     /** makes this structure hashable */
0087     EX_hash_handle hh;
0088 };
0089 
0090 /**
0091  * List of environment groups
0092  */
0093 typedef struct ndrx_env_grouplist ndrx_env_grouplist_t;
0094 struct ndrx_env_grouplist
0095 {
0096     /** pointer to group */
0097     ndrx_env_group_t *group;
0098     /** linked list */
0099     ndrx_env_grouplist_t *next, *prev;
0100 };
0101 
0102 /* Following API functions are needed:
0103  * 
0104  * 1) parse envs: IN: xmlDocPtr doc, xmlNodePtr cur, OUT: allocated: ndrx_env_list_t
0105  * Usable for both group level parsing and process level parsing.
0106  * 
0107  * 2) parse group  IN: xmlDocPtr doc, xmlNodePtr cur, OUT: allocated: ndrx_env_group_t
0108  * (i.e. added record to hash)
0109  * 
0110  * 3) update 1) to parse <usegroup>. In case if ndrx_env_grouplist_t parameter
0111  * is present, the load the resolved tags into this linked list. If parameter
0112  * is not present and usegroup is found, then merge the group into current
0113  * env list.
0114  */
0115 
0116 /*------------------------------Globals---------------------------------------*/
0117 /*------------------------------Statics---------------------------------------*/
0118 /*------------------------------Prototypes------------------------------------*/
0119 
0120 #endif /* EXENV_H_ */
0121 
0122 /* vim: set ts=4 sw=4 et smartindent: */