ajp_msg.c revision 36ef8f77bffe75d1aa327882be1b5bdbe2ff567a
/* 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.
*/
#include "ajp.h"
static char *hex_table = "0123456789ABCDEF";
/**
* 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
* @return dump message
*/
{
apr_size_t i, j;
char line[80];
char *current;
char *rv, *p;
apr_byte_t x;
/* Display only first 1024 bytes */
if (len > 1024)
len = 1024;
"ajp_msg_dump(): %s pos=%" APR_SIZE_T_FMT
for (i = 0; i < len; i += 16) {
for (j = 0; j < 16; j++) {
*current++ = ' ';
}
*current++ = ' ';
*current++ = '-';
*current++ = ' ';
for (j = 0; j < 16; j++) {
if (x > 0x20 && x < 0x7F) {
*current++ = x;
}
else {
*current++ = '.';
}
}
*current++ = '\0';
apr_snprintf(p, bl,
"ajp_msg_dump(): %.4lx %s\n",
(unsigned long)i, line);
}
return rv;
}
/**
* 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
*/
{
"ajp_check_msg_header() got bad signature %02x%02x",
return AJP_EBAD_SIGNATURE;
}
"ajp_check_msg_header() incoming message is "
return AJP_ETOBIG;
}
return APR_SUCCESS;
}
/**
* Reset an AJP Message
*
* @param msg AJP Message to reset
* @return APR_SUCCESS or error
*/
{
return APR_SUCCESS;
}
/**
* Reuse an AJP Message
*
* @param msg AJP Message to reuse
* @return APR_SUCCESS or error
*/
{
return APR_SUCCESS;
}
/**
* Mark the end of an AJP Message
*
* @param msg AJP Message to end
* @return APR_SUCCESS or error
*/
{
if (msg->server_side) {
}
else {
}
return APR_SUCCESS;
}
{
"%s(): BufferOverflowException %" APR_SIZE_T_FMT
" %" APR_SIZE_T_FMT,
return AJP_EOVERFLOW;
}
/**
* 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
*/
{
}
return APR_SUCCESS;
}
/**
* 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
*/
{
}
return APR_SUCCESS;
}
/**
* 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
*/
{
}
return APR_SUCCESS;
}
/**
* 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
*/
int convert)
{
}
}
/* ignore error - we checked once */
/* We checked for space !! */
if (convert) /* convert from EBCDIC if needed */
return APR_SUCCESS;
}
/**
* 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
*/
{
if (! valuelen) {
return APR_SUCCESS; /* Shouldn't we indicate an error ? */
}
}
/* We checked for space !! */
return APR_SUCCESS;
}
/**
* 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
*/
{
}
return APR_SUCCESS;
}
/**
* 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
*/
{
}
return APR_SUCCESS;
}
/**
* Peek a 16bits unsigned value from AJP Message, position in message
* is not updated
*
* @param msg AJP Message to get value from
* @param rvalue Pointer where value will be returned
* @return APR_SUCCESS or error
*/
{
}
return APR_SUCCESS;
}
/**
* Peek a 8bits unsigned value from AJP Message, position in message
* is not updated
*
* @param msg AJP Message to get value from
* @param rvalue Pointer where value will be returned
* @return APR_SUCCESS or error
*/
{
}
return APR_SUCCESS;
}
/**
* 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
*/
{
}
return APR_SUCCESS;
}
/**
* 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
*/
{
}
return APR_SUCCESS;
}
/**
* 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 */
}
*rvalue_len = size;
return APR_SUCCESS;
}
/**
* 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
*/
{
if (!msg) {
"ajp_msg_create(): can't allocate AJP message memory");
return APR_ENOPOOL;
}
msg->server_side = 0;
/* 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");
return APR_ENOPOOL;
}
return APR_SUCCESS;
}
/**
* 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");
return AJP_EINVAL;
}
"ajp_msg_copy(): destination buffer too "
return AJP_ETOSMALL;
}
return APR_SUCCESS;
}
/**
* Serialize in an AJP Message a PING command
*
* +-----------------------+
* | PING CMD (1 byte) |
* +-----------------------+
*
* @param smsg AJP message to put serialized message
* @return APR_SUCCESS or error
*/
{
return rc;
return APR_SUCCESS;
}
/**
* Serialize in an AJP Message a CPING command
*
* +-----------------------+
* | CPING CMD (1 byte) |
* +-----------------------+
*
* @param smsg AJP message to put serialized message
* @return APR_SUCCESS or error
*/
{
return rc;
return APR_SUCCESS;
}