1 /*
2    Copyright (c) 2003, 2021, Oracle and/or its affiliates.
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 PACKED_SIGNAL_HPP
26 #define PACKED_SIGNAL_HPP
27 
28 #include "SignalData.hpp"
29 
30 #define JAM_FILE_ID 73
31 
32 
33 // -------- CODES FOR COMPRESSED SIGNAL (PACKED_SIGNAL) -------
34 #define ZCOMMIT 0
35 #define ZCOMPLETE 1
36 #define ZCOMMITTED 2
37 #define ZCOMPLETED 3
38 #define ZLQHKEYCONF 4
39 #define ZREMOVE_MARKER 5
40 #define ZFIRE_TRIG_REQ 6
41 #define ZFIRE_TRIG_CONF 7
42 
43 // Definitions for verification of packed signals
44 static const int VERIFY_PACKED_SEND = 1;
45 #ifdef VM_TRACE
46 static const int VERIFY_PACKED_RECEIVE = 1;
47 #else
48 static const int VERIFY_PACKED_RECEIVE = 0;
49 #endif
50 static const int LQH_RECEIVE_TYPES = ((1 << ZCOMMIT) +
51                                       (1 << ZCOMPLETE) +
52                                       (1 << ZLQHKEYCONF) +
53                                       (1 << ZREMOVE_MARKER) +
54                                       (1 << ZFIRE_TRIG_REQ));
55 static const int TC_RECEIVE_TYPES = ((1 << ZCOMMITTED) +
56                                      (1 << ZCOMPLETED) +
57                                      (1 << ZLQHKEYCONF) +
58                                      (1 << ZFIRE_TRIG_CONF));
59 
60 class PackedSignal {
61 public:
62   static bool verify(const Uint32* data, Uint32 len, Uint32 typesExpected, Uint32 commitLen, Uint32 receiverBlockNo);
63 
64 private:
65   static Uint32 getSignalType(Uint32 data);
66 
67   /**
68    * For printing
69    */
70   friend bool printPACKED_SIGNAL(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
71 };
72 
73 inline
getSignalType(Uint32 data)74 Uint32 PackedSignal::getSignalType(Uint32 data) { return data >> 28; }
75 
76 
77 #undef JAM_FILE_ID
78 
79 #endif
80