• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

P_VConnection.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   A brief file description
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 
00025 #if !defined (P_VConnection_h)
00026 #define P_VConnection_h
00027 #include "I_EventSystem.h"
00028 
00029 TS_INLINE const char *
00030 get_vc_event_name(int event)
00031 {
00032   switch (event) {
00033   default:
00034     return "unknown event";
00035   case VC_EVENT_NONE:
00036     return "VC_EVENT_NONE";
00037   case VC_EVENT_IMMEDIATE:
00038     return "VC_EVENT_IMMEDIATE";
00039   case VC_EVENT_READ_READY:
00040     return "VC_EVENT_READ_READY";
00041   case VC_EVENT_WRITE_READY:
00042     return "VC_EVENT_WRITE_READY";
00043   case VC_EVENT_READ_COMPLETE:
00044     return "VC_EVENT_READ_COMPLETE";
00045   case VC_EVENT_WRITE_COMPLETE:
00046     return "VC_EVENT_WRITE_COMPLETE";
00047   case VC_EVENT_EOS:
00048     return "VC_EVENT_EOS";
00049   case VC_EVENT_ERROR:
00050     return "VC_EVENT_ERROR";
00051   case VC_EVENT_INACTIVITY_TIMEOUT:
00052     return "VC_EVENT_INACTIVITY_TIMEOUT";
00053   case VC_EVENT_ACTIVE_TIMEOUT:
00054     return "VC_EVENT_ACTIVE_TIMEOUT";
00055   }
00056 }
00057 
00058 
00059 TS_INLINE
00060 VConnection::VConnection(ProxyMutex * aMutex)
00061   :
00062 Continuation(aMutex),
00063 lerrno(0)
00064 {
00065   SET_HANDLER(0);
00066 }
00067 
00068 TS_INLINE
00069 VConnection::~
00070 VConnection()
00071 {
00072 }
00073 
00074 //////////////////////////////////////////////////////////////////////////////
00075 //
00076 //      DEPRECATED DEPRECATED DEPRECATED
00077 //
00078 //      inline VIO * VConnection::do_io()
00079 //
00080 //      This method enqueues a VIO operation onto the VIO queue, and
00081 //      activates the I/O operation if and operation of that type isn't
00082 //      already underway.
00083 //
00084 //////////////////////////////////////////////////////////////////////////////
00085 
00086 TS_INLINE VIO *
00087 vc_do_io_write(VConnection * vc, Continuation * cont, int64_t nbytes, MIOBuffer * buf, int64_t offset)
00088 {
00089   IOBufferReader *reader = buf->alloc_reader();
00090 
00091   if (offset > 0)
00092     reader->consume(offset);
00093 
00094   return vc->do_io_write(cont, nbytes, reader, true);
00095 }
00096 
00097 TS_INLINE VIO *
00098 VConnection::do_io(int op, Continuation * c, int64_t nbytes, MIOBuffer * cb, int data)
00099 {
00100   switch (op) {
00101   case VIO::READ:
00102     return do_io_read(c, nbytes, cb);
00103   case VIO::WRITE:
00104     return vc_do_io_write(this, c, nbytes, cb, data);
00105   case VIO::CLOSE:
00106     do_io_close();
00107     return NULL;
00108   case VIO::ABORT:
00109     do_io_close(data);
00110     return NULL;
00111   case VIO::SHUTDOWN_READ:
00112     do_io_shutdown(IO_SHUTDOWN_READ);
00113     return NULL;
00114   case VIO::SHUTDOWN_WRITE:
00115     do_io_shutdown(IO_SHUTDOWN_WRITE);
00116     return NULL;
00117   case VIO::SHUTDOWN_READWRITE:
00118     do_io_shutdown(IO_SHUTDOWN_READWRITE);
00119     return NULL;
00120   }
00121   ink_assert(!"cannot use default implementation for do_io operation");
00122   return NULL;
00123 }
00124 
00125 TS_INLINE void
00126 VConnection::set_continuation(VIO *, Continuation *)
00127 {
00128 }
00129 TS_INLINE void
00130 VConnection::reenable(VIO *)
00131 {
00132 }
00133 TS_INLINE void
00134 VConnection::reenable_re(VIO * vio)
00135 {
00136   reenable(vio);
00137 }
00138 #endif

Generated by  doxygen 1.7.1