|
reSIProcate
SIP stack, Dialog Usage Manager and related libraries
|
Connection implements, via sockets, ConnectionBase for managed connections. More...
#include <Connection.hxx>
Public Member Functions | |
| Connection (Transport *transport, const Tuple &who, Socket socket, Compression &compression, bool isServer) | |
| virtual | ~Connection () |
| Socket | getSocket () const |
| virtual bool | hasDataToRead () |
| always true – always add to fdset as read ready | |
| virtual bool | isGood () |
| has valid connection | |
| virtual bool | checkConnectionTimedout () |
| virtual bool | isWritable () |
| virtual bool | transportWrite () |
| void | requestWrite (SendData *sendData) |
| queue data to write and add this to writable list | |
| int | performWrite () |
| send some or all of a queued data; remove from writable if completely written | |
| bool | performWrites (unsigned int max=0) |
| Call performWrite() repeatedly, until either the send queue is exhausted, the write() call fails (probably because the fd is no longer ready to write), or a set number of writes has been performed. | |
| void | ensureWritable () |
| ensure that we are on the writeable list if required | |
| int | read () |
| move data from the connection to the buffer; move this to front of least recently used list. | |
| bool | performReads (unsigned int max=0) |
| Call read() repeatedly, until an error occurs (because the fd is not ready to read, most likely). | |
| void | enableFlowTimer () |
| Ensures this connection is in the FlowTimer LRU list in the connection manager. | |
| bool | isFlowTimerEnabled () |
| bool | isServer () const |
Public Member Functions inherited from resip::ConnectionBase | |
| ConnectionBase (Transport *transport, const Tuple &who, Compression &compression=Compression::Disabled) | |
| FlowKey | getFlowKey () const |
| virtual Transport * | transport () const |
| Tuple & | who () |
| const uint64_t & | whenLastUsed () |
| void | resetLastUsed () |
| void | addAdditionalFailureString (const Data &additionalFailureString) |
Public Member Functions inherited from resip::IntrusiveListElement< P > | |
| IntrusiveListElement () | |
| virtual | ~IntrusiveListElement () |
| bool | empty () const |
| iterator | begin () |
| iterator | end () |
| void | push_front (P elem) |
| void | push_back (P elem) |
| void | remove () |
Public Member Functions inherited from resip::IntrusiveListElement1< P > | |
| IntrusiveListElement1 () | |
| virtual | ~IntrusiveListElement1 () |
| bool | empty () const |
| iterator | begin () |
| iterator | end () |
| void | push_front (P elem) |
| void | push_back (P elem) |
| void | remove () |
Public Member Functions inherited from resip::IntrusiveListElement2< P > | |
| IntrusiveListElement2 () | |
| virtual | ~IntrusiveListElement2 () |
| bool | empty () const |
| iterator | begin () |
| iterator | end () |
| void | push_front (P elem) |
| void | push_back (P elem) |
| void | remove () |
Public Member Functions inherited from resip::IntrusiveListElement3< P > | |
| IntrusiveListElement3 () | |
| virtual | ~IntrusiveListElement3 () |
| bool | empty () const |
| iterator | begin () |
| iterator | end () |
| void | push_front (P elem) |
| void | push_back (P elem) |
| void | remove () |
Public Member Functions inherited from resip::FdPollItemIf | |
| FdPollItemIf () | |
| virtual | ~FdPollItemIf () |
Static Public Member Functions | |
| static void | setEnablePostConnectSocketFuncCall (bool enabled=true) |
Static Public Member Functions inherited from resip::ConnectionBase | |
| static void | setMessageSizeMax (size_t max) |
Static Public Member Functions inherited from resip::IntrusiveListElement< P > | |
| static P | makeList (P elem) |
Static Public Member Functions inherited from resip::IntrusiveListElement1< P > | |
| static P | makeList (P elem) |
Static Public Member Functions inherited from resip::IntrusiveListElement2< P > | |
| static P | makeList (P elem) |
Static Public Member Functions inherited from resip::IntrusiveListElement3< P > | |
| static P | makeList (P elem) |
Public Attributes | |
| bool | mFirstWriteAfterConnectedPending |
Static Public Attributes | |
| static volatile bool | mEnablePostConnectSocketFuncCall = false |
Protected Member Functions | |
| virtual int | read (char *, const int) |
| pure virtual, but need concrete Connection for book-ends of lists | |
| virtual int | write (const char *, const int) |
| pure virtual, but need concrete Connection for book-ends of lists | |
| virtual void | onDoubleCRLF () |
| virtual void | onSingleCRLF () |
| virtual void | onWsClose (const Data &payload) |
| virtual void | onWsPing (const Data &payload) |
| virtual void | processPollEvent (FdPollEventMask mask) |
| Virtual function of FdPollItemIf, called to process io events. | |
| virtual void | invokeAfterSocketCreationFunc () const |
Protected Member Functions inherited from resip::ConnectionBase | |
| ConnState | getCurrentState () const |
| bool | preparseNewBytes (int bytesRead) |
| bool | wsProcessHandshake (int bytesRead, bool &dropConnection) |
| bool | wsProcessData (int bytesRead) |
| void | wsParseCookies (CookieList &cookieList, const SipMessage *message) |
| void | decompressNewBytes (int bytesRead) |
| std::pair< char *, size_t > | getWriteBuffer () |
| std::pair< char *, size_t > | getCurrentWriteBuffer () |
| char * | getWriteBufferForExtraBytes (int bytesRead, int extraBytes) |
| void | setBuffer (char *bytes, int count) |
| void | setFailureReason (TransportFailure::FailureReason failReason, int subCode, const Data &failureString) |
| virtual | ~ConnectionBase () |
Friends | |
| class | ConnectionManager |
| EncodeStream & | operator<< (EncodeStream &strm, const resip::Connection &c) |
Connection implements, via sockets, ConnectionBase for managed connections.
Connections are managed for approximate fairness and least recently used garbage collection. Connection inherits three different instantiations of intrusive lists.
Definition at line 36 of file Connection.hxx.
| Connection::Connection | ( | Transport * | transport, |
| const Tuple & | who, | ||
| Socket | socket, | ||
| Compression & | compression, | ||
| bool | isServer | ||
| ) |
Definition at line 34 of file Connection.cxx.
|
virtual |
Definition at line 59 of file Connection.cxx.
|
virtual |
Definition at line 549 of file Connection.cxx.
| void Connection::enableFlowTimer | ( | ) |
Ensures this connection is in the FlowTimer LRU list in the connection manager.
Definition at line 484 of file Connection.cxx.
| void Connection::ensureWritable | ( | ) |
ensure that we are on the writeable list if required
Definition at line 348 of file Connection.cxx.
|
inline |
Definition at line 57 of file Connection.hxx.
|
virtual |
always true – always add to fdset as read ready
Reimplemented in resip::TlsConnection, and resip::TcpConnection.
Definition at line 537 of file Connection.cxx.
|
protectedvirtual |
Definition at line 633 of file Connection.cxx.
|
inline |
Definition at line 102 of file Connection.hxx.
|
virtual |
has valid connection
Reimplemented in resip::TlsConnection, and resip::TcpConnection.
Definition at line 543 of file Connection.cxx.
| bool Connection::isServer | ( | ) | const |
Definition at line 627 of file Connection.cxx.
|
virtual |
Reimplemented in resip::TlsConnection, and resip::TcpConnection.
Definition at line 577 of file Connection.cxx.
|
protectedvirtual |
Reimplemented from resip::ConnectionBase.
Definition at line 496 of file Connection.cxx.
|
protectedvirtual |
Reimplemented from resip::ConnectionBase.
Definition at line 508 of file Connection.cxx.
|
protectedvirtual |
Reimplemented from resip::ConnectionBase.
Definition at line 515 of file Connection.cxx.
|
protectedvirtual |
Reimplemented from resip::ConnectionBase.
Definition at line 528 of file Connection.cxx.
| bool Connection::performReads | ( | unsigned int | max = 0 | ) |
Call read() repeatedly, until an error occurs (because the fd is not ready to read, most likely).
| max | The maximum number of reads to perform. 0 indicates that there is no limit. |
Definition at line 464 of file Connection.cxx.
| int Connection::performWrite | ( | ) |
send some or all of a queued data; remove from writable if completely written
Definition at line 94 of file Connection.cxx.
| bool Connection::performWrites | ( | unsigned int | max = 0 | ) |
Call performWrite() repeatedly, until either the send queue is exhausted, the write() call fails (probably because the fd is no longer ready to write), or a set number of writes has been performed.
| max | The maximum number of writes to perform. 0 indicates that there is no limit. |
Definition at line 332 of file Connection.cxx.
|
protectedvirtual |
Virtual function of FdPollItemIf, called to process io events.
Implements resip::FdPollItemIf.
Definition at line 586 of file Connection.cxx.
| int Connection::read | ( | ) |
move data from the connection to the buffer; move this to front of least recently used list.
when the message is complete, it is delivered via mTransport->pushRxMsgUp() which generally puts it on a fifo
Definition at line 375 of file Connection.cxx.
|
inlineprotectedvirtual |
pure virtual, but need concrete Connection for book-ends of lists
Reimplemented in resip::TlsConnection, and resip::TcpConnection.
Definition at line 115 of file Connection.hxx.
| void Connection::requestWrite | ( | SendData * | sendData | ) |
queue data to write and add this to writable list
Definition at line 70 of file Connection.cxx.
|
inlinestatic |
Definition at line 107 of file Connection.hxx.
|
inlinevirtual |
Reimplemented in resip::TlsConnection.
Definition at line 65 of file Connection.hxx.
|
inlineprotectedvirtual |
pure virtual, but need concrete Connection for book-ends of lists
Reimplemented in resip::TlsConnection, and resip::TcpConnection.
Definition at line 117 of file Connection.hxx.
|
friend |
Definition at line 43 of file Connection.hxx.
|
friend |
|
static |
Definition at line 105 of file Connection.hxx.
| bool resip::Connection::mFirstWriteAfterConnectedPending |
Definition at line 104 of file Connection.hxx.