![]() |
|
|||
0001 /** 0002 * @brief Q util 0003 * 0004 * @file tmqutil.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 <stdio.h> 0035 #include <stdlib.h> 0036 #include <string.h> 0037 #include <errno.h> 0038 #include <regex.h> 0039 #include <utlist.h> 0040 0041 #include <ndebug.h> 0042 #include <atmi.h> 0043 #include <atmi_int.h> 0044 #include <typed_buf.h> 0045 #include <ndrstandard.h> 0046 #include <ubf.h> 0047 #include <Exfields.h> 0048 0049 #include <exnet.h> 0050 #include <ndrxdcmn.h> 0051 #include <qcommon.h> 0052 0053 #include "tmqd.h" 0054 #include "../libatmisrv/srv_int.h" 0055 #include <xa_cmn.h> 0056 #include <atmi_int.h> 0057 #include <exbase64.h> 0058 #include <nstdutil.h> 0059 /*---------------------------Externs------------------------------------*/ 0060 /*---------------------------Macros-------------------------------------*/ 0061 /*---------------------------Enums--------------------------------------*/ 0062 /*---------------------------Typedefs-----------------------------------*/ 0063 /*---------------------------Globals------------------------------------*/ 0064 /*---------------------------Statics------------------------------------*/ 0065 /*---------------------------Prototypes---------------------------------*/ 0066 0067 /** 0068 * Extract info from msgid. 0069 * 0070 * @param msgid_in 0071 * @param p_nodeid 0072 * @param p_srvid 0073 */ 0074 expublic void tmq_msgid_get_info(char *msgid, short *p_nodeid, short *p_srvid) 0075 { 0076 *p_nodeid = 0; 0077 *p_srvid = 0; 0078 0079 memcpy((char *)p_nodeid, msgid+sizeof(exuuid_t), sizeof(short)); 0080 memcpy((char *)p_srvid, msgid+sizeof(exuuid_t)+sizeof(short), sizeof(short)); 0081 0082 NDRX_LOG(log_info, "Extracted nodeid=%hd srvid=%hd", 0083 *p_nodeid, *p_srvid); 0084 } 0085 0086 /** 0087 * Generate serialized version of the string 0088 * @param msgid_in, length defined by constant TMMSGIDLEN 0089 * @param msgidstr_out 0090 * @return msgidstr_out 0091 */ 0092 expublic char * tmq_corrid_serialize(char *corrid_in, char *corrid_str_out) 0093 { 0094 size_t out_len = 0; 0095 0096 NDRX_DUMP(log_debug, "Original CORRID", corrid_in, TMCORRIDLEN); 0097 0098 ndrx_xa_base64_encode((unsigned char *)corrid_in, TMCORRIDLEN, &out_len, 0099 corrid_str_out); 0100 0101 /* corrid_str_out[out_len] = EXEOS; */ 0102 0103 NDRX_LOG(log_debug, "CORRID after serialize: [%s]", corrid_str_out); 0104 0105 return corrid_str_out; 0106 } 0107 0108 /* 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 |
![]() ![]() |