Axis2/C: utils

- Main Page
- Modules
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

# utils
[utilities]

## Files
file | axutil_utils.h
## Defines
#define | AXUTIL_LOG_FILE_SIZE 1024 * 1024 * 32
#define | AXUTIL_LOG_FILE_NAME_SIZE 512
#define | AXIS2_FUNC_PARAM_CHECK(object, env, error_return)
#define | AXIS2_PARAM_CHECK(error, object, error_return)
#define | AXIS2_PARAM_CHECK_VOID(error, object)
#define | AXIS2_ERROR_SET(error, error_number, status_code)
#define | AXIS2_HANDLE_ERROR_WITH_FILE(env, error_number,status_code, file_name_line_no)
#define | AXIS2_HANDLE_ERROR(env, error_number, status_code)
#define | AXIS2_CREATE_FUNCTION "axis2_get_instance"
#define | AXIS2_DELETE_FUNCTION "axis2_remove_instance"
#define | AXIS2_TARGET_EPR "target_epr"
#define | AXIS2_DUMP_INPUT_MSG_TRUE "dump"
## Typedefs
typedef void(* | AXIS2_FREE_VOID_ARG )(void *obj_to_be_freed, const axutil_env_t *env)
typedef int(* | AXIS2_READ_INPUT_CALLBACK )(char *buffer, int size, void *ctx)
typedef int(* | AXIS2_CLOSE_INPUT_CALLBACK )(void *ctx)
## Enumerations
enum | axis2_scopes { AXIS2_SCOPE_REQUEST = 0, AXIS2_SCOPE_SESSION, AXIS2_SCOPE_APPLICATION }
| Axis2 scopes. More...
## Functions
AXIS2_EXTERN axis2_status_t | axutil_parse_rest_url_for_params (const axutil_env_t *env, const axis2_char_t *tmpl, const axis2_char_t *url, int *match_count, axis2_char_t ****matches)
AXIS2_EXTERN axis2_char_t ** | axutil_parse_request_url_for_svc_and_op (const axutil_env_t *env, const axis2_char_t *request)
AXIS2_EXTERN axis2_char_t * | axutil_xml_quote_string (const axutil_env_t *env, const axis2_char_t *s, axis2_bool_t quotes)
AXIS2_EXTERN int | axutil_hexit (axis2_char_t c)
AXIS2_EXTERN axis2_status_t | axutil_url_decode (const axutil_env_t *env, axis2_char_t *dest, axis2_char_t *src)
AXIS2_EXTERN axis2_status_t | axis2_char_2_byte (const axutil_env_t *env, axis2_char_t *char_buffer, axis2_byte_t **byte_buffer, int *byte_buffer_size)

## Define Documentation

#define AXIS2_CREATE_FUNCTION "axis2_get_instance"

Method names in the loadable libraries

#define AXIS2_ERROR_SET | ( | error,
|  | error_number,
|  | status_code |  | ) |

Value:

    {                                                       \
            AXIS2_ERROR_SET_ERROR_NUMBER(error, error_number);  \
            AXIS2_ERROR_SET_STATUS_CODE(error, status_code);    \
        }

This macro is used to handle error situation.

Parameters:

  | error_number | Error number for the error occured
  | error_return | If function return a status it should pass here AXIS2_FAILURE. If function return a type pointer it should pass NULL

Returns:
  If function return a status code return AXIS2_SUCCESS. Else if function return a type pointer return NULL

#define AXIS2_FUNC_PARAM_CHECK | ( | object,
|  | env,
|  | error_return |  | ) |

Value:

    if (!object)                                                        \
        {                                                                   \
            AXIS2_ERROR_SET_ERROR_NUMBER(env->error, AXIS2_ERROR_INVALID_NULL_PARAM); \
            AXIS2_ERROR_SET_STATUS_CODE(env->error, AXIS2_FAILURE);         \
            return error_return;                                            \
        }                                                                   \
        else                                                                \
        {                                                                   \
            AXIS2_ERROR_SET_STATUS_CODE(env->error, AXIS2_SUCCESS);              \
        }

This macro is called to check whether structure on which function is called is NULL and to check whether the environment structure passed is valid.

Parameters:

  | object | structure on which function is called
  | env | environment to be checked for validity
  | error_return | If function return a status it should pass here AXIS2_FAILURE. If function return a type pointer it should pass NULL

Returns:
  If function return a status code return AXIS2_SUCCESS. Else if function return a type pointer return NULL

#define AXIS2_HANDLE_ERROR | ( | env,
|  | error_number,
|  | status_code |  | ) |

Value:

    AXIS2_HANDLE_ERROR_WITH_FILE(env, error_number, status_code, \
                AXIS2_LOG_SI)                                                \

This macro is used to set and error, and log it

Parameters:

  | env | Reference to env struct
  | error_number | Error number for the error occured
  | status_code | The Error Status to be set

#define AXIS2_HANDLE_ERROR_WITH_FILE | ( | env,
|  | error_number,
|  | status_code,
|  | file_name_line_no |  | ) |

Value:

    {                                                            \
            AXIS2_ERROR_SET(env->error, error_number, status_code);  \
            AXIS2_LOG_ERROR(env->log, file_name_line_no,             \
                AXIS2_ERROR_GET_MESSAGE(env->error));                \
        }

This macro is used to set and error, and log it. In addition to that you are capable of specifying the file name and line number

Parameters:

  | env | Reference to env struct
  | error_number | Error number for the error occured
  | status_code | The Error Status to be set
  | file_name_line_no | File name and line number constant

#define AXIS2_PARAM_CHECK | ( | error,
|  | object,
|  | error_return |  | ) |

Value:

    if (!object)                                                        \
        {                                                                   \
            AXIS2_ERROR_SET_ERROR_NUMBER(error, AXIS2_ERROR_INVALID_NULL_PARAM); \
            AXIS2_ERROR_SET_STATUS_CODE(error, AXIS2_FAILURE);              \
            return error_return;                                            \
        }                                                                   \
        else                                                                \
        {                                                                   \
            AXIS2_ERROR_SET_STATUS_CODE(error, AXIS2_SUCCESS);              \
        }

This macro is called to check whether an object is NULL. if object is NULL error number and status code is set

Parameters:

  | object | object to be check for NULL
  | error_return | If function return a status it should pass here AXIS2_FAILURE. If function return a type pointer it should pass NULL

Returns:
  If function return a status code return AXIS2_SUCCESS. Else if function return a type pointer return NULL

#define AXIS2_PARAM_CHECK_VOID | ( | error,
|  | object |  | ) |

Value:

    if (!object)                                                        \
        {                                                                   \
            AXIS2_ERROR_SET_ERROR_NUMBER(error, AXIS2_ERROR_INVALID_NULL_PARAM); \
            AXIS2_ERROR_SET_STATUS_CODE(error, AXIS2_FAILURE);              \
            return;                                                         \
        }

## Enumeration Type Documentation

enum axis2_scopes

Axis2 scopes.

Possible scope value for Axis2

Enumerator:

  AXIS2_SCOPE_REQUEST | Request scope
  AXIS2_SCOPE_SESSION | Session scope
  AXIS2_SCOPE_APPLICATION | Application scope

## Function Documentation

AXIS2_EXTERN axis2_char_t** axutil_parse_request_url_for_svc_and_op | ( | const axutil_env_t * | env,
|  | const axis2_char_t * | request |
| ) |  |  |

This function allows users to resolve the service and op from the url. It returns an array of 2 elements of axis2_char_t arrays (strings). The caller is responsible to free the memory allocated by the function for the return value.

Parameters:

  | env | pointer to environment struct
  | request | url

Returns:
  axis2_char_t ** `axis2_char_t **```

AXIS2_EXTERN axis2_status_t axutil_parse_rest_url_for_params | ( | const axutil_env_t * | env,
|  | const axis2_char_t * | tmpl,
|  | const axis2_char_t * | url,
|  | int * | match_count,
|  | axis2_char_t **** | matches |
| ) |  |  |

This function allows the user match a REST URL template with the Request URL. It returns a 3-dimensional array with pairs of elements of axis2_char_t arrays (strings). The caller is responsible to free the memory allocated by the function for the return value.

Parameters:

  | env | pointer to environment struct
  | tmpl | Template to Match
  | url | Request URL
  | match_count | variable to store match count
  | matches | axis2_char_t *** `axis2_char_t ***```

Returns:
  ``AXIS2_SUCCESS if all matches were found or AXIS2_FAILURE.``

AXIS2_EXTERN axis2_char_t* axutil_xml_quote_string | ( | const axutil_env_t * | env,
|  | const axis2_char_t * | s,
|  | axis2_bool_t | quotes |
| ) |  |  |

Quotes an XML string. Replace '<', '>', and '&' with '<', '>', and '&'. If quotes is true, then replace '"' with '"'.

Parameters:

  | env | pointer to environment struct
  | s | string to be quoted
  | quotes | if AXIS2_TRUE then replace '"' with '"'. quotes is typically set to true for XML strings that will occur within double quotes -- attribute values.

Returns:
  Encoded string if there are characters to be encoded, else NULL. The caller is responsible to free the memory allocated by the function for the return value