![]() |
|
|||
0001 /** 0002 * @brief Reload Q config 0003 * 0004 * @file cmd_mqrc.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 <stdlib.h> 0037 #include <memory.h> 0038 #include <sys/param.h> 0039 0040 #include <ndrstandard.h> 0041 #include <ndebug.h> 0042 #include <nstdutil.h> 0043 0044 #include <ndrxdcmn.h> 0045 #include <atmi_int.h> 0046 #include <gencall.h> 0047 #include <utlist.h> 0048 #include <Exfields.h> 0049 0050 #include "xa_cmn.h" 0051 #include <ndrx.h> 0052 #include <qcommon.h> 0053 /*---------------------------Externs------------------------------------*/ 0054 /*---------------------------Macros-------------------------------------*/ 0055 /*---------------------------Enums--------------------------------------*/ 0056 /*---------------------------Typedefs-----------------------------------*/ 0057 /*---------------------------Globals------------------------------------*/ 0058 /*---------------------------Statics------------------------------------*/ 0059 /*---------------------------Prototypes---------------------------------*/ 0060 0061 0062 /** 0063 * Reload Q config 0064 * @param p_cmd_map 0065 * @param argc 0066 * @param argv 0067 * @return SUCCEED 0068 */ 0069 expublic int cmd_mqrc(cmd_mapping_t *p_cmd_map, int argc, char **argv, int *p_have_next) 0070 { 0071 int ret = EXSUCCEED; 0072 atmi_svc_list_t *el, *tmp, *list; 0073 UBFH *p_ub = NULL; 0074 char cmd = TMQ_CMD_MQRC; 0075 long rsplen; 0076 0077 /* we need to init TP subsystem... */ 0078 if (EXSUCCEED!=tpinit(NULL)) 0079 { 0080 fprintf(stderr, "Failed to tpinit(): %s\n", tpstrerror(tperrno)); 0081 EXFAIL_OUT(ret); 0082 } 0083 0084 list = ndrx_get_svc_list(mqfilter); 0085 0086 LL_FOREACH_SAFE(list,el,tmp) 0087 { 0088 UBFH *p_ub = (UBFH *)tpalloc("UBF", "", 1024); 0089 0090 if (NULL==p_ub) 0091 { 0092 fprintf(stderr, "Failed to alloc call buffer%s\n", tpstrerror(tperrno)); 0093 EXFAIL_OUT(ret); 0094 } 0095 0096 if (EXSUCCEED!=Bchg(p_ub, EX_QCMD, 0, &cmd, 0L)) 0097 { 0098 fprintf(stderr, "Failed to set command: %s\n", Bstrerror(Berror)); 0099 EXFAIL_OUT(ret); 0100 } 0101 0102 printf("Updating %s ... ", list->svcnm); 0103 0104 if (EXSUCCEED!=tpcall(list->svcnm, (char *)p_ub, 0L, 0105 (char **)&p_ub, &rsplen, TPNOTRAN)) 0106 { 0107 printf("Failed: %s\n", tpstrerror(tperrno)); 0108 } 0109 else 0110 { 0111 printf("Succeed\n"); 0112 } 0113 0114 /* Have some housekeep. */ 0115 LL_DELETE(list,el); 0116 NDRX_FREE(el); 0117 0118 NDRX_FREE((char *)p_ub); 0119 p_ub = NULL; 0120 } 0121 0122 printf("Done\n"); 0123 0124 out: 0125 0126 if (NULL!=p_ub) 0127 { 0128 NDRX_FREE((char *)p_ub); 0129 p_ub = NULL; 0130 } 0131 0132 return ret; 0133 } 0134 /* vim: set ts=4 sw=4 et smartindent: */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |