MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TransporterDefinitions.hpp
1 /*
2  Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
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 as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #ifndef TransporterDefinitions_H
19 #define TransporterDefinitions_H
20 
21 #include <ndb_global.h>
22 #include <kernel_types.h>
23 #include <NdbOut.hpp>
24 
29 const int MAX_NTRANSPORTERS = 256;
30 
34 const int TCP_SEND_LIMIT = 64000;
35 
36 enum SendStatus {
37  SEND_OK = 0,
38  SEND_BLOCKED = 1,
39  SEND_DISCONNECTED = 2,
40  SEND_BUFFER_FULL = 3,
41  SEND_MESSAGE_TOO_BIG = 4,
42  SEND_UNKNOWN_NODE = 5
43 };
44 
45 enum TransporterType {
46  tt_TCP_TRANSPORTER = 1,
47  tt_SCI_TRANSPORTER = 2,
48  tt_SHM_TRANSPORTER = 3
49 };
50 
67 const Uint32 MAX_RECV_MESSAGE_BYTESIZE = 32768;
68 const Uint32 MAX_SEND_MESSAGE_BYTESIZE = 32768;
69 
77  Int32 s_port; // negative port number implies dynamic port
78  const char *remoteHostName;
79  const char *localHostName;
80  NodeId remoteNodeId;
81  NodeId localNodeId;
82  NodeId serverNodeId;
83  bool checksum;
84  bool signalId;
85  bool isMgmConnection; // is a mgm connection, requires transforming
86  TransporterType type;
87 
88  union { // Transporter specific configuration information
89 
90  struct {
91  Uint32 sendBufferSize; // Size of SendBuffer of priority B
92  Uint32 maxReceiveSize; // Maximum no of bytes to receive
93  Uint32 tcpSndBufSize;
94  Uint32 tcpRcvBufSize;
95  Uint32 tcpMaxsegSize;
96  Uint32 tcpOverloadLimit;
97  } tcp;
98 
99  struct {
100  Uint32 shmKey;
101  Uint32 shmSize;
102  int signum;
103  } shm;
104 
105  struct {
106  Uint32 sendLimit; // Packet size
107  Uint32 bufferSize; // Buffer size
108 
109  Uint32 nLocalAdapters; // 1 or 2, the number of adapters on local host
110 
111  Uint32 remoteSciNodeId0; // SCInodeId for adapter 1
112  Uint32 remoteSciNodeId1; // SCInodeId for adapter 2
113  } sci;
114  };
115 };
116 
117 struct SignalHeader {
118  Uint32 theVerId_signalNumber; // 4 bit ver id - 16 bit gsn
119  Uint32 theReceiversBlockNumber; // Only 16 bit blocknum
120  Uint32 theSendersBlockRef;
121  Uint32 theLength;
122  Uint32 theSendersSignalId;
123  Uint32 theSignalId;
124  Uint16 theTrace;
125  Uint8 m_noOfSections;
126  Uint8 m_fragmentInfo;
127 };
130  Uint32 sz;
131  Uint32 * p;
132 };
133 
135 {
136  Uint32 sz;
137  Uint32 i;
138  struct SectionSegment * p;
139 
140  void setNull() { p = 0;}
141  bool isNull() const { return p == 0;}
142  inline SegmentedSectionPtrPOD& assign(struct SegmentedSectionPtr&);
143 };
144 
146  Uint32 sz;
147  Uint32 i;
148  struct SectionSegment * p;
149 
151  SegmentedSectionPtr(Uint32 sz_arg, Uint32 i_arg,
152  struct SectionSegment *p_arg)
153  :sz(sz_arg), i(i_arg), p(p_arg)
154  {}
156  :sz(src.sz), i(src.i), p(src.p)
157  {}
158 
159  void setNull() { p = 0;}
160  bool isNull() const { return p == 0;}
161 };
162 
163 inline
165 SegmentedSectionPtrPOD::assign(struct SegmentedSectionPtr& src)
166 {
167  this->i = src.i;
168  this->p = src.p;
169  this->sz = src.sz;
170  return *this;
171 }
172 
173 /* Abstract interface for iterating over
174  * words in a section
175  */
177  virtual ~GenericSectionIterator() {};
178  virtual void reset()=0;
179  virtual const Uint32* getNextWords(Uint32& sz)=0;
180 };
181 
183  Uint32 sz;
184  GenericSectionIterator* sectionIter;
185 };
186 
187 class NdbOut & operator <<(class NdbOut & out, SignalHeader & sh);
188 
189 #endif // Define of TransporterDefinitions_H