RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
plugins/exchange/rubicon_exchange_connector.h
00001 /* rubicon_exchange_connector.h                                    -*- C++ -*-
00002    Jeremy Barnes, 12 March 2013
00003    Copyright (c) 2013 Datacratic Inc.  All rights reserved.
00004 
00005 */
00006 
00007 #pragma once
00008 
00009 #include "rtbkit/plugins/exchange/http_exchange_connector.h"
00010 
00011 namespace RTBKIT {
00012 
00013 
00014 /*****************************************************************************/
00015 /* RUBICON EXCHANGE CONNECTOR                                                */
00016 /*****************************************************************************/
00017 
00025 struct RubiconExchangeConnector: public HttpExchangeConnector {
00026     
00027     RubiconExchangeConnector(const std::string & name,
00028                              std::shared_ptr<ServiceProxies> proxies);
00029 
00030     virtual std::string exchangeName() const
00031     {
00032         return "rubicon";
00033     }
00034 
00035     virtual std::shared_ptr<BidRequest>
00036     parseBidRequest(HttpAuctionHandler & connection,
00037                     const HttpHeader & header,
00038                     const std::string & payload);
00039 
00040     virtual double
00041     getTimeAvailableMs(HttpAuctionHandler & connection,
00042                        const HttpHeader & header,
00043                        const std::string & payload);
00044 
00045     virtual HttpResponse
00046     getResponse(const HttpAuctionHandler & connection,
00047                 const HttpHeader & requestHeader,
00048                 const Auction & auction) const;
00049 
00050     virtual HttpResponse
00051     getDroppedAuctionResponse(const HttpAuctionHandler & connection,
00052                               const Auction & auction,
00053                               const std::string & reason) const;
00054 
00055     virtual HttpResponse
00056     getErrorResponse(const HttpAuctionHandler & connection,
00057                      const Auction & auction,
00058                      const std::string & errorMessage) const;
00059 
00063     struct CampaignInfo {
00064         Id seat;       
00065     };
00066 
00067     virtual ExchangeCompatibility
00068     getCampaignCompatibility(const AgentConfig & config,
00069                              bool includeReasons) const;
00070     
00074     struct CreativeInfo {
00075         std::string adm;                  
00076         std::vector<std::string> adomain; 
00077         Id crid;                          
00078         OpenRTB::List<OpenRTB::CreativeAttribute> attr; 
00079         std::string ext_creativeapi;      
00080     };
00081 
00082     virtual ExchangeCompatibility
00083     getCreativeCompatibility(const Creative & creative,
00084                              bool includeReasons) const;
00085 
00086     // Rubicon win price decoding function.
00087     static float decodeWinPrice(const std::string & sharedSecret,
00088                                 const std::string & winPriceStr);
00089 };
00090 
00091 
00092 
00093 } // namespace RTBKIT
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator