Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief Dispatch the "tpbroadcast" events on remote machines...
0003  *   All the handling actually is done in libatmi and libatmisrv...
0004  *
0005  * @file brdcstsv.c
0006  */
0007 /* -----------------------------------------------------------------------------
0008  * Enduro/X Middleware Platform for Distributed Transaction Processing
0009  * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0010  * Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0011  * This software is released under one of the following licenses:
0012  * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0013  * See LICENSE file for full text.
0014  * -----------------------------------------------------------------------------
0015  * AGPL license:
0016  *
0017  * This program is free software; you can redistribute it and/or modify it under
0018  * the terms of the GNU Affero General Public License, version 3 as published
0019  * by the Free Software Foundation;
0020  *
0021  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
0022  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0023  * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0024  * for more details.
0025  *
0026  * You should have received a copy of the GNU Affero General Public License along 
0027  * with this program; if not, write to the Free Software Foundation, Inc.,
0028  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0029  *
0030  * -----------------------------------------------------------------------------
0031  * A commercial use license is available from Mavimax, Ltd
0032  * contact@mavimax.com
0033  * -----------------------------------------------------------------------------
0034  */
0035 #include <stdio.h>
0036 #include <stdlib.h>
0037 #include <string.h>
0038 #include <errno.h>
0039 #include <regex.h>
0040 #include <utlist.h>
0041 #include <unistd.h>
0042 #include <signal.h>
0043 #include <sys/wait.h>
0044 
0045 #include <ndebug.h>
0046 #include <atmi.h>
0047 #include <atmi_int.h>
0048 #include <typed_buf.h>
0049 #include <ndrstandard.h>
0050 #include <ubf.h>
0051 #include <Exfields.h>
0052 
0053 #include "brdcstsv.h"
0054 /*---------------------------Externs------------------------------------*/
0055 /*---------------------------Macros-------------------------------------*/
0056 /*---------------------------Enums--------------------------------------*/
0057 /*---------------------------Typedefs-----------------------------------*/
0058 /*---------------------------Globals------------------------------------*/
0059 /*---------------------------Statics------------------------------------*/
0060 static long M_restarts = 0;
0061 static long M_check = 5; /* defaulted to 5 sec */
0062 /*---------------------------Prototypes---------------------------------*/
0063 int start_daemon_recover(void);
0064 
0065 /**
0066  * Nothing to do here..
0067  * 
0068  * @param p_svc
0069  */
0070 void TPBROADCAST (TPSVCINFO *p_svc)
0071 {
0072     int ret=EXSUCCEED;
0073     
0074 out:
0075     tpreturn(  ret==EXSUCCEED?TPSUCCESS:TPFAIL,
0076                 0,
0077                 (char *)p_svc->data,
0078                 0L,
0079                 0L);
0080 }
0081 
0082 /*
0083  * Do initialization
0084  */
0085 int NDRX_INTEGRA(tpsvrinit)(int argc, char **argv)
0086 {
0087     int ret=EXSUCCEED;
0088     char svcnm[MAXTIDENT+1];
0089     
0090     snprintf(svcnm, sizeof(svcnm), NDRX_SVC_TPBROAD, tpgetnodeid());
0091 
0092     if (EXSUCCEED!=tpadvertise(svcnm, TPBROADCAST))
0093     {
0094         NDRX_LOG(log_error, "Failed to initialize [%s]!", svcnm);
0095         EXFAIL_OUT(ret);
0096     }
0097 
0098 out:
0099     return ret;
0100 }
0101 
0102 void NDRX_INTEGRA(tpsvrdone)(void)
0103 {
0104     /* just for build... */
0105 }
0106 /* vim: set ts=4 sw=4 et smartindent: */