19 #ifndef TransporterInternalDefinitions_H
20 #define TransporterInternalDefinitions_H
22 #if defined DEBUG_TRANSPORTER || defined VM_TRACE
26 #define NDB_TCP_TRANSPORTER
29 #define NDB_SHM_TRANSPORTER
33 #define NDB_SCI_TRANSPORTER
36 #ifdef DEBUG_TRANSPORTER
37 #define DEBUG(x) ndbout << x << endl
42 #if defined VM_TRACE || defined DEBUG_TRANSPORTER
43 #define WARNING(X) ndbout << X << endl;
51 computeChecksum(
const Uint32 *
const startOfData,
int nWords) {
52 Uint32 chksum = startOfData[0];
53 for (
int i=1;
i < nWords;
i++)
54 chksum ^= startOfData[
i];
111 static Uint32 getCompressed (
const Uint32 & word1);
112 static Uint32 getSignalIdIncluded(
const Uint32 & word1);
113 static Uint32 getCheckSumIncluded(
const Uint32 & word1);
114 static Uint32 getPrio (
const Uint32 & word1);
115 static Uint32 getMessageLength (
const Uint32 & word1);
117 static void setByteOrder (Uint32 & word1, Uint32 byteOrder);
118 static void setCompressed (Uint32 & word1, Uint32 compressed);
119 static void setSignalIdIncluded(Uint32 & word1, Uint32 signalId);
120 static void setCheckSumIncluded(Uint32 & word1, Uint32 checkSum);
121 static void setPrio (Uint32 & word1, Uint32 prio);
122 static void setMessageLength (Uint32 & word1, Uint32 messageLen);
124 static void createSignalHeader(
SignalHeader *
const dst,
125 const Uint32 & word1,
126 const Uint32 & word2,
127 const Uint32 & word3);
129 static void createProtocol6Header(Uint32 & word1,
135 #define WORD1_BYTEORDER_MASK (0x81000081)
136 #define WORD1_SIGNALID_MASK (0x00000004)
137 #define WORD1_COMPRESSED_MASK (0x00000008)
138 #define WORD1_CHECKSUM_MASK (0x00000010)
139 #define WORD1_PRIO_MASK (0x00000060)
140 #define WORD1_MESSAGELEN_MASK (0x00FFFF00)
141 #define WORD1_SIGNAL_LEN_MASK (0x7C000000)
142 #define WORD1_FRAG_INF_MASK (0x00000002)
143 #define WORD1_FRAG_INF2_MASK (0x02000000)
145 #define WORD1_FRAG_INF_SHIFT (1)
146 #define WORD1_SIGNALID_SHIFT (2)
147 #define WORD1_COMPRESSED_SHIFT (3)
148 #define WORD1_CHECKSUM_SHIFT (4)
149 #define WORD1_PRIO_SHIFT (5)
150 #define WORD1_MESSAGELEN_SHIFT (8)
151 #define WORD1_FRAG_INF2_SHIFT (25)
152 #define WORD1_SIGNAL_LEN_SHIFT (26)
154 #define WORD2_VERID_GSN_MASK (0x000FFFFF)
155 #define WORD2_TRACE_MASK (0x03f00000)
156 #define WORD2_SEC_COUNT_MASK (0x0c000000)
158 #define WORD2_TRACE_SHIFT (20)
159 #define WORD2_SEC_COUNT_SHIFT (26)
161 #define WORD3_SENDER_MASK (0x0000FFFF)
162 #define WORD3_RECEIVER_MASK (0xFFFF0000)
164 #define WORD3_RECEIVER_SHIFT (16)
174 Protocol6::getCompressed(
const Uint32 & word1){
175 return (word1 & WORD1_COMPRESSED_MASK) >> WORD1_COMPRESSED_SHIFT;
180 Protocol6::getSignalIdIncluded(
const Uint32 & word1){
181 return (word1 & WORD1_SIGNALID_MASK) >> WORD1_SIGNALID_SHIFT;
186 Protocol6::getCheckSumIncluded(
const Uint32 & word1){
187 return (word1 & WORD1_CHECKSUM_MASK) >> WORD1_CHECKSUM_SHIFT;
192 Protocol6::getMessageLength(
const Uint32 & word1){
193 return (word1 & WORD1_MESSAGELEN_MASK) >> WORD1_MESSAGELEN_SHIFT;
198 Protocol6::getPrio(
const Uint32 & word1){
199 return (word1 & WORD1_PRIO_MASK) >> WORD1_PRIO_SHIFT;
204 Protocol6::setByteOrder(Uint32 & word1, Uint32 byteOrder){
205 Uint32 tmp = byteOrder;
208 word1 |= (tmp & WORD1_BYTEORDER_MASK);
213 Protocol6::setCompressed(Uint32 & word1, Uint32 compressed){
214 word1 |= ((compressed << WORD1_COMPRESSED_SHIFT) & WORD1_COMPRESSED_MASK);
219 Protocol6::setSignalIdIncluded(Uint32 & word1, Uint32 signalId){
220 word1 |= ((signalId << WORD1_SIGNALID_SHIFT) & WORD1_SIGNALID_MASK);
225 Protocol6::setCheckSumIncluded(Uint32 & word1, Uint32 checkSum){
226 word1 |= ((checkSum << WORD1_CHECKSUM_SHIFT) & WORD1_CHECKSUM_MASK);
231 Protocol6::setMessageLength(Uint32 & word1, Uint32 messageLen){
232 word1 |= ((messageLen << WORD1_MESSAGELEN_SHIFT) & WORD1_MESSAGELEN_MASK);
237 Protocol6::setPrio(Uint32 & word1, Uint32 prio){
238 word1 |= ((prio << WORD1_PRIO_SHIFT) & WORD1_PRIO_MASK);
244 const Uint32 & word1,
245 const Uint32 & word2,
246 const Uint32 & word3){
248 Uint32 signal_len = (word1 & WORD1_SIGNAL_LEN_MASK)>> WORD1_SIGNAL_LEN_SHIFT;
249 Uint32 fragInfo1 = (word1 & WORD1_FRAG_INF_MASK) >> (WORD1_FRAG_INF_SHIFT-1);
250 Uint32 fragInfo2 = (word1 & WORD1_FRAG_INF2_MASK) >> (WORD1_FRAG_INF2_SHIFT);
251 Uint32 trace = (word2 & WORD2_TRACE_MASK) >> WORD2_TRACE_SHIFT;
252 Uint32 verid_gsn = (word2 & WORD2_VERID_GSN_MASK);
253 Uint32 secCount = (word2 & WORD2_SEC_COUNT_MASK) >> WORD2_SEC_COUNT_SHIFT;
255 dst->theTrace = trace;
256 dst->m_noOfSections = secCount;
257 dst->m_fragmentInfo = fragInfo1 | fragInfo2;
259 dst->theLength = signal_len;
260 dst->theVerId_signalNumber = verid_gsn;
262 Uint32 sBlockNum = (word3 & WORD3_SENDER_MASK);
263 Uint32 rBlockNum = (word3 & WORD3_RECEIVER_MASK) >> WORD3_RECEIVER_SHIFT;
265 dst->theSendersBlockRef = sBlockNum;
266 dst->theReceiversBlockNumber = rBlockNum;
271 Protocol6::createProtocol6Header(Uint32 & word1,
275 const Uint32 signal_len = src->theLength;
276 const Uint32 fragInfo = src->m_fragmentInfo;
277 const Uint32 fragInfo1 = (fragInfo & 2);
278 const Uint32 fragInfo2 = (fragInfo & 1);
280 const Uint32 trace = src->theTrace;
281 const Uint32 verid_gsn = src->theVerId_signalNumber;
282 const Uint32 secCount = src->m_noOfSections;
284 word1 |= ((signal_len << WORD1_SIGNAL_LEN_SHIFT) & WORD1_SIGNAL_LEN_MASK);
285 word1 |= ((fragInfo1 << (WORD1_FRAG_INF_SHIFT-1)) & WORD1_FRAG_INF_MASK);
286 word1 |= ((fragInfo2 << WORD1_FRAG_INF2_SHIFT) & WORD1_FRAG_INF2_MASK);
288 word2 |= ((trace << WORD2_TRACE_SHIFT) & WORD2_TRACE_MASK);
289 word2 |= (verid_gsn & WORD2_VERID_GSN_MASK);
290 word2 |= ((secCount << WORD2_SEC_COUNT_SHIFT) & WORD2_SEC_COUNT_MASK);
292 Uint32 sBlockNum = src->theSendersBlockRef ;
293 Uint32 rBlockNum = src->theReceiversBlockNumber ;
295 word3 |= (sBlockNum & WORD3_SENDER_MASK);
296 word3 |= ((rBlockNum << WORD3_RECEIVER_SHIFT) & WORD3_RECEIVER_MASK);