util_ebcdic.h revision 33bdcae1f7a1a65e351dda2a766a0cf28b1e695d
1f728f035fca81594193e198b40bfa732b1c02ebtrawick/* ====================================================================
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * The Apache Software License, Version 1.1
1f728f035fca81594193e198b40bfa732b1c02ebtrawick *
33bdcae1f7a1a65e351dda2a766a0cf28b1e695dnd * Copyright (c) 2000-2003 The Apache Software Foundation. All rights
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * reserved.
1f728f035fca81594193e198b40bfa732b1c02ebtrawick *
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * Redistribution and use in source and binary forms, with or without
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * modification, are permitted provided that the following conditions
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * are met:
1f728f035fca81594193e198b40bfa732b1c02ebtrawick *
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * 1. Redistributions of source code must retain the above copyright
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * notice, this list of conditions and the following disclaimer.
1f728f035fca81594193e198b40bfa732b1c02ebtrawick *
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * 2. Redistributions in binary form must reproduce the above copyright
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * notice, this list of conditions and the following disclaimer in
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * the documentation and/or other materials provided with the
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * distribution.
1f728f035fca81594193e198b40bfa732b1c02ebtrawick *
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * 3. The end-user documentation included with the redistribution,
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * if any, must include the following acknowledgment:
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * "This product includes software developed by the
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * Apache Software Foundation (http://www.apache.org/)."
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * Alternately, this acknowledgment may appear in the software itself,
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * if and wherever such third-party acknowledgments normally appear.
1f728f035fca81594193e198b40bfa732b1c02ebtrawick *
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * 4. The names "Apache" and "Apache Software Foundation" must
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * not be used to endorse or promote products derived from this
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * software without prior written permission. For written
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * permission, please contact apache@apache.org.
1f728f035fca81594193e198b40bfa732b1c02ebtrawick *
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * 5. Products derived from this software may not be called "Apache",
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * nor may "Apache" appear in their name, without prior written
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * permission of the Apache Software Foundation.
1f728f035fca81594193e198b40bfa732b1c02ebtrawick *
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * SUCH DAMAGE.
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * ====================================================================
1f728f035fca81594193e198b40bfa732b1c02ebtrawick *
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * This software consists of voluntary contributions made by many
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * individuals on behalf of the Apache Software Foundation. For more
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * information on the Apache Software Foundation, please see
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * <http://www.apache.org/>.
1f728f035fca81594193e198b40bfa732b1c02ebtrawick *
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * Portions of this software are based upon public domain software
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * originally written at the National Center for Supercomputing Applications,
1f728f035fca81594193e198b40bfa732b1c02ebtrawick * University of Illinois, Urbana-Champaign.
1f728f035fca81594193e198b40bfa732b1c02ebtrawick */
1f728f035fca81594193e198b40bfa732b1c02ebtrawick
1f728f035fca81594193e198b40bfa732b1c02ebtrawick#ifndef APACHE_UTIL_EBCDIC_H
1f728f035fca81594193e198b40bfa732b1c02ebtrawick#define APACHE_UTIL_EBCDIC_H
1f728f035fca81594193e198b40bfa732b1c02ebtrawick
1f728f035fca81594193e198b40bfa732b1c02ebtrawick
1f728f035fca81594193e198b40bfa732b1c02ebtrawick#ifdef __cplusplus
1f728f035fca81594193e198b40bfa732b1c02ebtrawickextern "C" {
1f728f035fca81594193e198b40bfa732b1c02ebtrawick#endif
1f728f035fca81594193e198b40bfa732b1c02ebtrawick
1f728f035fca81594193e198b40bfa732b1c02ebtrawick#include "apr_xlate.h"
2a503ad7fa6fc3572647e915a0d7f31a17d11b1drbb#include "httpd.h"
3a50e4da8a0db4515ab45678e5b39ff7e7594320trawick#include "util_charset.h"
1f728f035fca81594193e198b40bfa732b1c02ebtrawick
2a503ad7fa6fc3572647e915a0d7f31a17d11b1drbb/**
2a503ad7fa6fc3572647e915a0d7f31a17d11b1drbb * @package Utilities for EBCDIC conversion
2a503ad7fa6fc3572647e915a0d7f31a17d11b1drbb */
2a503ad7fa6fc3572647e915a0d7f31a17d11b1drbb
db3fa7db7c7910f2f23c3e3ffe0cf9f41a1899b9trawick#if APR_CHARSET_EBCDIC
886cd69ebf69e990dbc365be87ff8ea7cd681904rbb
2a503ad7fa6fc3572647e915a0d7f31a17d11b1drbb/**
2a503ad7fa6fc3572647e915a0d7f31a17d11b1drbb * Setup all of the global translation handlers
2a503ad7fa6fc3572647e915a0d7f31a17d11b1drbb * @param pool pool to allocate out of
2a503ad7fa6fc3572647e915a0d7f31a17d11b1drbb */
2a503ad7fa6fc3572647e915a0d7f31a17d11b1drbbapr_status_t ap_init_ebcdic(apr_pool_t *pool);
1f728f035fca81594193e198b40bfa732b1c02ebtrawick
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick/**
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick * Convert protocol data from the implementation character
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick * set to ASCII.
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick * @param buffer buffer to translate
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick * @param len number of bytes to translate
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick */
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawickvoid ap_xlate_proto_to_ascii(char *buffer, apr_size_t len);
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick/**
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick * Convert protocol data to the implementation character
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick * set from ASCII.
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick * @param buffer buffer to translate
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick * @param len number of bytes to translate
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick */
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawickvoid ap_xlate_proto_from_ascii(char *buffer, apr_size_t len);
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick
8d290205047d88e37555019fe9a26f1c5ece7023gregames/**
8d290205047d88e37555019fe9a26f1c5ece7023gregames * Convert protocol data from the implementation charater
8d290205047d88e37555019fe9a26f1c5ece7023gregames * set to ASCII, then send it.
8d290205047d88e37555019fe9a26f1c5ece7023gregames * @param r the current request
8d290205047d88e37555019fe9a26f1c5ece7023gregames * @param ... the strings to write, followed by a NULL pointer
8d290205047d88e37555019fe9a26f1c5ece7023gregames */
8d290205047d88e37555019fe9a26f1c5ece7023gregamesint ap_rvputs_proto_in_ascii(request_rec *r, ...);
8d290205047d88e37555019fe9a26f1c5ece7023gregames
1f728f035fca81594193e198b40bfa732b1c02ebtrawick#ifdef __cplusplus
1f728f035fca81594193e198b40bfa732b1c02ebtrawick}
1f728f035fca81594193e198b40bfa732b1c02ebtrawick#endif
1f728f035fca81594193e198b40bfa732b1c02ebtrawick
db3fa7db7c7910f2f23c3e3ffe0cf9f41a1899b9trawick#else /* APR_CHARSET_EBCDIC */
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick#define ap_xlate_proto_to_ascii(x,y) /* NOOP */
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick#define ap_xlate_proto_from_ascii(x,y) /* NOOP */
67f6dca9f3c35eb904c7b29a220db6c4482374dctrawick
8d290205047d88e37555019fe9a26f1c5ece7023gregames#define ap_rvputs_proto_in_ascii ap_rvputs
8d290205047d88e37555019fe9a26f1c5ece7023gregames
db3fa7db7c7910f2f23c3e3ffe0cf9f41a1899b9trawick#endif /* APR_CHARSET_EBCDIC */
1f728f035fca81594193e198b40bfa732b1c02ebtrawick
1f728f035fca81594193e198b40bfa732b1c02ebtrawick#endif /* !APACHE_UTIL_EBCDIC_H */