Genivia Home Documentation
mod_gsoap.c File Reference

updated Sat Mar 9 2019 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   ((int)0xffff)
 
#define IOBUF_CHUNK_SIZE   8192
 
#define GSOAP_ID   "Apache 2.0 mod_gsoap gsoap httpd extension 0.0.9"
 
#define DLSYM(a, b)   dlsym(a,b)
 
#define DLOPEN(a, b)   dlopen(a,b)
 

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 void * gsoap_create_dir_config (apr_pool_t *p, char *dirspec)
 
static void * gsoap_merge_dir_config (apr_pool_t *p, void *parent_conf, void *newloc_conf)
 
static void * gsoap_create_server_config (apr_pool_t *p, server_rec *s)
 
static void * gsoap_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 void 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 http_parse (struct soap *psoap)
 
static int fpoll (struct soap *psoap)
 
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.0

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)

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

Macro Definition Documentation

◆ __attribute__

#define __attribute__ (   __x)

◆ APR_WANT_STRFUNC

#define APR_WANT_STRFUNC

◆ DLOPEN

#define DLOPEN (   a,
 
)    dlopen(a,b)

◆ DLSYM

#define DLSYM (   a,
 
)    dlsym(a,b)

◆ FALSE

#define FALSE   0

◆ GSOAP_ID

#define GSOAP_ID   "Apache 2.0 mod_gsoap gsoap httpd extension 0.0.9"

◆ IOBUF_CHUNK_SIZE

#define IOBUF_CHUNK_SIZE   8192

◆ TRUE

#define TRUE   ((int)0xffff)

Typedef Documentation

◆ Bool

typedef int Bool

◆ command_function_interface

typedef const char*(* command_function_interface) ()

◆ ConfigurationType

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

◆ gsoapConfiguration

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.

◆ gsoapRequestConfiguration

Our internal per request soap configuration

◆ SoapSharedLibraries

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

◆ SoapSharedLibrary

A shared library containing a SOAP server.

Enumeration Type Documentation

◆ enConfigurationType

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

Enumerator
ct_server 
ct_directory 
ct_both 

Function Documentation

◆ AddSharedLibrary()

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.

◆ cmd_SoapLibrary()

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.

◆ cmd_SupportLibrary()

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.

◆ fpoll()

static int fpoll ( struct soap *  psoap)
static

make sure we go through soap_send_fault(), which calls fpoll

◆ frecv()

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

◆ fsend()

static int fsend ( struct soap *  psoap,
const char *  pBuf,
apr_size_t  len 
)
static

◆ getConfiguration()

static gsoapConfiguration * getConfiguration ( request_rec *  r)
static

◆ getRequestConfiguration()

static gsoapRequestConfiguration * getRequestConfiguration ( struct soap *  soap)
static

◆ gsoap_child_exit()

static void gsoap_child_exit ( server_rec *  s,
apr_pool_t *  p 
)
static

◆ gsoap_child_init()

static void gsoap_child_init ( server_rec *  s,
apr_pool_t *  p 
)
static

◆ gsoap_create_dir_config()

static void * gsoap_create_dir_config ( apr_pool_t *  p,
char *  dirspec 
)
static

◆ gsoap_create_server_config()

static void * gsoap_create_server_config ( apr_pool_t *  p,
server_rec *  s 
)
static

◆ gsoap_handler()

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")

◆ gsoap_hooks()

static void gsoap_hooks ( apr_pool_t *  p)
static

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

◆ gsoap_init()

static int gsoap_init ( apr_pool_t *  p,
apr_pool_t *  ptemp,
apr_pool_t *  plog,
server_rec *  psrec 
)
static

◆ gsoap_merge_dir_config()

static void * gsoap_merge_dir_config ( apr_pool_t *  p,
void *  parent_conf,
void *  newloc_conf 
)
static

◆ gsoap_merge_server_config()

static void * gsoap_merge_server_config ( apr_pool_t *  p,
void *  server1_conf,
void *  server2_conf 
)
static

◆ gsoapConfiguration_create()

static gsoapConfiguration* gsoapConfiguration_create ( apr_pool_t *  p)
static

◆ gsoapConfiguration_getModulePool()

static apr_pool_t* gsoapConfiguration_getModulePool ( )
static
Returns
our apr_pool_tfor gsoapConfiguration

◆ gsoapConfiguration_init()

static void gsoapConfiguration_init ( gsoapConfiguration This,
apr_pool_t *  p 
)
static

◆ gsoapConfiguration_merge()

static void gsoapConfiguration_merge ( gsoapConfiguration This,
gsoapConfiguration pParentConfig,
gsoapConfiguration pNewConfig 
)
static

◆ http_parse()

static int http_parse ( struct soap *  psoap)
static

instead of real header parsing we skip that.

◆ http_post_header()

static int http_post_header ( struct soap *  soap,
const char *  key,
const char *  value 
)
static

◆ HTTPGet_SendWSDL()

static void HTTPGet_SendWSDL ( request_rec *  r,
const char *  path 
)
static

◆ ListHeaders()

static void ListHeaders ( request_rec *  r)
static

write out the headers of the request.

◆ ListHeadersCallback()

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

helper to write out the headers

◆ mod_gsoap_delete()

static void mod_gsoap_delete ( struct soap *  soap,
struct soap_plugin *  p 
)
static

◆ mod_gsoap_plugin()

static int mod_gsoap_plugin ( struct soap *  soap,
struct soap_plugin *  p,
void *  arg 
)
static

◆ mod_gsoap_plugin_copy()

static int mod_gsoap_plugin_copy ( struct soap *  soap,
struct soap_plugin *  dst,
struct soap_plugin *  src 
)
static

◆ send_header_to_gsoap()

static int send_header_to_gsoap ( void *  pvoid,
const char *  key,
const char *  value 
)
static

◆ SendErrorMessage()

static void SendErrorMessage ( request_rec *  r,
const char *  pszError 
)
static

send the error message to the client browser

◆ set_callbacks()

static void set_callbacks ( request_rec *  r,
gsoapRequestConfiguration pRqConf,
struct soap *  psoap 
)
static

◆ SoapSharedLibraries_addLibrary()

static void SoapSharedLibraries_addLibrary ( SoapSharedLibraries This,
SoapSharedLibrary pLibrary 
)
static

◆ SoapSharedLibraries_clear()

static void SoapSharedLibraries_clear ( SoapSharedLibraries This)
static

◆ SoapSharedLibraries_contains()

static Bool SoapSharedLibraries_contains ( SoapSharedLibraries This,
const char *  pszPath 
)
static
Parameters
pszPaththe operating system name of the library.

◆ SoapSharedLibraries_getEntryPoints()

static const char* SoapSharedLibraries_getEntryPoints ( SoapSharedLibraries This,
SoapSharedLibrary pLib,
apr_pool_t *  pTempPool,
request_rec *  r 
)
static

◆ SoapSharedLibraries_getLibrary()

static SoapSharedLibrary* SoapSharedLibraries_getLibrary ( SoapSharedLibraries This,
unsigned  nIndex 
)
static

◆ SoapSharedLibraries_init()

static void SoapSharedLibraries_init ( SoapSharedLibraries This,
apr_pool_t *  p 
)
static

◆ SoapSharedLibraries_loadAllLibraries()

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.

◆ SoapSharedLibraries_merge()

static void SoapSharedLibraries_merge ( SoapSharedLibraries This,
SoapSharedLibraries pLibs 
)
static

◆ SoapSharedLibraries_merge3()

static void SoapSharedLibraries_merge3 ( SoapSharedLibraries This,
SoapSharedLibraries libraries1,
SoapSharedLibraries libraries2 
)
static

◆ SoapSharedLibraries_unloadAllLibraries()

static const char* SoapSharedLibraries_unloadAllLibraries ( SoapSharedLibraries This)
static

◆ SoapSharedLibrary_clear()

static void SoapSharedLibrary_clear ( SoapSharedLibrary This,
apr_pool_t *  p 
)
static

◆ SoapSharedLibrary_create()

static SoapSharedLibrary* SoapSharedLibrary_create ( apr_pool_t *  p)
static

◆ SoapSharedLibrary_init()

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.

◆ SoapSharedLibrary_init2()

static void SoapSharedLibrary_init2 ( SoapSharedLibrary This,
apr_pool_t *  p,
const char *  pszPath 
)
static

◆ SoapSharedLibrary_load()

static const char* SoapSharedLibrary_load ( SoapSharedLibrary This,
apr_pool_t *  pTempPool 
)
static
Parameters
pTempPoolpool to use for allocating temporary objects (e.g. error message).

◆ SoapSharedLibrary_unload()

static const char* SoapSharedLibrary_unload ( SoapSharedLibrary This)
static
Returns
NULL on success or error message if an error occurred.

Variable Documentation

◆ gsoap_cmds

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:556
static const char * cmd_SoapLibrary(cmd_parms *cmd, void *mconfig, const char *pszPath)
Definition: mod_gsoap.c:542
const char *(* command_function_interface)()
Definition: mod_gsoap.c:564

List of directives specific to our module.

◆ gsoap_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:605
static void * gsoap_create_dir_config(apr_pool_t *p, char *dirspec)
Definition: mod_gsoap.c:1234
static void * gsoap_merge_server_config(apr_pool_t *p, void *server1_conf, void *server2_conf)
Definition: mod_gsoap.c:1298
static void * gsoap_merge_dir_config(apr_pool_t *p, void *parent_conf, void *newloc_conf)
Definition: mod_gsoap.c:1258
static const command_rec gsoap_cmds[]
Definition: mod_gsoap.c:568
static void * gsoap_create_server_config(apr_pool_t *p, server_rec *s)
Definition: mod_gsoap.c:1276

◆ mod_gsoap_id

char mod_gsoap_id[] = GSOAP_ID
static

◆ the_gsoapPool

apr_pool_t* the_gsoapPool = NULL
static