RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Attributes | Friends
Datacratic::ConnectionHandler Struct Reference
Inheritance diagram for Datacratic::ConnectionHandler:
Datacratic::ActiveEndpoint::ConnectManager Datacratic::PassiveConnectionHandler Datacratic::HttpConnectionHandler Datacratic::RemoteInputConnection Datacratic::RemoteOutputConnection FakeCarbon::CarbonConnection Datacratic::ChunkedHttpHandler Datacratic::HttpMonitorHandler< Handler, Arg > Datacratic::HttpNamedEndpoint::RestConnectionHandler Datacratic::JsonConnectionHandler Datacratic::HttpMonitorHandler< RouterRestApiConnection, Router * > RTBKIT::HttpAuctionHandler Datacratic::AdHocJsonConnectionHandler RTBKIT::HttpAdServerConnectionHandler RTBKIT::RouterRestApiConnection

List of all members.

Public Member Functions

virtual void onGotTransport ()
virtual void onDisassociate ()
virtual void onHandlerException (const std::string &handler, const std::exception &exc)
virtual void onCleanup ()
virtual void handleError (const std::string &message)
virtual void handleDisconnect ()
virtual std::string status () const
virtual void doError (const std::string &error)=0
void closeConnection ()
ssize_t send (const char *buf, size_t len, int flags)
ssize_t recv (char *buf, size_t buf_size, int flags)
int getHandle () const
void startReading ()
void stopReading ()
void startWriting ()
void stopWriting ()
void scheduleTimerAbsolute (Date timeout, size_t cookie=0, void(*freecookie)(size_t)=0)
void scheduleTimerRelative (double secondsFromNow, size_t cookie=0, void(*freecookie)(size_t)=0)
void cancelTimer ()
void closeWhenHandlerFinished ()
void recycleWhenHandlerFinished ()
virtual void handleInput ()
virtual void handleOutput ()
virtual void handlePeerShutdown ()
virtual void handleTimeout (Date time, size_t cookie)
bool hasTransport () const
TransportBasetransport ()
const TransportBasetransport () const
EndpointBaseget_endpoint ()
void addActivity (const std::string &activity)
void addActivityS (const char *activity)
void addActivity (const char *fmt,...)
void checkMagic () const
void doAsync (const boost::function< void()> &callback, const char *name)

Static Public Attributes

static uint32_t created = 0
static uint32_t destroyed = 0

Friends

class TransportBase

Detailed Description

Definition at line 26 of file connection_handler.h.


Member Function Documentation

void Datacratic::ConnectionHandler::addActivity ( const std::string &  activity)

What should the return code be for the handler? Should be zero if there isn't a fundamental protocol error, -1 if the connection should be closed (normally due to an error) and 1 if more events should be handled. Add an activity to the stream of activities for debugging.

Definition at line 117 of file connection_handler.cc.

void Datacratic::ConnectionHandler::addActivityS ( const char *  activity)

Add an activity to the stream of activities for debugging.

Definition at line 125 of file connection_handler.cc.

Cancel the timer for this connection if it exists.

Reimplemented in RTBKIT::HttpAuctionHandler.

Definition at line 145 of file connection_handler.h.

Close the connection.

Definition at line 63 of file connection_handler.cc.

void Datacratic::ConnectionHandler::doAsync ( const boost::function< void()> &  callback,
const char *  name 
) [inline]

Run the given function from a worker thread in the context of this handler.

Definition at line 210 of file connection_handler.h.

virtual void Datacratic::ConnectionHandler::doError ( const std::string &  error) [pure virtual]

Thing to call when we have an error

Implemented in Datacratic::PassiveConnectionHandler, and Datacratic::ActiveEndpoint::ConnectManager.

virtual void Datacratic::ConnectionHandler::handleDisconnect ( ) [inline, virtual]

Function called when there is a disconnection when reading.

Reimplemented in FakeCarbon::CarbonConnection, Datacratic::RemoteInputConnection, Datacratic::RemoteOutputConnection, RTBKIT::HttpAuctionHandler, and Datacratic::ChunkedHttpHandler.

Definition at line 80 of file connection_handler.h.

virtual void Datacratic::ConnectionHandler::handleError ( const std::string &  message) [inline, virtual]
virtual void Datacratic::ConnectionHandler::onCleanup ( ) [inline, virtual]

Function called out to to clean up before we finish for whatever reason.

Reimplemented in Datacratic::ActiveEndpoint::ConnectManager, Datacratic::HttpConnectionHandler, Datacratic::RemoteInputConnection, Datacratic::RemoteOutputConnection, and RTBKIT::HttpAuctionHandler.

Definition at line 68 of file connection_handler.h.

virtual void Datacratic::ConnectionHandler::onDisassociate ( ) [inline, virtual]

Function called when we're dissociating the connection.

Reimplemented in RTBKIT::HttpAuctionHandler.

Definition at line 51 of file connection_handler.h.

virtual void Datacratic::ConnectionHandler::onGotTransport ( ) [inline, virtual]
virtual void Datacratic::ConnectionHandler::onHandlerException ( const std::string &  handler,
const std::exception &  exc 
) [inline, virtual]

Function called when a handler throws an exception.

Definition at line 56 of file connection_handler.h.

ssize_t Datacratic::ConnectionHandler::recv ( char *  buf,
size_t  buf_size,
int  flags 
) [inline]

Pass on a recv request to the transport.

Definition at line 103 of file connection_handler.h.

void Datacratic::ConnectionHandler::scheduleTimerAbsolute ( Date  timeout,
size_t  cookie = 0,
void(*)(size_t)  freecookie = 0 
) [inline]

Schedule a timeout at the given absolute time. Only one timer is available per connection.

Definition at line 127 of file connection_handler.h.

void Datacratic::ConnectionHandler::scheduleTimerRelative ( double  secondsFromNow,
size_t  cookie = 0,
void(*)(size_t)  freecookie = 0 
) [inline]

Schedule a timeout at the given number of seconds from now. Again, only one timer is available per connection.

Definition at line 137 of file connection_handler.h.

ssize_t Datacratic::ConnectionHandler::send ( const char *  buf,
size_t  len,
int  flags 
) [inline]

Pass on a send request to the transport.

Definition at line 97 of file connection_handler.h.

React to read events

Definition at line 72 of file connection_handler.cc.

React to read events

Definition at line 88 of file connection_handler.cc.

Stop reacting to read events

Definition at line 80 of file connection_handler.cc.

Stop reacting to read events

Definition at line 96 of file connection_handler.cc.


The documentation for this struct was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator