Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ajp.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
26 #ifndef AJP_H
27 #define AJP_H
28 
29 #include "apr_version.h"
30 #include "apr.h"
31 
32 #include "apr_hooks.h"
33 #include "apr_lib.h"
34 #include "apr_strings.h"
35 #include "apr_buckets.h"
36 #include "apr_md5.h"
37 #include "apr_network_io.h"
38 #include "apr_poll.h"
39 #include "apr_pools.h"
40 #include "apr_strings.h"
41 #include "apr_uri.h"
42 #include "apr_date.h"
43 #include "apr_fnmatch.h"
44 #define APR_WANT_STRFUNC
45 #include "apr_want.h"
46 
47 #if APR_HAVE_NETINET_IN_H
48 #include <netinet/in.h>
49 #endif
50 #if APR_HAVE_ARPA_INET_H
51 #include <arpa/inet.h>
52 #endif
53 
54 #define AJP13_DEF_HOST "127.0.0.1"
55 #ifdef NETWARE
56 #define AJP13_DEF_PORT 9009 /* default to 9009 since 8009 is used by OS */
57 #else
58 #define AJP13_DEF_PORT 8009
59 #endif
60 
61 /* The following environment variables match mod_ssl! */
62 #define AJP13_HTTPS_INDICATOR "HTTPS"
63 #define AJP13_SSL_PROTOCOL_INDICATOR "SSL_PROTOCOL"
64 #define AJP13_SSL_CLIENT_CERT_INDICATOR "SSL_CLIENT_CERT"
65 #define AJP13_SSL_CIPHER_INDICATOR "SSL_CIPHER"
66 #define AJP13_SSL_SESSION_INDICATOR "SSL_SESSION_ID"
67 #define AJP13_SSL_KEY_SIZE_INDICATOR "SSL_CIPHER_USEKEYSIZE"
68 
69 #ifdef AJP_USE_HTTPD_WRAP
70 #include "httpd_wrap.h"
71 #else
72 #include "httpd.h"
73 #include "http_config.h"
74 #include "http_request.h"
75 #include "http_core.h"
76 #include "http_protocol.h"
77 #include "http_main.h"
78 #include "http_log.h"
79 #endif
80 
81 #include "mod_proxy.h"
82 #include "util_ebcdic.h"
83 
87 #define AJP_EOVERFLOW (APR_OS_START_USERERR + 1)
88 
89 #define AJP_ETOSMALL (APR_OS_START_USERERR + 2)
90 
91 #define AJP_EINVAL (APR_OS_START_USERERR + 3)
92 
93 #define AJP_EBAD_SIGNATURE (APR_OS_START_USERERR + 4)
94 
95 #define AJP_ETOBIG (APR_OS_START_USERERR + 5)
96 
97 #define AJP_ENO_HEADER (APR_OS_START_USERERR + 6)
98 
99 #define AJP_EBAD_HEADER (APR_OS_START_USERERR + 7)
100 
101 #define AJP_EBAD_MESSAGE (APR_OS_START_USERERR + 8)
102 
103 #define AJP_ELOGFAIL (APR_OS_START_USERERR + 9)
104 
105 
107 typedef struct ajp_msg ajp_msg_t;
108 
110 struct ajp_msg
111 {
124 };
125 
129 #define AJP13_WS_HEADER 0x1234
130 #define AJP_HEADER_LEN 4
131 #define AJP_HEADER_SZ_LEN 2
132 #define AJP_HEADER_SZ 6
133 #define AJP_MSG_BUFFER_SZ 8192
134 #define AJP_MAX_BUFFER_SZ 65536
135 #define AJP13_MAX_SEND_BODY_SZ (AJP_MAX_BUFFER_SZ - AJP_HEADER_SZ)
136 #define AJP_PING_PONG_SZ 128
137 
139 #define CMD_AJP13_FORWARD_REQUEST (unsigned char)2
140 
141 #define CMD_AJP13_SEND_BODY_CHUNK (unsigned char)3
142 
143 #define CMD_AJP13_SEND_HEADERS (unsigned char)4
144 
145 #define CMD_AJP13_END_RESPONSE (unsigned char)5
146 
147 #define CMD_AJP13_GET_BODY_CHUNK (unsigned char)6
148 
149 #define CMD_AJP13_SHUTDOWN (unsigned char)7
150 
151 #define CMD_AJP13_PING (unsigned char)8
152 
153 #define CMD_AJP13_CPONG (unsigned char)9
154 
155 #define CMD_AJP13_CPING (unsigned char)10
156 
172 
180 
188 
196 
205 
214 
223 
233 apr_status_t ajp_msg_append_string_ex(ajp_msg_t *msg, const char *value,
234  int convert);
239 #define ajp_msg_append_string(m, v) ajp_msg_append_string_ex(m, v, 1)
240 
244 #define ajp_msg_append_string_ascii(m, v) ajp_msg_append_string_ex(m, v, 0)
245 
255  apr_size_t valuelen);
256 
265 
274 
284 
293 
303 
311 apr_status_t ajp_msg_get_string(ajp_msg_t *msg, const char **rvalue);
312 
313 
323  apr_size_t *rvalue_len);
324 
334 
343 
355 
367 
379  apr_size_t count, char **buf);
380 
390 
399 
408 
419  apr_size_t buffsize,
420  apr_uri_t *uri,
421  const char *secret);
422 
432  request_rec *r,
433  apr_size_t buffsize,
434  ajp_msg_t **msg);
435 
445  apr_size_t *len, ajp_msg_t **msg);
446 
455  ajp_msg_t *msg, apr_size_t len);
456 
464 
473  ajp_msg_t *msg);
474 
484  apr_uint16_t *len, char **ptr);
485 
486 
495  apr_byte_t *reuse);
496 
497 
506  request_rec *r,
507  apr_interval_time_t timeout);
508 
509 
515 const char *ajp_type_str(int type);
516 
519 #endif /* AJP_H */
520 
size_t apr_size_t
Definition: apr.h:375
apr_status_t ajp_msg_get_uint8(ajp_msg_t *msg, apr_byte_t *rvalue)
apr_status_t ajp_msg_copy(ajp_msg_t *smsg, ajp_msg_t *dmsg)
Proxy Extension Module for Apache.
apr_size_t pos
Definition: ajp.h:119
APR Network library.
Apache Configuration.
const char * ajp_type_str(int type)
apr_status_t ajp_send_header(apr_socket_t *sock, request_rec *r, apr_size_t buffsize, apr_uri_t *uri, const char *secret)
apr_status_t ajp_send_data_msg(apr_socket_t *sock, ajp_msg_t *msg, apr_size_t len)
apr_status_t ajp_msg_end(ajp_msg_t *msg)
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:556
apr_status_t ajp_msg_check_header(ajp_msg_t *msg, apr_size_t *len)
apr_status_t ajp_msg_reset(ajp_msg_t *msg)
apr_size_t header_len
Definition: ajp.h:115
APR Standard Headers Support.
apr_status_t ajp_msg_append_uint16(ajp_msg_t *msg, apr_uint16_t value)
apr_status_t ajp_msg_peek_uint8(ajp_msg_t *msg, apr_byte_t *rvalue)
CORE HTTP Daemon.
unsigned char apr_byte_t
Definition: apr.h:328
Utilities for EBCDIC conversion.
const char const char * uri
Definition: mod_dav.h:618
apr_status_t ajp_msg_get_uint16(ajp_msg_t *msg, apr_uint16_t *rvalue)
apr_status_t ajp_msg_append_bytes(ajp_msg_t *msg, const apr_byte_t *value, apr_size_t valuelen)
apr_size_t max_size
Definition: ajp.h:123
apr_int64_t apr_interval_time_t
Definition: apr_time.h:55
APR Poll interface.
apr_status_t ajp_ilink_receive(apr_socket_t *sock, ajp_msg_t *msg)
dav_buffer apr_size_t size
Definition: mod_dav.h:461
unsigned short apr_uint16_t
Definition: apr.h:331
apr_status_t ajp_msg_dump(apr_pool_t *pool, ajp_msg_t *msg, char *err, apr_size_t count, char **buf)
apr_status_t ajp_msg_serialize_ping(ajp_msg_t *msg)
Definition: ajp.h:110
Apache Logging library.
int ajp_parse_type(request_rec *r, ajp_msg_t *msg)
APR Versioning Interface.
Command line options.
APR-UTIL date routines.
APR memory allocation.
apr_status_t ajp_msg_serialize_cping(ajp_msg_t *msg)
HTTP Daemon routines.
apr_status_t ajp_msg_create(apr_pool_t *pool, apr_size_t size, ajp_msg_t **rmsg)
Apache hook functions.
apr_status_t ajp_msg_log(request_rec *r, ajp_msg_t *msg, char *err)
apr_status_t ajp_handle_cping_cpong(apr_socket_t *sock, request_rec *r, apr_interval_time_t timeout)
Definition: apr_arch_networkio.h:37
apr_status_t ajp_msg_get_uint32(ajp_msg_t *msg, apr_uint32_t *rvalue)
dav_error * err
Definition: mod_dav.h:203
apr_status_t ajp_msg_get_bytes(ajp_msg_t *msg, apr_byte_t **rvalue, apr_size_t *rvalue_len)
APR-UTIL Buckets/Bucket Brigades.
APR FNMatch Functions.
unsigned int apr_uint32_t
Definition: apr.h:334
apr_status_t ajp_msg_reuse(ajp_msg_t *msg)
APR Platform Definitions.
APR MD5 Routines.
APR general purpose library routines.
int server_side
Definition: ajp.h:121
apr_status_t ajp_msg_append_uint32(ajp_msg_t *msg, apr_uint32_t value)
apr_status_t ajp_parse_data(request_rec *r, ajp_msg_t *msg, apr_uint16_t *len, char **ptr)
HTTP protocol handling.
Definition: apr_uri.h:85
apr_status_t ajp_alloc_data_msg(apr_pool_t *pool, char **ptr, apr_size_t *len, ajp_msg_t **msg)
apr_status_t ajp_msg_peek_uint16(ajp_msg_t *msg, apr_uint16_t *rvalue)
Apache Request library.
A structure that represents the current request.
Definition: httpd.h:805
apr_status_t ajp_msg_append_uint8(ajp_msg_t *msg, apr_byte_t value)
APR Strings library.
apr_status_t ajp_msg_append_string_ex(ajp_msg_t *msg, const char *value, int convert)
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
int apr_status_t
Definition: apr_errno.h:44
request_rec * r
Definition: mod_dav.h:519
APR-UTIL URI Routines.
apr_size_t len
Definition: ajp.h:117
apr_status_t ajp_parse_reuse(request_rec *r, ajp_msg_t *msg, apr_byte_t *reuse)
proxy_worker proxy_server_conf * conf
Definition: mod_proxy.h:602
Definition: mod_proxy.h:205
apr_status_t ajp_parse_header(request_rec *r, proxy_dir_conf *conf, ajp_msg_t *msg)
apr_status_t ajp_ilink_send(apr_socket_t *sock, ajp_msg_t *msg)
apr_status_t ajp_read_header(apr_socket_t *sock, request_rec *r, apr_size_t buffsize, ajp_msg_t **msg)
apr_byte_t * buf
Definition: ajp.h:113
apr_status_t ajp_msg_get_string(ajp_msg_t *msg, const char **rvalue)