RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
00001 /* generic_exchange_connector.h -*- C++ -*- 00002 Jeremy Barnes, 1 Febrary 2012 00003 Copyright (c) 2012 Datacratic. All rights reserved. 00004 00005 Base class for all Exchange connectors 00006 */ 00007 00008 #pragma once 00009 00010 #include "rtbkit/plugins/exchange/http_exchange_connector.h" 00011 #include "rtbkit/common/exchange_connector.h" 00012 00013 namespace RTBKIT { 00014 00015 00016 /*****************************************************************************/ 00017 /* GENERIC EXCHANGE CONNECTOR */ 00018 /*****************************************************************************/ 00019 00024 struct GenericExchangeConnector 00025 : public RTBKIT::HttpExchangeConnector { 00026 00027 GenericExchangeConnector(ServiceBase & owner, 00028 Json::Value config); 00029 00030 ~GenericExchangeConnector(); 00031 00032 virtual void shutdown(); 00033 00034 int numThreads; 00035 int listenPort; 00036 std::string bindHost; 00037 bool performNameLookup; 00038 int backlog; 00039 00040 virtual std::string exchangeName() const 00041 { 00042 return "rtbkit"; 00043 } 00044 00045 virtual std::shared_ptr<RTBKIT::BidRequest> 00046 parseBidRequest(HttpAuctionHandler & connection, 00047 const HttpHeader & header, 00048 const std::string & payload); 00049 00050 virtual double 00051 getTimeAvailableMs(HttpAuctionHandler & connection, 00052 const HttpHeader & header, 00053 const std::string & payload); 00054 00055 virtual double 00056 getRoundTripTimeMs(HttpAuctionHandler & connection, 00057 const HttpHeader & header); 00058 00059 virtual HttpResponse 00060 getResponse(const HttpAuctionHandler & connection, 00061 const HttpHeader & requestHeader, 00062 const RTBKIT::Auction & auction) const; 00063 00064 virtual HttpResponse 00065 getDroppedAuctionResponse(const HttpAuctionHandler & connection, 00066 const RTBKIT::Auction & auction, 00067 const std::string & reason) const; 00068 00069 virtual HttpResponse 00070 getErrorResponse(const HttpAuctionHandler & connection, 00071 const RTBKIT::Auction & auction, 00072 const std::string & errorMessage) const; 00073 00074 }; 00075 00076 } // namespace RTBKIT