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

HttpClientSession.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 
00026    HttpClientSession.h
00027 
00028    Description:
00029 
00030  ****************************************************************************/
00031 
00032 #ifndef _HTTP_CLIENT_SESSION_H_
00033 #define _HTTP_CLIENT_SESSION_H_
00034 
00035 #include "libts.h"
00036 #include "P_Net.h"
00037 #include "InkAPIInternal.h"
00038 #include "HTTP.h"
00039 #include "HttpConfig.h"
00040 #include "IPAllow.h"
00041 #include "ProxyClientSession.h"
00042 
00043 extern ink_mutex debug_cs_list_mutex;
00044 
00045 class HttpSM;
00046 class HttpServerSession;
00047 
00048 class SecurityContext;
00049 
00050 class HttpClientSession: public ProxyClientSession
00051 {
00052 public:
00053   HttpClientSession();
00054 
00055   // Implement ProxyClientSession interface.
00056   virtual void destroy();
00057 
00058   virtual void start() {
00059     new_transaction();
00060   }
00061 
00062   void new_connection(NetVConnection * new_vc, MIOBuffer * iobuf, IOBufferReader * reader, bool backdoor);
00063 
00064   // Implement VConnection interface.
00065   virtual VIO *do_io_read(Continuation * c, int64_t nbytes = INT64_MAX, MIOBuffer * buf = 0);
00066   virtual VIO *do_io_write(Continuation * c = NULL, int64_t nbytes = INT64_MAX, IOBufferReader * buf = 0, bool owner = false);
00067 
00068   virtual void do_io_close(int lerrno = -1);
00069   virtual void do_io_shutdown(ShutdownHowTo_t howto);
00070   virtual void reenable(VIO * vio);
00071 
00072   void new_transaction();
00073 
00074   void set_half_close_flag() { half_close = true; };
00075   virtual void release(IOBufferReader * r);
00076   NetVConnection *get_netvc() const { return client_vc;  };
00077 
00078   virtual void attach_server_session(HttpServerSession * ssession, bool transaction_done = true);
00079   HttpServerSession *get_server_session() const { return bound_ss; };
00080 
00081   // Used for the cache authenticated HTTP content feature
00082   HttpServerSession *get_bound_ss();
00083 
00084   // Functions for manipulating api hooks
00085   void ssn_hook_append(TSHttpHookID id, INKContInternal * cont);
00086   void ssn_hook_prepend(TSHttpHookID id, INKContInternal * cont);
00087 
00088   int get_transact_count() const { return  transact_count; }
00089 
00090 private:
00091   HttpClientSession(HttpClientSession &);
00092 
00093   int state_keep_alive(int event, void *data);
00094   int state_slave_keep_alive(int event, void *data);
00095   int state_wait_for_close(int event, void *data);
00096   void set_tcp_init_cwnd();
00097 
00098   enum C_Read_State
00099   {
00100     HCS_INIT,
00101     HCS_ACTIVE_READER,
00102     HCS_KEEP_ALIVE,
00103     HCS_HALF_CLOSED,
00104     HCS_CLOSED
00105   };
00106 
00107   int64_t con_id;
00108   NetVConnection *client_vc;
00109   int magic;
00110   int transact_count;
00111   bool tcp_init_cwnd_set;
00112   bool half_close;
00113   bool conn_decrease;
00114 
00115   HttpServerSession *bound_ss;
00116 
00117   MIOBuffer *read_buffer;
00118   IOBufferReader *sm_reader;
00119   HttpSM *current_reader;
00120   C_Read_State read_state;
00121 
00122   VIO *ka_vio;
00123   VIO *slave_ka_vio;
00124 
00125   Link<HttpClientSession> debug_link;
00126 
00127 public:
00128   /// Local address for outbound connection.
00129   IpAddr outbound_ip4;
00130   /// Local address for outbound connection.
00131   IpAddr outbound_ip6;
00132   /// Local port for outbound connection.
00133   uint16_t outbound_port;
00134   /// Set outbound connection to transparent.
00135   bool f_outbound_transparent;
00136   /// Transparently pass-through non-HTTP traffic.
00137   bool f_transparent_passthrough;
00138   /// DNS resolution preferences.
00139   HostResStyle host_res_style;
00140   /// acl record - cache IpAllow::match() call
00141   const AclRecord *acl_record;
00142 
00143   // for DI. An active connection is one that a request has
00144   // been successfully parsed (PARSE_DONE) and it remains to
00145   // be active until the transaction goes through or the client
00146   // aborts.
00147   bool m_active;
00148 };
00149 
00150 extern ClassAllocator<HttpClientSession> httpClientSessionAllocator;
00151 
00152 #endif

Generated by  doxygen 1.7.1