#include <InkAPIPrivateIOCore.h>
Inherits INKContInternal.
Inherited by NullTransform, PrefetchTransform, and RangeTransform.
Public Member Functions | |
INKVConnInternal () | |
INKVConnInternal (TSEventFunc funcp, TSMutex mutexp) | |
void | init (TSEventFunc funcp, TSMutex mutexp) |
virtual void | destroy () |
int | handle_event (int event, void *edata) |
VIO * | do_io_read (Continuation *c, int64_t nbytes, MIOBuffer *buf) |
Read data from the VConnection. | |
VIO * | do_io_write (Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner=false) |
Write data to the VConnection. | |
void | do_io_transform (VConnection *vc) |
void | do_io_close (int lerrno=-1) |
Indicate that the VConnection is no longer needed. | |
void | do_io_shutdown (ShutdownHowTo_t howto) |
Terminate one or both directions of the VConnection. | |
void | reenable (VIO *vio) |
void | retry (unsigned int delay) |
bool | get_data (int id, void *data) |
Convenience function to retrieve information from VConnection. | |
bool | set_data (int id, void *data) |
Convenience function to set information into the VConnection. | |
Data Fields | |
VIO | m_read_vio |
VIO | m_write_vio |
VConnection * | m_output_vc |
Definition at line 66 of file InkAPIPrivateIOCore.h.
INKVConnInternal::INKVConnInternal | ( | ) |
Definition at line 1011 of file InkAPI.cc.
References INKContInternal::m_closed.
INKVConnInternal::INKVConnInternal | ( | TSEventFunc | funcp, | |
TSMutex | mutexp | |||
) |
Definition at line 1017 of file InkAPI.cc.
References handle_event(), INKContInternal::m_closed, and SET_HANDLER.
void INKVConnInternal::destroy | ( | ) | [virtual] |
Reimplemented from INKContInternal.
Definition at line 1032 of file InkAPI.cc.
References INKVConnAllocator, INKContInternal::m_deletable, INKContInternal::m_deleted, m_read_vio, m_write_vio, Continuation::mutex, and VIO::set_continuation().
void INKVConnInternal::do_io_close | ( | int | lerrno = -1 |
) | [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. |
Reimplemented from DummyVConnection.
Definition at line 1106 of file InkAPI.cc.
References VIO::buffer, MIOBufferAccessor::clear(), VConnection::do_io_close(), ET_NET, eventProcessor, ink_assert, VConnection::lerrno, INKContInternal::m_closed, INKContInternal::m_event_count, m_output_vc, m_read_vio, m_write_vio, VIO::op, and EventProcessor::schedule_imm().
Referenced by HttpSM::plugin_agents_cleanup().
VIO * INKVConnInternal::do_io_read | ( | Continuation * | c, | |
int64_t | nbytes, | |||
MIOBuffer * | buf | |||
) | [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. |
Reimplemented from DummyVConnection.
Definition at line 1061 of file InkAPI.cc.
References VIO::buffer, ET_NET, eventProcessor, ink_assert, INKContInternal::m_event_count, m_read_vio, VIO::nbytes, VIO::ndone, VIO::op, EventProcessor::schedule_imm(), VIO::set_continuation(), VIO::vc_server, and MIOBufferAccessor::writer_for().
void INKVConnInternal::do_io_shutdown | ( | ShutdownHowTo_t | howto | ) | [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. |
Reimplemented from DummyVConnection.
Definition at line 1135 of file InkAPI.cc.
References VIO::buffer, MIOBufferAccessor::clear(), ET_NET, eventProcessor, ink_assert, IO_SHUTDOWN_READ, IO_SHUTDOWN_READWRITE, IO_SHUTDOWN_WRITE, INKContInternal::m_event_count, m_read_vio, m_write_vio, VIO::op, and EventProcessor::schedule_imm().
void INKVConnInternal::do_io_transform | ( | VConnection * | vc | ) |
Definition at line 1100 of file InkAPI.cc.
References m_output_vc.
Referenced by TransformVConnection::TransformVConnection().
VIO * INKVConnInternal::do_io_write | ( | Continuation * | c, | |
int64_t | nbytes, | |||
IOBufferReader * | buf, | |||
bool | owner = false | |||
) | [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 |
Reimplemented from DummyVConnection.
Definition at line 1079 of file InkAPI.cc.
References VIO::buffer, ET_NET, eventProcessor, ink_assert, INKContInternal::m_event_count, m_write_vio, VIO::nbytes, VIO::ndone, VIO::op, IOBufferReader::read_avail(), MIOBufferAccessor::reader(), MIOBufferAccessor::reader_for(), EventProcessor::schedule_imm(), VIO::set_continuation(), and VIO::vc_server.
bool INKVConnInternal::get_data | ( | int | id, | |
void * | data | |||
) | [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 from VConnection.
Definition at line 1172 of file InkAPI.cc.
References INKContInternal::m_closed, m_output_vc, m_read_vio, m_write_vio, TS_API_DATA_CLOSED, TS_API_DATA_OUTPUT_VC, TS_API_DATA_READ_VIO, and TS_API_DATA_WRITE_VIO.
int INKVConnInternal::handle_event | ( | int | event, | |
void * | edata | |||
) |
Reimplemented from INKContInternal.
Reimplemented in NullTransform, and RangeTransform.
Definition at line 1044 of file InkAPI.cc.
References INKContInternal::handle_event_count(), INKVConnAllocator, INKContInternal::m_deletable, INKContInternal::m_deleted, INKContInternal::m_event_func, m_read_vio, m_write_vio, Continuation::mutex, and VIO::set_continuation().
Referenced by init(), and INKVConnInternal().
void INKVConnInternal::init | ( | TSEventFunc | funcp, | |
TSMutex | mutexp | |||
) |
Reimplemented from INKContInternal.
Definition at line 1025 of file InkAPI.cc.
References handle_event(), and SET_HANDLER.
void INKVConnInternal::reenable | ( | VIO * | vio | ) | [virtual] |
Reimplemented from VConnection.
Definition at line 1154 of file InkAPI.cc.
References ET_NET, eventProcessor, ink_assert, INKContInternal::m_event_count, and EventProcessor::schedule_imm().
void INKVConnInternal::retry | ( | unsigned int | delay | ) |
Definition at line 1163 of file InkAPI.cc.
References HRTIME_MSECONDS, ink_assert, INKContInternal::m_event_count, and Continuation::mutex.
Referenced by RangeTransform::handle_event(), NullTransform::handle_event(), and PrefetchTransform::handle_event().
bool INKVConnInternal::set_data | ( | int | id, | |
void * | data | |||
) | [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 from VConnection.
Definition at line 1193 of file InkAPI.cc.
References m_output_vc, and TS_API_DATA_OUTPUT_VC.
Definition at line 97 of file InkAPIPrivateIOCore.h.
Referenced by TransformVConnection::backlog(), do_io_close(), do_io_transform(), get_data(), RangeTransform::handle_event(), NullTransform::handle_event(), PrefetchTransform::handle_event(), and set_data().
Definition at line 95 of file InkAPIPrivateIOCore.h.
Referenced by TransformVConnection::backlog(), destroy(), do_io_close(), do_io_read(), do_io_shutdown(), get_data(), and handle_event().
Definition at line 96 of file InkAPIPrivateIOCore.h.
Referenced by destroy(), do_io_close(), do_io_shutdown(), do_io_write(), get_data(), RangeTransform::handle_event(), NullTransform::handle_event(), PrefetchTransform::handle_event(), handle_event(), and RangeTransform::transform_to_range().