Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief ATMI Server Integration Level Object API code (auto-generated)
0003  *
0004  * @file oatmisrv_integra.c
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 #include <string.h>
0035 #include <stdio.h>
0036 #include <stdint.h>
0037 #include <stdlib.h>
0038 #include <memory.h>
0039 #include <errno.h>
0040 #include <dlfcn.h>
0041 
0042 #include <atmi.h>
0043 #include <atmi_tls.h>
0044 #include <ndrstandard.h>
0045 #include <ndebug.h>
0046 #include <ndrxdcmn.h>
0047 #include <userlog.h>
0048 #include <xa_cmn.h>
0049 /*---------------------------Externs------------------------------------*/
0050 /*---------------------------Macros-------------------------------------*/
0051 /*---------------------------Enums--------------------------------------*/
0052 /*---------------------------Typedefs-----------------------------------*/
0053 /*---------------------------Globals------------------------------------*/
0054 /*---------------------------Statics------------------------------------*/
0055 /*---------------------------Prototypes---------------------------------*/
0056 
0057 /**
0058  * Object-API wrapper for ndrx_main_integra() - Auto generated.
0059  */
0060 expublic int Ondrx_main_integra(TPCONTEXT_T *p_ctxt, int argc, char** argv, int (*in_tpsvrinit)(int, char **),void (*in_tpsvrdone)(void), long flags) 
0061 {
0062     int ret = EXSUCCEED;
0063     int did_set = EXFALSE;
0064 
0065 
0066 #ifdef NDRX_OAPI_DEBUG
0067     NDRX_LOG(log_debug, "ENTRY: ndrx_main_integra() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0068     NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d", 
0069         ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0070 
0071     NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d", 
0072         (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0073 
0074     NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d", 
0075         (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0076 
0077     NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d", 
0078         (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0079 
0080     NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d", 
0081         (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0082 
0083     NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d", 
0084         (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0085 
0086     NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d", 
0087         (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0088 #endif
0089 
0090  
0091 
0092     /* set the context */
0093     if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0094     {
0095         if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0, 
0096             CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0097         {
0098             userlog("ERROR! ndrx_main_integra() failed to set context");
0099             EXFAIL_OUT(ret);
0100         }
0101         did_set = EXTRUE;
0102     }
0103     else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0104     {
0105         userlog("WARNING! ndrx_main_integra() context %p thinks that it is assocated "
0106                 "with current thread, but thread is associated with %p context!",
0107                 p_ctxt, G_atmi_tls);
0108     }
0109     
0110     ret = ndrx_main_integra(argc, argv, in_tpsvrinit, in_tpsvrdone, flags);
0111 
0112     if (did_set)
0113     {
0114         if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0, 
0115             CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0116         {
0117             userlog("ERROR! ndrx_main_integra() failed to get context");
0118             EXFAIL_OUT(ret);
0119         }
0120     }
0121 out:
0122 
0123 #ifdef NDRX_OAPI_DEBUG
0124     NDRX_LOG(log_debug, "RETURN: ndrx_main_integra() returns, context: %p, current: %p",
0125         *p_ctxt, G_atmi_tls);
0126 #endif
0127 
0128  
0129     return ret; 
0130 }
0131 
0132