OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  7.0.3
API documentation
PacketHeader.h
Go to the documentation of this file.
1 /*
2 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3 *
4 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5 * and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable OnixS Software
8 * Services Agreement (the Agreement) and Customer end user license agreements granting
9 * a non-assignable, non-transferable and non-exclusive license to use the software
10 * for it's own data processing purposes under the terms defined in the Agreement.
11 *
12 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13 * of this source code or associated reference material to any other location for further reproduction
14 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15 *
16 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17 * the terms of the Agreement is a violation of copyright law.
18 */
19 
20 #pragma once
21 
24 
25 #include <OnixS/Core/Numeric/Integer.h>
26 
27 #include <OnixS/HandlerCore/FeedEngine/PacketContainer.h>
28 
29 #include <networking/Definitions.h>
30 
31 #include <fast/FixDecoder.h>
32 
33 namespace OnixS {
34 namespace Eurex {
35 namespace MarketData {
36 namespace Implementation {
37 
38 using namespace FIX::Core::FAST;
39 
40 #pragma pack(push,1)
41 
43 {
44  enum { TemplateIdValue = 71 };
45 
46  Networking::Byte pmap;
47  Networking::Byte tid;
48  Networking::Byte senderCompIdData;
49 
50  Networking::Byte packetSeqNumData[5];
51  Networking::Byte sendingTimeData[9];
52 };
53 
55 {
56  enum { TemplateIdValue = 61 };
57 
58  Networking::Byte pmap;
59  Networking::Byte tid;
60  Networking::Byte partitionIdData;
61  Networking::Byte senderCompIdData;
62 
63  Networking::Byte packetSeqNumData[5];
64  Networking::Byte sendingTimeData[9];
65  Networking::Byte performanceIndicatorData[5];
66 };
67 
69 {
70  enum { TemplateIdValue = 75 };
71 };
72 
74 {
75  enum { TemplateIdValue = 13004 };
76 
77  UInt16 BodyLen; // Number of bytes for the message, including this field. Message is teh packet header by iyself
78  UInt16 TemplateID; // Unique identifier for a Eurex EOBI message layout. Value: 13003 (TemplateIdValue)
79  UInt32 MsgSeqNum; // Not used
80  UInt32 ApplSeqNum; // Message sequence number is contiguous and is incremented across products.
81  UInt32 MarketSegmentID; // Product identifier.
82  UInt8 PartitionID; // Grouping of Eurex products. Belongs to the scope of Service Availability.
83  UInt8 CompletionIndicator; // Indicated whether an unit of work fits into a single datagram for incremental messages: 0 - Incomplete, 1 - Complete
84  UInt8 ApplSeqResetIndicator; // 0 - No Reset, 1 - Reset
85  UInt8 Pad5[5]; // Padding, not used
86  UInt64 TransactTime; // UTC time when market data feed handler writes packet on the wire.
87 };
88 
89 #pragma pack(pop)
90 
92 {
93  template< class TPacketHeader >
94  static unsigned int getSenderCompId(TPacketHeader* packetHeader)
95  {
96  unsigned int senderCompId;
97  const unsigned char * buffer = reinterpret_cast<const unsigned char *>(&packetHeader->senderCompIdData);
98  size_t fieldSize;
99  bool isNull;
100  TransferDecoding::decode(true, buffer, 1, &fieldSize, &senderCompId, &isNull);
101  return senderCompId;
102  }
103 
104  template< class TPacketHeader >
105  static UInt32 getTemplateId(TPacketHeader* packetHeader)
106  {
107  BOOST_ASSERT(packetHeader != NULL);
108 
109  UInt32 templateId = 0;
110  const unsigned char* buffer = reinterpret_cast<const unsigned char*>(&packetHeader->tid);
111  size_t fieldSize = 0;
112  bool isNull = false;
113  TransferDecoding::decode(true, buffer, sizeof(packetHeader->tid), &fieldSize, &templateId, &isNull);
114 
115  BOOST_ASSERT(isNull == false);
116  BOOST_ASSERT(fieldSize != 0);
117 
118  return templateId;
119  }
120 
121  template< class TPacketHeader >
122  static SequenceNumber getSeqNum(const TPacketHeader* packetHeader)
123  {
124  const unsigned char * buffer = reinterpret_cast<const unsigned char *>(&packetHeader->packetSeqNumData[0]);
125 
126  size_t offset = 1; //skip length
127  unsigned int byte4 = *(buffer + offset); offset++;
128  unsigned int byte3 = *(buffer + offset); offset++;
129  unsigned int byte2 = *(buffer + offset); offset++;
130  unsigned int byte1 = *(buffer + offset); offset++;
131  return (byte4 << 24) + (byte3 << 16) + (byte2 << 8) + byte1;
132  }
133 
134  //template< class TPacketHeader >
135  //static SequenceNumber getSeqNum(const HandlerCore::MarketData::FE::PacketContainer& container)
136  //{
137  // return details::getSeqNum<TPacketHeader>(container);
138  //}
139 
140  template< class TPacketHeader >
141  static UInt64 getSendingTime(TPacketHeader* packetHeader)
142  {
143  const unsigned char * buffer = reinterpret_cast<const unsigned char *>(&packetHeader->sendingTimeData[0]);
144 
145  size_t offset = 1; //skip length
146 
147  unsigned int byte8 = *(buffer + offset); offset++;
148  unsigned int byte7 = *(buffer + offset); offset++;
149  unsigned int byte6 = *(buffer + offset); offset++;
150  unsigned int byte5 = *(buffer + offset); offset++;
151  unsigned int byte4 = *(buffer + offset); offset++;
152  unsigned int byte3 = *(buffer + offset); offset++;
153  unsigned int byte2 = *(buffer + offset); offset++;
154  unsigned int byte1 = *(buffer + offset); offset++;
155 
156  UInt64 word2 = (byte8 << 24) + (byte7 << 16) + (byte6 << 8) + byte5;
157  UInt64 word1 = (byte4 << 24) + (byte3 << 16) + (byte2 << 8) + byte1;
158 
159  return (word2 << 32) + word1;
160  }
161 
162  static PartitionId getPartitionId(const PacketHeaderForEMDI* packetHeader)
163  {
164  BOOST_ASSERT(packetHeader);
165 
166  PartitionId partitionId;
167  const unsigned char * buffer = reinterpret_cast<const unsigned char *>(&packetHeader->partitionIdData);
168  size_t fieldSize;
169  bool isNull;
170  TransferDecoding::decode(true, buffer, 1, &fieldSize, &partitionId, &isNull);
171  return partitionId;
172  }
173 
175  {
176  const unsigned char * buffer = reinterpret_cast<const unsigned char *>(&packetHeader->performanceIndicatorData[0]);
177 
178  size_t offset = 1; //skip length
179  unsigned int byte4 = *(buffer + offset); offset++;
180  unsigned int byte3 = *(buffer + offset); offset++;
181  unsigned int byte2 = *(buffer + offset); offset++;
182  unsigned int byte1 = *(buffer + offset); offset++;
183  return (byte4 << 24) + (byte3 << 16) + (byte2 << 8) + byte1;
184  }
185 };
186 
187 
188 
189 
190 }}}}
191 
unsigned int SequenceNumber
Alias for sequence numbers.
unsigned char UInt8
Definition: Numeric.h:35
static SequenceNumber getSeqNum(const TPacketHeader *packetHeader)
Definition: PacketHeader.h:122
UInt32 PartitionId
Alias for Partition ID type.
Definition: Defines.h:48
static UInt32 getTemplateId(TPacketHeader *packetHeader)
Definition: PacketHeader.h:105
static unsigned int getSenderCompId(TPacketHeader *packetHeader)
Definition: PacketHeader.h:94
unsigned int UInt32
Definition: Numeric.h:41
Definition: Group.h:25
static UInt64 getSendingTime(TPacketHeader *packetHeader)
Definition: PacketHeader.h:141
unsigned short UInt16
Definition: Numeric.h:38
static PartitionId getPartitionId(const PacketHeaderForEMDI *packetHeader)
Definition: PacketHeader.h:162
static SequenceNumber getPerformanceIndicator(const PacketHeaderForEMDI *packetHeader)
Definition: PacketHeader.h:174