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

- Search for |

# environment
[utilities]

## Classes
struct | axutil_env
| Axis2 Environment struct. More...
## Defines
#define | AXIS_ENV_FREE_LOG 0x1
#define | AXIS_ENV_FREE_ERROR 0x2
#define | AXIS_ENV_FREE_THREADPOOL 0x4
#define | AXIS2_ENV_CHECK(env, error_return)
## Typedefs
typedef struct axutil_env | axutil_env_t
| Axis2 Environment struct.
## Functions
AXIS2_EXTERN axutil_env_t * | axutil_env_create (axutil_allocator_t *allocator)
AXIS2_EXTERN axutil_env_t * | axutil_env_create_all (const axis2_char_t *log_file, const axutil_log_levels_t log_level)
AXIS2_EXTERN axutil_env_t * | axutil_env_create_with_error (axutil_allocator_t *allocator, axutil_error_t *error)
AXIS2_EXTERN axutil_env_t * | axutil_env_create_with_error_log (axutil_allocator_t *allocator, axutil_error_t *error, axutil_log_t *log)
AXIS2_EXTERN axutil_env_t * | axutil_env_create_with_error_log_thread_pool (axutil_allocator_t *allocator, axutil_error_t *error, axutil_log_t *log, axutil_thread_pool_t *pool)
AXIS2_EXTERN axis2_status_t | axutil_env_enable_log (axutil_env_t *env, axis2_bool_t enable)
AXIS2_EXTERN axis2_status_t | axutil_env_check_status (const axutil_env_t *env)
AXIS2_EXTERN void | axutil_env_free (axutil_env_t *env)
AXIS2_EXTERN void | axutil_env_free_masked (axutil_env_t *env, char mask)
AXIS2_EXTERN axis2_status_t | axutil_env_increment_ref (axutil_env_t *env)

## Typedef Documentation

typedef struct axutil_env axutil_env_t

Axis2 Environment struct.

Environment acts as a container for error, log, memory allocator and threading routines

## Function Documentation

AXIS2_EXTERN axis2_status_t axutil_env_check_status | ( | const axutil_env_t * | env | ) |

Checks the status code of environment stored within error struct.

Parameters:

  | env | pointer to environment struct

Returns:
  error status code or AXIS2_CRITICAL_FAILURE in case of a failure

AXIS2_EXTERN axutil_env_t* axutil_env_create | ( | axutil_allocator_t * | allocator | ) |

Creates an environment struct. Would include a default log and error structs within the created environment. By default, logging would be enabled and the default log level would be debug.

Parameters:

  | allocator | pointer to an instance of allocator struct. Must not be NULL

Returns:
  pointer to the newly created environment struct

AXIS2_EXTERN axutil_env_t* axutil_env_create_all | ( | const axis2_char_t * | log_file,
|  | const axutil_log_levels_t | log_level |
| ) |  |  |

Creates an environment struct with all of its default parts, that is an allocator, error, log and a thread pool.

Parameters:

  | log_file | name of the log file. If NULL, a default log would be created.
  | log_level | log level to be used. If not valid, debug would be used as the default log level

Returns:
  pointer to the newly created environment struct

AXIS2_EXTERN axutil_env_t* axutil_env_create_with_error | ( | axutil_allocator_t * | allocator,
|  | axutil_error_t * | error |
| ) |  |  |

Creates an environment struct with given error struct.

Parameters:

  | allocator | pointer to an instance of allocator struct. Must not be NULL
  | error | pointer to an instance of error struct. Must not be NULL

Returns:
  pointer to the newly created environment struct

AXIS2_EXTERN axutil_env_t* axutil_env_create_with_error_log | ( | axutil_allocator_t * | allocator,
|  | axutil_error_t * | error,
|  | axutil_log_t * | log |
| ) |  |  |

Creates an environment struct with given error and log structs.

Parameters:

  | allocator | pointer to an instance of allocator struct. Must not be NULL
  | error | pointer to an instance of error struct. Must not be NULL
  | log | pointer to an instance of log struct. If NULL it would be assumed that logging is disabled.

Returns:
  pointer to the newly created environment struct

AXIS2_EXTERN axutil_env_t* axutil_env_create_with_error_log_thread_pool | ( | axutil_allocator_t * | allocator,
|  | axutil_error_t * | error,
|  | axutil_log_t * | log,
|  | axutil_thread_pool_t * | pool |
| ) |  |  |

Creates an environment struct with given error, log and thread pool structs.

Parameters:

  | allocator | pointer to an instance of allocator struct. Must not be NULL
  | error | pointer to an instance of error struct. Must not be NULL
  | log | pointer to an instance of log struct. If NULL it would be assumed that logging is disabled.
  | pool | pointer to an instance of thread_pool. Must not be NULL

Returns:
  pointer to the newly created environment struct

AXIS2_EXTERN axis2_status_t axutil_env_enable_log | ( | axutil_env_t * | env,
|  | axis2_bool_t | enable |
| ) |  |  |

Enable or disable logging.

Parameters:

  | env | pointer to environment struct
  | enable | AXIS2_TRUE to enable logging and AXIS2_FALSE to disable logging

Returns:
  AXIS2_SUCCESS on success else AXIS2_FAILURE

AXIS2_EXTERN void axutil_env_free | ( | axutil_env_t * | env | ) |

Frees an environment struct instance.

Parameters:

  | env | pointer to environment struct instance to be freed.

Returns:
  void

AXIS2_EXTERN void axutil_env_free_masked | ( | axutil_env_t * | env,
|  | char | mask |
| ) |  |  |

Frees the environment components based on the mask.

Parameters:

  | env | pointer to environment struct to be freed
  | mask | bit pattern indicating which components of the env struct are to be freed AXIS_ENV_FREE_LOG - Frees the log AXIS_ENV_FREE_ERROR - Frees the error AXIS_ENV_FREE_THREADPOOL - Frees the thread pool You can use combinations to free multiple components as well E.g : AXIS_ENV_FREE_LOG | AXIS_ENV_FREE_ERROR frees both log and error, but not the thread pool

Returns:
  void

AXIS2_EXTERN axis2_status_t axutil_env_increment_ref | ( | axutil_env_t * | env | ) |

Incrent the reference count.This is used when objects are created using this env and keeping this for future use.

Parameters:

  | env | pointer to environment struct instance to be freed.

Returns:
  void