📄 jk_service.h
字号:
/* * Copyright 1999-2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//*************************************************************************** * Description: Definitions of the objects used during the service step. * * These are the web server (ws) the worker and the connection* * JVM connection point * * Author: Gal Shachor <shachor@il.ibm.com> * * Author: Dan Milstein <danmil@shore.net> * * Author: Henri Gomez <hgomez@apache.org> * * Version: $Revision: 1.32 $ * ***************************************************************************/#ifndef JK_SERVICE_H#define JK_SERVICE_H#include "jk_global.h"#include "jk_logger.h"#include "jk_pool.h"#include "jk_map.h"#include "jk_uri_worker_map.h"#include "jk_msg_buff.h"#define JK_RETRIES 3#ifdef __cplusplusextern "C"{#endif /* __cplusplus *//* * Env Information to be provided to worker at init time * With AJP14 support we need to have access to many informations * about web-server, uri to worker map.... */struct jk_worker_env{ /* The URI to WORKER map, will be feeded by AJP14 autoconf feature */ jk_uri_worker_map_t *uri_to_worker; unsigned int num_of_workers; char **worker_list; /* Web-Server we're running on (Apache/IIS/NES) */ char *server_name; /* Virtual server handled - "*" is all virtual */ char *virtual;};typedef struct jk_worker_env jk_worker_env_t;struct jk_ws_service;struct jk_endpoint;struct jk_worker;typedef struct jk_ws_service jk_ws_service_t;typedef struct jk_endpoint jk_endpoint_t;typedef struct jk_worker jk_worker_t;/* * The web server service 'class'. An instance of this class is created * for each request which is forwarded from the web server to the servlet * container. Contains the basic information about the request * (e.g. protocol, req_uri, etc), and also contains a series of methods * which provide access to core web server functionality (start_response, * read, write). This class might be more accurately called ws_request. * * As with all the core jk classes, this is essentially an abstract base * class which is implemented/extended by classes which are specific to a * particular web server. By using an abstract base class in this manner, * workers can be written for different protocols (e.g. ajp12, ajp13, ajp14) * without the workers having to worry about which web server they are * talking to. * * This particular OO-in-C system uses a 'ws_private' pointer to point to * the platform-specific data. So in the subclasses, the methods do most * of their work by getting their hands on the ws_private pointer and then * using that to get at the correctly formatted data and functions for * their platform. * * Try imagining this as a 'public abstract class', and the ws_private * pointer as a sort of extra 'this' reference. Or imagine that you are * seeing the internal vtables of your favorite OO language. Whatever * works for you. * * See apache1.3/mod_jk.c and iis/jk_isapi_plugin.c for examples. */struct jk_ws_service{ /* * A 'this' pointer which is used by the subclasses of this class to * point to data which is specific to a given web server platform * (e.g. Apache or IIS). */ void *ws_private; /* * Provides memory management. All data specific to this request is * allocated within this pool, which can then be reclaimed at the end * of the request handling cycle. * * Alive as long as the request is alive. */ jk_pool_t *pool; /* * CGI Environment needed by servlets */ const char *method; const char *protocol; char *req_uri; const char *remote_addr; const char *remote_host; const char *remote_user; const char *auth_type; const char *query_string; const char *server_name; unsigned server_port; char *server_software; unsigned content_length; /* integer that represents the content */ /* length should be 0 if unknown. */ unsigned is_chunked; /* 1 if content length is unknown (chunked rq) */ unsigned no_more_chunks; /* 1 if last chunk has been read */ unsigned content_read; /* number of bytes read */ /* * SSL information * * is_ssl - True if request is in ssl connection * ssl_cert - If available, base64 ASN.1 encoded client certificates. * ssl_cert_len - Length of ssl_cert, 0 if certificates are not available. * ssl_cipher - The ssl cipher suite in use. * ssl_session - The ssl session string * * In some servers it is impossible to extract all this information, in this * case, we are passing NULL. */ int is_ssl; char *ssl_cert; unsigned ssl_cert_len; char *ssl_cipher; char *ssl_session; /* * SSL extra information for Servlet 2.3 API * * ssl_key_size - ssl key size in use */ int ssl_key_size; /* * Headers, names and values. */ char **headers_names; /* Names of the request headers */ char **headers_values; /* Values of the request headers */ unsigned num_headers; /* Number of request headers */ /* * Request attributes. * * These attributes that were extracted from the web server and are * sent to Tomcat. * * The developer should be able to read them from the ServletRequest * attributes. Tomcat is required to append org.apache.tomcat. to * these attrinbute names. */ char **attributes_names; /* Names of the request attributes */ char **attributes_values; /* Values of the request attributes */ unsigned num_attributes; /* Number of request attributes */ /* * The jvm route is in use when the adapter load balance among * several JVMs. It is the ID of a specific JVM in the load balance * group. We are using this variable to implement JVM session * affinity */ const char *jvm_route; /* Temp solution for auth. For native1 it'll be sent on each request, if an option is present. For native2 it'll be sent with the first request. On java side, both cases will work. For tomcat3.2 or a version that doesn't support secret - don't set the secret, and it'll work. */ const char *secret; /* * Callbacks into the web server. For each, the first argument is * essentially a 'this' pointer. All return JK_TRUE on success * and JK_FALSE on failure. */ /* * Area to get POST data for fail-over recovery in POST */ jk_msg_buf_t *reco_buf; int reco_status; /* Number of retries. Defaults to JK_RETRIES */ int retries; /* * If set call flush after each write */ int flush_packets; /* Uri worker map. Added for virtual host support */ jk_uri_worker_map_t *uw_map; /* * Send the response headers to the browser.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -