Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief Enduro/X client & server environment configuration structures
0003  *
0004  * @file ndrxconf.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 NDRXCONF_H_
0035 #define NDRXCONF_H_
0036 
0037 /*------------------------------Includes--------------------------------------*/
0038 #include <libxml/xmlreader.h>
0039 
0040 #include <ndrstandard.h>
0041 #include <atmi.h>
0042 #include <exhash.h>
0043 #include <exenv.h>
0044 #include <exhash.h>
0045 #include <nerror.h>
0046 /*------------------------------Externs---------------------------------------*/
0047 /*------------------------------Macros----------------------------------------*/
0048 /*------------------------------Enums-----------------------------------------*/
0049 /*------------------------------Typedefs--------------------------------------*/
0050 
0051 /**
0052  * Process group entry
0053  */
0054 typedef struct
0055 {
0056     char grpname[MAXTIDENT+1]; /**< group name                                */
0057     int grpno;                /**< group number, 1..ndrx_G_libnstd_cfg.sgmax  */
0058     long flags;                 /**< group flags                                */
0059     char sg_nodes[CONF_NDRX_NODEID_COUNT];  /**< Group nodes (full list us + them) */
0060 
0061     EX_hash_handle hh;         /**< makes this structure hashable               */
0062 } ndrx_procgroup_t;
0063 
0064 /**
0065  * Process group handler
0066  */
0067 typedef struct
0068 {
0069     /* hashmap handler for groups->id */
0070     ndrx_procgroup_t *groups_by_name;
0071     /* hashmap of ids. Structure size depends on the number of SG groups
0072      * defined
0073      */
0074     ndrx_procgroup_t groups_by_no[0];
0075 } ndrx_procgroups_t;
0076 
0077 
0078 /**
0079  * Error structure used by the ndrxconf libary 
0080  */
0081 typedef struct
0082 {
0083     char error_msg[MAX_ERROR_LEN+1];
0084     int error_code;
0085 } ndrx_ndrxconf_err_t;
0086 
0087 /*------------------------------Globals---------------------------------------*/
0088 /*------------------------------Statics---------------------------------------*/
0089 /*------------------------------Prototypes------------------------------------*/
0090 
0091 /* groups api: */
0092 
0093 /* envs api: */
0094 extern int ndrx_ndrxconf_envs_group_parse(xmlDocPtr doc, xmlNodePtr cur, 
0095          ndrx_env_group_t **grouphash);
0096 
0097 extern int ndrx_ndrxconf_envs_parse(xmlDocPtr doc, xmlNodePtr cur, 
0098         ndrx_env_list_t **envs, ndrx_env_group_t *grouphash, 
0099         ndrx_env_grouplist_t **grouplist);
0100 
0101 extern void ndrx_ndrxconf_envs_groups_free(ndrx_env_group_t **grouphash);
0102 extern void ndrx_ndrxconf_envs_grouplists_free(ndrx_env_grouplist_t **grouplist);
0103 extern void ndrx_ndrxconf_envs_envs_free(ndrx_env_list_t **envs);
0104 
0105 extern int ndrx_ndrxconf_envs_applyall(ndrx_env_grouplist_t *grouplist, 
0106         ndrx_env_list_t *envs);
0107 extern int ndrx_ndrxconf_envs_apply(ndrx_env_list_t *envs);
0108 
0109 extern int ndrx_ndrxconf_envs_append(ndrx_env_list_t **dest, ndrx_env_list_t *source);
0110 
0111 /* Process groups: */
0112 extern void ndrx_ndrxconf_procgroups_apply_singlegrp(ndrx_procgroups_t *handle);
0113 extern ndrx_procgroup_t* ndrx_ndrxconf_procgroups_resolveno(ndrx_procgroups_t *handle, int procgrpno);
0114 extern ndrx_procgroup_t* ndrx_ndrxconf_procgroups_resolvenm(ndrx_procgroups_t *handle, char *name);
0115 extern int ndrx_ndrxconf_procgroups_is_singleton(ndrx_procgroups_t *handle, int procgrp_no);
0116 extern void ndrx_ndrxconf_procgroups_free(ndrx_procgroups_t *handle);
0117 extern int ndrx_ndrxconf_procgroups_parse(ndrx_procgroups_t **config, 
0118     xmlDocPtr doc, xmlNodePtr cur, 
0119     char *config_file_short, ndrx_ndrxconf_err_t *err);
0120 
0121 
0122 #endif /* NDRXCONF_H_ */
0123 
0124 /* vim: set ts=4 sw=4 et smartindent: */