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 CREATE_TRIG_HPP 26 #define CREATE_TRIG_HPP 27 28 #include "SignalData.hpp" 29 #include <Bitmask.hpp> 30 #include <trigger_definitions.h> 31 #include <AttributeList.hpp> 32 33 #define JAM_FILE_ID 100 34 35 36 struct CreateTrigReq 37 { 38 enum OnlineFlag 39 { 40 CreateTriggerOnline = 1, 41 CreateTriggerOffline = 2 42 }; 43 44 enum EndpointFlag 45 { 46 MainTrigger = 0, 47 TriggerDst = 1, // TC "consuming" block(s) 48 TriggerSrc = 2 // LQH "producing" block(s) 49 }; 50 51 STATIC_CONST( SignalLength = 13 ); 52 SECTION( TRIGGER_NAME_SECTION = 0 ); 53 SECTION( ATTRIBUTE_MASK_SECTION = 1 ); 54 getOnlineFlagCreateTrigReq55 static Uint32 getOnlineFlag(Uint32 i) { return i & 3; } setOnlineFlagCreateTrigReq56 static void setOnlineFlag(Uint32 & i, Uint32 v) { i |= (v & 3); } getEndpointFlagCreateTrigReq57 static Uint32 getEndpointFlag(Uint32 i) { return (i >> 2) & 3;} setEndpointFlagCreateTrigReq58 static void setEndpointFlag(Uint32 & i, Uint32 v) { i |= ((v & 3) << 2); } 59 60 Uint32 clientRef; 61 Uint32 clientData; 62 63 Uint32 transId; 64 Uint32 transKey; 65 Uint32 requestInfo; 66 Uint32 tableId; 67 Uint32 tableVersion; 68 Uint32 indexId; // only for index trigger 69 Uint32 indexVersion; 70 Uint32 triggerNo; // only for index trigger 71 Uint32 forceTriggerId;// only for NR/SR 72 Uint32 triggerInfo; // type | timing | event | flags 73 Uint32 receiverRef; // receiver for subscription trigger 74 }; 75 76 struct CreateTrigConf { 77 STATIC_CONST( SignalLength = 7 ); 78 79 Uint32 senderRef; 80 union { Uint32 clientData, senderData; }; 81 Uint32 transId; 82 Uint32 tableId; 83 Uint32 indexId; 84 Uint32 triggerId; 85 Uint32 triggerInfo; 86 }; 87 88 struct CreateTrigRef 89 { 90 enum ErrorCode { 91 NoError = 0, 92 Busy = 701, 93 NotMaster = 702, 94 TriggerNameTooLong = 4236, 95 TooManyTriggers = 4237, 96 TriggerNotFound = 4238, 97 TriggerExists = 4239, 98 UnsupportedTriggerType = 4240, 99 BadRequestType = 4247, 100 InvalidName = 4248, 101 InvalidTable = 4249, 102 OutOfStringBuffer = 773, 103 OutOfSectionMemory = 795 104 }; 105 106 STATIC_CONST( SignalLength = 10 ); 107 108 Uint32 senderRef; 109 union { Uint32 clientData, senderData; }; 110 Uint32 transId; 111 Uint32 tableId; 112 Uint32 indexId; 113 Uint32 triggerInfo; 114 Uint32 errorCode; 115 Uint32 errorLine; 116 Uint32 errorNodeId; 117 Uint32 masterNodeId; 118 }; 119 120 121 #undef JAM_FILE_ID 122 123 #endif 124