OnixS C++ SGX Titan ITCH Market Data Handler  1.2.2
API documentation
GlimpsePacketProcessor.cpp
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 #include "GlimpsePacketProcessor.h"
21 
23 
24 #include "Formatting.h"
25 #include "MessageRepository.h"
26 
27 using namespace OnixS::HandlerCore::Common;
28 using namespace OnixS::HandlerCore::MarketData;
29 using namespace OnixS::Util;
30 
31 ONIXS_HANDLER_NAMESPACE_BEGIN
32 
33  GlimpsePacketProcessor::GlimpsePacketProcessor(HandlerLogger* logger, const Logging::LogFacility* parent, MessageRepository* messageRepository) :
34  Logging::LogFacility("Glimpse", parent, OnixS::Logging::LOG_LEVEL_DEBUG),
35  logger_(logger),
36  messageRepository_(messageRepository)
37  {
38  BOOST_ASSERT(logger_ != nullptr);
39  }
40 
42  {
43  }
44 
46  {
47  }
48 
49  void GlimpsePacketProcessor::onPacket(FE::PacketContainer& packetContainer)
50  {
51  const char* const data = static_cast<const char*>(packetContainer.data());
52  const size_t size = packetContainer.size();
53 
54  BOOST_ASSERT(data != nullptr);
55  BOOST_ASSERT(size != 0);
56 
57  logger_->log(ONIXS_LOG_INFO[this] << "Received " << size << " bytes (" << Base64Source(data, size) << ").");
58 
59  DataSource dataSource;
60  dataSource.origin = DataSource::glimpse;
61  dataSource.packetMessageCount = 1;
62  dataSource.packetMessageNumber = 0;
63  dataSource.packetReceptionTime = Timestamp();
64  dataSource.messageSeqNum = 0;
65  dataSource.session = nullptr; /*reinterpret_cast<const Byte*>(sessionId.c_str())*/;
66 
67  IncomingMessage msg(reinterpret_cast<const unsigned char*>(data), static_cast<UInt16>(size));
68  messageRepository_->processMessage(dataSource, &msg);
69  }
70 
71 ONIXS_HANDLER_NAMESPACE_END
Origin origin
the way data received
Definition: Defines.h:77
UInt16 packetMessageCount
Message sequence number.
Definition: Defines.h:65
Represents timestamp without time-zone information.
Definition: Timestamp.h:84
const Byte * session
Session Id.
Definition: Defines.h:74
void processMessage(const DataSource &dataSource, const IncomingMessage *message)
UInt8 packetMessageNumber
Number of message in packet.
Definition: Defines.h:68
UInt64 messageSeqNum
Message sequence number.
Definition: Defines.h:71
Timestamp packetReceptionTime
Time when the packet was received by Handler from UDP, in system ticks,.
Definition: Defines.h:62
void onPacket(OnixS::HandlerCore::MarketData::FE::PacketContainer &) override