Genivia Home Documentation
mod_gsoap.c File Reference

updated Thu Jun 24 2021 by Robert van Engelen
 
Classes | Macros | Typedefs | Enumerations | Functions | Variables
mod_gsoap.c File Reference
#include <stdio.h>
#include <assert.h>
#include <dlfcn.h>
#include "apr_strings.h"
#include "apr_fnmatch.h"
#include "apr_lib.h"
#include "apr_pools.h"
#include "apr_want.h"
#include "httpd.h"
#include "http_request.h"
#include "http_config.h"
#include "http_core.h"
#include "http_log.h"
#include "http_main.h"
#include "http_protocol.h"
#include "util_script.h"
#include "stdsoap2.h"
#include "apache_gsoap.h"
Include dependency graph for mod_gsoap.c:

Classes

struct  SoapSharedLibrary_S
 
struct  SoapSharedLibraries_S
 
struct  gsoapConfiguration_S
 
struct  gsoapRequestConfiguration_S
 

Macros

#define __attribute__(__x)
 
#define APR_WANT_STRFUNC
 
#define FALSE   0
 
#define TRUE   1
 
#define GSOAP_ID   "Apache 2.x mod_gsoap gsoap httpd extension 1.0"
 
#define DLSYM(a, b)   dlsym(a,b)
 
#define DLOPEN(a, b)   dlopen(a,b)
 
#define DLCLOSE(a)   dlclose(a)
 
#define DLERROR()   dlerror()
 

Typedefs

typedef int Bool
 
typedef struct SoapSharedLibrary_S SoapSharedLibrary
 
typedef struct SoapSharedLibraries_S SoapSharedLibraries
 
typedef enum enConfigurationType ConfigurationType
 
typedef struct gsoapConfiguration_S gsoapConfiguration
 
typedef struct gsoapRequestConfiguration_S gsoapRequestConfiguration
 
typedef const char *(* command_function_interface) ()
 

Enumerations

enum  enConfigurationType { ct_server = 1, ct_directory = 2, ct_both = 3 }
 

Functions

static apr_pool_t * gsoapConfiguration_getModulePool ()
 
static gsoapConfigurationgetConfiguration (request_rec *r)
 
static gsoapRequestConfigurationgetRequestConfiguration (struct soap *)
 
static void SoapSharedLibrary_init (SoapSharedLibrary *This, apr_pool_t *p, const SoapSharedLibrary *pLib)
 
static void SoapSharedLibrary_init2 (SoapSharedLibrary *This, apr_pool_t *p, const char *pszPath)
 
static void SoapSharedLibrary_clear (SoapSharedLibrary *This, apr_pool_t *p)
 
static SoapSharedLibrarySoapSharedLibrary_create (apr_pool_t *p)
 
static const char * SoapSharedLibrary_load (SoapSharedLibrary *This, apr_pool_t *pTempPool)
 
static const char * SoapSharedLibrary_unload (SoapSharedLibrary *This)
 
static void SoapSharedLibraries_init (SoapSharedLibraries *This, apr_pool_t *p)
 
static SoapSharedLibrarySoapSharedLibraries_getLibrary (SoapSharedLibraries *This, unsigned nIndex)
 
static Bool SoapSharedLibraries_contains (SoapSharedLibraries *This, const char *pszPath)
 
static void SoapSharedLibraries_addLibrary (SoapSharedLibraries *This, SoapSharedLibrary *pLibrary)
 
static const char * SoapSharedLibraries_getEntryPoints (SoapSharedLibraries *This, SoapSharedLibrary *pLib, apr_pool_t *pTempPool, request_rec *r)
 
static const char * SoapSharedLibraries_loadAllLibraries (SoapSharedLibraries *This, apr_pool_t *pTempPool, request_rec *r)
 
static const char * SoapSharedLibraries_unloadAllLibraries (SoapSharedLibraries *This)
 
static void SoapSharedLibraries_clear (SoapSharedLibraries *This)
 
static void SoapSharedLibraries_merge (SoapSharedLibraries *This, SoapSharedLibraries *pLibs)
 
static void SoapSharedLibraries_merge3 (SoapSharedLibraries *This, SoapSharedLibraries *libraries1, SoapSharedLibraries *libraries2)
 
static void gsoapConfiguration_merge (gsoapConfiguration *This, gsoapConfiguration *pParentConfig, gsoapConfiguration *pNewConfig)
 
static void gsoapConfiguration_init (gsoapConfiguration *This, apr_pool_t *p)
 
static gsoapConfigurationgsoapConfiguration_create (apr_pool_t *p)
 
static int gsoap_handler (request_rec *r)
 
static int gsoap_init (apr_pool_t *p, apr_pool_t *ptemp, apr_pool_t *plog, server_rec *psrec)
 
static voidgsoap_create_dir_config (apr_pool_t *p, char *dirspec)
 
static voidgsoap_merge_dir_config (apr_pool_t *p, void *parent_conf, void *newloc_conf)
 
static voidgsoap_create_server_config (apr_pool_t *p, server_rec *s)
 
static voidgsoap_merge_server_config (apr_pool_t *p, void *server1_conf, void *server2_conf)
 
static Bool AddSharedLibrary (gsoapConfiguration *pConfig, const char *pszPath, const Bool bIsSOAPLibrary)
 
static const char * cmd_SoapLibrary (cmd_parms *cmd, void *mconfig, const char *pszPath)
 
static const char * cmd_SupportLibrary (cmd_parms *cmd, void *mconfig, const char *pszPath)
 
static void gsoap_hooks (apr_pool_t *p)
 
static int ListHeadersCallback (void *rec, const char *key, const char *value)
 
static void ListHeaders (request_rec *r)
 
static void SendErrorMessage (request_rec *r, const char *pszError)
 
static int HTTPGet_SendWSDL (request_rec *r, const char *path)
 
static int send_header_to_gsoap (void *pvoid, const char *key, const char *value)
 
static int http_post_header (struct soap *soap, const char *key, const char *value)
 
static size_t frecv (struct soap *psoap, char *pBuf, apr_size_t len)
 
static int fsend (struct soap *psoap, const char *pBuf, apr_size_t len)
 
static int mod_gsoap_plugin_copy (struct soap *soap, struct soap_plugin *dst, struct soap_plugin *src)
 
static void mod_gsoap_delete (struct soap *soap, struct soap_plugin *p)
 
static int mod_gsoap_plugin (struct soap *soap, struct soap_plugin *p, void *arg)
 
static void set_callbacks (request_rec *r, gsoapRequestConfiguration *pRqConf, struct soap *psoap)
 
static void gsoap_child_init (server_rec *s, apr_pool_t *p)
 
static void gsoap_child_exit (server_rec *s, apr_pool_t *p)
 

Variables

static char mod_gsoap_id [] = GSOAP_ID
 
static apr_pool_t * the_gsoapPool = NULL
 
static const command_rec gsoap_cmds []
 
module AP_MODULE_DECLARE_DATA gsoap_module
 

Detailed Description

Apache gSOAP module for Apache 2.x

originator: Christian Aberger (http://www.aberger.at) ported to Apache 2.0 by Mick Wall (mick@.nosp@m.mick.nosp@m.andwe.nosp@m.ndy..nosp@m.com) updated by Robert van Engelen (engel.nosp@m.en@a.nosp@m.cm.or.nosp@m.g) updated by David Viner (dvine.nosp@m.r@ap.nosp@m.ache..nosp@m.org) updated by Ryan Troll (patch removed) updated by La Cam Chung and Robert van Engelen (HTTP GET ?wsdl to get WSDL) revised and upgraded by Robert van Engelen (engel.nosp@m.en@a.nosp@m.cm.or.nosp@m.g) to support more plugins, REST and decompression

Contributed to the gSOAP package under the terms and conditions of the gSOAP public license.

Macro Definition Documentation

#define __attribute__ (   __x)
#define APR_WANT_STRFUNC
#define DLCLOSE (   a)    dlclose(a)
#define DLERROR ( )    dlerror()
#define DLOPEN (   a,
 
)    dlopen(a,b)
#define DLSYM (   a,
 
)    dlsym(a,b)
#define FALSE   0
#define GSOAP_ID   "Apache 2.x mod_gsoap gsoap httpd extension 1.0"
#define TRUE   1

Typedef Documentation

typedef int Bool
typedef const char*(* command_function_interface) ()

Environment to which record applies (directory, server, or combination).

Store the configuration information set in the Apache Server configuration directives. These are set e.g. in the file httpd.conf It's perfectly reasonable to have two different structures for the two different environments. The same command handlers will be called for both, though, so the handlers need to be able to tell them apart. One possibility is for both structures to start with an int which is zero for one and 1 for the other.

Note that while the per-directory and per-server configuration records are available to most of the module handlers, they should be treated as READ-ONLY by all except the command and merge handlers. Sometimes handlers are handed a record that applies to the current location by implication or inheritance, and modifying it will change the rules for other locations.

Our internal per request soap configuration

Table of shared libraries that are already loaded. a singleton.

A shared library containing a SOAP server.

Enumeration Type Documentation

Environment to which record applies (directory, server, or combination).

Enumerator
ct_server 
ct_directory 
ct_both 

Function Documentation

static Bool AddSharedLibrary ( gsoapConfiguration pConfig,
const char *  pszPath,
const Bool  bIsSOAPLibrary 
)
static

helper funciton for library command handler.

Parameters
pszPaththe path of the library.
bIsSOAPLibrarytrue if it is a shared library containing a SOAP server.
Returns
true if the library was added, false if it was aleady in the collection.
static const char* cmd_SoapLibrary ( cmd_parms *  cmd,
void mconfig,
const char *  pszPath 
)
static

Command handler for the TAKE1 "SOAPLibrary" directive. We remember the load path for the shared library that contains the SOAP server.

static const char* cmd_SupportLibrary ( cmd_parms *  cmd,
void mconfig,
const char *  pszPath 
)
static

Command handler for the TAKE1 "SOAPSupportLibrary" directive. We remember the load path for a shared library that must additionally loaded. This is a mechanism to load libraries that the SOAPLibrary depends on. This type of libraries do not contain our soap server.

static size_t frecv ( struct soap *  psoap,
char *  pBuf,
apr_size_t  len 
)
static

gsoap function that requests the next piece of data from us

static int fsend ( struct soap *  psoap,
const char *  pBuf,
apr_size_t  len 
)
static
static gsoapConfiguration * getConfiguration ( request_rec *  r)
static
static gsoapRequestConfiguration * getRequestConfiguration ( struct soap *  soap)
static
static void gsoap_child_exit ( server_rec *  s,
apr_pool_t *  p 
)
static
static void gsoap_child_init ( server_rec *  s,
apr_pool_t *  p 
)
static
static void * gsoap_create_dir_config ( apr_pool_t *  p,
char *  dirspec 
)
static
static void * gsoap_create_server_config ( apr_pool_t *  p,
server_rec *  s 
)
static
static int gsoap_handler ( request_rec *  r)
static

SOAP content handler.

Returns
the value that instructs the caller concerning what happened and what to do next. OK ("we did our thing") DECLINED ("this isn't something with which we want to get involved") HTTP_mumble ("an error status should be reported")
static void gsoap_hooks ( apr_pool_t *  p)
static

List of callback routines and data structures that provide the hooks into our module.

static int gsoap_init ( apr_pool_t *  p,
apr_pool_t *  ptemp,
apr_pool_t *  plog,
server_rec *  psrec 
)
static
static void * gsoap_merge_dir_config ( apr_pool_t *  p,
void parent_conf,
void newloc_conf 
)
static
static void * gsoap_merge_server_config ( apr_pool_t *  p,
void server1_conf,
void server2_conf 
)
static
static gsoapConfiguration* gsoapConfiguration_create ( apr_pool_t *  p)
static
static apr_pool_t* gsoapConfiguration_getModulePool ( )
static
Returns
our apr_pool_tfor gsoapConfiguration
static void gsoapConfiguration_init ( gsoapConfiguration This,
apr_pool_t *  p 
)
static
static void gsoapConfiguration_merge ( gsoapConfiguration This,
gsoapConfiguration pParentConfig,
gsoapConfiguration pNewConfig 
)
static
static int http_post_header ( struct soap *  soap,
const char *  key,
const char *  value 
)
static
static int HTTPGet_SendWSDL ( request_rec *  r,
const char *  path 
)
static
static void ListHeaders ( request_rec *  r)
static

write out the headers of the request.

static int ListHeadersCallback ( void rec,
const char *  key,
const char *  value 
)
static

helper to write out the headers

static void mod_gsoap_delete ( struct soap *  soap,
struct soap_plugin *  p 
)
static
static int mod_gsoap_plugin ( struct soap *  soap,
struct soap_plugin *  p,
void arg 
)
static
static int mod_gsoap_plugin_copy ( struct soap *  soap,
struct soap_plugin *  dst,
struct soap_plugin *  src 
)
static
static int send_header_to_gsoap ( void pvoid,
const char *  key,
const char *  value 
)
static
static void SendErrorMessage ( request_rec *  r,
const char *  pszError 
)
static

send the error message to the client browser

static void set_callbacks ( request_rec *  r,
gsoapRequestConfiguration pRqConf,
struct soap *  psoap 
)
static
static void SoapSharedLibraries_addLibrary ( SoapSharedLibraries This,
SoapSharedLibrary pLibrary 
)
static
static void SoapSharedLibraries_clear ( SoapSharedLibraries This)
static
static Bool SoapSharedLibraries_contains ( SoapSharedLibraries This,
const char *  pszPath 
)
static
Parameters
pszPaththe operating system name of the library.
static const char* SoapSharedLibraries_getEntryPoints ( SoapSharedLibraries This,
SoapSharedLibrary pLib,
apr_pool_t *  pTempPool,
request_rec *  r 
)
static
static SoapSharedLibrary* SoapSharedLibraries_getLibrary ( SoapSharedLibraries This,
unsigned  nIndex 
)
static
static void SoapSharedLibraries_init ( SoapSharedLibraries This,
apr_pool_t *  p 
)
static
static const char* SoapSharedLibraries_loadAllLibraries ( SoapSharedLibraries This,
apr_pool_t *  pTempPool,
request_rec *  r 
)
static
Returns
the error message if a load failed, NULL on success.
static void SoapSharedLibraries_merge ( SoapSharedLibraries This,
SoapSharedLibraries pLibs 
)
static
static void SoapSharedLibraries_merge3 ( SoapSharedLibraries This,
SoapSharedLibraries libraries1,
SoapSharedLibraries libraries2 
)
static
static const char* SoapSharedLibraries_unloadAllLibraries ( SoapSharedLibraries This)
static
static void SoapSharedLibrary_clear ( SoapSharedLibrary This,
apr_pool_t *  p 
)
static
static SoapSharedLibrary* SoapSharedLibrary_create ( apr_pool_t *  p)
static
static void SoapSharedLibrary_init ( SoapSharedLibrary This,
apr_pool_t *  p,
const SoapSharedLibrary pLib 
)
static
Parameters
pthe apr_pool_tto use for memory allocations.
pszPaththe path of the library.
static void SoapSharedLibrary_init2 ( SoapSharedLibrary This,
apr_pool_t *  p,
const char *  pszPath 
)
static
static const char* SoapSharedLibrary_load ( SoapSharedLibrary This,
apr_pool_t *  pTempPool 
)
static
Parameters
pTempPoolpool to use for allocating temporary objects (e.g. error message).
static const char* SoapSharedLibrary_unload ( SoapSharedLibrary This)
static
Returns
NULL on success or error message if an error occurred.

Variable Documentation

const command_rec gsoap_cmds[]
static
Initial value:
= {
AP_INIT_TAKE1("SOAPLibrary",
NULL,
ACCESS_CONF,
"SOAP shared library that will be dynamically loaded. - 1 argument (path)"
),
AP_INIT_TAKE1("SupportLibrary",
NULL,
ACCESS_CONF,
"additional library that must be dynamically loaded - 1 argument (path)"
),
{NULL}
}
static const char * cmd_SupportLibrary(cmd_parms *cmd, void *mconfig, const char *pszPath)
Definition: mod_gsoap.c:553
static const char * cmd_SoapLibrary(cmd_parms *cmd, void *mconfig, const char *pszPath)
Definition: mod_gsoap.c:538
const char *(* command_function_interface)()
Definition: mod_gsoap.c:562

List of directives specific to our module.

module AP_MODULE_DECLARE_DATA gsoap_module
Initial value:
= {
STANDARD20_MODULE_STUFF,
}
static void gsoap_hooks(apr_pool_t *p)
Definition: mod_gsoap.c:603
static void * gsoap_create_dir_config(apr_pool_t *p, char *dirspec)
Definition: mod_gsoap.c:1250
static void * gsoap_merge_server_config(apr_pool_t *p, void *server1_conf, void *server2_conf)
Definition: mod_gsoap.c:1314
static void * gsoap_merge_dir_config(apr_pool_t *p, void *parent_conf, void *newloc_conf)
Definition: mod_gsoap.c:1274
static const command_rec gsoap_cmds[]
Definition: mod_gsoap.c:566
static void * gsoap_create_server_config(apr_pool_t *p, server_rec *s)
Definition: mod_gsoap.c:1292
char mod_gsoap_id[] = GSOAP_ID
static
apr_pool_t* the_gsoapPool = NULL
static