1 /* Copyright (c) 2003, 2005 MySQL AB
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
19 #include <TransporterDefinitions.hpp>
20 #include "TransporterInternalDefinitions.hpp"
23 Uint32 preComputedWord1
;
24 Uint32 checksumUsed
; // Checksum shall be included in the message
25 Uint32 signalIdUsed
; // Senders signal id shall be included in the message
27 Packer(bool signalId
, bool checksum
);
29 Uint32
getMessageLength(const SignalHeader
* header
,
30 const LinearSectionPtr ptr
[3]) const ;
33 Uint32
getMessageLength(const SignalHeader
* header
,
34 const SegmentedSectionPtr ptr
[3]) const ;
36 void pack(Uint32
* insertPtr
,
38 const SignalHeader
* header
,
40 const LinearSectionPtr ptr
[3]) const ;
42 void pack(Uint32
* insertPtr
,
44 const SignalHeader
* header
,
46 class SectionSegmentPool
& thePool
,
47 const SegmentedSectionPtr ptr
[3]) const ;
52 Packer::getMessageLength(const SignalHeader
* header
,
53 const LinearSectionPtr ptr
[3]) const {
54 Uint32 tLen32
= header
->theLength
;
55 Uint32 no_seg
= header
->m_noOfSections
;
56 tLen32
+= checksumUsed
;
57 tLen32
+= signalIdUsed
;
60 for(Uint32 i
= 0; i
<no_seg
; i
++){
64 return (tLen32
* 4) + sizeof(Protocol6
);
69 Packer::getMessageLength(const SignalHeader
* header
,
70 const SegmentedSectionPtr ptr
[3]) const {
71 Uint32 tLen32
= header
->theLength
;
72 Uint32 no_seg
= header
->m_noOfSections
;
73 tLen32
+= checksumUsed
;
74 tLen32
+= signalIdUsed
;
77 for(Uint32 i
= 0; i
<no_seg
; i
++){
81 return (tLen32
* 4) + sizeof(Protocol6
);