OnixS ICE iMpact Multicast Price Feed Handler C++ library 8.18.0
Users' manual and API documentation
Loading...
Searching...
No Matches
Conformance Tools Sample

A small command-line utility built on top of the ConformanceTools API. It supports two commands: FetchMulticastChannelGroups, which retrieves the multicast channel configuration for the given credentials, and FetchDebugResponse, which fetches a debug response from the exchange. Both are used during API certification / conformance testing.

Source code

#include "../Common/Utils.h"
#include <cstdlib>
int main(int argc, char** argv)
{
try
{
introduceMyself("Conformance Tools");
if (argc < 2)
{
std::cerr
<< "Usage: " << argv[0] << " <command> <args>\n"
<< "Available commands:\n"
<< " FetchMulticastChannelGroups <host> <port> <username> <password> [<useSsl> "
"<timeoutInMilliseconds> <localNetworkInterface>]\n"
<< " FetchDebugResponse <host> <port> [<useSsl> <timeoutInMilliseconds> <localNetworkInterface>]\n";
return EXIT_FAILURE;
}
const std::string command = argv[1];
if (command == "FetchMulticastChannelGroups")
{
if (argc < 6)
{
std::cerr << "Usage: " << argv[0]
<< " FetchMulticastChannelGroups <host> <port> <username> <password> [<useSsl> "
"<timeoutInMilliseconds> <localNetworkInterface>]\n";
return EXIT_FAILURE;
}
const std::string host = argv[2];
const int port = std::atoi(argv[3]);
const std::string username = argv[4];
const std::string password = argv[5];
const bool useSsl = argc > 6 ? std::atoi(argv[6]) : true;
const unsigned int timeoutInMilliseconds = argc > 7 ? std::atoi(argv[7]) : 30000;
const std::string localNetworkInterface = argc > 8 ? argv[8] : "";
host,
port,
username,
password,
useSsl,
timeoutInMilliseconds,
localNetworkInterface
);
std::cout << multicastChannelGroups << std::endl;
}
else if (command == "FetchDebugResponse")
{
if (argc < 4)
{
std::cerr
<< "Usage: " << argv[0]
<< " FetchDebugResponse <host> <port> [<useSsl> <timeoutInMilliseconds> <localNetworkInterface>]\n";
return EXIT_FAILURE;
}
const std::string host = argv[2];
const int port = std::atoi(argv[3]);
const bool useSsl = argc > 4 ? std::atoi(argv[4]) : true;
const unsigned int timeoutInMilliseconds = argc > 5 ? std::atoi(argv[5]) : 30000;
const std::string localNetworkInterface = argc > 6 ? argv[6] : "";
DebugResponse debugResponse =
ConformanceTools::fetchDebugResponse(host, port, useSsl, timeoutInMilliseconds, localNetworkInterface);
std::cout << debugResponse << std::endl;
}
else
{
std::cerr << "Unknown command: " << command << std::endl;
return EXIT_FAILURE;
}
std::cout << "Done." << std::endl;
}
catch (const std::exception& ex)
{
std::cerr << "Error: " << ex.what() << std::endl;
return EXIT_FAILURE;
}
catch (...)
{
std::cerr << "Unknown exception." << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}