Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __PROXY_CLIENT_SESSION_H__
00025 #define __PROXY_CLIENT_SESSION_H__
00026
00027 #include "libts.h"
00028 #include "P_Net.h"
00029 #include "InkAPIInternal.h"
00030
00031
00032
00033
00034 #define DebugSsn(ssn, tag, ...) DebugSpecific((ssn)->debug(), tag, __VA_ARGS__)
00035
00036 class ProxyClientSession : public VConnection
00037 {
00038 public:
00039 ProxyClientSession();
00040
00041 virtual void destroy() = 0;
00042 virtual void start() = 0;
00043
00044 virtual void new_connection(NetVConnection * new_vc, MIOBuffer * iobuf, IOBufferReader * reader, bool backdoor) = 0;
00045
00046 virtual void ssn_hook_append(TSHttpHookID id, INKContInternal * cont) {
00047 this->api_hooks.prepend(id, cont);
00048 }
00049
00050 virtual void ssn_hook_prepend(TSHttpHookID id, INKContInternal * cont) {
00051 this->api_hooks.prepend(id, cont);
00052 }
00053
00054 APIHook * ssn_hook_get(TSHttpHookID id) const {
00055 return this->api_hooks.get(id);
00056 }
00057
00058 void * get_user_arg(unsigned ix) const {
00059 ink_assert(ix < countof(user_args));
00060 return this->user_args[ix];
00061 }
00062
00063 void set_user_arg(unsigned ix, void * arg) {
00064 ink_assert(ix < countof(user_args));
00065 user_args[ix] = arg;
00066 }
00067
00068
00069 bool debug() const {
00070 return this->debug_on;
00071 }
00072
00073 bool hooks_enabled() const {
00074 return this->hooks_on;
00075 }
00076
00077 bool has_hooks() const {
00078 return this->api_hooks.has_hooks() || http_global_hooks->has_hooks();
00079 }
00080
00081
00082 void do_api_callout(TSHttpHookID id);
00083
00084 void cleanup();
00085
00086 static int64_t next_connection_id();
00087
00088 protected:
00089
00090
00091
00092
00093
00094 bool debug_on;
00095 bool hooks_on;
00096
00097 private:
00098 APIHookScope api_scope;
00099 TSHttpHookID api_hookid;
00100 APIHook * api_current;
00101 HttpAPIHooks api_hooks;
00102 void * user_args[HTTP_SSN_TXN_MAX_USER_ARG];
00103
00104 ProxyClientSession(ProxyClientSession &);
00105 ProxyClientSession& operator=(const ProxyClientSession &);
00106
00107 int state_api_callout(int event, void * edata);
00108 void handle_api_return(int event);
00109
00110 friend void TSHttpSsnDebugSet(TSHttpSsn, int);
00111 };
00112
00113 #endif // __PROXY_CLIENT_SESSION_H__