1 /*
2    Copyright (c) 2011, 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 TRPMAN_H
26 #define TRPMAN_H
27 
28 #include <pc.hpp>
29 #include <SimulatedBlock.hpp>
30 #include <LocalProxy.hpp>
31 #include <signaldata/EnableCom.hpp>
32 #include <signaldata/CloseComReqConf.hpp>
33 
34 #define JAM_FILE_ID 334
35 
36 
37 class Trpman : public SimulatedBlock
38 {
39 public:
40   Trpman(Block_context& ctx, Uint32 instanceNumber = 0);
41   virtual ~Trpman();
42   BLOCK_DEFINES(Trpman);
43 
44   void execCLOSE_COMREQ(Signal *signal);
45   void execCLOSE_COMCONF(Signal * signal);
46   void execOPEN_COMORD(Signal *signal);
47   void execENABLE_COMREQ(Signal *signal);
48   void execDISCONNECT_REP(Signal *signal);
49   void execCONNECT_REP(Signal *signal);
50   void execROUTE_ORD(Signal* signal);
51 
52   void execDBINFO_SCANREQ(Signal*);
53 
54   void execNDB_TAMPER(Signal*);
55   void execDUMP_STATE_ORD(Signal*);
56 protected:
57 private:
58   bool handles_this_node(Uint32 nodeId);
59 };
60 
61 class TrpmanProxy : public LocalProxy
62 {
63 public:
64   TrpmanProxy(Block_context& ctx);
65   virtual ~TrpmanProxy();
66   BLOCK_DEFINES(TrpmanProxy);
67 
68   // GSN_OPEN_COMORD
69   void execOPEN_COMORD(Signal *signal);
70 
71   // GSN_CLOSE_COMREQ
72   struct Ss_CLOSE_COMREQ : SsParallel {
73     CloseComReqConf m_req;
Ss_CLOSE_COMREQTrpmanProxy::Ss_CLOSE_COMREQ74     Ss_CLOSE_COMREQ() {
75       m_sendREQ = (SsFUNCREQ)&TrpmanProxy::sendCLOSE_COMREQ;
76       m_sendCONF = (SsFUNCREP)&TrpmanProxy::sendCLOSE_COMCONF;
77     }
78     enum { poolSize = MAX_NODES };
poolTrpmanProxy::Ss_CLOSE_COMREQ79     static SsPool<Ss_CLOSE_COMREQ>& pool(LocalProxy* proxy) {
80       return ((TrpmanProxy*)proxy)->c_ss_CLOSE_COMREQ;
81     }
82   };
83   SsPool<Ss_CLOSE_COMREQ> c_ss_CLOSE_COMREQ;
84   void execCLOSE_COMREQ(Signal *signal);
85   void sendCLOSE_COMREQ(Signal*, Uint32 ssId, SectionHandle*);
86   void execCLOSE_COMCONF(Signal *signal);
87   void sendCLOSE_COMCONF(Signal*, Uint32 ssId);
88 
89   // GSN_ENABLE_COMREQ
90   struct Ss_ENABLE_COMREQ : SsParallel {
91     EnableComReq m_req;
Ss_ENABLE_COMREQTrpmanProxy::Ss_ENABLE_COMREQ92     Ss_ENABLE_COMREQ() {
93       m_sendREQ = (SsFUNCREQ)&TrpmanProxy::sendENABLE_COMREQ;
94       m_sendCONF = (SsFUNCREP)&TrpmanProxy::sendENABLE_COMCONF;
95     }
96     enum { poolSize = MAX_NODES };
poolTrpmanProxy::Ss_ENABLE_COMREQ97     static SsPool<Ss_ENABLE_COMREQ>& pool(LocalProxy* proxy) {
98       return ((TrpmanProxy*)proxy)->c_ss_ENABLE_COMREQ;
99     }
100   };
101   SsPool<Ss_ENABLE_COMREQ> c_ss_ENABLE_COMREQ;
102   void execENABLE_COMREQ(Signal *signal);
103   void sendENABLE_COMREQ(Signal*, Uint32 ssId, SectionHandle*);
104   void execENABLE_COMCONF(Signal *signal);
105   void sendENABLE_COMCONF(Signal*, Uint32 ssId);
106 
107   void execROUTE_ORD(Signal* signal);
108   void execNDB_TAMPER(Signal*);
109   void execDUMP_STATE_ORD(Signal*);
110 protected:
111   virtual SimulatedBlock* newWorker(Uint32 instanceNo);
112 };
113 
114 
115 #undef JAM_FILE_ID
116 
117 #endif
118