⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mod_gsoap.c

📁 基于Linux平台的SNMP/SOAP客服端源码:很不错的东西,可以学习,也可以应用开发.
💻 C
📖 第 1 页 / 共 4 页
字号:
 * record.  It will always be called for the "default" server. * * The return value is a pointer to the created module-specific * structure. */static void *gsoap_create_server_config(pool * p, server_rec * s){    gsoapConfiguration *pConfig = gsoapConfiguration_create(p);    pConfig->m_Type = ct_server;    return pConfig;}/* * This function gets called to merge two per-server configuration * records.  This is typically done to cope with things like virtual hosts and * the default server configuration. The routine has the responsibility of * creating a new record and merging the contents of the other two into it * appropriately. If the module doesn't declare a merge routine, the more * specific existing record is used exclusively. * * The routine MUST NOT modify any of its arguments! * * The return value is a pointer to the created module-specific structure * containing the merged values. */static void *gsoap_merge_server_config(pool * p, void *server1_conf, void *server2_conf){    gsoapConfiguration *pMergedConfig = gsoapConfiguration_create(p);    gsoapConfiguration *pServer1Config = (gsoapConfiguration *) server1_conf;    gsoapConfiguration *pServer2Config = (gsoapConfiguration *) server2_conf;    gsoapConfiguration_merge(pMergedConfig, pServer1Config, pServer2Config);    pMergedConfig->m_Type = ct_server;    return (void *)pMergedConfig;}/* * This routine is called after the request has been read but before any other * phases have been processed.  This allows us to make decisions based upon * the input header fields. * * The return value is OK, DECLINED, or HTTP_mumble.  If we return OK, no * further modules are called for this phase. */static intgsoap_post_read_request(request_rec * r){    return DECLINED;}/* * This routine gives our module an opportunity to translate the URI into an * actual filename.  If we don't do anything special, the server's default * rules (Alias directives and the like) will continue to be followed. * * The return value is OK, DECLINED, or HTTP_mumble.  If we return OK, no * further modules are called for this phase. */static intgsoap_translate_handler(request_rec * r){    return DECLINED;}/* * This routine is called to check the authentication information sent with * the request (such as looking up the user in a database and verifying that * the [encrypted] password sent matches the one in the database). * * The return value is OK, DECLINED, or some HTTP_mumble error (typically * HTTP_UNAUTHORIZED).  If we return OK, no other modules are given a chance * at the request during this phase. */static intgsoap_check_user_id(request_rec * r){    return DECLINED;}/* * This routine is called to check to see if the resource being requested * requires authorisation. * * The return value is OK, DECLINED, or HTTP_mumble.  If we return OK, no * other modules are called during this phase. * * If *all* modules return DECLINED, the request is aborted with a server * error. */static intgsoap_auth_checker(request_rec * r){    return DECLINED;}/* * This routine is called to check for any module-specific restrictions placed * upon the requested resource.  (See the mod_access module for an example.) * * The return value is OK, DECLINED, or HTTP_mumble.  All modules with an * handler for this phase are called regardless of whether their predecessors * return OK or DECLINED.  The first one to return any other status, however, * will abort the sequence (and the request) as usual. */static intgsoap_access_checker(request_rec * r){    return DECLINED;}/* * This routine is called to determine and/or set the various document type * information bits, like Content-type (via r->content_type), language, et * cetera. * * The return value is OK, DECLINED, or HTTP_mumble.  If we return OK, no * further modules are given a chance at the request for this phase. */static intgsoap_type_checker(request_rec * r){    return DECLINED;}/* * This routine is called to perform any module-specific fixing of header * fields, et cetera.  It is invoked just before any content-handler. * * The return value is OK, DECLINED, or HTTP_mumble.  If we return OK, the * server will still call any remaining modules with an handler for this * phase. */static intgsoap_fixer_upper(request_rec * r){    return OK;}/* * This routine is called to perform any module-specific logging activities * over and above the normal server things. * * The return value is OK, DECLINED, or HTTP_mumble.  If we return OK, any * remaining modules with an handler for this phase will still be called. */static intgsoap_logger(request_rec * r){    return DECLINED;}/* * This routine is called to give the module a chance to look at the request * headers and take any appropriate specific actions early in the processing * sequence. * * The return value is OK, DECLINED, or HTTP_mumble.  If we return OK, any * remaining modules with handlers for this phase will still be called. */static intgsoap_header_parser(request_rec * r){    return DECLINED;}/** helper funciton for library command handler. * @param pszPath the path of the library. * @param bIsSOAPLibrary true if it is a shared library containing a SOAP server. * @return true if the library was added, false if it was aleady in the collection. */static boolAddSharedLibrary(gsoapConfiguration * pConfig, const char *pszPath,                 const bool bIsSOAPLibrary){    bool bAdded = false;    pool *pPool = gsoapConfiguration_getModulePool();    if(!SoapSharedLibraries_contains(pConfig->m_pLibraries, pszPath))    {        SoapSharedLibrary *pLibrary = SoapSharedLibrary_create(pPool);        SoapSharedLibrary_init2(pLibrary, pPool, ap_pstrdup(pPool, pszPath));        pLibrary->m_bIsSOAPLibrary = bIsSOAPLibrary;        SoapSharedLibraries_addLibrary(pConfig->m_pLibraries, pLibrary);        bAdded = true;    }    return bAdded;}static gsoapConfiguration *getConfiguration(request_rec * r){    return (gsoapConfiguration *) ap_get_module_config(r->per_dir_config,                                                       &gsoap_module);}static gsoapRequestConfiguration *getRequestConfiguration(struct soap *soap){    gsoapRequestConfiguration *pRqConf =        (gsoapRequestConfiguration *) soap->fplugin(soap, GSOAP_ID);    return pRqConf;}/* * Patch from Ryan Troll * * Implmement these as weak symbols, allowing symbol checking during * compilation to succeed, even when another object is actually * providing these symbols at runtime. */SOAP_NMAC struct Namespace namespaces[] __attribute__ ((weak));SOAP_NMAC struct Namespace namespaces[] = {    {"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/",     "http://www.w3.org/*/soap-envelope"},    {"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/",     "http://www.w3.org/*/soap-encoding"},    {"xsi", "http://www.w3.org/2001/XMLSchema-instance",     "http://www.w3.org/*/XMLSchema-instance"},    {"xsd", "http://www.w3.org/2001/XMLSchema",     "http://www.w3.org/*/XMLSchema"},    {NULL, NULL}};SOAP_FMAC3 void SOAP_FMAC4 soap_serializeheader(struct soap *soap)    __attribute__ ((weak));SOAP_FMAC3 void SOAP_FMAC4soap_serializeheader(struct soap *soap){    gsoapRequestConfiguration *pRqConf = getRequestConfiguration(soap);    pRqConf->pIntf->soap_serializeheader(soap);}SOAP_FMAC3 int SOAP_FMAC4 soap_putheader(struct soap *soap)    __attribute__ ((weak));SOAP_FMAC3 int SOAP_FMAC4soap_putheader(struct soap *soap){    gsoapRequestConfiguration *pRqConf = getRequestConfiguration(soap);    return pRqConf->pIntf->soap_putheader(soap);}SOAP_FMAC3 int SOAP_FMAC4 soap_getheader(struct soap *soap)    __attribute__ ((weak));SOAP_FMAC3 int SOAP_FMAC4soap_getheader(struct soap *soap){    gsoapRequestConfiguration *pRqConf = getRequestConfiguration(soap);    return pRqConf->pIntf->soap_getheader(soap);}SOAP_FMAC3 void SOAP_FMAC4 soap_fault(struct soap *soap) __attribute__ ((weak));SOAP_FMAC3 void SOAP_FMAC4soap_fault(struct soap *soap){    gsoapRequestConfiguration *pRqConf = getRequestConfiguration(soap);    pRqConf->pIntf->soap_fault(soap);}SOAP_FMAC3 void SOAP_FMAC4 soap_serializefault(struct soap *soap)    __attribute__ ((weak));SOAP_FMAC3 void SOAP_FMAC4soap_serializefault(struct soap *soap){    gsoapRequestConfiguration *pRqConf = getRequestConfiguration(soap);    pRqConf->pIntf->soap_serializefault(soap);}SOAP_FMAC3 int SOAP_FMAC4 soap_putfault(struct soap *soap)    __attribute__ ((weak));SOAP_FMAC3 int SOAP_FMAC4soap_putfault(struct soap *soap){    gsoapRequestConfiguration *pRqConf = getRequestConfiguration(soap);    return pRqConf->pIntf->soap_putfault(soap);}SOAP_FMAC3 int SOAP_FMAC4 soap_getfault(struct soap *soap)    __attribute__ ((weak));SOAP_FMAC3 int SOAP_FMAC4soap_getfault(struct soap *soap){    gsoapRequestConfiguration *pRqConf = getRequestConfiguration(soap);    return pRqConf->pIntf->soap_getfault(soap);}SOAP_FMAC3 const char **SOAP_FMAC4 soap_faultcode(struct soap *soap)    __attribute__ ((weak));SOAP_FMAC3 const char **SOAP_FMAC4soap_faultcode(struct soap *soap){    gsoapRequestConfiguration *pRqConf = getRequestConfiguration(soap);    return pRqConf->pIntf->soap_faultcode(soap);}SOAP_FMAC3 const char **SOAP_FMAC4 soap_faultstring(struct soap *soap)    __attribute__ ((weak));SOAP_FMAC3 const char **SOAP_FMAC4soap_faultstring(struct soap *soap){    gsoapRequestConfiguration *pRqConf = getRequestConfiguration(soap);    return pRqConf->pIntf->soap_faultstring(soap);}SOAP_FMAC3 const char **SOAP_FMAC4 soap_faultdetail(struct soap *soap)    __attribute__ ((weak));SOAP_FMAC3 const char **SOAP_FMAC4soap_faultdetail(struct soap *soap){    gsoapRequestConfiguration *pRqConf = getRequestConfiguration(soap);    return pRqConf->pIntf->soap_faultdetail(soap);}/* * Patch from Ryan Troll * * These may never be used within a server context.  However, * gsoap-2.7.0e requires these functions to be defined.  Thus, * we need to define them here. * */SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap *soap, const void *a,                                            int b) __attribute__ ((weak));SOAP_FMAC3 void SOAP_FMAC4soap_markelement(struct soap *soap, const void *a, int b){    gsoapRequestConfiguration *pRqConf = getRequestConfiguration(soap);    return pRqConf->pIntf->soap_markelement(soap, a, b);}SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap *soap, const void *a,                                          const char *b, int c, int d)    __attribute__ ((weak));SOAP_FMAC3 int SOAP_FMAC4soap_putelement(struct soap *soap, const void *a, const char *b, int c, int d){    gsoapRequestConfiguration *pRqConf = getRequestConfiguration(soap);    return pRqConf->pIntf->soap_putelement(soap, a, b, c, d);}SOAP_FMAC3 void *SOAP_FMAC4 soap_getelement(struct soap *soap, int *a)    __attribute__ ((weak));SOAP_FMAC3 void *SOAP_FMAC4soap_getelement(struct soap *soap, int *a){    gsoapRequestConfiguration *pRqConf = getRequestConfiguration(soap);    return pRqConf->pIntf->soap_getelement(soap, a);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -