OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  8.1.0
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 = 73 };
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 = 63 };
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 = 68 };
71 
72  Networking::Byte pmap;
73  Networking::Byte tid;
74  Networking::Byte senderCompIdData;
75 
76  Networking::Byte packetSeqNumData[5];
77  Networking::Byte sendingTimeData[9];
78 };
79 
81 {
82  enum { TemplateIdValue = 77 };
83 };
84 
86 {
87  enum { TemplateIdValue = 13000 };
88 
89  UInt16 BodyLen; // Number of bytes for the message, including this field. Message is teh packet header by iyself
90  UInt16 TemplateID; // Unique identifier for a Eurex EOBI message layout. Value: 13003 (TemplateIdValue)
91  UInt32 MsgSeqNum; // Not used
92  UInt32 ApplSeqNum; // Message sequence number is contiguous and is incremented across products.
93  UInt32 MarketSegmentID; // Product identifier.
94  UInt8 PartitionID; // Grouping of Eurex products. Belongs to the scope of Service Availability.
95  UInt8 CompletionIndicator; // Indicated whether an unit of work fits into a single datagram for incremental messages: 0 - Incomplete, 1 - Complete
96  UInt8 ApplSeqResetIndicator; // 0 - No Reset, 1 - Reset
97  UInt8 Pad5[5]; // Padding, not used
98  UInt64 TransactTime; // UTC time when market data feed handler writes packet on the wire.
99 };
100 
101 #pragma pack(pop)
102 
104 {
105  template< class TPacketHeader >
106  static unsigned int getSenderCompId(TPacketHeader* packetHeader)
107  {
108  unsigned int senderCompId;
109  const unsigned char * buffer = reinterpret_cast<const unsigned char *>(&packetHeader->senderCompIdData);
110  size_t fieldSize;
111  bool isnullptr;
112  TransferDecoding::decode(true, buffer, 1, &fieldSize, &senderCompId, &isnullptr);
113  return senderCompId;
114  }
115 
116  template< class TPacketHeader >
117  static UInt32 getTemplateId(TPacketHeader* packetHeader)
118  {
119  BOOST_ASSERT(packetHeader != nullptr);
120 
121  UInt32 templateId = 0;
122  const unsigned char* buffer = reinterpret_cast<const unsigned char*>(&packetHeader->tid);
123  size_t fieldSize = 0;
124  bool isnullptr = false;
125  TransferDecoding::decode(true, buffer, sizeof(packetHeader->tid), &fieldSize, &templateId, &isnullptr);
126 
127  BOOST_ASSERT(isnullptr == false);
128  BOOST_ASSERT(fieldSize != 0);
129 
130  return templateId;
131  }
132 
133  template< class TPacketHeader >
134  static SequenceNumber getSeqNum(const TPacketHeader* packetHeader)
135  {
136  const unsigned char * buffer = reinterpret_cast<const unsigned char *>(&packetHeader->packetSeqNumData[0]);
137 
138  size_t offset = 1; //skip length
139  unsigned int byte4 = *(buffer + offset); offset++;
140  unsigned int byte3 = *(buffer + offset); offset++;
141  unsigned int byte2 = *(buffer + offset); offset++;
142  unsigned int byte1 = *(buffer + offset); offset++;
143  return (byte4 << 24) + (byte3 << 16) + (byte2 << 8) + byte1;
144  }
145 
146  //template< class TPacketHeader >
147  //static SequenceNumber getSeqNum(const HandlerCore::MarketData::FE::PacketContainer& container)
148  //{
149  // return details::getSeqNum<TPacketHeader>(container);
150  //}
151 
152  template< class TPacketHeader >
153  static UInt64 getSendingTime(TPacketHeader* packetHeader)
154  {
155  const unsigned char * buffer = reinterpret_cast<const unsigned char *>(&packetHeader->sendingTimeData[0]);
156 
157  size_t offset = 1; //skip length
158 
159  unsigned int byte8 = *(buffer + offset); offset++;
160  unsigned int byte7 = *(buffer + offset); offset++;
161  unsigned int byte6 = *(buffer + offset); offset++;
162  unsigned int byte5 = *(buffer + offset); offset++;
163  unsigned int byte4 = *(buffer + offset); offset++;
164  unsigned int byte3 = *(buffer + offset); offset++;
165  unsigned int byte2 = *(buffer + offset); offset++;
166  unsigned int byte1 = *(buffer + offset); offset++;
167 
168  UInt64 word2 = (byte8 << 24) + (byte7 << 16) + (byte6 << 8) + byte5;
169  UInt64 word1 = (byte4 << 24) + (byte3 << 16) + (byte2 << 8) + byte1;
170 
171  return (word2 << 32) + word1;
172  }
173 
174  static PartitionId getPartitionId(const PacketHeaderForEMDI* packetHeader)
175  {
176  BOOST_ASSERT(packetHeader);
177 
178  PartitionId partitionId;
179  const unsigned char * buffer = reinterpret_cast<const unsigned char *>(&packetHeader->partitionIdData);
180  size_t fieldSize;
181  bool isnullptr;
182  TransferDecoding::decode(true, buffer, 1, &fieldSize, &partitionId, &isnullptr);
183  return partitionId;
184  }
185 
187  {
188  const unsigned char * buffer = reinterpret_cast<const unsigned char *>(&packetHeader->performanceIndicatorData[0]);
189 
190  size_t offset = 1; //skip length
191  unsigned int byte4 = *(buffer + offset); offset++;
192  unsigned int byte3 = *(buffer + offset); offset++;
193  unsigned int byte2 = *(buffer + offset); offset++;
194  unsigned int byte1 = *(buffer + offset); offset++;
195  return (byte4 << 24) + (byte3 << 16) + (byte2 << 8) + byte1;
196  }
197 };
198 
199 
200 
201 
202 }}}}
203 
unsigned int SequenceNumber
Alias for sequence numbers.
unsigned char UInt8
Definition: Numeric.h:35
static SequenceNumber getSeqNum(const TPacketHeader *packetHeader)
Definition: PacketHeader.h:134
UInt32 PartitionId
Alias for Partition ID type.
Definition: Defines.h:48
static UInt32 getTemplateId(TPacketHeader *packetHeader)
Definition: PacketHeader.h:117
static unsigned int getSenderCompId(TPacketHeader *packetHeader)
Definition: PacketHeader.h:106
unsigned int UInt32
Definition: Numeric.h:41
Definition: Defines.h:30
static UInt64 getSendingTime(TPacketHeader *packetHeader)
Definition: PacketHeader.h:153
unsigned short UInt16
Definition: Numeric.h:38
static PartitionId getPartitionId(const PacketHeaderForEMDI *packetHeader)
Definition: PacketHeader.h:174
static SequenceNumber getPerformanceIndicator(const PacketHeaderForEMDI *packetHeader)
Definition: PacketHeader.h:186