int main( int argc, char** argv ) { if ( argc != 2 ) { std::cout << "usage: " << argv[ 0 ] << " FILE." << std::endl; return 0; } std::string file = argv[ 1 ]; try { FIX::SessionSettings settings( file ); Application application; FIX::FileStoreFactory storeFactory( settings ); FIX::FileLogFactory logFactory( settings ); FIX::SocketAcceptor acceptor( application, storeFactory, settings, logFactory ); acceptor.start(); //wait(); while(true){ FIX::process_sleep(5); application.sendXMessages(); } acceptor.stop(); return 0; } catch ( std::exception & e ) { std::cout << e.what() << std::endl; return 1; } }
int main( int argc, char** argv ) { if ( argc != 2 ) { std::cout << "usage: " << argv[ 0 ] << " FILE." << std::endl; return 0; } std::string file = argv[ 1 ]; try { FIX::SessionSettings settings( file ); Application application; FIX::FileStoreFactory storeFactory( settings ); FIX::ScreenLogFactory logFactory( settings ); FIX::ThreadedSocketAcceptor acceptor( application, storeFactory, settings, logFactory ); acceptor.start(); wait(); acceptor.stop(); return 0; } catch ( std::exception & e ) { std::cout << e.what() << std::endl; return 1; } }
int main( int argc, char** argv ) { if ( argc != 2 ) { std::cout << "usage: " << argv[ 0 ] << " FILE." << std::endl; return 0; } std::string file = argv[ 1 ]; try { FIX::SessionSettings settings( file ); MDApplication application; FIX::FileStoreFactory storeFactory( settings ); FIX::FileLogFactory logFactory(settings); FIX::SocketInitiator initiator( application, storeFactory, settings, logFactory ); initiator.start(); application.run(); initiator.stop(); return 0; } catch ( std::exception & e ) { std::cout << e.what(); return 1; } }
int main( int argc, char** argv ) { if ( argc < 2 ) { std::cout << "usage: " << argv[ 0 ] << " FILE." << std::endl; return 0; } std::string file = argv[ 1 ]; #ifdef HAVE_SSL std::string isSSL; if (argc > 2) { isSSL.assign(argv[2]); } #endif FIX::Acceptor * acceptor = 0; try { FIX::SessionSettings settings( file ); Application application; FIX::FileStoreFactory storeFactory( settings ); FIX::ScreenLogFactory logFactory( settings ); #ifdef HAVE_SSL if (isSSL.compare("SSL") == 0) acceptor = new FIX::ThreadedSSLSocketAcceptor ( application, storeFactory, settings, logFactory ); else if (isSSL.compare("SSL-ST") == 0) acceptor = new FIX::SSLSocketAcceptor ( application, storeFactory, settings, logFactory ); else #endif acceptor = new FIX::SocketAcceptor ( application, storeFactory, settings, logFactory ); acceptor->start(); wait(); acceptor->stop(); delete acceptor; return 0; } catch ( std::exception & e ) { std::cout << e.what() << std::endl; delete acceptor; return 1; } }
int main( int argc, char** argv ) { if ( argc != 2 ) { std::cout << "usage: " << argv[ 0 ] << " FILE." << std::endl; return 0; } std::string file = argv[ 1 ]; try { FIX::SessionSettings settings( file ); const FIX::Dictionary& defaultDict = settings.get(); QuoteUser = defaultDict.getString( "MySQLQuoteUser" ); QuotePassword = defaultDict.getString( "MySQLQuotePassword" ); QuoteHost = defaultDict.getString( "MySQLQuoteHost" ); SleepCount = defaultDict.getInt( "MySQLQuoteReflush" ); Application application; FIX::FileStoreFactory storeFactory( settings ); FIX::ThreadedSocketAcceptor acceptor( application, storeFactory, settings ); MainDatabase = new QuotationDatabaseCache ( QuoteHost, QuoteUser, QuotePassword ); MainDatabase -> Connect(); acceptor.start(); wait(); acceptor.stop(); return 0; } catch ( std::exception & e ) { std::cout << e.what() << std::endl; return 1; } }
int main(int argc, const char** argv) { std::cout << "client started." << std::endl; if (argc < 2) { std::cout << "usage: ./client <config_file>" << std::endl; exit(1); } std::string fileName = argv[1]; std::cout << "config_file: " << fileName << std::endl; FIX::SessionSettings settings(fileName); FIX::FileStoreFactory storeFactory(settings); FIXApplication application; FIX::SocketInitiator initiator(application, storeFactory, settings); initiator.start(); while (1) { sleep(1); } initiator.stop(); std::cout << "Bye" << std::endl; return 0; }
int main( int argc, char** argv ) { int err = 0; std::string argOutputDir; std::string symbolFile; std::string configFile; std::string password; bool printDebug; (void) signal(SIGINT, sighandler); (void) signal(SIGTERM, sighandler); (void) signal(SIGHUP, sighandler); try { po::options_description desc("Allowed options"); desc.add_options() ("help", "produce help message") ("s", po::value<std::string>(), "<symbol file>") ("c", po::value<std::string>(), "<config file>") ("d", "debug info") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); if (vm.count("help")) { std::cout << desc << "\n"; return 1; } if (vm.count("s")) { std::cout << "Symbol file: " << vm["s"].as<std::string>() << "\n"; symbolFile = vm["s"].as<std::string>(); } else { // use default name for symbols file name symbolFile = "symbols.cfg"; std::cout << "Using default symbols file: symbols.cfg\n"; } if (vm.count("c")) { std::cout << "Config file: " << vm["c"].as<std::string>() << ".\n"; configFile = vm["c"].as<std::string>(); } else { std::cout << "Config file was not set.\n"; err++; } printDebug = vm.count("d") > 0; } catch(std::exception& e) { std::cerr << "EXCEPTION:" << e.what(); return 1; } if (err > 0) { std::cout << "Usage: validate_symbols --c <config_file> --s <symbol_file> \n"; std::cout << "Will save files to MIC.validated-symbols"; return 1; } /* * @see http://www.boost.org/doc/libs/1_41_0/doc/html/program_options.html */ std::vector<std::string> symbols = readSymbols(symbolFile); try { FIX::SessionSettings settings(configFile); std::set<FIX::SessionID> sessions = settings.getSessions (); assert(sessions.size() == 1); FIX::SessionID sessionId = *(sessions.begin()); const FIX::Dictionary& dict = settings.get(sessionId); ApplicationConfig config; // MIC code for adding to output filename config.mic_code = dict.has("MIC") ? dict.getString("MIC") : ""; // Username and password settings config.username = dict.has("Username") ? dict.getString("Username") : ""; config.password = dict.has("Password") ? dict.getString("Password") : ""; config.sendPasswordInRawDataField = dict.has("SendPasswordInRawData") && dict.getBool("SendPasswordInRawData"); // Fix Version string config.version = dict.has("FIXVersion") ? (FIXVersion)atoi(dict.getString("FIXVersion").c_str()) : FIX_42; std::cout << "Using FIX version: " << config.version << std::endl; // Reset sequence numbers? bool bReset = dict.has("ResetSeqNo") ? dict.getBool("ResetSeqNo") : false; std::cout << "Resetting sequence numbers: " << bReset << std::endl; // Debug settings config.printDebug = printDebug; Application application(bReset, config); papplication = &application; application.addSymbols(symbols); // if user specified an output dir, then put files into date-sorted // subdirectories, otherwise put into the default dirs specified in // config file std::string orderBooksOutputDir = "."; std::string logOutputDir = dict.has("FileLogPath") ? dict.getString("FileLogPath") : "."; std::string storeOutputDir = dict.has("FileStorePath") ? dict.getString("FileStorePath") : "."; if (argOutputDir.length() > 0) { orderBooksOutputDir = argOutputDir; fs::path argPath = fs::path(argOutputDir); if (!fs::exists(argPath)) { fs::create_directories(argPath); } /* put both order books and message logs in subdirs, but put the store at the root dir */ fs::path logOutputPath = argPath / fs::path("log"); if (!fs::exists(logOutputPath)) { fs::create_directory(logOutputPath); } logOutputDir = logOutputPath.string(); fs::path storeOutputPath = argPath / fs::path("store"); if (!fs::exists(storeOutputPath)) { fs::create_directory(storeOutputPath); } storeOutputDir = storeOutputPath.string(); } FIX::FileStoreFactory storeFactory(storeOutputDir); FIX::FileLogFactory logFactory(logOutputDir); FIX::SocketInitiator initiator(application, storeFactory, settings, logFactory); pinitiator = &initiator; std::cout << "Starting initiator" << std::endl; initiator.start(); //application.run(); char x; while(std::cin >> x) { std::cout << " Press 'q' to quit" << std::endl; if (x == 'q') { break; } } std::cout << "Stopping initiator..." << std::endl; initiator.stop(); return 0; } catch ( FIX::Exception & e ) { std::cout << e.what(); return 1; } }