libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
fix_to_general_program_options.cpp
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright © 2017 by J.M.McGuiness, isimud@hussar.me.uk
3 **
4 ** This library is free software; you can redistribute it and/or
5 ** modify it under the terms of the GNU Lesser General Public
6 ** License as published by the Free Software Foundation; either
7 ** version 2.1 of the License, or (at your option) any later version.
8 **
9 ** This library is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ** Lesser General Public License for more details.
13 **
14 ** You should have received a copy of the GNU Lesser General Public
15 ** License along with this library; if not, write to the Free Software
16 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 
20 
21 #include "../common/thread_traits.hpp"
22 
23 #include <boost/asio.hpp>
24 
25 using namespace libjmmcg;
26 
27 namespace isimud { namespace ISIMUD_VER_NAMESPACE { namespace exchanges {
28 
29 boost::program_options::options_description
30 create_program_options() noexcept(false) {
31  std::ostringstream msg;
32  msg<<"A FIX-to-exchange translator that listens to an IPADDR:PORT combination for a FIX client and connects to the specified ports. The executable name indicates the message translation performed & versions. Compiled to run on NUMA node: "<<common::thread_traits::numa_index<<". For details regarding the properties of the translator see the documentation that came with the distribution. Note that Wireshark has a built-in FIX protocol: see the \"Analyze/Enabled Protocols...\" dialog in Wireshark or https://www.wireshark.org/docs/dfref/f/fix.html. Copyright © J.M.McGuiness, consultant@isimud.ltd.uk. http://libjmmcg.sf.net/ Distributed under the terms of the GPL v2.1.\n"<<exit_codes::to_string();
33  boost::program_options::options_description general(msg.str());
34  general.add_options()
35  ("help", "Print this help message.")
36  ("version", "Print the build number of this program.")
37  ;
38  boost::program_options::options_description performance("Performance-monitoring options.");
39  performance.add_options()
40  (
41  "num_timings",
42  boost::program_options::value<unsigned long>()->required()->default_value(0UL),
43  "The number (positive-integer) of latency timings to reserve. This value must be greater than the total number of messages to be processed, otherwise the behaviour is undefined. Upon exit, these values will be written in CSV-format to a file named 'argv[0]+\"-%%%%%.PID.csv\"' (where each '%' is a random hexadecimal digit and PID is the current process id). This file shall be created in the current directory. If the value is zero, then the file shall not be created, no values will be stored, unlimited messages may be processed."
44  );
45  boost::program_options::options_description client("FIX-client options.");
46  client.add_options()
47  (
48  "client_address",
49  boost::program_options::value<std::string>()->required()->default_value(boost::asio::ip::address_v4::loopback().to_string()),
50  "IP address (in v4 format; thus the network interface to which it is bound) to which the translator should listen."
51  )
52  (
53  "client_port",
54  boost::program_options::value<unsigned short>()->required(),
55  "An unused port to which the translator should listen."
56  );
57  boost::program_options::options_description all("All options.");
58  all.add(general).add(client).add(performance);
59  return all;
60 }
61 
62 } } }