ajp_msg.c revision 1b73a711dca29bb65aeec50e1174fbee812426ac
/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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 * 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. * Dump up to the first 1024 bytes on an AJP Message * @param pool pool to allocate from * @param msg AJP Message to dump * @param err error string to display /* Display only first 1024 bytes */ for (i = 0; i <
len; i +=
16) {
for (j = 0; j <
16; j++) {
for (j = 0; j <
16; j++) {
if (x >
0x20 && x <
0x7F) {
"ajp_msg_dump(): %.4lx %s\n",
* Check a new AJP Message by looking at signature and return its size * @param msg AJP Message to check * @param len Pointer to returned len * @return APR_SUCCESS or error if (!((
head[0] ==
0x41 &&
head[
1] ==
0x42) ||
(
head[0] ==
0x12 &&
head[
1] ==
0x34))) {
"ajp_msg_check_header() got bad signature %02x%02x",
"ajp_msg_check_header() incoming message is " * @param msg AJP Message to reset * @return APR_SUCCESS or error * @param msg AJP Message to reuse * @return APR_SUCCESS or error * Mark the end of an AJP Message * @param msg AJP Message to end * @return APR_SUCCESS or error * Add an unsigned 32bits value to AJP Message * @param msg AJP Message to get value from * @param value value to add to AJP Message * @return APR_SUCCESS or error * Add an unsigned 16bits value to AJP Message * @param msg AJP Message to get value from * @param value value to add to AJP Message * @return APR_SUCCESS or error * Add an unsigned 8bits value to AJP Message * @param msg AJP Message to get value from * @param value value to add to AJP Message * @return APR_SUCCESS or error * Add a String in AJP message, and transform the String in ASCII * if convert is set and we're on an EBCDIC machine * @param msg AJP Message to get value from * @param value Pointer to String * @param convert When set told to convert String to ASCII * @return APR_SUCCESS or error /* ignore error - we checked once */ /* We checked for space !! */ /* convert from EBCDIC if needed */ * Add a Byte array to AJP Message * @param msg AJP Message to get value from * @param value Pointer to Byte array * @param valuelen Byte array len * @return APR_SUCCESS or error return APR_SUCCESS;
/* Shouldn't we indicate an error ? */ /* We checked for space !! */ * Get a 32bits unsigned value from AJP Message * @param msg AJP Message to get value from * @param rvalue Pointer where value will be returned * @return APR_SUCCESS or error * Get a 16bits unsigned value from AJP Message * @param msg AJP Message to get value from * @param rvalue Pointer where value will be returned * @return APR_SUCCESS or error * Peek a 16bits unsigned value from AJP Message, position in message * @param msg AJP Message to get value from * @param rvalue Pointer where value will be returned * @return APR_SUCCESS or error * Peek a 8bits unsigned value from AJP Message, position in message * @param msg AJP Message to get value from * @param rvalue Pointer where value will be returned * @return APR_SUCCESS or error * Get a 8bits unsigned value from AJP Message * @param msg AJP Message to get value from * @param rvalue Pointer where value will be returned * @return APR_SUCCESS or error * Get a String value from AJP Message * @param msg AJP Message to get value from * @param rvalue Pointer where value will be returned * @return APR_SUCCESS or error msg->
pos++;
/* a String in AJP is NULL terminated */ * Get a Byte array from AJP Message * @param msg AJP Message to get value from * @param rvalue Pointer where value will be returned * @param rvalueLen Pointer where Byte array len will be returned * @return APR_SUCCESS or error /* save the current position */ * Create an AJP Message from pool * @param pool memory pool to allocate AJP message from * @param size size of the buffer to create * @param rmsg Pointer to newly created AJP message * @return APR_SUCCESS or error "ajp_msg_create(): can't allocate AJP message memory");
/* XXX: This should never happen * In case if the OS cannont allocate 8K of data * we are in serious trouble * No need to check the alloc return value, cause the * core dump is probably the best solution anyhow. "ajp_msg_create(): can't allocate AJP message memory");
* Recopy an AJP Message to another * @param smsg source AJP message * @param dmsg destination AJP message * @return APR_SUCCESS or error "ajp_msg_copy(): destination msg is null");
"ajp_msg_copy(): destination buffer too " * Serialize in an AJP Message a PING command * +-----------------------+ * +-----------------------+ * @param smsg AJP message to put serialized message * @return APR_SUCCESS or error * Serialize in an AJP Message a CPING command * +-----------------------+ * +-----------------------+ * @param smsg AJP message to put serialized message * @return APR_SUCCESS or error