Public Member Functions | Data Fields

HttpServerSession Class Reference

#include <HttpServerSession.h>

Inherits VConnection.

Collaboration diagram for HttpServerSession:
Collaboration graph
[legend]

Public Member Functions

 HttpServerSession ()
void destroy ()
void new_connection (NetVConnection *new_vc)
void reset_read_buffer (void)
IOBufferReaderget_reader ()
virtual VIOdo_io_read (Continuation *c, int64_t nbytes=INT64_MAX, MIOBuffer *buf=0)
 Read data from the VConnection.
virtual VIOdo_io_write (Continuation *c=NULL, int64_t nbytes=INT64_MAX, IOBufferReader *buf=0, bool owner=false)
 Write data to the VConnection.
virtual void do_io_close (int lerrno=-1)
 Indicate that the VConnection is no longer needed.
virtual void do_io_shutdown (ShutdownHowTo_t howto)
 Terminate one or both directions of the VConnection.
virtual void reenable (VIO *vio)
void release ()
void attach_hostname (const char *hostname)
NetVConnectionget_netvc ()
 LINK (HttpServerSession, ip_hash_link)
 LINK (HttpServerSession, host_hash_link)

Data Fields

IpEndpoint server_ip
INK_MD5 hostname_hash
int64_t con_id
int transact_count
HSS_State state
bool to_parent_proxy
int server_trans_stat
bool private_session
TSServerSessionSharingMatchType sharing_match
TSServerSessionSharingPoolType sharing_pool
bool enable_origin_connection_limiting
ConnectionCountconnection_count
MIOBufferread_buffer

Detailed Description

Definition at line 68 of file HttpServerSession.h.


Constructor & Destructor Documentation

HttpServerSession::HttpServerSession (  )  [inline]

Definition at line 71 of file HttpServerSession.h.

References server_ip.


Member Function Documentation

void HttpServerSession::attach_hostname ( const char *  hostname  )  [inline]
void HttpServerSession::destroy (  ) 
void HttpServerSession::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.

Parameters:
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.

Implements VConnection.

Definition at line 115 of file HttpServerSession.cc.

References ats_ip_ntop(), con_id, connection_count, Debug, destroy(), NetVConnection::do_io_close(), enable_origin_connection_limiting, Error, ConnectionCount::getCount(), HSS_ACTIVE, http_current_parent_proxy_connections_stat, http_current_server_connections_stat, http_current_server_transactions_stat, HTTP_DECREMENT_DYN_STAT, HTTP_SUM_DYN_STAT, HTTP_SUM_GLOBAL_DYN_STAT, http_transactions_per_server_con, ConnectionCount::incrementCount(), IpEndpoint::sa, server_ip, server_trans_stat, state, to_parent_proxy, and transact_count.

Referenced by ServerSessionPool::eventHandler(), release(), and HttpSM::release_server_session().

VIO * HttpServerSession::do_io_read ( Continuation c,
int64_t  nbytes = INT64_MAX,
MIOBuffer buf = 0 
) [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
Parameters:
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.
Returns:
VIO representing the scheduled IO operation.

Implements VConnection.

Definition at line 97 of file HttpServerSession.cc.

References NetVConnection::do_io_read().

Referenced by HttpSM::attach_server_session(), HttpClientSession::attach_server_session(), ServerSessionPool::releaseSession(), and HttpSM::setup_server_read_response_header().

void HttpServerSession::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
Parameters:
howto Specifies which direction of the VConnection to shutdown.

Implements VConnection.

Definition at line 109 of file HttpServerSession.cc.

References NetVConnection::do_io_shutdown().

VIO * HttpServerSession::do_io_write ( Continuation c = NULL,
int64_t  nbytes = INT64_MAX,
IOBufferReader buf = 0,
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
Parameters:
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 
Returns:
VIO representing the scheduled IO operation.

Implements VConnection.

Definition at line 103 of file HttpServerSession.cc.

References NetVConnection::do_io_write().

Referenced by HttpSM::attach_server_session(), HttpClientSession::attach_server_session(), and ServerSessionPool::releaseSession().

NetVConnection* HttpServerSession::get_netvc (  )  [inline]
IOBufferReader* HttpServerSession::get_reader (  )  [inline]
HttpServerSession::LINK ( HttpServerSession  ,
host_hash_link   
)
HttpServerSession::LINK ( HttpServerSession  ,
ip_hash_link   
)
void HttpServerSession::new_connection ( NetVConnection new_vc  ) 
void HttpServerSession::reenable ( VIO vio  )  [virtual]

Reimplemented from VConnection.

Definition at line 153 of file HttpServerSession.cc.

References NetVConnection::reenable().

void HttpServerSession::release (  ) 
void HttpServerSession::reset_read_buffer ( void   )  [inline]

Field Documentation

Definition at line 143 of file HttpServerSession.h.

Referenced by release(), and HttpSM::state_http_server_open().

Definition at line 132 of file HttpServerSession.h.

Referenced by do_io_close(), and HttpSM::state_http_server_open().


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