1 /* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
22
23 #include <signaldata/AllocNodeId.hpp>
24 #include <RefConvert.hpp>
25
26 bool
printALLOC_NODEID_REQ(FILE * output,const Uint32 * theData,Uint32 len,Uint16 recBlockNo)27 printALLOC_NODEID_REQ(FILE * output,
28 const Uint32 * theData,
29 Uint32 len,
30 Uint16 recBlockNo)
31 {
32 AllocNodeIdReq * sig = (AllocNodeIdReq *)&theData[0];
33
34 switch (len)
35 {
36 case AllocNodeIdReq::SignalLength:
37 fprintf(output,
38 " senderRef: (node: %d, block: %d)\n"
39 " senderData: %u\n"
40 " nodeId: %u\n"
41 " nodeType: %u\n"
42 " timeout: %u\n",
43 refToNode(sig->senderRef), refToBlock(sig->senderRef),
44 sig->senderData,
45 sig->nodeId,
46 sig->nodeType,
47 sig->timeout);
48 return true;
49 case AllocNodeIdReq::SignalLengthQMGR:
50 fprintf(output,
51 " senderRef: (node: %d, block: %d)\n"
52 " senderData: %u\n"
53 " nodeId: %u\n"
54 " nodeType: %u\n"
55 " timeout: %u\n"
56 " secret: %08x %08x\n",
57 refToNode(sig->senderRef), refToBlock(sig->senderRef),
58 sig->senderData,
59 sig->nodeId,
60 sig->nodeType,
61 sig->timeout,
62 sig->secret_hi, sig->secret_lo);
63 return true;
64 }
65 return false;
66 }
67
68 bool
printALLOC_NODEID_CONF(FILE * output,const Uint32 * theData,Uint32 len,Uint16 recBlockNo)69 printALLOC_NODEID_CONF(FILE * output,
70 const Uint32 * theData,
71 Uint32 len,
72 Uint16 recBlockNo)
73 {
74 AllocNodeIdConf * sig = (AllocNodeIdConf *)&theData[0];
75
76 if (len == AllocNodeIdConf::SignalLength)
77 {
78 fprintf(output,
79 " senderRef: (node: %d, block: %d)\n"
80 " senderData: %u\n"
81 " nodeId: %u\n"
82 " secret: %08x %08x\n",
83 refToNode(sig->senderRef), refToBlock(sig->senderRef),
84 sig->senderData,
85 sig->nodeId,
86 sig->secret_hi, sig->secret_lo);
87 return true;
88 }
89 return false;
90 }
91
92 static
93 const char *
get_text_AllocNodeIdRef_ErrorCodes(Uint32 errorCode)94 get_text_AllocNodeIdRef_ErrorCodes(Uint32 errorCode)
95 {
96 switch (errorCode)
97 {
98 case AllocNodeIdRef::NoError: return "NoError";
99 case AllocNodeIdRef::Undefined: return "Undefined";
100 case AllocNodeIdRef::NF_FakeErrorREF: return "NF_FakeErrorREF";
101 case AllocNodeIdRef::Busy: return "Busy";
102 case AllocNodeIdRef::NotMaster: return "NotMaster";
103 case AllocNodeIdRef::NodeReserved: return "NodeReserved";
104 case AllocNodeIdRef::NodeConnected: return "NodeConnected";
105 case AllocNodeIdRef::NodeFailureHandlingNotCompleted: return "NodeFailureHandlingNotCompleted";
106 case AllocNodeIdRef::NodeTypeMismatch: return "NodeTypeMismatch";
107 default: return "<Unknown error code>";
108 }
109 }
110
111 bool
printALLOC_NODEID_REF(FILE * output,const Uint32 * theData,Uint32 len,Uint16 recBlockNo)112 printALLOC_NODEID_REF(FILE * output,
113 const Uint32 * theData,
114 Uint32 len,
115 Uint16 recBlockNo)
116 {
117 AllocNodeIdRef * sig = (AllocNodeIdRef *)&theData[0];
118
119 if (len == AllocNodeIdRef::SignalLength)
120 {
121 fprintf(output,
122 " senderRef: (node: %d, block: %d)\n"
123 " senderData: %u\n"
124 " nodeId: %u\n"
125 " errorCode: %u %s\n"
126 " masterRef: (node: %d, block: %d)\n",
127 refToNode(sig->senderRef), refToBlock(sig->senderRef),
128 sig->senderData,
129 sig->nodeId,
130 sig->errorCode, get_text_AllocNodeIdRef_ErrorCodes(sig->errorCode),
131 refToNode(sig->masterRef), refToBlock(sig->masterRef));
132 return true;
133 }
134 return false;
135 }
136