RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
00001 /* remote_input.h -*- C++ -*- 00002 Jeremy Barnes, 26 May 2011 00003 Copyright (c) 2011 Datacratic. All rights reserved. 00004 00005 The input side of a remote logging connection. 00006 */ 00007 00008 #pragma once 00009 00010 #include "logger.h" 00011 #include "soa/service/passive_endpoint.h" 00012 00013 00014 namespace Datacratic { 00015 00016 struct RemoteInput { 00017 00018 RemoteInput(); 00019 00020 ~RemoteInput(); 00021 00023 void listen(int port, 00024 const std::string & address, 00025 boost::function<void ()> onShutdown = boost::function<void ()>()); 00026 00028 void shutdown(); 00029 00031 int port() const 00032 { 00033 return endpoint.port(); 00034 } 00035 00037 boost::function<void (const std::string &)> onData; 00038 00039 private: 00040 PassiveEndpointT<SocketTransport> endpoint; 00041 boost::function<void ()> onShutdown; 00042 }; 00043 00044 } // namespace Datacratic