![]() |
|
|||
0001 /** 0002 * @brief Return list of bridge admin queues 0003 * 0004 * @file cmd_blist.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 <exhash.h> 0039 #include <errno.h> 0040 #include <ndrstandard.h> 0041 0042 #include <ndebug.h> 0043 #include <userlog.h> 0044 #include <ndrxd.h> 0045 #include <ndrxdcmn.h> 0046 #include <atmi_shm.h> 0047 0048 #include "cmd_processor.h" 0049 #include <bridge_int.h> 0050 #include <utlist.h> 0051 /*---------------------------Externs------------------------------------*/ 0052 /*---------------------------Macros-------------------------------------*/ 0053 /*---------------------------Enums--------------------------------------*/ 0054 /*---------------------------Typedefs-----------------------------------*/ 0055 /*---------------------------Globals------------------------------------*/ 0056 /*---------------------------Statics------------------------------------*/ 0057 /*---------------------------Prototypes---------------------------------*/ 0058 0059 /** 0060 * Modify reply according the data. 0061 * @param call 0062 * @param pm 0063 */ 0064 expublic void blist_reply_mod(command_reply_t *reply, size_t *send_size, mod_param_t *params) 0065 { 0066 command_reply_blist_t * blist_info = (command_reply_blist_t *)reply; 0067 0068 reply->msg_type = NDRXD_CALL_TYPE_BLIST; 0069 /* calculate new send size */ 0070 *send_size += (sizeof(command_reply_blist_t) - sizeof(command_reply_t)); 0071 0072 /* Copy data to reply structure */ 0073 NDRX_STRCPY_SAFE(blist_info->qstr, (char *)params->mod_param1); 0074 0075 NDRX_LOG(log_debug, "magic: %ld", blist_info->rply.magic); 0076 } 0077 0078 /** 0079 * Callback to report startup progress 0080 * @param call 0081 * @param qstr - queue to send away 0082 * @return 0083 */ 0084 exprivate int blist_progress(command_call_t * call, char *qstr) 0085 { 0086 int ret=EXSUCCEED; 0087 mod_param_t params; 0088 0089 NDRX_LOG(log_debug, "blist_progress enter"); 0090 memset(¶ms, 0, sizeof(mod_param_t)); 0091 0092 /* pass to reply process model node */ 0093 params.mod_param1 = (void *)qstr; 0094 0095 if (EXSUCCEED!=simple_command_reply(call, ret, NDRXD_CALL_FLAGS_RSPHAVE_MORE, 0096 /* hook up the reply */ 0097 ¶ms, blist_reply_mod, 0L, 0, NULL)) 0098 { 0099 userlog("Failed to send progress back to [%s]", call->reply_queue); 0100 EXFAIL_OUT(ret); 0101 } 0102 0103 out: 0104 NDRX_LOG(log_debug, "blist_progress exit %d", ret); 0105 return ret; 0106 } 0107 0108 /** 0109 * Call of the blist command 0110 * @param args 0111 * @return 0112 */ 0113 expublic int cmd_blist (command_call_t * call, char *data, size_t len, int context) 0114 { 0115 int ret=EXSUCCEED; 0116 pm_node_t *p_pm; 0117 0118 DL_FOREACH(G_process_model, p_pm) 0119 { 0120 /* only connected bridges being listed */ 0121 if ( (p_pm->flags & SRV_KEY_FLAGS_BRIDGE) 0122 && (p_pm->flags & SRV_KEY_FLAGS_CONNECTED)) 0123 { 0124 if (EXSUCCEED!=blist_progress(call, get_srv_admin_q(p_pm))) 0125 { 0126 EXFAIL_OUT(ret); 0127 } 0128 } 0129 } 0130 0131 out: 0132 if (EXSUCCEED!=simple_command_reply(call, ret, 0L, NULL, NULL, 0L, 0, NULL)) 0133 { 0134 userlog("Failed to send reply back to [%s]", call->reply_queue); 0135 } 0136 0137 NDRX_LOG(log_warn, "cmd_blist returns with status %d", ret); 0138 0139 return ret; 0140 } 0141 0142 /* 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 |
![]() ![]() |