fred-mod-corba-1.4.2
|
mod_corba.c manages corba object references. More...
#include "httpd.h"
#include "http_log.h"
#include "http_config.h"
#include "http_connection.h"
#include "apr_pools.h"
#include "apr_strings.h"
#include "apr_hash.h"
#include "apr_tables.h"
#include <orbit/orbit.h>
#include <ORBitservices/CosNaming.h>
Data Structures | |
struct | corba_conf |
Configuration structure of corba module. More... | |
struct | cache_t |
Per-child cache structure. More... | |
struct | reference_cleanup_arg |
This structure is passed to reference cleanup routine. More... | |
struct | get_reference_ctx |
Context structure passed between get_reference_from_() and connection handler. More... | |
Macros | |
#define | ap_log_cerror(mark, level, status, c, ...) ap_log_error(mark, level, status, (c)->base_server, __VA_ARGS__) |
ap_log_cerror is defined only if apache version is 2.0 because 2.0 contrary to 2.2 does not have this function. | |
#define | raised_exception(ev) ((ev)->_major != CORBA_NO_EXCEPTION) |
Quick test if corba exception was raised. More... | |
Functions | |
static apr_status_t | reference_cleanup (void *raw_arg) |
Cleanup routine releases corba object reference. More... | |
static void * | get_reference_for_service (void *pctx, const char *alias, const char *name) |
Context structure passed between get_ior_from_nameservice() and post config hook. More... | |
static int | get_reference_from_nameservice (void *pctx, const char *alias, const char *name) |
Function obtains one reference from corba nameservice and sticks the reference to connection. More... | |
static int | get_ior_from_nameservice (void *pctx, const char *alias, const char *name) |
Function obtains IOR string for one object registered in mod_corba and assign it to IOR cache table. More... | |
static int | ior_cache_fill (void *pctx) |
Caching support functions. More... | |
static int | get_reference_from_ior (void *pctx, const char *alias, const char *name) |
Function obtains one reference from IOR string and sticks the reference to connection. More... | |
static int | corba_process_connection (conn_rec *c) |
Connection handler. More... | |
static apr_status_t | corba_cleanup (void *par_orb) |
Cleanup routine releases ORB. More... | |
static int | corba_postconfig_hook (apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) |
In post config hook we initialize ORB. More... | |
static const char * | set_corba (cmd_parms *cmd, void *dummy, int flag) |
Handler for apache's configuration directive "CorbaEnable". More... | |
static const char * | set_ior_cache (cmd_parms *cmd, void *dummy, int flag) |
Handler for apache's configuration directive "CorbaEnable". More... | |
static const char * | set_nameservice (cmd_parms *cmd, void *dummy, const char *ns_loc) |
Handler for apache's configuration directive "CorbaNameservice". More... | |
static const char * | set_object (cmd_parms *cmd, void *dummy, const char *object, const char *alias) |
Handler for apache's configuration directive "CorbaObject". More... | |
static void * | create_corba_config (apr_pool_t *p, server_rec *s) |
Initialization of of mod_corba's configuration structure. | |
static void * | merge_corba_config (apr_pool_t *p, void *base_par, void *override_par) |
Merge of of mod_corba's configuration structure. | |
static void | corba_child_init (apr_pool_t *p, server_rec *s) |
Child init function. | |
static void | register_hooks (apr_pool_t *p) |
Registration of various hooks which the mod_corba is interested in. | |
Variables | |
module AP_MODULE_DECLARE_DATA | corba_module |
corba_module declaration. More... | |
static cache_t * | cache |
static const command_rec | corba_cmds [] |
Structure containing mod_corba's configuration directives and their handler references. More... | |
mod_corba.c manages corba object references.
The management is at this time rather primitive. For each connection, for which this module was enabled, are created configured object references, which are saved in connection notes and available for later use by other modules. The references are automaticaly cleaned up upon connection pool destruction.
#define raised_exception | ( | ev | ) | ((ev)->_major != CORBA_NO_EXCEPTION) |
Quick test if corba exception was raised.
Referenced by corba_cleanup(), corba_postconfig_hook(), corba_process_connection(), get_ior_from_nameservice(), get_reference_for_service(), get_reference_from_ior(), ior_cache_fill(), and reference_cleanup().
|
static |
Cleanup routine releases ORB.
This routine is called upon destroying configuration pool (which is at restarts).
par_orb | The ORB. |
References get_reference_ctx::orb, and raised_exception.
Referenced by corba_postconfig_hook().
|
static |
In post config hook we initialize ORB.
p | Memory pool. |
plog | Memory pool used for logging. |
ptemp | Memory pool destroyed right after postconfig phase. |
s | Server record. |
References corba_cleanup(), corba_module, corba_conf::enabled, corba_conf::ns_loc, corba_conf::objects, corba_conf::orb, get_reference_ctx::orb, and raised_exception.
Referenced by register_hooks().
|
static |
Connection handler.
Connection handler obtains object references from IOR string for configured objects. These object references are sticked to connection for later use by other modules. Cleanup routine which handles reference's release is bound to connection.
c | Incoming connection. |
References ap_log_cerror, get_reference_ctx::c, corba_module, corba_conf::enabled, get_reference_from_ior(), get_reference_from_nameservice(), corba_conf::ior_cache_enabled, get_reference_ctx::nameservice, corba_conf::ns_loc, corba_conf::objects, get_reference_ctx::objects, corba_conf::orb, get_reference_ctx::orb, and raised_exception.
Referenced by register_hooks().
|
static |
Function obtains IOR string for one object registered in mod_corba and assign it to IOR cache table.
pctx | Context pointer. |
alias | Alias of object. |
name | Name of object. |
References ap_log_cerror, get_reference_ctx::c, get_reference_for_service(), cache_t::iors, get_reference_ctx::orb, and raised_exception.
Referenced by ior_cache_fill().
|
static |
Context structure passed between get_ior_from_nameservice() and post config hook.
Function returns reference from nameservice (defined at context structure) for object given by name
pctx | Context pointer. |
alias | Alias of object. |
name | Name of object. |
References ap_log_cerror, get_reference_ctx::c, get_reference_ctx::nameservice, and raised_exception.
Referenced by get_ior_from_nameservice(), and get_reference_from_nameservice().
|
static |
Function obtains one reference from IOR string and sticks the reference to connection.
pctx | Context pointer. |
alias | Alias of object. |
name | Name of object. |
Try cache then nameservice (also overwrite cache for futher use) if nameservice is unavailable retry 3 times then fails.
References ap_log_cerror, get_reference_ctx::c, ior_cache_fill(), cache_t::iors, get_reference_ctx::objects, get_reference_ctx::orb, raised_exception, and reference_cleanup().
Referenced by corba_process_connection().
|
static |
Function obtains one reference from corba nameservice and sticks the reference to connection.
pctx | Context pointer. |
name | Name of object. |
alias | Alias of object. |
References ap_log_cerror, get_reference_ctx::c, get_reference_for_service(), get_reference_ctx::objects, and reference_cleanup().
Referenced by corba_process_connection().
|
static |
Caching support functions.
Function should delete whole cache and allocate new one. This is not used because if we refilling cache we just replace IOR string for new one for same object alias. Deletion is delegated to apr_table_set function.
static int ior_cache_garbage() { if (cache) { #if APR_HAS_THREADS apr_thread_mutex_lock(cache->mutex); #endif apr_pool_clear(cache->pool); cache->iors = apr_table_make(cache->pool, 5); #if APR_HAS_THREADS apr_thread_mutex_unlock(cache->mutex); #endif return 1; } return 0; } Function fills IOR cache with IOR strings configured for given server
s | Server structure pointer. |
References ap_log_cerror, get_reference_ctx::c, corba_module, get_ior_from_nameservice(), cache_t::iors, get_reference_ctx::nameservice, corba_conf::ns_loc, corba_conf::objects, get_reference_ctx::orb, and raised_exception.
Referenced by get_reference_from_ior().
|
static |
Cleanup routine releases corba object reference.
This routine is called upon destroying connection pool.
object | The object reference. |
References ap_log_cerror, and raised_exception.
Referenced by get_reference_from_ior(), and get_reference_from_nameservice().
|
static |
Handler for apache's configuration directive "CorbaEnable".
cmd | Command structure. |
dummy | Not used parameter. |
flag | 1 means Corba is turned on, 0 means turned off. |
References corba_module, and corba_conf::enabled.
|
static |
Handler for apache's configuration directive "CorbaEnable".
cmd | Command structure. |
dummy | Not used parameter. |
flag | 1 means Corba is turned on, 0 means turned off. |
References corba_module, and corba_conf::ior_cache_enabled.
|
static |
Handler for apache's configuration directive "CorbaNameservice".
Sets the host and optional port where nameservice runs.
cmd | Command structure. |
dummy | Not used parameter. |
ns_loc | The host [port] of nameservice. |
References corba_module, and corba_conf::ns_loc.
|
static |
Handler for apache's configuration directive "CorbaObject".
Sets a name of CORBA object which will be managed by this module.
cmd | Command structure. |
dummy | Not used parameter. |
object | A name of object. |
References corba_module, and corba_conf::objects.
|
static |
Structure containing mod_corba's configuration directives and their handler references.
Referenced by register_hooks().
module AP_MODULE_DECLARE_DATA corba_module |
corba_module declaration.
corba_module definition.
Referenced by corba_postconfig_hook(), corba_process_connection(), ior_cache_fill(), register_hooks(), set_corba(), set_ior_cache(), set_nameservice(), and set_object().