football
socket abstraction layer
Public Member Functions | Static Protected Member Functions | Friends
Football::Connection Class Reference

C++ Connection wrapper. More...

#include <football.h>

Inheritance diagram for Football::Connection:
Football::Thingie

Public Member Functions

ServiceBaseservice (void) const
 Get a connection's parent service. More...
 
virtual ssize_t conditional_print (bool(*callback)(FB_CONNECTION *), const std::string &message) override
 Send a message to some output queues depending on the callback function return value. More...
 
bool transfer (ServiceBase *service, bool invokeNewConnectionHandler=false)
 Transfer a connection to another service. More...
 
void close (void)
 Initiate connection closure.
 
void acceptInput (bool mode)
 Control acceptance of input. More...
 
virtual void newConnection (const FB_EVENT *event)
 Invoked when a new connection has arrived/greeted. More...
 
virtual void connectionClose (const FB_EVENT *event)
 Invoked when a connection is closing. More...
 
virtual void inputReceived (const FB_EVENT *event)
 Invoked when a completed message is received. More...
 
- Public Member Functions inherited from Football::Thingie
ssize_t print (const std::string &message)
 Add a string to the output queues.
 
ssize_t conditional_broadcast (bool(*callback)(FB_CONNECTION *), const std::string &message)
 Send a message to some output queues depending on the callback function return value.
 
ssize_t printf (const char *format,...)
 Add messages to output queues. More...
 
ssize_t vprintf (const char *format, va_list parameters)
 
ssize_t bprintf (const char *format,...)
 
ssize_t bvprintf (const char *format, va_list parameters)
 
ssize_t cbprintf (bool(*callback)(FB_CONNECTION *), const char *format,...)
 
ssize_t cbvprintf (bool(*callback)(FB_CONNECTION *), const char *format, va_list parameters)
 
virtual std::streamsize xsputn (const char_type *data, std::streamsize count) override
 
virtual int_type overflow (int_type c) override
 

Static Protected Member Functions

static ConnectiontryGetFromOld (FB_CONNECTION *connection)
 

Friends

class Iterator
 
class ServiceBase
 
class Arena
 

Additional Inherited Members

Detailed Description

C++ Connection wrapper.

Member Function Documentation

◆ acceptInput()

void Football::Connection::acceptInput ( bool  mode)

Control acceptance of input.

Parameters
modeIf true, enables input. If false, the connection is ignored; received input will be queued and received when input is again enabled.

◆ conditional_print()

ssize_t Football::Connection::conditional_print ( bool(*)(FB_CONNECTION *)  callback,
const std::string &  message 
)
overridevirtual

Send a message to some output queues depending on the callback function return value.

Parameters
callbackA callback function accepting FB_CONNECTION * that returns true to broadcast to, false to skip.
messageThe message to put on the output queue.

Implements Football::Thingie.

◆ connectionClose()

void Football::Connection::connectionClose ( const FB_EVENT event)
virtual

Invoked when a connection is closing.

Corresponds to FB_EVENT_CLOSE event. This is the last notification/event for a connection before it closes.

Parameters
eventClosing connection details.

◆ inputReceived()

void Football::Connection::inputReceived ( const FB_EVENT event)
virtual

Invoked when a completed message is received.

Corresponds to FB_EVENT_INPUT event.

Parameters
eventDetails of the message received.

◆ newConnection()

void Football::Connection::newConnection ( const FB_EVENT event)
virtual

Invoked when a new connection has arrived/greeted.

Corresponds to FB_EVENT_CONNECT.

Parameters
eventThe new connection details, or a nullptr for transferred connections.

◆ service()

ServiceBase * Football::Connection::service ( void  ) const

Get a connection's parent service.

Returns
The C++ service object for the connection.

◆ transfer()

bool Football::Connection::transfer ( ServiceBase newservice,
bool  invokeNewConnectionHandler = false 
)

Transfer a connection to another service.

Parameters
newserviceThe service to transfer to.
invokeNewConnectionHandlerIf true, the newConnection handler is invoked with a nullptr.

The documentation for this class was generated from the following files: