Base class for the connection classes that provide IO capabilities. More...
#include <I_VConnection.h>
Inherits Continuation.
Inherited by CacheVConnection, DummyVConnection, HttpServerSession, NetVConnection, ProxyClientSession, TransformTerminus, and TransformVCChain.
Public Member Functions | |
virtual | ~VConnection () |
virtual VIO * | do_io_read (Continuation *c=NULL, int64_t nbytes=INT64_MAX, MIOBuffer *buf=0)=0 |
Read data from the VConnection. | |
virtual VIO * | do_io_write (Continuation *c=NULL, int64_t nbytes=INT64_MAX, IOBufferReader *buf=0, bool owner=false)=0 |
Write data to the VConnection. | |
virtual void | do_io_close (int lerrno=-1)=0 |
Indicate that the VConnection is no longer needed. | |
virtual void | do_io_shutdown (ShutdownHowTo_t howto)=0 |
Terminate one or both directions of the VConnection. | |
VConnection (ProxyMutex *aMutex) | |
VIO * | do_io (int op, Continuation *c=NULL, int64_t nbytes=INT64_MAX, MIOBuffer *buf=0, int data=0) |
virtual void | set_continuation (VIO *vio, Continuation *cont) |
virtual void | reenable (VIO *vio) |
virtual void | reenable_re (VIO *vio) |
virtual bool | get_data (int id, void *data) |
Convenience function to retrieve information from VConnection. | |
virtual bool | set_data (int id, void *data) |
Convenience function to set information into the VConnection. | |
Data Fields | |
int | lerrno |
The error code from the last error. |
Base class for the connection classes that provide IO capabilities.
The VConnection class is an abstract representation of a uni or bi-directional data conduit returned by a Processor. In a sense, they serve a similar purpose to file descriptors. A VConnection is a pure base class that defines methods to perform stream IO. It is also a Continuation that is called back from processors.
Definition at line 150 of file I_VConnection.h.
TS_INLINE VConnection::~VConnection | ( | ) | [virtual] |
Definition at line 70 of file P_VConnection.h.
TS_INLINE VConnection::VConnection | ( | ProxyMutex * | aMutex | ) |
Definition at line 60 of file P_VConnection.h.
References SET_HANDLER.
TS_INLINE VIO * VConnection::do_io | ( | int | op, | |
Continuation * | c = NULL , |
|||
int64_t | nbytes = INT64_MAX , |
|||
MIOBuffer * | buf = 0 , |
|||
int | data = 0 | |||
) |
Definition at line 98 of file P_VConnection.h.
References VIO::ABORT, VIO::CLOSE, do_io_close(), do_io_read(), do_io_shutdown(), ink_assert, IO_SHUTDOWN_READ, IO_SHUTDOWN_READWRITE, IO_SHUTDOWN_WRITE, VIO::READ, VIO::SHUTDOWN_READ, VIO::SHUTDOWN_READWRITE, VIO::SHUTDOWN_WRITE, vc_do_io_write(), and VIO::WRITE.
Referenced by HttpCacheSM::abort_read(), HttpCacheSM::abort_write(), TestProxy::cacheSendGetEvent(), HttpCacheSM::close_read(), OneWayMultiTunnel::close_target_vio(), HttpCacheSM::close_write(), ClusterAccept::ClusterAcceptMachine(), TestProxy::clusterEvent(), TestProxy::clusterOpenEvent(), TestProxy::connectEvent(), CacheContinuation::disposeOfDataBuffer(), TestProxy::done(), ClusterVConnectionCacheEvent::eventHandler(), OneWayMultiTunnel::init(), SSLNextProtocolTrampoline::ioCompletionEvent(), CacheContinuation::localVCsetupEvent(), ClusterHandler::machine_down(), ObjectReloadCont::ObjectReloadEvent(), CacheContinuation::remoteOpEvent(), CacheContinuation::replyOpEvent(), ICPPeerReadCont::StaleCheck(), TestAccept::startEvent(), TSVConnRead(), HttpSM::tunnel_handler_cache_write(), HttpSM::tunnel_handler_plugin_agent(), HttpSM::tunnel_handler_transform_write(), CacheContinuation::VCdataRead(), and ClusterHandler::~ClusterHandler().
virtual void VConnection::do_io_close | ( | int | lerrno = -1 |
) | [pure virtual] |
Indicate that the VConnection is no longer needed.
Once the state machine has finished using this VConnection, it must call this function to indicate that the VConnection can be deallocated. After a close has been called, the VConnection and underlying processor must not send any more events related to this VConnection to the state machine. Likeswise, the state machine must not access the VConnection or any VIOs obtained from it after calling this method.
lerrno | indicates where a close is a normal close or an abort. The difference between a normal close and an abort depends on the underlying type of the VConnection. |
Implemented in CacheVConnection, CacheVC, ClusterVConnectionBase, ClusterVConnection, DummyVConnection, NetVConnection, UnixNetVConnection, INKVConnInternal, HttpClientSession, HttpServerSession, Http2ClientSession, TransformTerminus, and TransformVConnection.
Referenced by PrefetchBlaster::blastObject(), HttpTunnel::chain_abort_all(), HttpTunnel::chain_abort_cache_write(), HttpVCTable::cleanup_entry(), OneWayTunnel::close_source_vio(), OneWayTunnel::close_target_vio(), HttpTunnel::close_vc(), do_io(), TransformVConnection::do_io_close(), INKVConnInternal::do_io_close(), PrefetchBlaster::free(), TransformControl::handle_event(), PrefetchBlaster::invokeBlaster(), HttpSM::transform_cleanup(), TSVConnAbort(), TSVConnClose(), HttpSM::tunnel_handler_100_continue_ua(), HttpSM::tunnel_handler_cache_read(), HttpSM::tunnel_handler_cache_write(), HttpSM::tunnel_handler_plugin_agent(), HttpSM::tunnel_handler_post_server(), HttpSM::tunnel_handler_post_ua(), HttpSM::tunnel_handler_server(), HttpSM::tunnel_handler_ssl_consumer(), HttpSM::tunnel_handler_transform_read(), HttpSM::tunnel_handler_transform_write(), and HttpSM::tunnel_handler_ua_push().
virtual VIO* VConnection::do_io_read | ( | Continuation * | c = NULL , |
|
int64_t | nbytes = INT64_MAX , |
|||
MIOBuffer * | buf = 0 | |||
) | [pure virtual] |
Read data from the VConnection.
Called by a state machine to read data from the VConnection. Processors implementing read functionality take out lock, put new bytes on the buffer and call the continuation back before releasing the lock in order to enable the state machine to handle transfer schemes where the end of a given transaction is marked by a special character (ie: NNTP).
Possible Event Codes
On the callback to the continuation, the VConnection may use on of the following values for the event code:
Event code | Meaning |
VC_EVENT_READ_READY | Data has been added to the buffer or the buffer is full |
VC_EVENT_READ_COMPLETE | The amount of data indicated by 'nbytes' has been read into the buffer |
VC_EVENT_EOS | The stream being read from has been shutdown |
VC_EVENT_ERROR | An error occurred during the read |
c | Continuation to be called back with events. | |
nbytes | Number of bytes to read. If unknown, nbytes must be set to INT64_MAX. | |
buf | buffer to read into. |
Implemented in CacheVConnection, CacheVC, ClusterVConnectionBase, ClusterVConnection, DummyVConnection, NetVConnection, UnixNetVConnection, INKVConnInternal, HttpClientSession, HttpServerSession, Http2ClientSession, TransformTerminus, and TransformVConnection.
Referenced by PrefetchBlaster::bufferObject(), do_io(), TransformControl::handle_event(), HttpSM::handle_server_setup_error(), OneWayTunnel::init(), CacheContinuation::setupVCdataRead(), HttpSM::tunnel_handler_post_server(), and HttpSM::tunnel_handler_post_ua().
virtual void VConnection::do_io_shutdown | ( | ShutdownHowTo_t | howto | ) | [pure virtual] |
Terminate one or both directions of the VConnection.
Indicates that one or both sides of the VConnection should be terminated. After this call is issued, no further I/O can be done on the specified direction of the connection. The processor must not send any further events (including timeout events) to the state machine, and the state machine must not use any VIOs from a shutdown direction of the connection. Even if both sides of a connection are shutdown, the state machine must still call do_io_close() when it wishes the VConnection to be deallocated.
Possible howto values
Value | Meaning |
IO_SHUTDOWN_READ | Indicates that this VConnection should not generate any more read events |
IO_SHUTDOWN_WRITE | Indicates that this VConnection should not generate any more write events |
IO_SHUTDOWN_READWRITE | Indicates that this VConnection should not generate any more read nor write events |
howto | Specifies which direction of the VConnection to shutdown. |
Implemented in CacheVConnection, ClusterVConnectionBase, DummyVConnection, NetVConnection, UnixNetVConnection, INKVConnInternal, HttpClientSession, HttpServerSession, Http2ClientSession, TransformTerminus, and TransformVConnection.
Referenced by do_io(), TransformVConnection::do_io_shutdown(), RangeTransform::handle_event(), NullTransform::handle_event(), PrefetchTransform::handle_event(), HttpSM::handle_server_setup_error(), TSVConnShutdown(), HttpSM::tunnel_handler_post_server(), HttpSM::tunnel_handler_ssl_consumer(), HttpSM::tunnel_handler_ssl_producer(), and HttpSM::tunnel_handler_transform_write().
virtual VIO* VConnection::do_io_write | ( | Continuation * | c = NULL , |
|
int64_t | nbytes = INT64_MAX , |
|||
IOBufferReader * | buf = 0 , |
|||
bool | owner = false | |||
) | [pure virtual] |
Write data to the VConnection.
This method is called by a state machine to write data to the VConnection.
Possible Event Codes
On the callback to the continuation, the VConnection may use on of the following event codes:
Event code | Meaning |
VC_EVENT_WRITE_READY | Data was written from the reader or there are no bytes available for the reader to write. |
VC_EVENT_WRITE_COMPLETE | The amount of data indicated by 'nbytes' has been written to the VConnection |
VC_EVENT_INACTIVITY_TIMEOUT | No activity was performed for a certain period. |
VC_EVENT_ACTIVE_TIMEOUT | Write operation continued beyond a time limit. |
VC_EVENT_ERROR | An error occurred during the write |
c | Continuation to be called back with events. | |
nbytes | Number of bytes to write. If unknown, nbytes must be set to INT64_MAX. | |
buf | Reader whose data is to be read from. | |
owner |
Implemented in CacheVConnection, CacheVC, ClusterVConnectionBase, ClusterVConnection, DummyVConnection, NetVConnection, UnixNetVConnection, INKVConnInternal, HttpClientSession, HttpServerSession, Http2ClientSession, TransformTerminus, and TransformVConnection.
Referenced by TransformVConnection::do_io_write(), RangeTransform::handle_event(), NullTransform::handle_event(), TransformControl::handle_event(), PrefetchTransform::handle_event(), PrefetchBlaster::httpClient(), OneWayTunnel::init(), HttpSM::setup_server_send_request(), TSVConnWrite(), and vc_do_io_write().
virtual bool VConnection::get_data | ( | int | id, | |
void * | data | |||
) | [inline, virtual] |
Convenience function to retrieve information from VConnection.
This function is provided as a convenience for state machines to transmit information from/to a VConnection without breaking the VConnection abstraction. Its behavior varies depending on the type of VConnection being used.
id | Identifier associated to interpret the data field | |
data | Value or pointer with state machine or VConnection data. |
Reimplemented in CacheVC, ClusterVConnection, UnixNetVConnection, and INKVConnInternal.
Definition at line 342 of file I_VConnection.h.
Referenced by TSTransformOutputVConnGet(), TSVConnClosedGet(), TSVConnReadVIOGet(), and TSVConnWriteVIOGet().
TS_INLINE void VConnection::reenable | ( | VIO * | vio | ) | [virtual] |
Reimplemented in CacheVConnection, CacheVC, ClusterVConnectionBase, ClusterVConnection, NetVConnection, UnixNetVConnection, INKVConnInternal, HttpClientSession, HttpServerSession, Http2ClientSession, TransformTerminus, and TransformVConnection.
Definition at line 130 of file P_VConnection.h.
Referenced by VIO::reenable(), and reenable_re().
TS_INLINE void VConnection::reenable_re | ( | VIO * | vio | ) | [virtual] |
Reimplemented in CacheVConnection, CacheVC, ClusterVConnectionBase, NetVConnection, and UnixNetVConnection.
Definition at line 134 of file P_VConnection.h.
References reenable().
Referenced by VIO::reenable_re().
TS_INLINE void VConnection::set_continuation | ( | VIO * | vio, | |
Continuation * | cont | |||
) | [virtual] |
Definition at line 126 of file P_VConnection.h.
Referenced by VIO::set_continuation().
virtual bool VConnection::set_data | ( | int | id, | |
void * | data | |||
) | [inline, virtual] |
Convenience function to set information into the VConnection.
This function is provided as a convenience for state machines to transmit information from/to a VConnection without breaking the VConnection abstraction. Its behavior varies depending on the type of VConnection being used.
id | Identifier associated to interpret the data field. | |
data | Value or pointer with state machine or VConnection data. |
Reimplemented in CacheVC, and INKVConnInternal.
Definition at line 362 of file I_VConnection.h.
The error code from the last error.
Indicates the last error on the VConnection. They are either system error codes or from the InkErrno.h file.
Definition at line 378 of file I_VConnection.h.
Referenced by ClusterHandler::close_ClusterVConnection(), ClusterHandler::cluster_signal_error_and_update(), UnixNetVConnection::connectUp(), UnixNetVConnection::do_io_close(), TransformTerminus::do_io_close(), INKVConnInternal::do_io_close(), ClusterVConnectionBase::do_io_close(), HttpSM::handle_server_setup_error(), read_signal_error(), and write_signal_error().