mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / storage / ndb / include / kernel / signaldata / TcKeyConf.hpp
blob4fffdc56bd6c9060693dbe3d19c1cd82ae28f5f4
1 /* Copyright (c) 2003-2005, 2007 MySQL AB
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 #ifndef TC_KEY_CONF_H
17 #define TC_KEY_CONF_H
19 #include "SignalData.hpp"
21 /**
24 class TcKeyConf {
25 /**
26 * Reciver(s)
28 friend class Ndb;
29 friend class NdbTransaction;
30 friend class Ndbcntr;
31 friend class DbUtil;
33 /**
34 * Sender(s)
36 friend class Dbtc;
38 /**
39 * For printing
41 friend bool printTCKEYCONF(FILE *, const Uint32 *, Uint32, Uint16);
43 public:
44 /**
45 * Length of signal
47 STATIC_CONST( StaticLength = 5 );
48 STATIC_CONST( OperationLength = 2 );
49 STATIC_CONST( DirtyReadBit = (((Uint32)1) << 31) );
51 private:
53 /**
54 * DATA VARIABLES
56 //-------------------------------------------------------------
57 // Unconditional part. First 5 words
58 //-------------------------------------------------------------
60 Uint32 apiConnectPtr;
61 Uint32 gci;
62 Uint32 confInfo;
63 Uint32 transId1;
64 Uint32 transId2;
66 struct OperationConf {
67 Uint32 apiOperationPtr;
68 Uint32 attrInfoLen;
70 //-------------------------------------------------------------
71 // Operations confirmations,
72 // No of actually sent = getNoOfOperations(confInfo)
73 //-------------------------------------------------------------
74 OperationConf operations[10];
76 /**
77 * Get:ers for confInfo
79 static Uint32 getNoOfOperations(const Uint32 & confInfo);
80 static Uint32 getCommitFlag(const Uint32 & confInfo);
81 static bool getMarkerFlag(const Uint32 & confInfo);
83 /**
84 * Set:ers for confInfo
86 static void setCommitFlag(Uint32 & confInfo, Uint8 flag);
87 static void setNoOfOperations(Uint32 & confInfo, Uint32 noOfOps);
88 static void setMarkerFlag(Uint32 & confInfo, Uint32 flag);
91 inline
92 Uint32
93 TcKeyConf::getNoOfOperations(const Uint32 & confInfo){
94 return confInfo & 65535;
97 inline
98 Uint32
99 TcKeyConf::getCommitFlag(const Uint32 & confInfo){
100 return ((confInfo >> 16) & 1);
103 inline
104 bool
105 TcKeyConf::getMarkerFlag(const Uint32 & confInfo){
106 const Uint32 bits = 3 << 16; // Marker only valid when doing commit
107 return (confInfo & bits) == bits;
110 inline
111 void
112 TcKeyConf::setNoOfOperations(Uint32 & confInfo, Uint32 noOfOps){
113 ASSERT_MAX(noOfOps, 65535, "TcKeyConf::setNoOfOperations");
114 confInfo = (confInfo & 0xFFFF0000) | noOfOps;
117 inline
118 void
119 TcKeyConf::setCommitFlag(Uint32 & confInfo, Uint8 flag){
120 ASSERT_BOOL(flag, "TcKeyConf::setCommitFlag");
121 confInfo |= (flag << 16);
124 inline
125 void
126 TcKeyConf::setMarkerFlag(Uint32 & confInfo, Uint32 flag){
127 ASSERT_BOOL(flag, "TcKeyConf::setMarkerFlag");
128 confInfo |= (flag << 17);
131 #endif