1 /* Copyright (c) 2003-2006 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 CREATE_EVNT_HPP
17 #define CREATE_EVNT_HPP
20 #include "SignalData.hpp"
21 #include <NodeBitmask.hpp>
22 #include <signaldata/DictTabInfo.hpp>
28 friend bool printDROP_EVNT_REQ(FILE*, const Uint32
*, Uint32
, Uint16
);
31 STATIC_CONST( SignalLength
= 2 );
32 SECTION( EVENT_NAME_SECTION
= 0 );
34 union { // user block reference
40 Uint32 m_userData
; // user
43 Uint32
getUserRef() const {
46 void setUserRef(Uint32 val
) {
49 Uint32
getUserData() const {
52 void setUserData(Uint32 val
) {
61 friend bool printDROP_EVNT_CONF(FILE*, const Uint32
*, Uint32
, Uint16
);
64 STATIC_CONST( SignalLength
= 2 );
66 union { // user block reference
72 Uint32 m_userData
; // user
75 Uint32
getUserRef() const {
78 void setUserRef(Uint32 val
) {
81 Uint32
getUserData() const {
84 void setUserData(Uint32 val
) {
93 friend bool printDROP_EVNT_REF(FILE*, const Uint32
*, Uint32
, Uint16
);
103 STATIC_CONST( SignalLength
= 7 );
104 STATIC_CONST( SignalLength2
= SignalLength
+1 );
106 union { // user block reference
112 Uint32 m_userData
; // user
120 // with SignalLength2
121 Uint32 m_masterNodeId
;
122 Uint32
getUserRef() const {
125 void setUserRef(Uint32 val
) {
128 Uint32
getUserData() const {
131 void setUserData(Uint32 val
) {
134 Uint32
getErrorCode() const {
137 void setErrorCode(Uint32 val
) {
140 Uint32
getErrorLine() const {
143 void setErrorLine(Uint32 val
) {
146 Uint32
getErrorNode() const {
149 void setErrorNode(Uint32 val
) {
152 Uint32
getMasterNode() const {
153 return m_masterNodeId
;
155 void setMasterNode(Uint32 val
) {
156 m_masterNodeId
= val
;
163 struct CreateEvntReq
{
164 friend bool printCREATE_EVNT_REQ(FILE*, const Uint32
*, Uint32
, Uint16
);
171 RT_DICT_AFTER_GET
= 0x1 << 4
172 // RT_DICT_MASTER = 0x2 << 4,
174 // RT_DICT_COMMIT = 0xC << 4,
175 // RT_DICT_ABORT = 0xF << 4,
179 EF_REPORT_ALL
= 0x1 << 16,
180 EF_REPORT_SUBSCRIBE
= 0x2 << 16,
181 EF_ALL
= 0xFFFF << 16
183 STATIC_CONST( SignalLengthGet
= 3 );
184 STATIC_CONST( SignalLengthCreate
= 6+MAXNROFATTRIBUTESINWORDS
);
185 STATIC_CONST( SignalLength
= 8+MAXNROFATTRIBUTESINWORDS
);
186 // SECTION( ATTRIBUTE_LIST_SECTION = 0 );
187 SECTION( EVENT_NAME_SECTION
= 0 );
190 Uint32 m_userRef
; // user block reference
191 Uint32 senderRef
; // user block reference
194 Uint32 m_userData
; // user
195 Uint32 senderData
; // user
197 Uint32 m_requestInfo
;
198 Uint32 m_tableId
; // table to event
199 Uint32 m_tableVersion
; // table version
200 AttributeMask::Data m_attrListBitmask
;
201 Uint32 m_eventType
; // EventFlags (16 bits) + from DictTabInfo::TableType (16 bits)
202 Uint32 m_eventId
; // event table id set by DICT/SUMA
203 Uint32 m_eventKey
; // event table key set by DICT/SUMA
204 Uint32
getUserRef() const {
207 void setUserRef(Uint32 val
) {
210 Uint32
getUserData() const {
213 void setUserData(Uint32 val
) {
216 CreateEvntReq::RequestType
getRequestType() const {
217 const Uint32 val
= BitmaskImpl::getField(1, &m_requestInfo
, 0, 16);
218 return (CreateEvntReq::RequestType
)val
;
220 void setRequestType(CreateEvntReq::RequestType val
) {
221 m_requestInfo
= (Uint32
)val
;
223 Uint32
getRequestFlag() const {
224 return BitmaskImpl::getField(1, &m_requestInfo
, 16, 16);
226 void addRequestFlag(Uint32 val
) {
227 val
|= BitmaskImpl::getField(1, &m_requestInfo
, 16, 16);
228 BitmaskImpl::setField(1, &m_requestInfo
, 16, 16, val
);
230 Uint32
getTableId() const {
233 void setTableId(Uint32 val
) {
236 Uint32
getTableVersion() const {
237 return m_tableVersion
;
239 void setTableVersion(Uint32 val
) {
240 m_tableVersion
= val
;
242 AttributeMask
getAttrListBitmask() const {
244 tmp
.assign(m_attrListBitmask
);
247 void setAttrListBitmask(const AttributeMask
& val
) {
248 AttributeMask::assign(m_attrListBitmask
.data
, val
);
250 Uint32
getEventType() const {
251 return m_eventType
& ~EF_ALL
;
253 void setEventType(Uint32 val
) {
254 m_eventType
= (m_eventType
& EF_ALL
) | (~EF_ALL
& (Uint32
)val
);
256 Uint32
getEventId() const {
259 void setEventId(Uint32 val
) {
262 Uint32
getEventKey() const {
265 void setEventKey(Uint32 val
) {
269 m_eventType
&= ~EF_ALL
;
271 Uint32
getReportFlags() const {
272 return m_eventType
& EF_ALL
;
274 void setReportFlags(Uint32 val
) {
275 m_eventType
= (val
& EF_ALL
) | (m_eventType
& ~EF_ALL
);
277 Uint32
getReportAll() const {
278 return m_eventType
& EF_REPORT_ALL
;
280 void setReportAll() {
281 m_eventType
|= EF_REPORT_ALL
;
283 Uint32
getReportSubscribe() const {
284 return m_eventType
& EF_REPORT_SUBSCRIBE
;
286 void setReportSubscribe() {
287 m_eventType
|= EF_REPORT_SUBSCRIBE
;
294 class CreateEvntConf
{
295 friend bool printCREATE_EVNT_CONF(FILE*, const Uint32
*, Uint32
, Uint16
);
298 // STATIC_CONST( InternalLength = 3 );
299 STATIC_CONST( SignalLength
= 8+MAXNROFATTRIBUTESINWORDS
);
302 Uint32 m_userRef
; // user block reference
303 Uint32 senderRef
; // user block reference
306 Uint32 m_userData
; // user
307 Uint32 senderData
; // user
309 Uint32 m_requestInfo
;
311 Uint32 m_tableVersion
; // table version
312 AttributeMask m_attrListBitmask
;
317 Uint32
getUserRef() const {
320 void setUserRef(Uint32 val
) {
323 Uint32
getUserData() const {
326 void setUserData(Uint32 val
) {
329 CreateEvntReq::RequestType
getRequestType() const {
330 return (CreateEvntReq::RequestType
)m_requestInfo
;
332 void setRequestType(CreateEvntReq::RequestType val
) {
333 m_requestInfo
= (Uint32
)val
;
335 Uint32
getTableId() const {
338 void setTableId(Uint32 val
) {
341 Uint32
getTableVersion() const {
342 return m_tableVersion
;
344 void setTableVersion(Uint32 val
) {
345 m_tableVersion
= val
;
347 AttributeMask
getAttrListBitmask() const {
348 return m_attrListBitmask
;
350 void setAttrListBitmask(const AttributeMask
& val
) {
351 m_attrListBitmask
= val
;
353 Uint32
getEventType() const {
356 void setEventType(Uint32 val
) {
357 m_eventType
= (Uint32
)val
;
359 Uint32
getEventId() const {
362 void setEventId(Uint32 val
) {
365 Uint32
getEventKey() const {
368 void setEventKey(Uint32 val
) {
376 struct CreateEvntRef
{
377 friend class SafeCounter
;
378 friend bool printCREATE_EVNT_REF(FILE*, const Uint32
*, Uint32
, Uint16
);
380 STATIC_CONST( SignalLength
= 11 );
381 STATIC_CONST( SignalLength2
= SignalLength
+ 1 );
385 NF_FakeErrorREF
= 11,
390 Uint32 m_userRef
; // user block reference
391 Uint32 senderRef
; // user block reference
394 Uint32 m_userData
; // user
395 Uint32 senderData
; // user
398 Uint32 m_requestInfo
;
400 Uint32 m_tableVersion
; // table version
407 // with SignalLength2
408 Uint32 m_masterNodeId
;
409 Uint32
getUserRef() const {
412 void setUserRef(Uint32 val
) {
415 Uint32
getUserData() const {
418 void setUserData(Uint32 val
) {
421 CreateEvntReq::RequestType
getRequestType() const {
422 return (CreateEvntReq::RequestType
)m_requestInfo
;
424 void setRequestType(CreateEvntReq::RequestType val
) {
425 m_requestInfo
= (Uint32
)val
;
427 Uint32
getTableId() const {
430 void setTableId(Uint32 val
) {
433 Uint32
getTableVersion() const {
434 return m_tableVersion
;
436 void setTableVersion(Uint32 val
) {
437 m_tableVersion
= val
;
440 Uint32
getEventType() const {
443 void setEventType(Uint32 val
) {
444 m_eventType
= (Uint32
)val
;
446 Uint32
getEventId() const {
449 void setEventId(Uint32 val
) {
452 Uint32
getEventKey() const {
455 void setEventKey(Uint32 val
) {
459 Uint32
getErrorCode() const {
462 void setErrorCode(Uint32 val
) {
465 Uint32
getErrorLine() const {
468 void setErrorLine(Uint32 val
) {
471 Uint32
getErrorNode() const {
474 void setErrorNode(Uint32 val
) {
477 Uint32
getMasterNode() const {
478 return m_masterNodeId
;
480 void setMasterNode(Uint32 val
) {
481 m_masterNodeId
= val
;