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 SD_EVENT_REPORT_H
26 #define SD_EVENT_REPORT_H
27
28 #include <ndb_logevent.h>
29 #include "SignalData.hpp"
30
31 #define JAM_FILE_ID 52
32
33
34 /**
35 * Send by different block to report that a event has taken place
36 *
37 * SENDER: *Block*
38 * RECIVER: SimBlockCMCtrBlck
39 */
40 class EventReport {
41 friend class SimulatedBlock;
42 friend class Cmvmi;
43 friend class SimblockMissra;
44 friend class Dbacc;
45 friend class Dblqh;
46 friend class Dbtup;
47 friend class Dbtc;
48 friend class Ndbcntr;
49 friend class Qmgr;
50 friend class Dbdih;
51 friend class Dbdict;
52 friend class MgmtSrvr;
53
54 public:
55 /*
56 EventType defines what event reports to send.
57
58 The ORDER is NOT important anymore. //ejonore 2003-07-24 15:03
59
60 HOW TO ADD A NEW EVENT
61 --------------------
62 1) Add SentHeartbeat EventType in the category where it belongs.
63 ...
64 // INFO
65 SentHeartbeat,
66 InfoEvent
67 ...
68
69 2) remeber to update # of events below. Just to keep count...
70 Number of event types = 53
71
72 3) Add a new SentHeartBeat entry to EventLogger::matrix[].
73 ...
74 // INFO
75 { EventReport::SentHeartbeat, LogLevel::llInfo, 11, INFO },
76 { EventReport::InfoEvent, LogLevel::llInfo, 2, INFO }
77 ...
78
79 4) Add SentHeartbeat in EventLogger::getText()
80
81 */
82 void setNodeId(Uint32 nodeId);
83 Uint32 getNodeId() const;
84 void setEventType(Ndb_logevent_type type);
85 Ndb_logevent_type getEventType() const;
86 UintR eventType; // DATA 0
87 };
88
89 inline
90 void
setNodeId(Uint32 nodeId)91 EventReport::setNodeId(Uint32 nodeId){
92 eventType = (nodeId << 16) | (eventType & 0xFFFF);
93 }
94
95 inline
96 Uint32
getNodeId() const97 EventReport::getNodeId() const {
98 return eventType >> 16;
99 }
100
101 inline
102 void
setEventType(Ndb_logevent_type type)103 EventReport::setEventType(Ndb_logevent_type type){
104 eventType = (eventType & 0xFFFF0000) | (((UintR) type) & 0xFFFF);
105 }
106
107 inline
108 Ndb_logevent_type
getEventType() const109 EventReport::getEventType() const {
110 return (Ndb_logevent_type)(eventType & 0xFFFF);
111 }
112
113
114 #undef JAM_FILE_ID
115
116 #endif
117