1 /*
2    Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
3 
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License, version 2.0,
6    as published by the Free Software Foundation.
7 
8    This program is also distributed with certain software (including
9    but not limited to OpenSSL) that is licensed under separate terms,
10    as designated in a particular file or component or in included license
11    documentation.  The authors of MySQL hereby grant you an additional
12    permission to link the program and your derivative works with the
13    separately licensed software that they have included with MySQL.
14 
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License, version 2.0, for more details.
19 
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
23 */
24 
25 #ifndef SIGNAL_DATA_H
26 #define SIGNAL_DATA_H
27 
28 #include <ndb_global.h>
29 #include <kernel/ndb_limits.h>
30 #include <kernel/kernel_types.h>
31 
32 #define ASSERT_BOOL(flag, message) assert(flag<=1)
33 #define ASSERT_RANGE(value, min, max, message) \
34  assert((value) >= (min) && (value) <= (max))
35 #define ASSERT_MAX(value, max, message) assert((value) <= (max))
36 
37 #define SECTION(x) STATIC_CONST(x)
38 
39 template <typename T>
40 inline
41 T*
cast_ptr(Uint32 * ptr)42 cast_ptr(Uint32 * ptr)
43 {
44   NDB_ASSERT_POD(T);
45   return new (ptr) T;
46 }
47 
48 template <typename T>
49 inline
50 const T*
cast_constptr(const Uint32 * ptr)51 cast_constptr(const Uint32 * ptr)
52 {
53   NDB_ASSERT_POD(T);
54   return const_cast<const T*>(new (const_cast<Uint32*>(ptr)) T);
55 }
56 
57 #define CAST_PTR(Y,X) cast_ptr<Y>(X)
58 #define CAST_CONSTPTR(Y,X) cast_constptr<Y>(X)
59 
60 // defines for setter and getters on commonly used member data in signals
61 
62 #define GET_SET_SENDERDATA \
63   Uint32 getSenderData() { return senderData; }; \
64   void setSenderData(Uint32 _s) { senderData = _s; };
65 
66 #define GET_SET_SENDERREF \
67   Uint32 getSenderRef() { return senderRef; }; \
68   void setSenderRef(Uint32 _s) { senderRef = _s; };
69 
70 #define GET_SET_PREPAREID \
71   Uint32 getPrepareId() { return prepareId; }; \
72   void setPrepareId(Uint32 _s) { prepareId = _s; };
73 
74 #define GET_SET_ERRORCODE \
75   Uint32 getErrorCode() { return errorCode; }; \
76   void setErrorCode(Uint32 _s) { errorCode = _s; };
77 
78 #define GET_SET_TCERRORCODE \
79   Uint32 getTCErrorCode() { return TCErrorCode; }; \
80   void setTCErrorCode(Uint32 _s) { TCErrorCode = _s; };
81 
82 #define GSN_PRINT_SIGNATURE(f) bool f(FILE *, const Uint32 *, Uint32, Uint16)
83 
84 GSN_PRINT_SIGNATURE(printTCKEYREQ);
85 GSN_PRINT_SIGNATURE(printTCKEYCONF);
86 GSN_PRINT_SIGNATURE(printTCKEYREF);
87 GSN_PRINT_SIGNATURE(printLQHKEYREQ);
88 GSN_PRINT_SIGNATURE(printLQHKEYCONF);
89 GSN_PRINT_SIGNATURE(printLQHKEYREF);
90 GSN_PRINT_SIGNATURE(printTUPKEYREQ);
91 GSN_PRINT_SIGNATURE(printTUPKEYCONF);
92 GSN_PRINT_SIGNATURE(printTUPKEYREF);
93 GSN_PRINT_SIGNATURE(printTUPCOMMITREQ);
94 GSN_PRINT_SIGNATURE(printCONTINUEB);
95 GSN_PRINT_SIGNATURE(printFSOPENREQ);
96 GSN_PRINT_SIGNATURE(printFSCLOSEREQ);
97 GSN_PRINT_SIGNATURE(printFSREADWRITEREQ);
98 GSN_PRINT_SIGNATURE(printFSREADWRITEREQ);
99 GSN_PRINT_SIGNATURE(printFSREF);
100 GSN_PRINT_SIGNATURE(printFSREF);
101 GSN_PRINT_SIGNATURE(printFSREF);
102 GSN_PRINT_SIGNATURE(printFSREF);
103 GSN_PRINT_SIGNATURE(printFSREF);
104 GSN_PRINT_SIGNATURE(printFSCONF);
105 GSN_PRINT_SIGNATURE(printFSCONF);
106 GSN_PRINT_SIGNATURE(printFSCONF);
107 GSN_PRINT_SIGNATURE(printFSCONF);
108 GSN_PRINT_SIGNATURE(printFSCONF);
109 GSN_PRINT_SIGNATURE(printCLOSECOMREQCONF);
110 GSN_PRINT_SIGNATURE(printCLOSECOMREQCONF);
111 GSN_PRINT_SIGNATURE(printPACKED_SIGNAL);
112 GSN_PRINT_SIGNATURE(printPREPFAILREQREF);
113 GSN_PRINT_SIGNATURE(printPREPFAILREQREF);
114 GSN_PRINT_SIGNATURE(printALTER_TABLE_REQ);
115 GSN_PRINT_SIGNATURE(printALTER_TABLE_CONF);
116 GSN_PRINT_SIGNATURE(printALTER_TABLE_REF);
117 GSN_PRINT_SIGNATURE(printALTER_TAB_REQ);
118 GSN_PRINT_SIGNATURE(printALTER_TAB_CONF);
119 GSN_PRINT_SIGNATURE(printALTER_TAB_REF);
120 GSN_PRINT_SIGNATURE(printCREATE_TRIG_REQ);
121 GSN_PRINT_SIGNATURE(printCREATE_TRIG_CONF);
122 GSN_PRINT_SIGNATURE(printCREATE_TRIG_REF);
123 GSN_PRINT_SIGNATURE(printALTER_TRIG_REQ);
124 GSN_PRINT_SIGNATURE(printALTER_TRIG_CONF);
125 GSN_PRINT_SIGNATURE(printALTER_TRIG_REF);
126 GSN_PRINT_SIGNATURE(printDROP_TRIG_REQ);
127 GSN_PRINT_SIGNATURE(printDROP_TRIG_CONF);
128 GSN_PRINT_SIGNATURE(printDROP_TRIG_REF);
129 GSN_PRINT_SIGNATURE(printFIRE_TRIG_ORD);
130 GSN_PRINT_SIGNATURE(printTRIG_ATTRINFO);
131 GSN_PRINT_SIGNATURE(printCREATE_INDX_REQ);
132 GSN_PRINT_SIGNATURE(printCREATE_INDX_CONF);
133 GSN_PRINT_SIGNATURE(printCREATE_INDX_REF);
134 GSN_PRINT_SIGNATURE(printDROP_INDX_REQ);
135 GSN_PRINT_SIGNATURE(printDROP_INDX_CONF);
136 GSN_PRINT_SIGNATURE(printDROP_INDX_REF);
137 GSN_PRINT_SIGNATURE(printALTER_INDX_REQ);
138 GSN_PRINT_SIGNATURE(printALTER_INDX_CONF);
139 GSN_PRINT_SIGNATURE(printALTER_INDX_REF);
140 GSN_PRINT_SIGNATURE(printTCINDXREQ);
141 GSN_PRINT_SIGNATURE(printTCINDXCONF);
142 GSN_PRINT_SIGNATURE(printTCINDXREF);
143 GSN_PRINT_SIGNATURE(printINDXKEYINFO);
144 GSN_PRINT_SIGNATURE(printINDXATTRINFO);
145 GSN_PRINT_SIGNATURE(printFSAPPENDREQ);
146 GSN_PRINT_SIGNATURE(printBACKUP_REQ);
147 GSN_PRINT_SIGNATURE(printBACKUP_DATA);
148 GSN_PRINT_SIGNATURE(printBACKUP_REF);
149 GSN_PRINT_SIGNATURE(printBACKUP_CONF);
150 GSN_PRINT_SIGNATURE(printABORT_BACKUP_ORD);
151 GSN_PRINT_SIGNATURE(printBACKUP_ABORT_REP);
152 GSN_PRINT_SIGNATURE(printBACKUP_COMPLETE_REP);
153 GSN_PRINT_SIGNATURE(printBACKUP_NF_COMPLETE_REP);
154 GSN_PRINT_SIGNATURE(printDEFINE_BACKUP_REQ);
155 GSN_PRINT_SIGNATURE(printDEFINE_BACKUP_REF);
156 GSN_PRINT_SIGNATURE(printDEFINE_BACKUP_CONF);
157 GSN_PRINT_SIGNATURE(printSTART_BACKUP_REQ);
158 GSN_PRINT_SIGNATURE(printSTART_BACKUP_REF);
159 GSN_PRINT_SIGNATURE(printSTART_BACKUP_CONF);
160 GSN_PRINT_SIGNATURE(printBACKUP_FRAGMENT_REQ);
161 GSN_PRINT_SIGNATURE(printBACKUP_FRAGMENT_REF);
162 GSN_PRINT_SIGNATURE(printBACKUP_FRAGMENT_CONF);
163 GSN_PRINT_SIGNATURE(printSTOP_BACKUP_REQ);
164 GSN_PRINT_SIGNATURE(printSTOP_BACKUP_REF);
165 GSN_PRINT_SIGNATURE(printSTOP_BACKUP_CONF);
166 GSN_PRINT_SIGNATURE(printBACKUP_STATUS_REQ);
167 GSN_PRINT_SIGNATURE(printBACKUP_STATUS_CONF);
168 GSN_PRINT_SIGNATURE(printUTIL_SEQUENCE_REQ);
169 GSN_PRINT_SIGNATURE(printUTIL_SEQUENCE_REF);
170 GSN_PRINT_SIGNATURE(printUTIL_SEQUENCE_CONF);
171 GSN_PRINT_SIGNATURE(printUTIL_PREPARE_REQ);
172 GSN_PRINT_SIGNATURE(printUTIL_PREPARE_REF);
173 GSN_PRINT_SIGNATURE(printUTIL_PREPARE_CONF);
174 GSN_PRINT_SIGNATURE(printUTIL_EXECUTE_REQ);
175 GSN_PRINT_SIGNATURE(printUTIL_EXECUTE_REF);
176 GSN_PRINT_SIGNATURE(printUTIL_EXECUTE_CONF);
177 GSN_PRINT_SIGNATURE(printSCANTABREQ);
178 GSN_PRINT_SIGNATURE(printSCANTABCONF);
179 GSN_PRINT_SIGNATURE(printSCANTABREF);
180 GSN_PRINT_SIGNATURE(printSCANNEXTREQ);
181 GSN_PRINT_SIGNATURE(printSCANFRAGNEXTREQ);
182 GSN_PRINT_SIGNATURE(printLQH_FRAG_REQ);
183 GSN_PRINT_SIGNATURE(printLQH_FRAG_REF);
184 GSN_PRINT_SIGNATURE(printLQH_FRAG_CONF);
185 GSN_PRINT_SIGNATURE(printPREP_DROP_TAB_REQ);
186 GSN_PRINT_SIGNATURE(printPREP_DROP_TAB_REF);
187 GSN_PRINT_SIGNATURE(printPREP_DROP_TAB_CONF);
188 GSN_PRINT_SIGNATURE(printDROP_TAB_REQ);
189 GSN_PRINT_SIGNATURE(printDROP_TAB_REF);
190 GSN_PRINT_SIGNATURE(printDROP_TAB_CONF);
191 GSN_PRINT_SIGNATURE(printLCP_FRAG_ORD);
192 GSN_PRINT_SIGNATURE(printLCP_FRAG_REP);
193 GSN_PRINT_SIGNATURE(printLCP_COMPLETE_REP);
194 GSN_PRINT_SIGNATURE(printSTART_LCP_REQ);
195 GSN_PRINT_SIGNATURE(printSTART_LCP_CONF);
196 GSN_PRINT_SIGNATURE(printMASTER_LCP_REQ);
197 GSN_PRINT_SIGNATURE(printMASTER_LCP_REF);
198 GSN_PRINT_SIGNATURE(printMASTER_LCP_CONF);
199 GSN_PRINT_SIGNATURE(printCOPY_GCI_REQ);
200 GSN_PRINT_SIGNATURE(printSYSTEM_ERROR);
201 GSN_PRINT_SIGNATURE(printSTART_REC_REQ);
202 GSN_PRINT_SIGNATURE(printSTART_REC_CONF);
203 GSN_PRINT_SIGNATURE(printNF_COMPLETE_REP);
204 GSN_PRINT_SIGNATURE(printSIGNAL_DROPPED_REP);
205 GSN_PRINT_SIGNATURE(printFAIL_REP);
206 GSN_PRINT_SIGNATURE(printDISCONNECT_REP);
207 GSN_PRINT_SIGNATURE(printSUB_CREATE_REQ);
208 GSN_PRINT_SIGNATURE(printSUB_CREATE_CONF);
209 GSN_PRINT_SIGNATURE(printSUB_CREATE_REF);
210 GSN_PRINT_SIGNATURE(printSUB_REMOVE_REQ);
211 GSN_PRINT_SIGNATURE(printSUB_REMOVE_CONF);
212 GSN_PRINT_SIGNATURE(printSUB_REMOVE_REF);
213 GSN_PRINT_SIGNATURE(printSUB_START_REQ);
214 GSN_PRINT_SIGNATURE(printSUB_START_REF);
215 GSN_PRINT_SIGNATURE(printSUB_START_CONF);
216 GSN_PRINT_SIGNATURE(printSUB_STOP_REQ);
217 GSN_PRINT_SIGNATURE(printSUB_STOP_REF);
218 GSN_PRINT_SIGNATURE(printSUB_STOP_CONF);
219 GSN_PRINT_SIGNATURE(printSUB_SYNC_REQ);
220 GSN_PRINT_SIGNATURE(printSUB_SYNC_REF);
221 GSN_PRINT_SIGNATURE(printSUB_SYNC_CONF);
222 GSN_PRINT_SIGNATURE(printSUB_META_DATA);
223 GSN_PRINT_SIGNATURE(printSUB_TABLE_DATA);
224 GSN_PRINT_SIGNATURE(printSUB_SYNC_CONTINUE_REQ);
225 GSN_PRINT_SIGNATURE(printSUB_SYNC_CONTINUE_REF);
226 GSN_PRINT_SIGNATURE(printSUB_SYNC_CONTINUE_CONF);
227 GSN_PRINT_SIGNATURE(printSUB_GCP_COMPLETE_REP);
228 GSN_PRINT_SIGNATURE(printCREATE_FRAGMENTATION_REQ);
229 GSN_PRINT_SIGNATURE(printCREATE_FRAGMENTATION_REF);
230 GSN_PRINT_SIGNATURE(printCREATE_FRAGMENTATION_CONF);
231 GSN_PRINT_SIGNATURE(printUTIL_CREATE_LOCK_REQ);
232 GSN_PRINT_SIGNATURE(printUTIL_CREATE_LOCK_REF);
233 GSN_PRINT_SIGNATURE(printUTIL_CREATE_LOCK_CONF);
234 GSN_PRINT_SIGNATURE(printUTIL_DESTROY_LOCK_REQ);
235 GSN_PRINT_SIGNATURE(printUTIL_DESTROY_LOCK_REF);
236 GSN_PRINT_SIGNATURE(printUTIL_DESTROY_LOCK_CONF);
237 GSN_PRINT_SIGNATURE(printUTIL_LOCK_REQ);
238 GSN_PRINT_SIGNATURE(printUTIL_LOCK_REF);
239 GSN_PRINT_SIGNATURE(printUTIL_LOCK_CONF);
240 GSN_PRINT_SIGNATURE(printUTIL_UNLOCK_REQ);
241 GSN_PRINT_SIGNATURE(printUTIL_UNLOCK_REF);
242 GSN_PRINT_SIGNATURE(printUTIL_UNLOCK_CONF);
243 GSN_PRINT_SIGNATURE(printCNTR_START_REQ);
244 GSN_PRINT_SIGNATURE(printCNTR_START_REF);
245 GSN_PRINT_SIGNATURE(printCNTR_START_CONF);
246 GSN_PRINT_SIGNATURE(printREAD_NODES_CONF);
247 GSN_PRINT_SIGNATURE(printTUX_MAINT_REQ);
248 GSN_PRINT_SIGNATURE(printACC_LOCKREQ);
249 GSN_PRINT_SIGNATURE(printLQH_TRANSCONF);
250 GSN_PRINT_SIGNATURE(printSCAN_FRAGREQ);
251 GSN_PRINT_SIGNATURE(printSCAN_FRAGCONF);
252 
253 GSN_PRINT_SIGNATURE(printCONTINUEB_NDBFS);
254 GSN_PRINT_SIGNATURE(printCONTINUEB_DBDIH);
255 GSN_PRINT_SIGNATURE(printSTART_FRAG_REQ);
256 
257 GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_BEGIN_REQ);
258 GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_BEGIN_CONF);
259 GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_BEGIN_REF);
260 GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_END_REQ);
261 GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_END_CONF);
262 GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_END_REF);
263 GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_END_REP);
264 GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_IMPL_REQ);
265 GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_IMPL_CONF);
266 GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_IMPL_REF);
267 GSN_PRINT_SIGNATURE(printCREATE_TAB_REQ);
268 GSN_PRINT_SIGNATURE(printCREATE_TAB_CONF);
269 GSN_PRINT_SIGNATURE(printCREATE_TAB_REF);
270 GSN_PRINT_SIGNATURE(printCREATE_TABLE_REQ);
271 GSN_PRINT_SIGNATURE(printCREATE_TABLE_CONF);
272 GSN_PRINT_SIGNATURE(printCREATE_TABLE_REF);
273 GSN_PRINT_SIGNATURE(printDROP_TABLE_REQ);
274 GSN_PRINT_SIGNATURE(printDROP_TABLE_REF);
275 GSN_PRINT_SIGNATURE(printDROP_TABLE_CONF);
276 
277 GSN_PRINT_SIGNATURE(printGET_TABINFO_REQ);
278 GSN_PRINT_SIGNATURE(printGET_TABINFO_REF);
279 GSN_PRINT_SIGNATURE(printGET_TABINFO_CONF);
280 
281 GSN_PRINT_SIGNATURE(printCREATE_TRIG_IMPL_REQ);
282 GSN_PRINT_SIGNATURE(printCREATE_TRIG_IMPL_CONF);
283 GSN_PRINT_SIGNATURE(printCREATE_TRIG_IMPL_REF);
284 GSN_PRINT_SIGNATURE(printDROP_TRIG_IMPL_REQ);
285 GSN_PRINT_SIGNATURE(printDROP_TRIG_IMPL_CONF);
286 GSN_PRINT_SIGNATURE(printDROP_TRIG_IMPL_REF);
287 GSN_PRINT_SIGNATURE(printALTER_TRIG_IMPL_REQ);
288 GSN_PRINT_SIGNATURE(printALTER_TRIG_IMPL_CONF);
289 GSN_PRINT_SIGNATURE(printALTER_TRIG_IMPL_REF);
290 
291 GSN_PRINT_SIGNATURE(printCREATE_INDX_IMPL_REQ);
292 GSN_PRINT_SIGNATURE(printCREATE_INDX_IMPL_CONF);
293 GSN_PRINT_SIGNATURE(printCREATE_INDX_IMPL_REF);
294 GSN_PRINT_SIGNATURE(printDROP_INDX_IMPL_REQ);
295 GSN_PRINT_SIGNATURE(printDROP_INDX_IMPL_CONF);
296 GSN_PRINT_SIGNATURE(printDROP_INDX_IMPL_REF);
297 GSN_PRINT_SIGNATURE(printALTER_INDX_IMPL_REQ);
298 GSN_PRINT_SIGNATURE(printALTER_INDX_IMPL_CONF);
299 GSN_PRINT_SIGNATURE(printALTER_INDX_IMPL_REF);
300 
301 GSN_PRINT_SIGNATURE(printBUILD_INDX_REQ);
302 GSN_PRINT_SIGNATURE(printBUILD_INDX_CONF);
303 GSN_PRINT_SIGNATURE(printBUILD_INDX_REF);
304 GSN_PRINT_SIGNATURE(printBUILD_INDX_IMPL_REQ);
305 GSN_PRINT_SIGNATURE(printBUILD_INDX_IMPL_CONF);
306 GSN_PRINT_SIGNATURE(printBUILD_INDX_IMPL_REF);
307 
308 GSN_PRINT_SIGNATURE(printAPI_VERSION_REQ);
309 GSN_PRINT_SIGNATURE(printAPI_VERSION_CONF);
310 
311 GSN_PRINT_SIGNATURE(printLOCAL_ROUTE_ORD);
312 
313 GSN_PRINT_SIGNATURE(printDBINFO_SCAN);
314 GSN_PRINT_SIGNATURE(printDBINFO_SCAN_REF);
315 
316 GSN_PRINT_SIGNATURE(printNODE_PING_REQ);
317 GSN_PRINT_SIGNATURE(printNODE_PING_CONF);
318 
319 GSN_PRINT_SIGNATURE(printINDEX_STAT_REQ);
320 GSN_PRINT_SIGNATURE(printINDEX_STAT_CONF);
321 GSN_PRINT_SIGNATURE(printINDEX_STAT_REF);
322 GSN_PRINT_SIGNATURE(printINDEX_STAT_IMPL_REQ);
323 GSN_PRINT_SIGNATURE(printINDEX_STAT_IMPL_CONF);
324 GSN_PRINT_SIGNATURE(printINDEX_STAT_IMPL_REF);
325 GSN_PRINT_SIGNATURE(printINDEX_STAT_REP);
326 
327 GSN_PRINT_SIGNATURE(printGET_CONFIG_REQ);
328 GSN_PRINT_SIGNATURE(printGET_CONFIG_REF);
329 GSN_PRINT_SIGNATURE(printGET_CONFIG_CONF);
330 
331 #endif
332