ajp_msg.c revision c30d52559f5ffd4b8639d97066719f1de9176c98
/* 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"
#define AJP_MSG_DUMP_BYTES_PER_LINE 16
/* 2 hex digits plus space plus one char per dumped byte */
/* plus prefix plus separator plus '\0' */
strlen("XXXX ") + \
static char *hex_table = "0123456789ABCDEF";
/**
* Dump the given number of bytes on an AJP Message
*
* @param pool pool to allocate from
* @param msg AJP Message to dump
* @param err error string to display
* @param count the number of bytes to dump
* @param buf buffer pointer for dump message
* @return APR_SUCCESS or error
*/
{
apr_size_t i, j;
char *current;
apr_byte_t x;
/* Display only first "count" bytes */
/* First the space needed for the first line */
/* Now for the data lines */
if (!*buf)
return APR_ENOMEM;
"%s pos=%" APR_SIZE_T_FMT
for (i = 0; i < len; i += AJP_MSG_DUMP_BYTES_PER_LINE) {
/* Safety check: do we have enough buffer for another line? */
if (AJP_MSG_DUMP_LINE_LENGTH > rl) {
return APR_ENOMEM;
}
if (line_len > AJP_MSG_DUMP_BYTES_PER_LINE) {
}
for (j = 0; j < line_len; j++) {
*current++ = ' ';
}
*current++ = ' ';
*current++ = '-';
*current++ = ' ';
for (j = 0; j < line_len; j++) {
if (x > 0x20 && x < 0x7F) {
*current++ = x;
}
else {
*current++ = '.';
}
}
*current++ = '\n';
}
return APR_SUCCESS;
}
/**
* Log an AJP message
*
* @param request The current request
* @param msg AJP Message to dump
* @param err error string to display
* @return APR_SUCCESS or error
*/
{
int level;
if (APLOGrtrace7(r)) {
count = 1024;
if (APLOGrtrace8(r)) {
}
if (rc == APR_SUCCESS) {
*next = '\0';
}
}
}
return rc;
}
/**
* 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_msg_check_header() got bad signature %02x%02x",
return AJP_EBAD_SIGNATURE;
}
"ajp_msg_check_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
*/
{
msg->server_side = 0;
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 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;
}