# axutil_utils.h

Go to the documentation of this file.

    00001
    00002 /*
    00003  * Licensed to the Apache Software Foundation (ASF) under one or more
    00004  * contributor license agreements.  See the NOTICE file distributed with
    00005  * this work for additional information regarding copyright ownership.
    00006  * The ASF licenses this file to You under the Apache License, Version 2.0
    00007  * (the "License"); you may not use this file except in compliance with
    00008  * the License.  You may obtain a copy of the License at
    00009  *
    00010  *      http://www.apache.org/licenses/LICENSE-2.0
    00011  *
    00012  * Unless required by applicable law or agreed to in writing, software
    00013  * distributed under the License is distributed on an "AS IS" BASIS,
    00014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00015  * See the License for the specific language governing permissions and
    00016  * limitations under the License.
    00017  */
    00018
    00019 #ifndef AXUTIL_UTILS_H
    00020 #define AXUTIL_UTILS_H
    00021
    00022 #include <axutil_utils_defines.h>
    00023 #include <axutil_error.h>
    00024 #include <axutil_env.h>
    00025 #include <axutil_date_time.h>
    00026 #include <axutil_base64_binary.h>
    00027
    00028 #ifdef __cplusplus
    00029 extern "C"
    00030 {
    00031 #endif
    00032
    00043 #define AXUTIL_LOG_FILE_SIZE 1024 * 1024 * 32
    00044 #define AXUTIL_LOG_FILE_NAME_SIZE 512
    00045
    00056 #define AXIS2_FUNC_PARAM_CHECK(object, env, error_return)               \
    00057     if (!object)                                                        \
    00058     {                                                                   \
    00059         AXIS2_ERROR_SET_ERROR_NUMBER(env->error, AXIS2_ERROR_INVALID_NULL_PARAM); \
    00060         AXIS2_ERROR_SET_STATUS_CODE(env->error, AXIS2_FAILURE);         \
    00061         return error_return;                                            \
    00062     }                                                                   \
    00063     else                                                                \
    00064     {                                                                   \
    00065         AXIS2_ERROR_SET_STATUS_CODE(env->error, AXIS2_SUCCESS);              \
    00066     }
    00067
    00068
    00078 #define AXIS2_PARAM_CHECK(error, object, error_return)                  \
    00079     if (!object)                                                        \
    00080     {                                                                   \
    00081         AXIS2_ERROR_SET_ERROR_NUMBER(error, AXIS2_ERROR_INVALID_NULL_PARAM); \
    00082         AXIS2_ERROR_SET_STATUS_CODE(error, AXIS2_FAILURE);              \
    00083         return error_return;                                            \
    00084     }                                                                   \
    00085     else                                                                \
    00086     {                                                                   \
    00087         AXIS2_ERROR_SET_STATUS_CODE(error, AXIS2_SUCCESS);              \
    00088     }
    00089
    00090
    00091
    00092 #define AXIS2_PARAM_CHECK_VOID(error, object)                           \
    00093     if (!object)                                                        \
    00094     {                                                                   \
    00095         AXIS2_ERROR_SET_ERROR_NUMBER(error, AXIS2_ERROR_INVALID_NULL_PARAM); \
    00096         AXIS2_ERROR_SET_STATUS_CODE(error, AXIS2_FAILURE);              \
    00097         return;                                                         \
    00098     }
    00099
    00100
    00101
    00110 #define AXIS2_ERROR_SET(error, error_number, status_code)   \
    00111     {                                                       \
    00112         AXIS2_ERROR_SET_ERROR_NUMBER(error, error_number);  \
    00113         AXIS2_ERROR_SET_STATUS_CODE(error, status_code);    \
    00114     }
    00115
    00124 #define AXIS2_HANDLE_ERROR_WITH_FILE(env, error_number,          \
    00125             status_code, file_name_line_no)                      \
    00126     {                                                            \
    00127         AXIS2_ERROR_SET(env->error, error_number, status_code);  \
    00128         AXIS2_LOG_ERROR(env->log, file_name_line_no,             \
    00129             AXIS2_ERROR_GET_MESSAGE(env->error));                \
    00130     }
    00131
    00138 #define AXIS2_HANDLE_ERROR(env, error_number, status_code)               \
    00139             AXIS2_HANDLE_ERROR_WITH_FILE(env, error_number, status_code, \
    00140             AXIS2_LOG_SI)                                                \
    00141
    00142
    00144 #define AXIS2_CREATE_FUNCTION "axis2_get_instance"
    00145 #define AXIS2_DELETE_FUNCTION "axis2_remove_instance"
    00146
    00147     typedef void(
    00148         AXIS2_CALL
    00149         * AXIS2_FREE_VOID_ARG)(
    00150             void *obj_to_be_freed,
    00151             const axutil_env_t * env);
    00152
    00153     /* Function pointer typedef for read callback */
    00154     typedef int(
    00155         AXIS2_CALL
    00156         * AXIS2_READ_INPUT_CALLBACK)(
    00157             char *buffer,
    00158             int size,
    00159             void *ctx);
    00160
    00161     /* Function pointer typedef for close callback */
    00162     typedef int(
    00163         AXIS2_CALL
    00164         * AXIS2_CLOSE_INPUT_CALLBACK)(
    00165             void *ctx);
    00166
    00172     enum axis2_scopes
    00173     {
    00174
    00176         AXIS2_SCOPE_REQUEST = 0,
    00177
    00179         AXIS2_SCOPE_SESSION,
    00180
    00182         AXIS2_SCOPE_APPLICATION
    00183     };
    00184
    00185 #define AXIS2_TARGET_EPR "target_epr"
    00186 #define AXIS2_DUMP_INPUT_MSG_TRUE "dump"
    00187
    00200     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00201     axutil_parse_rest_url_for_params(
    00202         const axutil_env_t * env,
    00203         const axis2_char_t * tmpl,
    00204         const axis2_char_t * url,
    00205         int * match_count,
    00206         axis2_char_t **** matches);
    00207
    00217     AXIS2_EXTERN axis2_char_t **AXIS2_CALL
    00218     axutil_parse_request_url_for_svc_and_op(
    00219         const axutil_env_t * env,
    00220         const axis2_char_t * request);
    00221
    00235     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00236     axutil_xml_quote_string(
    00237         const axutil_env_t * env,
    00238         const axis2_char_t * s,
    00239         axis2_bool_t quotes);
    00240
    00241     AXIS2_EXTERN int AXIS2_CALL
    00242     axutil_hexit(axis2_char_t c);
    00243
    00244     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00245     axutil_url_decode(
    00246         const axutil_env_t * env,
    00247         axis2_char_t * dest,
    00248         axis2_char_t * src);
    00249
    00250     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00251     axis2_char_2_byte(
    00252         const axutil_env_t *env,
    00253         axis2_char_t *char_buffer,
    00254         axis2_byte_t **byte_buffer,
    00255         int *byte_buffer_size);
    00256
    00259 #ifdef __cplusplus
    00260 }
    00261 #endif
    00262
    00263 #endif                          /* AXIS2_UTILS_H */