commit c59214acbe4c161aa5fed442efd95e2c3ba744e4 Author: zribiahmed Date: Thu Nov 22 13:29:17 2012 +0000 copy diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f57fe68 --- /dev/null +++ b/Makefile @@ -0,0 +1,121 @@ +# +# Copyright (C) 2011 Inteno +# + + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk +PKG_NAME:=cwmpd +PKG_RELEASE:=0 +PKG_VERSION:=1.3 +CWMP_BKP_FILE:=/etc/cwmpd/.cwmpd_backup_session.xml +OTHER_MENU:=Other modules +include $(INCLUDE_DIR)/package.mk + + +define KernelPackage/kcwmp + SUBMENU:=$(OTHER_MENU) + TITLE:=Modules for TR-069 value change notification + KCONFIG:= + FILES:=$(PKG_BUILD_DIR)/kcwmp.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,1,kcwmp) +endef + +define KernelPackage/kcwmp/description + TR-069 kernel modules for value change notification +endef + +EXTRA_KCONFIG:= \ + CONFIG_HELLO_MOD=m + +EXTRA_CFLAGS:= \ + $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(EXTRA_KCONFIG)))) \ + $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(EXTRA_KCONFIG)))) \ + +MAKE_OPTS:= \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + SUBDIRS="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ + $(EXTRA_KCONFIG) + +define Package/cwmpd + CATEGORY:=Utilities + TITLE:=TR-069 client + DEPENDS:=PACKAGE_libuci:libuci PACKAGE_libexpat:libexpat PACKAGE_libcurl:libcurl PACKAGE_libpthread:libpthread PACKAGE_libopenssl:libopenssl +endef + +define Package/libcwmp + SECTION:=libs + CATEGORY:=Libraries + TITLE:=C library for the TR-069 client +endef + +define Package/cwmpd/description + TR-069 client +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + $(CP) ./src/* $(PKG_BUILD_DIR)/ +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) LINUX_DIR=$(LINUX_DIR) MAKE_OPTS=$(MAKE_OPTS) LDFLAGS="-L$(STAGING_DIR)/usr/lib" CFLAGS="$(TARGET_CFLAGS) -I$(LINUX_DIR)/include -I$(STAGING_DIR)/usr/include -DCWMP_BKP_FILE=\\\"$(CWMP_BKP_FILE)\\\"" +endef + +define Package/libcwmp/install + $(INSTALL_DIR) $(1)/lib + $(CP) $(PKG_BUILD_DIR)/libcwmp.so* $(1)/lib/ +endef + +define Package/cwmpd/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/cwmpd $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/cwmp_value_change $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) -m0644 $(PKG_BUILD_DIR)/config/cwmp $(1)/etc/config/ + $(INSTALL_DIR) $(1)/etc/cwmpd/dm + $(INSTALL_DATA) -m0644 $(PKG_BUILD_DIR)/dm/xml/* $(1)/etc/cwmpd/dm + $(INSTALL_DIR) $(1)/etc/cwmpd/scripts + $(INSTALL_DATA) -m0755 $(PKG_BUILD_DIR)/dm/scripts/* $(1)/etc/cwmpd/scripts + $(INSTALL_DATA) -m0755 $(PKG_BUILD_DIR)/init/iccu_enable $(1)/etc/cwmpd/scripts/iccu_enable + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DATA) -m0755 $(PKG_BUILD_DIR)/init/cwmpd.init $(1)/etc/init.d/cwmpd + $(INSTALL_DATA) -m0755 $(PKG_BUILD_DIR)/init/iccu.init $(1)/etc/init.d/iccu +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/inc/cwmp_lib.h $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/inc/cwmp_kernel.h $(LINUX_DIR)/include/linux + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/libcwmp.so* $(1)/usr/lib +endef + +define Package/cwmpd/postinst + #!/bin/sh + echo "$(CWMP_BKP_FILE)" >> $${IPKG_INSTROOT}/etc/sysupgrade.conf + echo "/etc/cwmpd/.iccu/cwmp" >> $${IPKG_INSTROOT}/etc/sysupgrade.conf + if [ -z "$${IPKG_INSTROOT}" ]; then + echo "Enabling rc.d symlink for cwmpd" + /etc/init.d/cwmpd enable + /etc/init.d/iccu enable + fi + exit 0 +endef + +define Package/cwmpd/prerm + #!/bin/sh + if [ -z "$${IPKG_INSTROOT}" ]; then + echo "Disabling rc.d symlink for cwmpd" + /etc/init.d/cwmpd disable + /etc/init.d/iccu disable + fi + exit 0 +endef + +$(eval $(call BuildPackage,cwmpd)) +$(eval $(call BuildPackage,libcwmp)) +$(eval $(call KernelPackage,kcwmp)) diff --git a/README b/README new file mode 100644 index 0000000..4b4639a --- /dev/null +++ b/README @@ -0,0 +1,136 @@ +1)Build + Requirements : + librairies: + - libuci.so + - libexpat.so + - libcurl.so + - libpthread.so + - libopenssl.so + - libz.so + - libcrypto.so + the librairies should be present in the "staging_dir/target-i386_uClibc-0.9.30.1/usr/lib/" or "staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/lib" + + header files and folders: + - expat.h + - expat_external.h + - uci.h + - uci_config.h + - zlib.h + - curl folder + - openssl folder + the header files and folders should be present in the staging_dir/target-i386_uClibc-0.9.30.1/usr/include/ or staging_dir/toolchain-i386_gcc-4.1.2_uClibc-0.9.30.1/usr/include/ + + +if a librairie doesn't exist: + a- run make menuconfig and select the librarie + b- build the librarie package + +2) Build + +this software is composed of 3 packages: +- cwmpd package: contains cwmpd daemon +- cwmp lib package: contains cwmplib and contains cwmp_value_change binary. They could be used by other user space applications in order to notify the cwmp daemon when paramter changes +- cwmp kernel package: contains cwmp kernel module. This module could be used by other kernel modules to notify the cwmpd daemon when kernel parameter changes + +The three packages should be selected in the make menu config in order to get the three packages compiled. +To compile the three packages: $ make package/cwmpd/compile + +3) OpenWRT settings +in the OpenWRT, Add the following lines in the /usr/share/udhcpc/default.script file: + uci_set_state provisioning iup tr069url "$url" + uci_set_state provisioning iup provisioningcode "$provisioningcode" + +4) Run + Requirements: + - libuci package should be installed + - libexpat package should be installed + - libcurl package should be installed + - libpthread package should be installed + - libopenssl package should be installed + - libz package should be installed + - libcrypto package should be installed + + Configure the acs url in the /etc/config/cwmp + and then start the cwmpd service: /etc/init.d/cwmpd start + for the help: /etc/init.d/cwmpd + +5) Value Change + +5.1) value change for user space applications (using the libcwmp) + +Before using the libcwmp, we should check that the libcwmp package is selected in "make menu config". and we should check that the package is compiled. +The libcwmp should be installed uin the OpenWRT firmware + +example of using libcwmp +in myapplication.c + +#... +#include +#... + +int anyfunction () +{ + ..... + /* parameter change here */ + /* so we inform the cwmp: */ + lib_api_cwmp_value_change_call (3, "InternetGatewayDevice.LANDevice.{i}.LANHostConfigManagement.IPInterface.{i}.IPInterfaceIPAddress","lan2","3"); + ..... +/* +Description of lib_api_cwmp_value_change_call input parameters + parameter 1 : is the number of input string in the function lib_api_cwmp_value_change_call + parameter 2 : is the parameter path + parameter 3 : is the first correspondence related to the first indice + parameter 4 : is the second correspondence related to the second indice + . + . + . + parameter n : is the (n-2) correspondence related to the (n-2) indice +*/ + +} + +5.2) value change for user space applications (using the cwmp_value_change CLI) + +Before using the libcwmp, we should check that the libcwmp package is selected in "make menu config". and we should check that the package is compiled. +The libcwmp should be installed uin the OpenWRT firmware + +in OpenWRT: + +root@OpenWrt:~# cwmp_value_change InternetGatewayDevice.LANDevice.{i}.LANHostConfigManagement.IPInterface.{i}.IPInterfaceIPAddress "lan2" "3" + +in this case the command will force cwmp client to send a notification to the ACS (if and only if the parameter path as configured as active or as passive parameter using the setAttributeParameter method) + +5.3) value change for kernel space modules +Before using the cwmp kernel module for value change, we should check that the kernel module package is selected in "make menu config". and we should check that the package is compiled. +The kernel module should be installed uin the OpenWRT firmware and should be insert before all other kernel modules + +example of using cwmp kernel module +in mykernelmodule.c + +#... +#include +#... + +int anykernelfunction () +{ + ..... + /* parameter change here */ + /* so we inform the cwmp: */ + kernel_api_cwmp_value_change_call (3, "InternetGatewayDevice.LANDevice.{i}.LANHostConfigManagement.IPInterface.{i}.IPInterfaceIPAddress","lan2","3"); + ..... +/* +Description of lib_api_cwmp_value_change_call input parameters + parameter 1 : is the number of input string in the function lib_api_cwmp_value_change_call + parameter 2 : is the parameter path + parameter 3 : is the first correspondence related to the first indice + parameter 4 : is the second correspondence related to the second indice + . + . + . + parameter n : is the (n-2) correspondence related to the (n-2) indice +*/ + +} + + + diff --git a/docs/README.doc b/docs/README.doc new file mode 100644 index 0000000..d0f608e Binary files /dev/null and b/docs/README.doc differ diff --git a/docs/conception.doc b/docs/conception.doc new file mode 100644 index 0000000..c634128 Binary files /dev/null and b/docs/conception.doc differ diff --git a/docs/conception.odg b/docs/conception.odg new file mode 100644 index 0000000..495c6fa Binary files /dev/null and b/docs/conception.odg differ diff --git a/docs/holdrequest.doc b/docs/holdrequest.doc new file mode 100644 index 0000000..d6fbfb9 Binary files /dev/null and b/docs/holdrequest.doc differ diff --git a/docs/tr069_datamodel_guide.doc b/docs/tr069_datamodel_guide.doc new file mode 100644 index 0000000..9fcd01a Binary files /dev/null and b/docs/tr069_datamodel_guide.doc differ diff --git a/src/AddObject.c b/src/AddObject.c new file mode 100644 index 0000000..a2f08af --- /dev/null +++ b/src/AddObject.c @@ -0,0 +1,157 @@ +/* + AddObject.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 20011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include "soapH.h" +#include "cwmp.h" +#include "list.h" +#include "dm.h" +#include "dm_rpc.h" + +LIST_HEAD(list_dm_add_handler); + +struct rpc_cpe *cwmp_add_session_rpc_cpe (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_addObject (struct session *session); +int cwmp_rpc_cpe_addObject (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_addObject_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_addObject_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_addObject_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_session_rpc_cpe_destructor (struct cwmp *cwmp, struct session *session, struct rpc_cpe *rpc_cpe); +struct rpc_cpe *cwmp_add_session_rpc_cpe_Fault (struct session *session, int idx); +int cwmp_dm_addObject(struct cwmp *cwmp, struct dm_set_handler *dm_set_handler, char *path, int *InstanceNumber); +int dm_run_queue_cmd_handler_at_end_session (struct cwmp *cwmp, struct dm_set_handler *dm_set_handler); +int cwmp_reboot(struct cwmp *cwmp,void *v); +int dm_cwmp_config_reload (struct cwmp *cwmp, void *v ); + +struct rpc_cpe *cwmp_add_session_rpc_cpe_addObject (struct session *session) +{ + struct rpc_cpe *rpc_cpe; + struct soap_cwmp1_methods__rpc *soap_methods; + + rpc_cpe = cwmp_add_session_rpc_cpe (session); + if (rpc_cpe == NULL) + { + return NULL; + } + soap_methods = &(rpc_cpe->soap_methods); + rpc_cpe->method_data = (void *) calloc (1,sizeof(struct _cwmp1__AddObject)); + rpc_cpe->method = cwmp_rpc_cpe_addObject; + rpc_cpe->method_response_data = (void *) calloc (1,sizeof(struct _cwmp1__AddObjectResponse)); + rpc_cpe->method_response_data_init = cwmp_rpc_cpe_addObject_response_data_init; + rpc_cpe->method_response = cwmp_rpc_cpe_addObject_response; + rpc_cpe->method_end = cwmp_rpc_cpe_addObject_end; + rpc_cpe->destructor = cwmp_session_rpc_cpe_destructor; + soap_methods->envelope = "cwmp:AddObject"; + soap_methods->envelope_response = "cwmp:AddObjectResponse"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize__cwmp1__AddObjectResponse; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put__cwmp1__AddObjectResponse; + soap_methods->soap_get_cwmp1__rpc_received_data = (void *) soap_get__cwmp1__AddObject; + return rpc_cpe; +} + +int cwmp_rpc_cpe_addObject (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_cpe_addObject_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + struct _cwmp1__AddObject *p_soap_cwmp1__AddObject; + struct _cwmp1__AddObjectResponse *p_soap_cwmp1__AddObjectResponse; + struct dm_set_handler *dm_add_handler; + char buf[128]; + int error; + int InstanceNumber; + + dm_add_handler = calloc(1,sizeof(struct dm_set_handler)); + + if (dm_add_handler == NULL) + { + return FAULT_CPE_INTERNAL_ERROR_IDX; + } + + list_add_tail(&(dm_add_handler->list),&(list_dm_add_handler)); + + INIT_LIST_HEAD (&(dm_add_handler->cmd_list)); + INIT_LIST_HEAD (&(dm_add_handler->cancel_list)); + INIT_LIST_HEAD (&(dm_add_handler->service_list)); + + p_soap_cwmp1__AddObject = (struct _cwmp1__AddObject*)this->method_data; + p_soap_cwmp1__AddObjectResponse = (struct _cwmp1__AddObjectResponse*)this->method_response_data; + + error = cwmp_dm_addObject(cwmp, dm_add_handler, p_soap_cwmp1__AddObject->ObjectName,&InstanceNumber); + + if (error != FAULT_CPE_NO_FAULT_IDX) + { + dm_free_dm_set_handler_queues(dm_add_handler); + if (dm_add_handler!=NULL) + { + list_del(&(dm_add_handler->list)); + free(dm_add_handler); + } + if (cwmp_add_session_rpc_cpe_Fault(session,error)==NULL) + { + return CWMP_GEN_ERR; + } + return CWMP_FAULT_CPE; + } + + CWMP_LOG(INFO,"RUN uci commit"); /* TODO to be removed*/ + sprintf(buf,"%s=%s",UCI_ACS_PARAMETERKEY_PATH,p_soap_cwmp1__AddObject->ParameterKey); + uci_set_value (buf); + uci_commit_value(); + + dm_run_queue_cmd_handler(dm_add_handler,FALSE); + p_soap_cwmp1__AddObjectResponse->InstanceNumber = InstanceNumber; + p_soap_cwmp1__AddObjectResponse->Status = _cwmp1__AddObjectResponse_Status__0; + + if (dm_add_handler->reboot_required==TRUE) + { + CWMP_LOG(INFO,"Add reboot at the end of the session"); + add_session_end_func(session,cwmp_reboot,NULL,TRUE); + p_soap_cwmp1__AddObjectResponse->Status = _cwmp1__AddObjectResponse_Status__1; + } + + if (dm_add_handler->cmd_list.next!=&(dm_add_handler->cmd_list)) + { + add_session_end_func(session,dm_run_queue_cmd_handler_at_end_session,dm_add_handler,FALSE); + p_soap_cwmp1__AddObjectResponse->Status = _cwmp1__AddObjectResponse_Status__1; + return CWMP_OK; + } + + dm_free_dm_set_handler_queues(dm_add_handler); + + if (dm_add_handler!=NULL) + { + list_del(&(dm_add_handler->list)); + free(dm_add_handler); + } + + return CWMP_OK; +} + +int cwmp_rpc_cpe_addObject_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + int error; + CWMP_LOG (INFO,"Trying to send AddObject response to the ACS"); + error = cwmp_soap_send_rpc_cpe_response (cwmp, session, this); + return error; +} + +int cwmp_rpc_cpe_addObject_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} diff --git a/src/DeleteObject.c b/src/DeleteObject.c new file mode 100644 index 0000000..2558faf --- /dev/null +++ b/src/DeleteObject.c @@ -0,0 +1,157 @@ +/* + DeleteObject.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 20011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include "soapH.h" +#include "cwmp.h" +#include "list.h" +#include "dm.h" +#include "dm_rpc.h" + +LIST_HEAD(list_dm_del_handler); + +struct rpc_cpe *cwmp_add_session_rpc_cpe (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_deleteObject (struct session *session); +int cwmp_rpc_cpe_deleteObject (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_deleteObject_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_deleteObject_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_deleteObject_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_session_rpc_cpe_destructor (struct cwmp *cwmp, struct session *session, struct rpc_cpe *rpc_cpe); +struct rpc_cpe *cwmp_add_session_rpc_cpe_Fault (struct session *session, int idx); +int cwmp_dm_deleteObject(struct cwmp *cwmp, struct dm_set_handler *dm_set_handler, char *path); +int dm_run_queue_cmd_handler_at_end_session (struct cwmp *cwmp, struct dm_set_handler *dm_set_handler); +int cwmp_reboot(struct cwmp *cwmp,void *v); +int dm_cwmp_config_reload (struct cwmp *cwmp, void *v ); + +struct rpc_cpe *cwmp_add_session_rpc_cpe_deleteObject (struct session *session) +{ + struct rpc_cpe *rpc_cpe; + struct soap_cwmp1_methods__rpc *soap_methods; + + rpc_cpe = cwmp_add_session_rpc_cpe (session); + if (rpc_cpe == NULL) + { + return NULL; + } + soap_methods = &(rpc_cpe->soap_methods); + rpc_cpe->method_data = (void *) calloc (1,sizeof(struct _cwmp1__DeleteObject)); + rpc_cpe->method = cwmp_rpc_cpe_deleteObject; + rpc_cpe->method_response_data = (void *) calloc (1,sizeof(struct _cwmp1__DeleteObjectResponse)); + rpc_cpe->method_response_data_init = cwmp_rpc_cpe_deleteObject_response_data_init; + rpc_cpe->method_response = cwmp_rpc_cpe_deleteObject_response; + rpc_cpe->method_end = cwmp_rpc_cpe_deleteObject_end; + rpc_cpe->destructor = cwmp_session_rpc_cpe_destructor; + soap_methods->envelope = "cwmp:DeleteObject"; + soap_methods->envelope_response = "cwmp:DeleteObjectResponse"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize__cwmp1__DeleteObjectResponse; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put__cwmp1__DeleteObjectResponse; + soap_methods->soap_get_cwmp1__rpc_received_data = (void *) soap_get__cwmp1__DeleteObject; + return rpc_cpe; +} + +int cwmp_rpc_cpe_deleteObject (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_cpe_deleteObject_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + struct _cwmp1__DeleteObject *p_soap_cwmp1__DeleteObject; + struct _cwmp1__DeleteObjectResponse *p_soap_cwmp1__DeleteObjectResponse; + struct dm_set_handler *dm_del_handler; + char buf[128]; + int error; + int InstanceNumber; + + dm_del_handler = calloc(1,sizeof(struct dm_set_handler)); + + if (dm_del_handler == NULL) + { + return FAULT_CPE_INTERNAL_ERROR_IDX; + } + + list_add_tail(&(dm_del_handler->list),&(list_dm_del_handler)); + + INIT_LIST_HEAD (&(dm_del_handler->cmd_list)); + INIT_LIST_HEAD (&(dm_del_handler->cancel_list)); + INIT_LIST_HEAD (&(dm_del_handler->service_list)); + + p_soap_cwmp1__DeleteObject = (struct _cwmp1__DeleteObject*)this->method_data; + p_soap_cwmp1__DeleteObjectResponse = (struct _cwmp1__DeleteObjectResponse*)this->method_response_data; + + error = cwmp_dm_deleteObject(cwmp, dm_del_handler, p_soap_cwmp1__DeleteObject->ObjectName); + + if (error != FAULT_CPE_NO_FAULT_IDX) + { + dm_free_dm_set_handler_queues(dm_del_handler); + if (dm_del_handler!=NULL) + { + list_del(&(dm_del_handler->list)); + free(dm_del_handler); + } + if (cwmp_add_session_rpc_cpe_Fault(session,error)==NULL) + { + return CWMP_GEN_ERR; + } + return CWMP_FAULT_CPE; + } + + CWMP_LOG(INFO,"RUN uci commit"); /* TODO to be removed*/ + sprintf(buf,"%s=%s",UCI_ACS_PARAMETERKEY_PATH,p_soap_cwmp1__DeleteObject->ParameterKey); + uci_set_value (buf); + uci_commit_value(); + + dm_run_queue_cmd_handler(dm_del_handler,FALSE); + + p_soap_cwmp1__DeleteObjectResponse->Status = _cwmp1__DeleteObjectResponse_Status__0; + + if (dm_del_handler->reboot_required==TRUE) + { + CWMP_LOG(INFO,"Add reboot at the end of the session"); + add_session_end_func(session,cwmp_reboot,NULL,TRUE); + p_soap_cwmp1__DeleteObjectResponse->Status = _cwmp1__DeleteObjectResponse_Status__1; + } + + if (dm_del_handler->cmd_list.next!=&(dm_del_handler->cmd_list)) + { + add_session_end_func(session,dm_run_queue_cmd_handler_at_end_session,dm_del_handler,FALSE); + p_soap_cwmp1__DeleteObjectResponse->Status = _cwmp1__DeleteObjectResponse_Status__1; + return CWMP_OK; + } + + dm_free_dm_set_handler_queues(dm_del_handler); + + if (dm_del_handler!=NULL) + { + list_del(&(dm_del_handler->list)); + free(dm_del_handler); + } + + return CWMP_OK; +} + +int cwmp_rpc_cpe_deleteObject_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + int error; + CWMP_LOG (INFO,"Trying to send DeleteObject response to the ACS"); + error = cwmp_soap_send_rpc_cpe_response (cwmp, session, this); + return error; +} + +int cwmp_rpc_cpe_deleteObject_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} diff --git a/src/Download.c b/src/Download.c new file mode 100644 index 0000000..b20c38d --- /dev/null +++ b/src/Download.c @@ -0,0 +1,639 @@ +/* + Download.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include +#include +#include +#include +#include +#include "soapH.h" +#include "cwmp.h" +#include "list.h" +#include "backupSession.h" + +#if LIBCURL_VERSION_NUM < 0x070907 +#error LIBCURL version should be >= 7.9.7 +#endif + +LIST_HEAD(list_download); +static struct download_end_func *download_end_func = NULL; +static pthread_mutex_t mutex_download; +static pthread_cond_t threshold_download; +static bool thread_download_is_working = FALSE; +int count_download_queue = 0; +extern struct cwmp cwmp_main; + +struct rpc_cpe *cwmp_add_session_rpc_cpe (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_download (struct session *session); +int cwmp_rpc_cpe_download (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_download_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_download_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_download_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_session_rpc_cpe_destructor (struct cwmp *cwmp, struct session *session, struct rpc_cpe *rpc_cpe); +struct rpc_cpe *cwmp_add_session_rpc_cpe_Fault (struct session *session, int idx); +struct _cwmp1__TransferComplete *cwmp_set_data_rpc_acs_transferComplete(); +int cwmp_reboot(struct cwmp *cwmp,void *v); +size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream); +int cwmp_launch_download(struct cwmp *cwmp, struct session *session, struct download *pDownload); +int cwmp_download_firmware(struct cwmp *cwmp, struct session *session); +int cwmp_download_web_content(struct cwmp *cwmp, struct session *session); +int cwmp_download_configuration_file(struct cwmp *cwmp, struct session *session); +void backup_session_insert_download(char *commandKey, char *url, time_t id); +void backup_session_delete_download(char *commandKey, char *url, time_t id); +void backup_session_insert_parameter_download(char *name, char *value, char *url, int id, char *commandKey); + +typedef struct FILE_DOWNLOAD_TYPE +{ + char *FILE_TYPE; + char *FILE_NAME; + unsigned short APPLY_AFTER_REBOOT; + unsigned int CHECK_SIZE; + long int *MEMORY_SIZE; + int (*UPDATE_VALUE)(); + int (*DOWNLOAD)(struct cwmp *cwmp, struct session *session); +} FILE_DOWNLOAD_TYPE; + +const struct FILE_DOWNLOAD_TYPE FILE_DOWNLOAD_TYPE_ARRAY [] = { + {"1 Firmware Upgrade Image" ,DOWNLOADED_FIRMWARE_FILE ,1,ENABLE_CHECK_SIZE ,&(cwmp_main.env.max_firmware_size),NULL,cwmp_download_firmware}, + {"2 Web Content" ,DOWNLOADED_WEBCONTENT_FILE,0,DISABLE_CHECK_SIZE,0 ,NULL,cwmp_download_web_content}, + {"3 Vendor Configuration File",DOWNLOADED_CONFIG_FILE ,1,DISABLE_CHECK_SIZE,0 ,NULL,cwmp_download_configuration_file} +}; + +struct rpc_cpe *cwmp_add_session_rpc_cpe_download (struct session *session) +{ + struct rpc_cpe *rpc_cpe; + struct soap_cwmp1_methods__rpc *soap_methods; + + rpc_cpe = cwmp_add_session_rpc_cpe (session); + if (rpc_cpe == NULL) + { + return NULL; + } + soap_methods = &(rpc_cpe->soap_methods); + rpc_cpe->method_data = (void *) calloc (1,sizeof(struct _cwmp1__Download)); + rpc_cpe->method = cwmp_rpc_cpe_download; + rpc_cpe->method_response_data = (void *) calloc (1,sizeof(struct _cwmp1__DownloadResponse)); + rpc_cpe->method_response_data_init = cwmp_rpc_cpe_download_response_data_init; + rpc_cpe->method_response = cwmp_rpc_cpe_download_response; + rpc_cpe->method_end = cwmp_rpc_cpe_download_end; + rpc_cpe->destructor = cwmp_session_rpc_cpe_destructor; + soap_methods->envelope = "cwmp:Download"; + soap_methods->envelope_response = "cwmp:DownloadResponse"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize__cwmp1__DownloadResponse; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put__cwmp1__DownloadResponse; + soap_methods->soap_get_cwmp1__rpc_received_data = (void *) soap_get__cwmp1__Download; + return rpc_cpe; +} + +void *thread_cwmp_rpc_cpe_download (void *v) +{ + struct cwmp *cwmp = (struct cwmp *)v; + struct download *download; + struct timespec download_timeout = {0, 0}; + time_t current_time; + int error = FAULT_CPE_NO_FAULT_IDX; + time_t download_startTime; + time_t download_completeTime; + char startTime[64]; + char completeTime[64]; + struct _cwmp1__TransferComplete *p_soap_cwmp1__TransferComplete; + extern struct FAULT_CPE FAULT_CPE_ARRAY [FAULT_CPE_ARRAY_SIZE]; + long int time_of_grace = 3600,timeout; + + thread_download_is_working = TRUE; + while (list_download.next!=&(list_download)) + { + download = list_entry(list_download.next,struct download, list); + current_time = time(NULL); + timeout = current_time - download->scheduled_time; + if((timeout >= 0)&&(timeout > time_of_grace)) + { + pthread_mutex_lock (&mutex_download); + backup_session_delete_download(download->CommandKey,download->URL,download->scheduled_time); + p_soap_cwmp1__TransferComplete = cwmp_set_data_rpc_acs_transferComplete (); + if(p_soap_cwmp1__TransferComplete != NULL) + { + error = FAULT_CPE_DOWNLOAD_FAILURE_IDX; + download_completeTime = time((time_t*)NULL); + + p_soap_cwmp1__TransferComplete->CommandKey = strdup(download->CommandKey); + p_soap_cwmp1__TransferComplete->StartTime = time((time_t*)NULL); + p_soap_cwmp1__TransferComplete->CompleteTime = p_soap_cwmp1__TransferComplete->StartTime; + + sprintf(startTime,"%li",p_soap_cwmp1__TransferComplete->StartTime); + backup_session_insert_rpc("TransferComplete",p_soap_cwmp1__TransferComplete->CommandKey,RPC_NO_STATUS); + backup_session_insert_parameter("StartTime",startTime,"rpc","TransferComplete",-1,p_soap_cwmp1__TransferComplete->CommandKey); + backup_session_insert_parameter("CompleteTime",startTime,"rpc","TransferComplete",-1,p_soap_cwmp1__TransferComplete->CommandKey); + + p_soap_cwmp1__TransferComplete->FaultStruct = calloc(1,sizeof(struct cwmp1__FaultStruct)); + p_soap_cwmp1__TransferComplete->FaultStruct->FaultCode = strdup(FAULT_CPE_ARRAY[error].CODE); + p_soap_cwmp1__TransferComplete->FaultStruct->FaultString = strdup(FAULT_CPE_ARRAY[error].DESCRIPTION); + + backup_session_insert_parameter("FaultCode",p_soap_cwmp1__TransferComplete->FaultStruct->FaultCode,"rpc","TransferComplete",-1,p_soap_cwmp1__TransferComplete->CommandKey); + cwmp_root_cause_TransferComplete (cwmp); + } + list_del (&(download->list)); + count_download_queue--; + cwmp_free_download_request(download); + pthread_mutex_unlock (&mutex_download); + } + if((timeout >= 0)&&(timeout <= time_of_grace)) + { + pthread_mutex_lock (&(cwmp->mutex_session_send)); + CWMP_LOG(INFO,"Launch download file %s",download->URL); + error = cwmp_launch_download(cwmp,NULL,download); + if((error != FAULT_CPE_NO_FAULT_IDX)||(download_end_func == NULL)) + { + cwmp_root_cause_TransferComplete (cwmp); + } + run_download_end_func (cwmp); + pthread_mutex_unlock (&(cwmp->mutex_session_send)); + pthread_cond_signal (&(cwmp->threshold_session_send)); + pthread_mutex_lock (&mutex_download); + list_del (&(download->list)); + count_download_queue--; + cwmp_free_download_request(download); + pthread_mutex_unlock (&mutex_download); + continue; + } + pthread_mutex_lock (&mutex_download); + download_timeout.tv_sec = download->scheduled_time; + pthread_cond_timedwait(&threshold_download, &mutex_download, &download_timeout); + pthread_mutex_unlock (&mutex_download); + } + thread_download_is_working = FALSE; + return CWMP_OK; +} + +size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) +{ + size_t written; + + written = fwrite(ptr, size, nmemb, stream); + return written; +} + +int cwmp_rpc_cpe_download (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + struct _cwmp1__DownloadResponse *p_soap_cwmp1__DownloadResponse; + struct _cwmp1__Download *p_soap_cwmp1__Download; + int error = FAULT_CPE_NO_FAULT_IDX; + int i; + char *url; + long int check_size; + struct download *download; + time_t scheduled_time; + struct list_head *ilist; + bool cond_signal = FALSE; + pthread_t download_thread; + char scheduledTime[64]; + char delaySeconds[64]; + bool valid_file_type = FALSE; + + p_soap_cwmp1__Download = (struct _cwmp1__Download *)this->method_data; + p_soap_cwmp1__DownloadResponse = (struct _cwmp1__DownloadResponse *)this->method_response_data; + url = p_soap_cwmp1__Download->URL; + p_soap_cwmp1__DownloadResponse->Status = _cwmp1__DownloadResponse_Status__1; + + for(i=0;iFileType) == 0) + { + valid_file_type = TRUE; + if(FILE_DOWNLOAD_TYPE_ARRAY[i].CHECK_SIZE == ENABLE_CHECK_SIZE) + { + if(FILE_DOWNLOAD_TYPE_ARRAY[i].UPDATE_VALUE != NULL) + { + FILE_DOWNLOAD_TYPE_ARRAY[i].UPDATE_VALUE(); + } + check_size = *(FILE_DOWNLOAD_TYPE_ARRAY[i].MEMORY_SIZE); + } + break; + } + } + if((FILE_DOWNLOAD_TYPE_ARRAY[i].CHECK_SIZE == ENABLE_CHECK_SIZE) && + ((check_size>0)&&(check_size < (long int)p_soap_cwmp1__Download->FileSize))) + { + error = FAULT_CPE_DOWNLOAD_FAILURE_IDX; + } + else if(count_download_queue>=MAX_DOWNLOAD_QUEUE) + { + error = FAULT_CPE_RESOURCES_EXCEEDED_IDX; + } + else if((url == NULL || ((url != NULL) && (strcmp(url,"")==0)))|| + (!valid_file_type)) + { + error = FAULT_CPE_REQUEST_DENIED_IDX; + } + else if(strstr(url,"@") != NULL) + { + error = FAULT_CPE_INVALID_ARGUMENTS_IDX; + } + else if(strncmp(url,DOWNLOAD_PROTOCOL_HTTP,strlen(DOWNLOAD_PROTOCOL_HTTP))!=0 && + strncmp(url,DOWNLOAD_PROTOCOL_FTP,strlen(DOWNLOAD_PROTOCOL_FTP))!=0) + { + error = FAULT_CPE_FILE_TRANSFER_UNSUPPORTED_PROTOCOL_IDX; + } + + if(error != FAULT_CPE_NO_FAULT_IDX) + { + if (cwmp_add_session_rpc_cpe_Fault(session,error) == NULL) + { + return CWMP_GEN_ERR; + } + return CWMP_FAULT_CPE; + } + + if(p_soap_cwmp1__Download->DelaySeconds == 0) + { + download = calloc (1,sizeof(struct download)); + if (download == NULL) + { + return CWMP_GEN_ERR; + } + download->CommandKey = strdup(p_soap_cwmp1__Download->CommandKey); + download->FileType = strdup(p_soap_cwmp1__Download->FileType); + download->URL = strdup(p_soap_cwmp1__Download->URL); + download->Username = strdup(p_soap_cwmp1__Download->Username); + download->Password = strdup(p_soap_cwmp1__Download->Password); + download->scheduled_time = 0; + + error = cwmp_launch_download(cwmp,session,download); + if((error != FAULT_CPE_NO_FAULT_IDX)||(FILE_DOWNLOAD_TYPE_ARRAY[i].APPLY_AFTER_REBOOT == 0)) + { + if(cwmp_root_cause_TransferComplete (cwmp) != CWMP_OK) + { + cwmp_free_download_request(download); + return CWMP_GEN_ERR; + } + } + cwmp_free_download_request(download); + } + else + { + pthread_mutex_lock (&mutex_download); + + scheduled_time = time(NULL) + p_soap_cwmp1__Download->DelaySeconds; + __list_for_each(ilist,&(list_download)) + { + download = list_entry(ilist,struct download, list); + if (download->scheduled_time == scheduled_time) + { + pthread_mutex_unlock (&mutex_download); + return CWMP_OK; + } + if (download->scheduled_time > scheduled_time) + { + cond_signal = TRUE; + break; + } + } + CWMP_LOG(INFO,"Download will start in %us",p_soap_cwmp1__Download->DelaySeconds); + download = calloc (1,sizeof(struct download)); + if (download == NULL) + { + pthread_mutex_unlock (&mutex_download); + return CWMP_OK; + } + + download->CommandKey = strdup(p_soap_cwmp1__Download->CommandKey); + download->FileType = strdup(p_soap_cwmp1__Download->FileType); + download->URL = strdup(p_soap_cwmp1__Download->URL); + download->Username = strdup(p_soap_cwmp1__Download->Username); + download->Password = strdup(p_soap_cwmp1__Download->Password); + download->scheduled_time = scheduled_time; + + backup_session_insert_download(download->CommandKey,download->URL,download->scheduled_time); + backup_session_insert_parameter_download("Password",download->Password,download->URL,download->scheduled_time,download->CommandKey); + backup_session_insert_parameter_download("Username",download->Username,download->URL,download->scheduled_time,download->CommandKey); + backup_session_insert_parameter_download("FileType",download->FileType,download->URL,download->scheduled_time,download->CommandKey); + + list_add (&(download->list), ilist->prev); + count_download_queue++; + if (cond_signal) + { + pthread_cond_signal(&threshold_download); + } + pthread_mutex_unlock (&mutex_download); + + if (!thread_download_is_working) + { + thread_download_is_working = TRUE; + error = pthread_create(&download_thread, NULL, &thread_cwmp_rpc_cpe_download, (void *)cwmp); + if (error<0) + { + CWMP_LOG(ERROR,"Error when creating the download thread!"); + thread_download_is_working = FALSE; + return CWMP_OK; + } + } + } + + return CWMP_OK; +} + +int cwmp_rpc_cpe_download_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_cpe_download_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + int error; + error = cwmp_soap_send_rpc_cpe_response (cwmp, session, this); + return error; +} + +int cwmp_rpc_cpe_download_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} + +int cwmp_launch_download(struct cwmp *cwmp, struct session *session, struct download *pDownload) +{ + CURL *curl; + FILE *fp; + CURLcode res; + int error = FAULT_CPE_NO_FAULT_IDX; + int i; + char filename[256]; + int (*doDownload)(struct cwmp *cwmp, struct session *session); + time_t download_startTime; + time_t download_completeTime; + char startTime[64]; + char completeTime[64]; + struct _cwmp1__TransferComplete *p_soap_cwmp1__TransferComplete; + extern struct FAULT_CPE FAULT_CPE_ARRAY [FAULT_CPE_ARRAY_SIZE]; + char userpwd[256]; + + download_startTime = time((time_t*)NULL); + + if(pDownload->scheduled_time != 0) + { + backup_session_delete_download(pDownload->CommandKey,pDownload->URL,pDownload->scheduled_time); + } + + for(i=0;iFileType) == 0) + { + doDownload = FILE_DOWNLOAD_TYPE_ARRAY[i].DOWNLOAD; + strcpy(filename,FILE_DOWNLOAD_TYPE_ARRAY[i].FILE_NAME); + break; + } + } + + curl = curl_easy_init(); + + if (curl) + { + fp = fopen(filename,"wb"); + if((strcmp(pDownload->URL,"") != 0)&& + (pDownload->URL != NULL)) + { + +#if LIBCURL_VERSION_NUM >= 0x071301 + if((strcmp(pDownload->Username,"") != 0)&& + (pDownload->Username != NULL)) + { + curl_easy_setopt(curl, CURLOPT_USERNAME, pDownload->Username); + } + if((strcmp(pDownload->Password,"") != 0)&& + (pDownload->Password != NULL)) + { + curl_easy_setopt(curl, CURLOPT_PASSWORD, pDownload->Password); + } +#else + if(((strcmp(pDownload->Username,"") != 0)&&(pDownload->Username != NULL))&& + (strcmp(pDownload->Password,"") != 0)&&(pDownload->Password != NULL)) + { + sprintf(userpwd,"%s:%s",pDownload->Username,pDownload->Password); + curl_easy_setopt(curl, CURLOPT_USERPWD, userpwd); + } +#endif + curl_easy_setopt(curl, CURLOPT_URL, pDownload->URL); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); + curl_easy_setopt(curl, CURLOPT_FAILONERROR, TRUE); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } + fclose(fp); + } + + if(res != CURLE_OK) + { + remove(filename); + } + + switch(res) + { + case CURLE_OK: + error = FAULT_CPE_NO_FAULT_IDX; /** No fault code **/ + break; + case CURLE_UNSUPPORTED_PROTOCOL: +#if LIBCURL_VERSION_NUM >= 0x071100 + case CURLE_REMOTE_ACCESS_DENIED: +#endif + error = FAULT_CPE_REQUEST_DENIED_IDX; /** Request denied **/ + break; + case CURLE_OUT_OF_MEMORY: + error = FAULT_CPE_INTERNAL_ERROR_IDX; /** Internal error **/ + break; + case CURLE_FTP_CANT_GET_HOST: + case CURLE_URL_MALFORMAT: + case CURLE_COULDNT_RESOLVE_HOST: + case CURLE_COULDNT_CONNECT: + error = FAULT_CPE_DOWNLOAD_FAIL_CONTACT_SERVER_IDX; /** Download failure: unable to contact file server **/ + break; + case CURLE_FTP_COULDNT_RETR_FILE: +#if LIBCURL_VERSION_NUM >= 0x071001 + case CURLE_REMOTE_FILE_NOT_FOUND: +#endif +#if LIBCURL_VERSION_NUM >= 0x070a03 + case CURLE_HTTP_RETURNED_ERROR: +#endif +#if LIBCURL_VERSION_NUM >= 0x071500 + case CURLE_FTP_BAD_FILE_LIST: +#endif +#if LIBCURL_VERSION_NUM >= 0x070901 + case CURLE_GOT_NOTHING: +#endif + error = FAULT_CPE_DOWNLOAD_FAIL_ACCESS_FILE_IDX; /** Download failure: unable to access file **/ + break; +#if LIBCURL_VERSION_NUM >= 0x070a02 + case CURLE_OPERATION_TIMEDOUT: + error = FAULT_CPE_DOWNLOAD_FAIL_COMPLETE_DOWNLOAD_IDX; /** Download failure: unable to complete download **/ + break; +#endif +#if LIBCURL_VERSION_NUM >= 0x070d01 + case CURLE_LOGIN_DENIED: + error = FAULT_CPE_DOWNLOAD_FAIL_FILE_AUTHENTICATION_IDX; /** Download failure: file authentication failure **/ + break; +#endif + default: + error = FAULT_CPE_DOWNLOAD_FAILURE_IDX; /** Download failure **/ + break; + } + + if(error == FAULT_CPE_NO_FAULT_IDX) + { + error = doDownload (cwmp,session); + } + + p_soap_cwmp1__TransferComplete = cwmp_set_data_rpc_acs_transferComplete (); + if(p_soap_cwmp1__TransferComplete == NULL) + { + error = FAULT_CPE_INTERNAL_ERROR_IDX; + return error; + } + download_completeTime = time((time_t*)NULL); + + p_soap_cwmp1__TransferComplete->CommandKey = strdup(pDownload->CommandKey); + p_soap_cwmp1__TransferComplete->StartTime = download_startTime; + p_soap_cwmp1__TransferComplete->CompleteTime = download_completeTime; + + sprintf(startTime,"%li",p_soap_cwmp1__TransferComplete->StartTime); + sprintf(completeTime,"%li",download_completeTime); + + backup_session_insert_rpc("TransferComplete",p_soap_cwmp1__TransferComplete->CommandKey,RPC_NO_STATUS); + backup_session_insert_parameter("StartTime",startTime,"rpc","TransferComplete",-1,p_soap_cwmp1__TransferComplete->CommandKey); + backup_session_insert_parameter("CompleteTime",completeTime,"rpc","TransferComplete",-1,p_soap_cwmp1__TransferComplete->CommandKey); + + if(error != FAULT_CPE_NO_FAULT_IDX) + { + p_soap_cwmp1__TransferComplete->FaultStruct = calloc(1,sizeof(struct cwmp1__FaultStruct)); + p_soap_cwmp1__TransferComplete->FaultStruct->FaultCode = strdup(FAULT_CPE_ARRAY[error].CODE); + p_soap_cwmp1__TransferComplete->FaultStruct->FaultString = strdup(FAULT_CPE_ARRAY[error].DESCRIPTION); + + backup_session_insert_parameter("FaultCode",p_soap_cwmp1__TransferComplete->FaultStruct->FaultCode,"rpc","TransferComplete",-1,p_soap_cwmp1__TransferComplete->CommandKey); + } + + return error; +} + +int cwmp_download_firmware (struct cwmp *cwmp, struct session *session) +{ + int error = FAULT_CPE_NO_FAULT_IDX; + + error = uci_upgrade_image(cwmp,session); + + return error; +} + +int cwmp_download_web_content (struct cwmp *cwmp, struct session *session) +{ + int error = FAULT_CPE_NO_FAULT_IDX; + + error = uci_apply_web_packages(); + + return error; +} + +int cwmp_download_configuration_file (struct cwmp *cwmp, struct session *session) +{ + int error = FAULT_CPE_NO_FAULT_IDX; + + error = uci_apply_configuration(); + if(error == FAULT_CPE_NO_FAULT_IDX) + { + if(session != NULL) + { + add_session_end_func(session,cwmp_reboot,NULL,TRUE); + } + else + { + add_download_end_func(cwmp_reboot,NULL); + } + } + + return error; +} + +int cwmp_free_download_request(struct download *download) +{ + if(download != NULL) + { + if(download->CommandKey != NULL) + { + free(download->CommandKey); + } + if(download->FileType != NULL) + { + free(download->FileType); + } + if(download->URL != NULL) + { + free(download->URL); + } + if(download->Username != NULL) + { + free(download->Username); + } + if(download->Password != NULL) + { + free(download->Password); + } + free(download); + } + return CWMP_OK; +} + +int add_download_end_func (int (*func)(struct cwmp *cwmp, void *input),void *input) +{ + download_end_func = calloc(1,sizeof(struct download_end_func)); + if(download_end_func == NULL) + { + return CWMP_MEM_ERR; + } + download_end_func->func = func; + download_end_func->input = input; + + return CWMP_OK; +} + +int run_download_end_func (struct cwmp *cwmp) +{ + int error = CWMP_OK; + + if(download_end_func != NULL) + { + error = download_end_func->func(cwmp,download_end_func->input); + free (download_end_func); + download_end_func = NULL; + } + + return error; +} + +int cwmp_scheduledDownload_remove_all() +{ + struct download *download; + + pthread_mutex_lock (&mutex_download); + while (list_download.next!=&(list_download)) + { + download = list_entry(list_download.next,struct download, list); + list_del (&(download->list)); + backup_session_delete_download(download->CommandKey,download->URL,download->scheduled_time); + count_download_queue--; + cwmp_free_download_request(download); + } + pthread_mutex_unlock (&mutex_download); + + return CWMP_OK; +} diff --git a/src/FactoryReset.c b/src/FactoryReset.c new file mode 100644 index 0000000..c7bf1ce --- /dev/null +++ b/src/FactoryReset.c @@ -0,0 +1,79 @@ +/* + FactoryReset.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include +#include +#include "soapH.h" +#include "cwmp.h" + +struct rpc_cpe *cwmp_add_session_rpc_cpe (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_factoryReset (struct session *session); +int cwmp_rpc_cpe_factoryReset (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_factoryReset_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_factoryReset_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_factoryReset_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_session_rpc_cpe_destructor (struct cwmp *cwmp, struct session *session, struct rpc_cpe *rpc_cpe); +int cwmp_reset_factory(struct cwmp *cwmp,void *v); + +struct rpc_cpe *cwmp_add_session_rpc_cpe_factoryReset (struct session *session) +{ + struct rpc_cpe *rpc_cpe; + struct soap_cwmp1_methods__rpc *soap_methods; + + rpc_cpe = cwmp_add_session_rpc_cpe (session); + if (rpc_cpe == NULL) + { + return NULL; + } + soap_methods = &(rpc_cpe->soap_methods); + rpc_cpe->method_data = (void *) calloc (1,sizeof(struct _cwmp1__FactoryReset)); + rpc_cpe->method = cwmp_rpc_cpe_factoryReset; + rpc_cpe->method_response_data = (void *) calloc (1,sizeof(struct _cwmp1__FactoryResetResponse)); + rpc_cpe->method_response_data_init = cwmp_rpc_cpe_factoryReset_response_data_init; + rpc_cpe->method_response = cwmp_rpc_cpe_factoryReset_response; + rpc_cpe->method_end = cwmp_rpc_cpe_factoryReset_end; + rpc_cpe->destructor = cwmp_session_rpc_cpe_destructor; + soap_methods->envelope = "cwmp:FactoryReset"; + soap_methods->envelope_response = "cwmp:FactoryResetResponse"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize__cwmp1__FactoryReset; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put__cwmp1__FactoryReset; + soap_methods->soap_get_cwmp1__rpc_received_data = (void *) soap_get__cwmp1__FactoryReset; + return rpc_cpe; +} + +int cwmp_rpc_cpe_factoryReset (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + add_session_end_func(session,cwmp_reset_factory,NULL,TRUE); + return CWMP_OK; +} + +int cwmp_rpc_cpe_factoryReset_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_cpe_factoryReset_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + int error; + error = cwmp_soap_send_rpc_cpe_response (cwmp, session, this); + return error; +} + +int cwmp_rpc_cpe_factoryReset_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} diff --git a/src/Fault_cpe.c b/src/Fault_cpe.c new file mode 100644 index 0000000..b68c211 --- /dev/null +++ b/src/Fault_cpe.c @@ -0,0 +1,211 @@ +/* + Fault_cpe.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include "soapH.h" +#include "cwmp.h" +#include "list.h" + +#define FAULT_CPE_TYPE_CLIENT 0 +#define FAULT_CPE_TYPE_SERVER 1 + +char *FAULT_CPE_ARRAY_TYPE [] = { + [FAULT_CPE_TYPE_CLIENT] = "Client", + [FAULT_CPE_TYPE_SERVER] = "Server" +}; + +struct FAULT_CPE FAULT_CPE_ARRAY [] = { + [FAULT_CPE_NO_FAULT_IDX] = {NULL, 0, NULL}, + [FAULT_CPE_METHOD_NOT_SUPPORTED_IDX] = {"9000",FAULT_CPE_TYPE_SERVER, "Method not supported"}, + [FAULT_CPE_REQUEST_DENIED_IDX] = {"9001",FAULT_CPE_TYPE_SERVER, "Request denied (no reason specified)"}, + [FAULT_CPE_INTERNAL_ERROR_IDX] = {"9002",FAULT_CPE_TYPE_SERVER, "Internal error"}, + [FAULT_CPE_INVALID_ARGUMENTS_IDX] = {"9003",FAULT_CPE_TYPE_CLIENT, "Invalid arguments"}, + [FAULT_CPE_RESOURCES_EXCEEDED_IDX] = {"9004",FAULT_CPE_TYPE_SERVER, "Resources exceeded"}, + [FAULT_CPE_INVALID_PARAMETER_NAME_IDX] = {"9005",FAULT_CPE_TYPE_CLIENT, "Invalid parameter name"}, + [FAULT_CPE_INVALID_PARAMETER_TYPE_IDX] = {"9006",FAULT_CPE_TYPE_CLIENT, "Invalid parameter type"}, + [FAULT_CPE_INVALID_PARAMETER_VALUE_IDX] = {"9007",FAULT_CPE_TYPE_CLIENT, "Invalid parameter value"}, + [FAULT_CPE_NON_WRITABLE_PARAMETER_IDX] = {"9008",FAULT_CPE_TYPE_CLIENT, "Attempt to set a non-writable parameter"}, + [FAULT_CPE_NOTIFICATION_REJECTED_IDX] = {"9009",FAULT_CPE_TYPE_SERVER, "Notification request rejected"}, + [FAULT_CPE_DOWNLOAD_FAILURE_IDX] = {"9010",FAULT_CPE_TYPE_SERVER, "Download failure"}, + [FAULT_CPE_UPLOAD_FAILURE_IDX] = {"9011",FAULT_CPE_TYPE_SERVER, "Upload failure"}, + [FAULT_CPE_FILE_TRANSFER_AUTHENTICATION_FAILURE_IDX]= {"9012",FAULT_CPE_TYPE_SERVER, "File transfer server authentication failure"}, + [FAULT_CPE_FILE_TRANSFER_UNSUPPORTED_PROTOCOL_IDX] = {"9013",FAULT_CPE_TYPE_SERVER, "Unsupported protocol for file transfer"}, + [FAULT_CPE_DOWNLOAD_FAIL_MULTICAST_GROUP_IDX] = {"9014",FAULT_CPE_TYPE_SERVER, "Download failure: unable to join multicast group"}, + [FAULT_CPE_DOWNLOAD_FAIL_CONTACT_SERVER_IDX] = {"9015",FAULT_CPE_TYPE_SERVER, "Download failure: unable to contact file server"}, + [FAULT_CPE_DOWNLOAD_FAIL_ACCESS_FILE_IDX] = {"9016",FAULT_CPE_TYPE_SERVER, "Download failure: unable to access file"}, + [FAULT_CPE_DOWNLOAD_FAIL_COMPLETE_DOWNLOAD_IDX] = {"9017",FAULT_CPE_TYPE_SERVER, "Download failure: unable to complete download"}, + [FAULT_CPE_DOWNLOAD_FAIL_FILE_CORRUPTED_IDX] = {"9018",FAULT_CPE_TYPE_SERVER, "Download failure: file corrupted"}, + [FAULT_CPE_DOWNLOAD_FAIL_FILE_AUTHENTICATION_IDX] = {"9019",FAULT_CPE_TYPE_SERVER, "Download failure: file authentication failure"} +}; + +struct rpc_cpe *cwmp_add_session_rpc_cpe (struct session *session); + +int cwmp_rpc_cpe_fault (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_fault_response_data_init (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_fault_response (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_fault_end (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_fault_destructor (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap *soap, const struct SOAP_ENV__Fault *a); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap *soap, const struct SOAP_ENV__Fault *a, const char *tag, const char *type); + +struct rpc_cpe *cwmp_add_session_rpc_cpe_Fault (struct session *session, int idx) +{ + struct rpc_cpe *rpc_cpe; + struct soap_cwmp1_methods__rpc *soap_methods; + struct fault *fault; + + rpc_cpe = cwmp_add_session_rpc_cpe (session); + if (rpc_cpe == NULL) + { + return NULL; + } + soap_methods = &(rpc_cpe->soap_methods); + fault = &(rpc_cpe->fault); + rpc_cpe->method_data = NULL; + rpc_cpe->method = cwmp_rpc_cpe_fault; + rpc_cpe->method_response_data = (void *) calloc (1,sizeof(struct SOAP_ENV__Fault)); + rpc_cpe->method_response_data_init = cwmp_rpc_cpe_fault_response_data_init; + rpc_cpe->method_response = cwmp_rpc_cpe_fault_response; + rpc_cpe->method_end = cwmp_rpc_cpe_fault_end; + rpc_cpe->destructor = cwmp_rpc_cpe_fault_destructor; + soap_methods->envelope = ""; + soap_methods->envelope_response = "SOAP-ENV:Fault"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize_SOAP_ENV__Fault; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put_SOAP_ENV__Fault; + soap_methods->soap_get_cwmp1__rpc_received_data = NULL; + fault->code_idx = idx; + return rpc_cpe; +} + +int cwmp_rpc_cpe_fault (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_cpe_fault_response_data_init (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + + struct SOAP_ENV__Fault *p_soap_Fault; + struct _cwmp1__Fault *fault; + struct fault *rpc_fault; + struct SOAP_ENV__Detail *detail; + int type_idx; + + if (session==NULL || this==NULL) + { + return CWMP_GEN_ERR; + } + + p_soap_Fault = (struct SOAP_ENV__Fault *) this->method_response_data; + rpc_fault = &(this->fault); + type_idx = FAULT_CPE_ARRAY[rpc_fault->code_idx].TYPE; + p_soap_Fault->faultcode = FAULT_CPE_ARRAY_TYPE[type_idx]; + p_soap_Fault->faultstring = "CWMP fault"; + p_soap_Fault->detail = (struct SOAP_ENV__Detail *) calloc(1, sizeof(struct SOAP_ENV__Detail)); + if (p_soap_Fault->detail == NULL) + { + return CWMP_MEM_ERR; + } + detail = p_soap_Fault->detail; + detail->__type = SOAP_TYPE__cwmp1__Fault; + detail->fault = (struct _cwmp1__Fault *) calloc(1, sizeof(struct _cwmp1__Fault)); + if (detail->fault == NULL) + { + return CWMP_MEM_ERR; + } + fault = (struct _cwmp1__Fault *) detail->fault; + fault->FaultCode = FAULT_CPE_ARRAY[rpc_fault->code_idx].CODE; + fault->FaultString = FAULT_CPE_ARRAY[rpc_fault->code_idx].DESCRIPTION; + if (rpc_fault->parameter_cause!=NULL) + { + fault->SetParameterValuesFault = (struct _cwmp1__Fault_SetParameterValuesFault *) calloc(1, sizeof(struct _cwmp1__Fault_SetParameterValuesFault)); + fault->SetParameterValuesFault->FaultCode = strdup(FAULT_CPE_ARRAY[rpc_fault->code_idx].CODE); + fault->SetParameterValuesFault->FaultString = strdup(FAULT_CPE_ARRAY[rpc_fault->code_idx].DESCRIPTION); + fault->SetParameterValuesFault->ParameterName = rpc_fault->parameter_cause; + fault->__sizeSetParameterValuesFault = 1; + } + + return CWMP_OK; +} + +int cwmp_rpc_cpe_fault_response (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + int error; + CWMP_LOG (INFO,"Trying to send Fault response to the ACS"); + error = cwmp_soap_send_rpc_cpe_response (cwmp, session, this); + return error; +} + +int cwmp_rpc_cpe_Fault_parameter_cause (struct rpc_cpe *this, char *parameter) +{ + this->fault.parameter_cause = strdup(parameter); + return CWMP_OK; +} + +int cwmp_rpc_cpe_fault_end (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + struct SOAP_ENV__Fault *p_soap_Fault; + struct _cwmp1__Fault *fault; + struct SOAP_ENV__Detail *detail; + + p_soap_Fault = (struct SOAP_ENV__Fault *) this->method_response_data; + if (p_soap_Fault!=NULL) + { + detail = p_soap_Fault->detail; + if (detail!=NULL) + { + fault = (struct _cwmp1__Fault *)detail->fault; + if (fault->SetParameterValuesFault!=NULL) + { + if (fault->SetParameterValuesFault->FaultCode!=NULL) + { + free (fault->SetParameterValuesFault->FaultCode); + } + if (fault->SetParameterValuesFault->FaultString!=NULL) + { + free (fault->SetParameterValuesFault->FaultString); + } + free (fault->SetParameterValuesFault); + } + if (fault!=NULL) + { + free (fault); + } + free (detail); + } + } + + return CWMP_OK; +} + +int cwmp_rpc_cpe_fault_destructor (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + struct SOAP_ENV__Fault *p_soap_Fault; + + p_soap_Fault = (struct SOAP_ENV__Fault *) this->method_response_data; + if (p_soap_Fault!=NULL) + { + free (p_soap_Fault); + } + if (this->fault.parameter_cause!=NULL) + { + free (this->fault.parameter_cause); + } + list_del(&(this->list)); + free (this); + return CWMP_OK; +} diff --git a/src/GetParameterAttributes.c b/src/GetParameterAttributes.c new file mode 100644 index 0000000..96a9d55 --- /dev/null +++ b/src/GetParameterAttributes.c @@ -0,0 +1,216 @@ +/* + GetParameterAttributes.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 20011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include "soapH.h" +#include "cwmp.h" +#include "list.h" +#include "dm.h" +#include "dm_rpc.h" + +struct rpc_cpe *cwmp_add_session_rpc_cpe (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_getParameterAttributes (struct session *session); +int cwmp_rpc_cpe_getParameterAttributes (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_getParameterAttributes_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_getParameterAttributes_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_getParameterAttributes_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_session_rpc_cpe_destructor (struct cwmp *cwmp, struct session *session, struct rpc_cpe *rpc_cpe); +struct rpc_cpe *cwmp_add_session_rpc_cpe_Fault (struct session *session, int idx); +int cwmp_dm_getParameterAttributes(struct cwmp *cwmp, char *path, struct list_head *list, int *n); +int free_list_getParameterAttributes(struct list_head *list); + +struct rpc_cpe *cwmp_add_session_rpc_cpe_getParameterAttributes (struct session *session) +{ + struct rpc_cpe *rpc_cpe; + struct soap_cwmp1_methods__rpc *soap_methods; + + rpc_cpe = cwmp_add_session_rpc_cpe (session); + if (rpc_cpe == NULL) + { + return NULL; + } + soap_methods = &(rpc_cpe->soap_methods); + rpc_cpe->method_data = (void *) calloc (1,sizeof(struct _cwmp1__GetParameterAttributes)); + rpc_cpe->method = cwmp_rpc_cpe_getParameterAttributes; + rpc_cpe->method_response_data = (void *) calloc (1,sizeof(struct _cwmp1__GetParameterAttributesResponse)); + rpc_cpe->method_response_data_init = cwmp_rpc_cpe_getParameterAttributes_response_data_init; + rpc_cpe->method_response = cwmp_rpc_cpe_getParameterAttributes_response; + rpc_cpe->method_end = cwmp_rpc_cpe_getParameterAttributes_end; + rpc_cpe->destructor = cwmp_session_rpc_cpe_destructor; + soap_methods->envelope = "cwmp:GetParameterAttributes"; + soap_methods->envelope_response = "cwmp:GetParameterAttributesResponse"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize__cwmp1__GetParameterAttributesResponse; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put__cwmp1__GetParameterAttributesResponse; + soap_methods->soap_get_cwmp1__rpc_received_data = (void *) soap_get__cwmp1__GetParameterAttributes; + return rpc_cpe; +} + +int cwmp_rpc_cpe_getParameterAttributes (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_cpe_getParameterAttributes_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + struct _cwmp1__GetParameterAttributes *p_soap_cwmp1__GetParameterAttributes; + struct _cwmp1__GetParameterAttributesResponse *p_soap_cwmp1__GetParameterAttributesResponse; + struct cwmp1__ParameterAttributeStruct **ptr_ParameterAttributeStruct; + struct cwmp1ParameterAttributeList *ParameterList; + char **name; + int i,n,size,error; + int size_response = 0; + LIST_HEAD(list_ParameterAttributesStruct); + + p_soap_cwmp1__GetParameterAttributes = (struct _cwmp1__GetParameterAttributes *)this->method_data; + p_soap_cwmp1__GetParameterAttributesResponse = (struct _cwmp1__GetParameterAttributesResponse *)this->method_response_data; + name = p_soap_cwmp1__GetParameterAttributes->ParameterNames->__ptrstring; + size = p_soap_cwmp1__GetParameterAttributes->ParameterNames->__size; + + for(i=0;i__size = size_response; + ParameterList->__ptrParameterAttributeStruct = ptr_ParameterAttributeStruct; + p_soap_cwmp1__GetParameterAttributesResponse->ParameterList = ParameterList; + + while(!list_empty(&list_ParameterAttributesStruct)) + { + struct handler_ParameterAttributeStruct *handler_ParameterAttributeStruct; + handler_ParameterAttributeStruct = list_entry (list_ParameterAttributesStruct.next, struct handler_ParameterAttributeStruct, list); + *ptr_ParameterAttributeStruct = handler_ParameterAttributeStruct->ParameterAttributeStruct; + ptr_ParameterAttributeStruct++; + list_del(list_ParameterAttributesStruct.next); + free(handler_ParameterAttributeStruct); + } + return CWMP_OK; +} + +int cwmp_rpc_cpe_getParameterAttributes_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + int error; + CWMP_LOG (INFO,"Trying to send GetParameterAttributes response to the ACS"); + error = cwmp_soap_send_rpc_cpe_response (cwmp, session, this); + return error; +} +int cwmp_rpc_cpe_getParameterAttributes_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + struct _cwmp1__GetParameterAttributesResponse *p_soap_cwmp1__GetParameterAttributesResponse; + struct cwmp1__ParameterAttributeStruct **ptrParameterAttributeStruct,*pParameterAttributeStruct; + char **ptrAccessList,*pAccessList; + int i,j,size_ParameterAttributeStruct,size_AccessList; + + p_soap_cwmp1__GetParameterAttributesResponse = (struct _cwmp1__GetParameterAttributesResponse *)this->method_response_data; + + if(p_soap_cwmp1__GetParameterAttributesResponse->ParameterList != NULL) + { + size_ParameterAttributeStruct = p_soap_cwmp1__GetParameterAttributesResponse->ParameterList->__size; + ptrParameterAttributeStruct = p_soap_cwmp1__GetParameterAttributesResponse->ParameterList->__ptrParameterAttributeStruct; + + for(i=0;iName != NULL) + { + free(pParameterAttributeStruct->Name); + } + if(pParameterAttributeStruct->AccessList != NULL) + { + size_AccessList = pParameterAttributeStruct->AccessList->__size; + ptrAccessList = pParameterAttributeStruct->AccessList->__ptrstring; + for(j=0;jAccessList); + } + + ptrParameterAttributeStruct++; + free(pParameterAttributeStruct); + } + } + free(p_soap_cwmp1__GetParameterAttributesResponse->ParameterList); + } + + return CWMP_OK; +} + +int free_list_getParameterAttributes(struct list_head *list) +{ + struct handler_ParameterAttributeStruct *handler_ParameterAttributeStruct; + struct cwmp1__ParameterAttributeStruct *ParameterAttributeStruct; + int i; + char **pAccessList; + + while(list->next!=list) + { + handler_ParameterAttributeStruct = list_entry (list->next, struct handler_ParameterAttributeStruct, list); + ParameterAttributeStruct = handler_ParameterAttributeStruct->ParameterAttributeStruct; + if (ParameterAttributeStruct!=NULL) + { + if (ParameterAttributeStruct->Name!=NULL) + { + free(ParameterAttributeStruct->Name); + } + if (ParameterAttributeStruct->AccessList!=NULL) + { + if (ParameterAttributeStruct->AccessList->__ptrstring!=NULL) + { + pAccessList = ParameterAttributeStruct->AccessList->__ptrstring; + for(i=0;iAccessList->__size;i++,pAccessList++) + { + if(*pAccessList!=NULL) + { + free(*pAccessList); + } + } + free(ParameterAttributeStruct->AccessList->__ptrstring); + } + free(ParameterAttributeStruct->AccessList); + } + free(ParameterAttributeStruct); + } + list_del(list->next); + free (handler_ParameterAttributeStruct); + } + return CWMP_OK; +} diff --git a/src/GetParameterNames.c b/src/GetParameterNames.c new file mode 100644 index 0000000..f680718 --- /dev/null +++ b/src/GetParameterNames.c @@ -0,0 +1,180 @@ +/* + GetParameterNames.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include "soapH.h" +#include "cwmp.h" +#include "list.h" +#include "dm.h" +#include "dm_rpc.h" + +struct rpc_cpe *cwmp_add_session_rpc_cpe (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_getParameterNames (struct session *session); +int cwmp_rpc_cpe_getParameterNames (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_getParameterNames_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_getParameterNames_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_getParameterNames_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_dm_getParameterNames(struct cwmp *cwmp, char *path, struct list_head *list, int *n, enum xsd__boolean NextLevel); +struct rpc_cpe *cwmp_add_session_rpc_cpe_Fault (struct session *session, int idx); +static int free_list_getParameterNames(struct list_head *list); +int cwmp_session_rpc_cpe_destructor (struct cwmp *cwmp, struct session *session, struct rpc_cpe *rpc_cpe); + +extern const struct CPE_METHOD_CONSTRUCTORS CPE_METHOD_CONSTRUCTORS_ARRAY [COUNT_RPC_CPE]; + +struct rpc_cpe *cwmp_add_session_rpc_cpe_getParameterNames (struct session *session) +{ + struct rpc_cpe *rpc_cpe; + struct soap_cwmp1_methods__rpc *soap_methods; + + rpc_cpe = cwmp_add_session_rpc_cpe (session); + if (rpc_cpe == NULL) + { + return NULL; + } + soap_methods = &(rpc_cpe->soap_methods); + rpc_cpe->method_data = (void *) calloc (1,sizeof(struct _cwmp1__GetParameterNames)); + rpc_cpe->method = cwmp_rpc_cpe_getParameterNames; + rpc_cpe->method_response_data = (void *) calloc (1,sizeof(struct _cwmp1__GetParameterNamesResponse)); + rpc_cpe->method_response_data_init = cwmp_rpc_cpe_getParameterNames_response_data_init; + rpc_cpe->method_response = cwmp_rpc_cpe_getParameterNames_response; + rpc_cpe->method_end = cwmp_rpc_cpe_getParameterNames_end; + rpc_cpe->destructor = cwmp_session_rpc_cpe_destructor; + soap_methods->envelope = "cwmp:GetParameterNames"; + soap_methods->envelope_response = "cwmp:GetParameterNamesResponse"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize__cwmp1__GetParameterNamesResponse; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put__cwmp1__GetParameterNamesResponse; + soap_methods->soap_get_cwmp1__rpc_received_data = (void *) soap_get__cwmp1__GetParameterNames; + return rpc_cpe; +} + +int cwmp_rpc_cpe_getParameterNames (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + struct _cwmp1__GetParameterNames *p_soap_cwmp1__GetParameterNames; + struct _cwmp1__GetParameterNamesResponse *p_soap_cwmp1__GetParameterNamesResponse; + struct cwmp1ParameterInfoList *ParameterList; + struct cwmp1__ParameterInfoStruct **ptrParameterInfoStruct; + char *ParameterPath; + enum xsd__boolean NextLevel; + int i,size,error; + LIST_HEAD(list_ParameterInfoStruct); + + p_soap_cwmp1__GetParameterNames = (struct _cwmp1__GetParameterNames *)this->method_data; + p_soap_cwmp1__GetParameterNamesResponse = (struct _cwmp1__GetParameterNamesResponse *)this->method_response_data; + ParameterPath = *(p_soap_cwmp1__GetParameterNames->ParameterPath); + NextLevel = p_soap_cwmp1__GetParameterNames->NextLevel; + + CWMP_LOG(INFO,"ParameterPath = \"%s\"", ParameterPath); + error = cwmp_dm_getParameterNames(cwmp, ParameterPath, &list_ParameterInfoStruct, &size,NextLevel); + if (error != FAULT_CPE_NO_FAULT_IDX) + { + free_list_getParameterNames(&list_ParameterInfoStruct); + if (cwmp_add_session_rpc_cpe_Fault(session,error)==NULL) + { + return CWMP_GEN_ERR; + } + return CWMP_FAULT_CPE; + } + + ParameterList = calloc(1,sizeof(struct cwmp1ParameterInfoList)); + ptrParameterInfoStruct = calloc(size,sizeof(struct cwmp1__ParameterInfoStruct *)); + if (ParameterList == NULL || + ptrParameterInfoStruct == NULL) + { + return CWMP_MEM_ERR; + } + ParameterList->__size = size; + ParameterList->__ptrParameterInfoStruct = ptrParameterInfoStruct; + p_soap_cwmp1__GetParameterNamesResponse->ParameterList = ParameterList; + while(list_ParameterInfoStruct.next!=&list_ParameterInfoStruct) + { + struct handler_ParameterInfoStruct *handler_ParameterInfoStruct; + handler_ParameterInfoStruct = list_entry(list_ParameterInfoStruct.next,struct handler_ParameterInfoStruct,list); + *ptrParameterInfoStruct = handler_ParameterInfoStruct->ParameterInfoStruct; + ptrParameterInfoStruct++; + list_del(list_ParameterInfoStruct.next); + free (handler_ParameterInfoStruct); + } + return CWMP_OK; +} + +int cwmp_rpc_cpe_getParameterNames_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} +int cwmp_rpc_cpe_getParameterNames_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + int error; + CWMP_LOG (INFO,"Trying to send GetParameterNames response to the ACS"); + error = cwmp_soap_send_rpc_cpe_response (cwmp, session, this); + return error; +} +int cwmp_rpc_cpe_getParameterNames_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + struct _cwmp1__GetParameterNames *p_soap_cwmp1__GetParameterNames; + struct _cwmp1__GetParameterNamesResponse *p_soap_cwmp1__GetParameterNamesResponse; + struct cwmp1ParameterInfoList *ParameterList; + struct cwmp1__ParameterInfoStruct **ptrParameterInfoStruct,*ParameterInfoStruct; + int i; + + p_soap_cwmp1__GetParameterNamesResponse = (struct _cwmp1__GetParameterNamesResponse *)this->method_response_data; + if (p_soap_cwmp1__GetParameterNamesResponse!=NULL) + { + if (p_soap_cwmp1__GetParameterNamesResponse->ParameterList != NULL) + { + if(p_soap_cwmp1__GetParameterNamesResponse->ParameterList->__ptrParameterInfoStruct != NULL) + { + ptrParameterInfoStruct = p_soap_cwmp1__GetParameterNamesResponse->ParameterList->__ptrParameterInfoStruct; + for (i=0;iParameterList->__size;i++,ptrParameterInfoStruct++) + { + ParameterInfoStruct = *ptrParameterInfoStruct; + if (ParameterInfoStruct!=NULL) + { + if (ParameterInfoStruct->Name!=NULL) + { + free(ParameterInfoStruct->Name); + } + free(ParameterInfoStruct); + } + } + free (p_soap_cwmp1__GetParameterNamesResponse->ParameterList->__ptrParameterInfoStruct); + } + free (p_soap_cwmp1__GetParameterNamesResponse->ParameterList); + } + } + return CWMP_OK; +} + +static int free_list_getParameterNames(struct list_head *list) +{ + struct handler_ParameterInfoStruct *handler_ParameterInfoStruct; + struct cwmp1__ParameterInfoStruct *ParameterInfoStruct; + while(list->next!=list) + { + handler_ParameterInfoStruct = list_entry(list->next,struct handler_ParameterInfoStruct,list); + ParameterInfoStruct = handler_ParameterInfoStruct->ParameterInfoStruct; + if (ParameterInfoStruct!=NULL) + { + if (ParameterInfoStruct->Name!=NULL) + { + free(ParameterInfoStruct->Name); + } + free(ParameterInfoStruct); + } + list_del(list->next); + free (handler_ParameterInfoStruct); + } + return CWMP_OK; +} diff --git a/src/GetParameterValues.c b/src/GetParameterValues.c new file mode 100644 index 0000000..656b236 --- /dev/null +++ b/src/GetParameterValues.c @@ -0,0 +1,190 @@ +/* + GetParameterValues.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 20011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include "soapH.h" +#include "cwmp.h" +#include "list.h" +#include "dm.h" +#include "dm_rpc.h" + +struct rpc_cpe *cwmp_add_session_rpc_cpe (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_getParameterValues (struct session *session); +int cwmp_rpc_cpe_getParameterValues (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_getParameterValues_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_getParameterValues_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_getParameterValues_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_dm_getParameterValues(struct cwmp *cwmp, char *name, struct list_head *list, int *n); +struct rpc_cpe *cwmp_add_session_rpc_cpe_Fault (struct session *session, int idx); +int free_list_getParameterValues(struct list_head *list); +int cwmp_session_rpc_cpe_destructor (struct cwmp *cwmp, struct session *session, struct rpc_cpe *rpc_cpe); + +extern const struct CPE_METHOD_CONSTRUCTORS CPE_METHOD_CONSTRUCTORS_ARRAY [COUNT_RPC_CPE]; + +struct rpc_cpe *cwmp_add_session_rpc_cpe_getParameterValues (struct session *session) +{ + struct rpc_cpe *rpc_cpe; + struct soap_cwmp1_methods__rpc *soap_methods; + + rpc_cpe = cwmp_add_session_rpc_cpe (session); + if (rpc_cpe == NULL) + { + return NULL; + } + soap_methods = &(rpc_cpe->soap_methods); + rpc_cpe->method_data = (void *) calloc (1,sizeof(struct _cwmp1__GetParameterValues)); + rpc_cpe->method = cwmp_rpc_cpe_getParameterValues; + rpc_cpe->method_response_data = (void *) calloc (1,sizeof(struct _cwmp1__GetParameterValuesResponse)); + rpc_cpe->method_response_data_init = cwmp_rpc_cpe_getParameterValues_response_data_init; + rpc_cpe->method_response = cwmp_rpc_cpe_getParameterValues_response; + rpc_cpe->method_end = cwmp_rpc_cpe_getParameterValues_end; + rpc_cpe->destructor = cwmp_session_rpc_cpe_destructor; + soap_methods->envelope = "cwmp:GetParameterValues"; + soap_methods->envelope_response = "cwmp:GetParameterValuesResponse"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize__cwmp1__GetParameterValuesResponse; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put__cwmp1__GetParameterValuesResponse; + soap_methods->soap_get_cwmp1__rpc_received_data = (void *) soap_get__cwmp1__GetParameterValues; + return rpc_cpe; +} + +int cwmp_rpc_cpe_getParameterValues (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + struct _cwmp1__GetParameterValues *p_soap_cwmp1__GetParameterValues; + struct _cwmp1__GetParameterValuesResponse *p_soap_cwmp1__GetParameterValuesResponse; + struct cwmp1ParameterValueList *ParameterList; + struct cwmp1__ParameterValueStruct **ptr_ParameterValueStruct; + char **name; + int i,n,size,error; + int size_resp=0; + LIST_HEAD(list_ParameterValueStruct); + + p_soap_cwmp1__GetParameterValues = (struct _cwmp1__GetParameterValues *)this->method_data; + p_soap_cwmp1__GetParameterValuesResponse = (struct _cwmp1__GetParameterValuesResponse *)this->method_response_data; + name = p_soap_cwmp1__GetParameterValues->ParameterNames->__ptrstring; + size = p_soap_cwmp1__GetParameterValues->ParameterNames->__size; + + for (i=0;i__size = size_resp; + ParameterList->__ptrParameterValueStruct = ptr_ParameterValueStruct; + p_soap_cwmp1__GetParameterValuesResponse->ParameterList = ParameterList; + while(list_ParameterValueStruct.next!=&list_ParameterValueStruct) + { + struct handler_ParameterValueStruct *handler_ParameterValueStruct; + handler_ParameterValueStruct = list_entry(list_ParameterValueStruct.next,struct handler_ParameterValueStruct,list); + *ptr_ParameterValueStruct = handler_ParameterValueStruct->ParameterValueStruct; + ptr_ParameterValueStruct++; + list_del(list_ParameterValueStruct.next); + free (handler_ParameterValueStruct); + } + return CWMP_OK; +} + +int cwmp_rpc_cpe_getParameterValues_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} +int cwmp_rpc_cpe_getParameterValues_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + int error; + CWMP_LOG (INFO,"Trying to send GetParameterValues response to the ACS"); + error = cwmp_soap_send_rpc_cpe_response (cwmp, session, this); + return error; +} +int cwmp_rpc_cpe_getParameterValues_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + struct _cwmp1__GetParameterValues *p_soap_cwmp1__GetParameterValues; + struct _cwmp1__GetParameterValuesResponse *p_soap_cwmp1__GetParameterValuesResponse; + struct cwmp1__ParameterValueStruct **ptr_ParameterValueStruct,*ParameterValueStruct; + int i; + + p_soap_cwmp1__GetParameterValuesResponse = (struct _cwmp1__GetParameterValuesResponse *)this->method_response_data; + if (p_soap_cwmp1__GetParameterValuesResponse!=NULL) + { + if (p_soap_cwmp1__GetParameterValuesResponse->ParameterList != NULL) + { + if(p_soap_cwmp1__GetParameterValuesResponse->ParameterList->__ptrParameterValueStruct != NULL) + { + ptr_ParameterValueStruct = p_soap_cwmp1__GetParameterValuesResponse->ParameterList->__ptrParameterValueStruct; + for (i=0;iParameterList->__size;i++,ptr_ParameterValueStruct++) + { + ParameterValueStruct = *ptr_ParameterValueStruct; + if (ParameterValueStruct!=NULL) + { + if (ParameterValueStruct->Name!=NULL) + { + free(ParameterValueStruct->Name); + } + if (ParameterValueStruct->Value!=NULL) + { + free(ParameterValueStruct->Value); + } + free(ParameterValueStruct); + } + } + free (p_soap_cwmp1__GetParameterValuesResponse->ParameterList->__ptrParameterValueStruct); + } + free (p_soap_cwmp1__GetParameterValuesResponse->ParameterList); + } + } + return CWMP_OK; +} + +int free_list_getParameterValues(struct list_head *list) +{ + struct handler_ParameterValueStruct *handler_ParameterValueStruct; + struct cwmp1__ParameterValueStruct *ParameterValueStruct; + while(list->next!=list) + { + handler_ParameterValueStruct = list_entry(list->next,struct handler_ParameterValueStruct,list); + ParameterValueStruct = handler_ParameterValueStruct->ParameterValueStruct; + if (ParameterValueStruct!=NULL) + { + if (ParameterValueStruct->Name!=NULL) + { + free(ParameterValueStruct->Name); + } + if (ParameterValueStruct->Value!=NULL) + { + free(ParameterValueStruct->Value); + } + free(ParameterValueStruct); + } + list_del(list->next); + free (handler_ParameterValueStruct); + } + return CWMP_OK; +} diff --git a/src/GetRPCMethods_acs.c b/src/GetRPCMethods_acs.c new file mode 100644 index 0000000..a2b5f5a --- /dev/null +++ b/src/GetRPCMethods_acs.c @@ -0,0 +1,88 @@ +/* + GetRPCMethods_acs.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include "soapH.h" +#include "cwmp.h" +#include "list.h" + +int cwmp_rpc_acs_getRPCMethods_data_init (struct cwmp *cwmp, struct session *session, struct rpc_acs *this); +int cwmp_rpc_acs_getRPCMethods_remote_call (struct cwmp *cwmp, struct session *session, struct rpc_acs *this); +int cwmp_rpc_acs_getRPCMethods_response (struct cwmp *cwmp, struct session *session, struct rpc_acs *this); +int cwmp_rpc_acs_getRPCMethods_end (struct cwmp *cwmp, struct session *session, struct rpc_acs *this); +int cwmp_rpc_acs_getRPCMethods_destructor (struct cwmp *cwmp, struct session *session, struct rpc_acs *this); + +void soap_serialize__cwmp1__GetRPCMethods(struct soap *soap, const struct _cwmp1__GetRPCMethods *a); +int soap_put__cwmp1__GetRPCMethods(struct soap *soap, const struct _cwmp1__GetRPCMethods *a, const char *tag, const char *type); +struct _cwmp1__GetRPCMethodsResponse * soap_get__cwmp1__GetRPCMethodsResponse(struct soap *soap, struct _cwmp1__GetRPCMethodsResponse *p, const char *tag, const char *type); + +struct rpc_acs *cwmp_add_session_rpc_acs (struct session *session); + +struct rpc_acs *cwmp_add_session_rpc_acs_getRPCMethods (struct session *session) +{ + struct rpc_acs *rpc_acs; + struct soap_cwmp1_methods__rpc *soap_methods; + + rpc_acs = cwmp_add_session_rpc_acs (session); + if (rpc_acs == NULL) + { + return NULL; + } + soap_methods = &(rpc_acs->soap_methods); + rpc_acs->method_data = (void *) calloc (1,sizeof(struct _cwmp1__GetRPCMethods)); + rpc_acs->method_data_init = cwmp_rpc_acs_getRPCMethods_data_init; + rpc_acs->method_remote_call = cwmp_rpc_acs_getRPCMethods_remote_call; + rpc_acs->method_response_data = (void *) calloc (1,sizeof(struct _cwmp1__GetRPCMethodsResponse)); + rpc_acs->method_response = cwmp_rpc_acs_getRPCMethods_response; + rpc_acs->method_end = cwmp_rpc_acs_getRPCMethods_end; + rpc_acs->destructor = cwmp_rpc_acs_getRPCMethods_destructor; + rpc_acs->type = RPC_ACS_GETRPCMETHODS_IDX; + soap_methods->envelope = "cwmp:GetRPCMethods"; + soap_methods->envelope_response = "cwmp:GetRPCMethodsResponse"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize__cwmp1__GetRPCMethods; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put__cwmp1__GetRPCMethods; + soap_methods->soap_get_cwmp1__rpc_received_data = (void *) soap_get__cwmp1__GetRPCMethodsResponse; + + return rpc_acs; +} + +int cwmp_rpc_acs_getRPCMethods_data_init (struct cwmp *cwmp, struct session *session, struct rpc_acs *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_acs_getRPCMethods_remote_call (struct cwmp *cwmp, struct session *session, struct rpc_acs *this) +{ + CWMP_LOG (INFO,"Trying to call the GetRPCMethods remote method"); + cwmp_soap_call_rpc_acs (cwmp, session, this); + return CWMP_OK; +} + +int cwmp_rpc_acs_getRPCMethods_response (struct cwmp *cwmp, struct session *session, struct rpc_acs *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_acs_getRPCMethods_end (struct cwmp *cwmp, struct session *session, struct rpc_acs *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_acs_getRPCMethods_destructor (struct cwmp *cwmp, struct session *session, struct rpc_acs *this) +{ + cwmp_session_rpc_acs_destructor (cwmp, session, this); + return CWMP_OK; +} diff --git a/src/GetRPCMethods_cpe.c b/src/GetRPCMethods_cpe.c new file mode 100644 index 0000000..362537f --- /dev/null +++ b/src/GetRPCMethods_cpe.c @@ -0,0 +1,119 @@ +/* + GetRPCMethods_cpe.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ +#include "soapH.h" +#include "cwmp.h" +#include "list.h" + +struct rpc_cpe *cwmp_add_session_rpc_cpe (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_getRPCMethods (struct session *session); +int cwmp_rpc_cpe_getRPCMethods (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_getRPCMethods_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_getRPCMethods_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_getRPCMethods_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_session_rpc_cpe_destructor (struct cwmp *cwmp, struct session *session, struct rpc_cpe *rpc_cpe); +extern const struct CPE_METHOD_CONSTRUCTORS CPE_METHOD_CONSTRUCTORS_ARRAY [COUNT_RPC_CPE]; + +struct rpc_cpe *cwmp_add_session_rpc_cpe_getRPCMethods (struct session *session) +{ + struct rpc_cpe *rpc_cpe; + struct soap_cwmp1_methods__rpc *soap_methods; + + rpc_cpe = cwmp_add_session_rpc_cpe (session); + if (rpc_cpe == NULL) + { + return NULL; + } + soap_methods = &(rpc_cpe->soap_methods); + rpc_cpe->method_data = (void *) calloc (1,sizeof(struct _cwmp1__GetRPCMethods)); + rpc_cpe->method = cwmp_rpc_cpe_getRPCMethods; + rpc_cpe->method_response_data = (void *) calloc (1,sizeof(struct _cwmp1__GetRPCMethodsResponse)); + rpc_cpe->method_response_data_init = cwmp_rpc_cpe_getRPCMethods_response_data_init; + rpc_cpe->method_response = cwmp_rpc_cpe_getRPCMethods_response; + rpc_cpe->method_end = cwmp_rpc_cpe_getRPCMethods_end; + rpc_cpe->destructor = cwmp_session_rpc_cpe_destructor; + soap_methods->envelope = "cwmp:GetRPCMethods"; + soap_methods->envelope_response = "cwmp:GetRPCMethodsResponse"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize__cwmp1__GetRPCMethodsResponse; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put__cwmp1__GetRPCMethodsResponse; + soap_methods->soap_get_cwmp1__rpc_received_data = (void *) soap_get__cwmp1__GetRPCMethods; + return rpc_cpe; +} + +int cwmp_rpc_cpe_getRPCMethods (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_cpe_getRPCMethods_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + int i; + struct cwmp1MethodList *MethodList; + char **mlstruct; + struct _cwmp1__GetRPCMethodsResponse *p_soap_cwmp1__GetRPCMethodsResponse; + + MethodList = calloc(1,sizeof(struct cwmp1MethodList)); + mlstruct = calloc(COUNT_RPC_CPE,sizeof(char *)); + if(MethodList == NULL || + mlstruct == NULL) + { + return CWMP_MEM_ERR; + } + MethodList->__ptrstring = mlstruct; + for(i=0;i__size++; + mlstruct++; + } + } + + + p_soap_cwmp1__GetRPCMethodsResponse = (struct _cwmp1__GetRPCMethodsResponse *)this->method_response_data; + p_soap_cwmp1__GetRPCMethodsResponse->MethodList = MethodList; + return CWMP_OK; +} + +int cwmp_rpc_cpe_getRPCMethods_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + int error; + CWMP_LOG (INFO,"Trying to send GetRPCMethods response to the ACS"); + error = cwmp_soap_send_rpc_cpe_response (cwmp, session, this); + return error; +} + +int cwmp_rpc_cpe_getRPCMethods_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + struct _cwmp1__GetRPCMethodsResponse *p_soap_cwmp1__GetRPCMethodsResponse; + + p_soap_cwmp1__GetRPCMethodsResponse = (struct _cwmp1__GetRPCMethodsResponse *)this->method_response_data; + if (p_soap_cwmp1__GetRPCMethodsResponse!=NULL) + { + if (p_soap_cwmp1__GetRPCMethodsResponse->MethodList != NULL) + { + if(p_soap_cwmp1__GetRPCMethodsResponse->MethodList->__ptrstring != NULL) + { + free (p_soap_cwmp1__GetRPCMethodsResponse->MethodList->__ptrstring); + } + free (p_soap_cwmp1__GetRPCMethodsResponse->MethodList); + } + } + + return CWMP_OK; +} + diff --git a/src/Inform.c b/src/Inform.c new file mode 100644 index 0000000..f654828 --- /dev/null +++ b/src/Inform.c @@ -0,0 +1,413 @@ +/* + inform.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include +#include +#include +#include "soapH.h" +#include "list.h" +#include "cwmp.h" +#include "dm.h" +#include "dm_rpc.h" +#include +#include "backupSession.h" + +struct rpc_acs *cwmp_add_session_rpc_acs (struct session *session); +struct rpc_acs *cwmp_add_session_rpc_acs_head (struct session *session); + +int cwmp_rpc_acs_inform_data_init (struct cwmp *cwmp, struct session *session, struct rpc_acs *this); +int cwmp_rpc_acs_inform_remote_call (struct cwmp *cwmp, struct session *session, struct rpc_acs *this); +int cwmp_rpc_acs_inform_response (struct cwmp *cwmp, struct session *session, struct rpc_acs *this); +int cwmp_rpc_acs_inform_end (struct cwmp *cwmp, struct session *session, struct rpc_acs *this); +int cwmp_session_rpc_acs_destructor (struct cwmp *cwmp, struct session *session, struct rpc_acs *rpc_acs); +int cwmp_rpc_acs_inform_destructor (struct cwmp *cwmp, struct session *session, struct rpc_acs *this); +int event_remove_all_event_container(struct session *session, int rem_from); + +void soap_serialize_cwmp1__Inform (struct soap *soap, const struct cwmp1__Inform *a); +int soap_put_cwmp1__Inform (struct soap *soap, const struct cwmp1__Inform *a, const char *tag, const char *type); +int free_list_getParameterValues(struct list_head *list); +struct cwmp1__InformResponse *soap_get_cwmp1__InformResponse (struct soap *soap, struct cwmp1__InformResponse *p, const char *tag, const char *type); + +extern struct list_head forced_inform_parameter_list; +static int forced_inform_parameter_size=0; +static LIST_HEAD(forced_inform_parameter_indice_list); +extern char *TYPE_VALUES_ARRAY [COUNT_TYPE_VALUES]; + +struct rpc_acs *cwmp_add_session_rpc_acs_inform (struct session *session) +{ + struct rpc_acs *rpc_acs; + struct soap_cwmp1_methods__rpc *soap_methods; + + rpc_acs = cwmp_add_session_rpc_acs_head (session); /* Only the inform rpc should be added in the head of the rpc acs list*/ + if (rpc_acs == NULL) + { + return NULL; + } + soap_methods = &(rpc_acs->soap_methods); + rpc_acs->method_data = (void *) calloc (1,sizeof(struct cwmp1__Inform)); + rpc_acs->method_data_init = cwmp_rpc_acs_inform_data_init; + rpc_acs->method_remote_call = cwmp_rpc_acs_inform_remote_call; + rpc_acs->method_response_data = (void *) calloc (1,sizeof(struct cwmp1__InformResponse)); + rpc_acs->method_response = cwmp_rpc_acs_inform_response; + rpc_acs->method_end = cwmp_rpc_acs_inform_end; + rpc_acs->destructor = cwmp_rpc_acs_inform_destructor; + rpc_acs->type = RPC_ACS_INFORM_IDX; + soap_methods->envelope = "cwmp:Inform"; + soap_methods->envelope_response = "cwmp:InformResponse"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize_cwmp1__Inform; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put_cwmp1__Inform; + soap_methods->soap_get_cwmp1__rpc_received_data = (void *) soap_get_cwmp1__InformResponse; + return rpc_acs; +} + +int cwmp_rpc_acs_inform_data_init (struct cwmp *cwmp, struct session *session, struct rpc_acs *this) +{ + struct cwmp1__Inform *p_soap_cwmp1__Inform; + struct cwmp1__DeviceIdStruct *DeviceIdStruct; + struct cwmp1__EventStruct **pEventStruct; + struct cwmp1__ParameterValueStruct *ParameterValueStructForce, **ptr_ParameterValueStruct, *p,**pp; + struct event_container *event_container; + struct paramater_container *paramater_container; + struct forced_inform_parameter *fip; + int i, j, size, force_size = 0 , error; + struct list_head *ilist,*jlist; + + + if (session==NULL || this==NULL) + { + return CWMP_GEN_ERR; + } + + DeviceIdStruct = calloc(1,sizeof(struct cwmp1__DeviceIdStruct)); + if (DeviceIdStruct == NULL) + { + return CWMP_MEM_ERR; + } + dm_get_deviceId_manufacturer(cwmp,&(DeviceIdStruct->Manufacturer)); + dm_get_deviceId_oui(cwmp,&(DeviceIdStruct->OUI)); + dm_get_deviceId_productClass(cwmp,&(DeviceIdStruct->ProductClass)); + dm_get_deviceId_serialNumber(cwmp,&(DeviceIdStruct->SerialNumber)); + p_soap_cwmp1__Inform = (struct cwmp1__Inform *) this->method_data; + p_soap_cwmp1__Inform->DeviceId = DeviceIdStruct; + p_soap_cwmp1__Inform->CurrentTime = time((time_t*)NULL); + p_soap_cwmp1__Inform->RetryCount = cwmp->retry_count_session; + p_soap_cwmp1__Inform->MaxEnvelopesI = 1; + __list_for_each(ilist, &(forced_inform_parameter_list)) + { + fip = list_entry (ilist, struct forced_inform_parameter,list); + if (strstr(fip->name,"{i}")==NULL) + { + force_size++; + } + else + { + int n = 0; + inform_dm_getParameterPaths_by_correspondence(cwmp,fip->name,&forced_inform_parameter_indice_list,&n); + force_size += n; + } + } + forced_inform_parameter_size = force_size; + size = force_size + session->parameter_size; + p_soap_cwmp1__Inform->ParameterList = calloc(1,sizeof(struct cwmp1ParameterValueList)); + ParameterValueStructForce = calloc(force_size,sizeof(struct cwmp1__ParameterValueStruct)); + ptr_ParameterValueStruct = calloc(size,sizeof(struct cwmp1__ParameterValueStruct *)); + p_soap_cwmp1__Inform->Event = calloc(1,sizeof(struct cwmp1EventList)); + pEventStruct = calloc(session->event_size,sizeof(struct cwmp1__EventStruct *)); + if (p_soap_cwmp1__Inform->ParameterList == NULL || + ParameterValueStructForce == NULL || + ptr_ParameterValueStruct == NULL || + p_soap_cwmp1__Inform->Event == NULL || + pEventStruct==NULL) + { + return CWMP_MEM_ERR; + } + p_soap_cwmp1__Inform->ParameterList->__ptrParameterValueStruct = ptr_ParameterValueStruct; + p_soap_cwmp1__Inform->Event->__size = session->event_size; + p_soap_cwmp1__Inform->Event->__ptrEventStruct = pEventStruct; + i = 0; + __list_for_each(ilist, &(forced_inform_parameter_list)) + { + fip = list_entry (ilist, struct forced_inform_parameter,list); + if (strstr(fip->name,"{i}")==NULL) + { + if (i!=0) + { + ParameterValueStructForce++; + ptr_ParameterValueStruct++; + } + i++; + ParameterValueStructForce->Name = strdup (fip->name); + ParameterValueStructForce->Type = TYPE_VALUES_ARRAY [fip->node->value_type]; + if (error = get_node_paramater_value(fip->node,NULL,0,&(ParameterValueStructForce->Value))) + { + char t[1]; + t[0] = 0; + ParameterValueStructForce->Value = strdup(t); + } + *ptr_ParameterValueStruct = ParameterValueStructForce; + } + } + __list_for_each(ilist, &(forced_inform_parameter_indice_list)) + { + struct handler_ParameterValueStruct *handler_ParameterValueStruct; + if (i!=0) + { + ParameterValueStructForce++; + ptr_ParameterValueStruct++; + } + i++; + handler_ParameterValueStruct = list_entry(ilist,struct handler_ParameterValueStruct,list); + ParameterValueStructForce->Name = handler_ParameterValueStruct->ParameterValueStruct->Name; + ParameterValueStructForce->Value = handler_ParameterValueStruct->ParameterValueStruct->Value; + ParameterValueStructForce->Type = handler_ParameterValueStruct->ParameterValueStruct->Type; + *ptr_ParameterValueStruct = ParameterValueStructForce; + ilist = ilist->prev; + list_del(&(handler_ParameterValueStruct->list)); + free (handler_ParameterValueStruct->ParameterValueStruct); + free (handler_ParameterValueStruct); + } + pp = p_soap_cwmp1__Inform->ParameterList->__ptrParameterValueStruct; + size = 0; + error = 1; + __list_for_each(ilist,&(session->head_event_container)) + { + event_container = list_entry(ilist, struct event_container, list); + *pEventStruct = &(event_container->event); + pEventStruct ++; + + __list_for_each(jlist,&(event_container->head_paramater_container)) + { + paramater_container = list_entry(jlist, struct paramater_container, list); + for (j=0;j<(size+force_size);j++) + { + p = *(pp+j); + if ((error = strcmp(paramater_container->paramater.Name,p->Name))==0) + { + break; + } + } + if (error==0) + { + continue; + } + if (i!=0) + { + ptr_ParameterValueStruct++; + } + i++; + inform_dm_get_value_by_path (cwmp, paramater_container->paramater.Name, &(paramater_container->paramater.Value), &(paramater_container->paramater.Type)); + *ptr_ParameterValueStruct = &(paramater_container->paramater); + size++; + } + } + p_soap_cwmp1__Inform->ParameterList->__size = size + force_size; + + return CWMP_OK; +} + +int cwmp_rpc_acs_inform_remote_call (struct cwmp *cwmp, struct session *session, struct rpc_acs *this) +{ + CWMP_LOG(INFO, "Trying to call the Inform remote method"); + cwmp_soap_call_rpc_acs (cwmp, session, this); + return CWMP_OK; +} + +int cwmp_rpc_acs_inform_response (struct cwmp *cwmp, struct session *session, struct rpc_acs *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_acs_inform_end (struct cwmp *cwmp, struct session *session, struct rpc_acs *this) +{ + struct cwmp1__Inform *p_soap_cwmp1__Inform; + struct cwmp1__InformResponse *p_soap_cwmp1__InformResponse; + int force_size; + + force_size = forced_inform_parameter_size; + p_soap_cwmp1__Inform = (struct cwmp1__Inform *)this->method_data; + + if (p_soap_cwmp1__Inform!=NULL) + { + if (p_soap_cwmp1__Inform->DeviceId!=NULL) + { + if (p_soap_cwmp1__Inform->DeviceId->Manufacturer!=NULL) + { + free (p_soap_cwmp1__Inform->DeviceId->Manufacturer); + } + if (p_soap_cwmp1__Inform->DeviceId->OUI!=NULL) + { + free (p_soap_cwmp1__Inform->DeviceId->OUI); + } + if (p_soap_cwmp1__Inform->DeviceId->ProductClass!=NULL) + { + free (p_soap_cwmp1__Inform->DeviceId->ProductClass); + } + if (p_soap_cwmp1__Inform->DeviceId->SerialNumber!=NULL) + { + free (p_soap_cwmp1__Inform->DeviceId->SerialNumber); + } + free (p_soap_cwmp1__Inform->DeviceId); + } + if (p_soap_cwmp1__Inform->Event!=NULL) + { + if (p_soap_cwmp1__Inform->Event->__ptrEventStruct!=NULL) + { + free (p_soap_cwmp1__Inform->Event->__ptrEventStruct); + } + free (p_soap_cwmp1__Inform->Event); + } + if (p_soap_cwmp1__Inform->ParameterList!=NULL) + { + struct cwmp1__ParameterValueStruct *ParameterValueStructForce,*p; + int i = 0; + if (p_soap_cwmp1__Inform->ParameterList->__ptrParameterValueStruct!= NULL) + { + if (force_size>0) + { + ParameterValueStructForce = *(p_soap_cwmp1__Inform->ParameterList->__ptrParameterValueStruct); + p = ParameterValueStructForce; + while (p!=NULL && iName!=NULL) + { + free (p->Name); + } + if (p->Value!=NULL) + { + free (p->Value); + } + p++; + i++; + } + if (ParameterValueStructForce!=NULL) + { + free (ParameterValueStructForce); + } + } + free(p_soap_cwmp1__Inform->ParameterList->__ptrParameterValueStruct); + } + free (p_soap_cwmp1__Inform->ParameterList); + } + } + return CWMP_OK; +} + +int cwmp_rpc_acs_inform_destructor (struct cwmp *cwmp, struct session *session, struct rpc_acs *this) +{ + + cwmp_session_rpc_acs_destructor (cwmp, session, this); + event_remove_all_event_container (session,RPC_SEND); + return CWMP_OK; +} + +/* + * Get Device ID values + */ + +int dm_get_deviceId_manufacturer(struct cwmp *cwmp, char **value) +{ + *value = strdup("Inteno"); + return CWMP_OK; +} + +int inform_dm_get_value_by_path (struct cwmp *cwmp, char *path, char **value, char **type) +{ + int n,error; + LIST_HEAD(list_ParameterValueStruct); + + *value = NULL; + *type = NULL; + error = cwmp_dm_getParameterValues(cwmp, path, &list_ParameterValueStruct,&n); + if (error == FAULT_CPE_NO_FAULT_IDX) + { + struct handler_ParameterValueStruct *handler_ParameterValueStruct; + if (list_ParameterValueStruct.next!=&list_ParameterValueStruct) + { + handler_ParameterValueStruct = list_entry(list_ParameterValueStruct.next,struct handler_ParameterValueStruct,list); + *value = strdup(handler_ParameterValueStruct->ParameterValueStruct->Value); + *type = handler_ParameterValueStruct->ParameterValueStruct->Type; + } + } + if (*value==NULL) + { + char t[1]; + t[0] = 0; + *value = strdup(t); + } + if (*type==NULL) + { + *type = TYPE_VALUES_ARRAY[TYPE_VALUE_string_IDX]; + } + free_list_getParameterValues(&list_ParameterValueStruct); + return CWMP_OK; +} + +int dm_get_deviceId_oui(struct cwmp *cwmp, char **value) +{ + int error; + char *type; + error = inform_dm_get_value_by_path (cwmp, "InternetGatewayDevice.DeviceInfo.ManufacturerOUI", value, &type); + return error; +} + +int dm_get_deviceId_productClass(struct cwmp *cwmp, char **value) +{ + int error; + char *type; + error = inform_dm_get_value_by_path (cwmp, "InternetGatewayDevice.DeviceInfo.ProductClass", value, &type); + return error; +} + +int dm_get_deviceId_serialNumber(struct cwmp *cwmp, char **value) +{ + int error; + char *type; + error = inform_dm_get_value_by_path (cwmp, "InternetGatewayDevice.DeviceInfo.SerialNumber", value, &type); + return error; +} + +/* + * End Get Device ID values + */ + +int inform_dm_getParameterPaths_by_correspondence(struct cwmp *cwmp, char *path, struct list_head *list, int *n) +{ + + char *prefix_path=NULL; + char **argv; + struct sub_path *sub_path; + int i,sub_path_size; + + argv = calloc (1,sizeof(char *)); + sub_path = calloc (DM_MAX_INDICE,sizeof(struct sub_path)); + argv[0] = path; + cwmp_dm_get_sub_indice_path(1,argv,&prefix_path,sub_path,&sub_path_size); + cwmp_dm_getParameterPaths_by_correspondence(cwmp,prefix_path,sub_path,sub_path_size,list,n,TRUE,FALSE,&i); + for (i=0;i +#include + +struct rpc_cpe *cwmp_add_session_rpc_cpe (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_reboot (struct session *session); +int cwmp_rpc_cpe_reboot (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_reboot_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_reboot_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_reboot_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_session_rpc_cpe_destructor (struct cwmp *cwmp, struct session *session, struct rpc_cpe *rpc_cpe); +struct event_container *cwmp_add_event_container (struct cwmp *cwmp, int event_idx, char *command_key); +void cwmp_save_event_container (struct cwmp *cwmp,struct event_container *event_container); + +struct rpc_cpe *cwmp_add_session_rpc_cpe_reboot (struct session *session) +{ + struct rpc_cpe *rpc_cpe; + struct soap_cwmp1_methods__rpc *soap_methods; + + rpc_cpe = cwmp_add_session_rpc_cpe (session); + if (rpc_cpe == NULL) + { + return NULL; + } + soap_methods = &(rpc_cpe->soap_methods); + rpc_cpe->method_data = (void *) calloc (1,sizeof(struct _cwmp1__Reboot)); + rpc_cpe->method = cwmp_rpc_cpe_reboot; + rpc_cpe->method_response_data = (void *) calloc (1,sizeof(struct _cwmp1__RebootResponse)); + rpc_cpe->method_response_data_init = cwmp_rpc_cpe_reboot_response_data_init; + rpc_cpe->method_response = cwmp_rpc_cpe_reboot_response; + rpc_cpe->method_end = cwmp_rpc_cpe_reboot_end; + rpc_cpe->destructor = cwmp_session_rpc_cpe_destructor; + soap_methods->envelope = "cwmp:Reboot"; + soap_methods->envelope_response = "cwmp:RebootResponse"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize__cwmp1__RebootResponse; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put__cwmp1__RebootResponse; + soap_methods->soap_get_cwmp1__rpc_received_data = (void *) soap_get__cwmp1__Reboot; + return rpc_cpe; +} + +int cwmp_reboot(struct cwmp *cwmp,void *v) +{ + CWMP_LOG(INFO,"RUN reboot function"); + /** flush file system buffers **/ + sync(); + return reboot(RB_AUTOBOOT); +} + +int cwmp_rpc_cpe_reboot (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + struct event_container *event_container; + struct _cwmp1__Reboot *p; + + pthread_mutex_lock (&(cwmp->mutex_session_queue)); + p = (struct _cwmp1__Reboot *) this->method_data; + event_container = cwmp_add_event_container (cwmp, EVENT_IDX_M_Reboot, p->CommandKey); + if (event_container == NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_MEM_ERR; + } + cwmp_save_event_container (cwmp,event_container); + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + add_session_end_func(session,cwmp_reboot,NULL,TRUE); + return CWMP_OK; +} + +int cwmp_rpc_cpe_reboot_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_cpe_reboot_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + int error; + CWMP_LOG (INFO,"Trying to send Reboot response to the ACS"); + error = cwmp_soap_send_rpc_cpe_response (cwmp, session, this); + return error; +} + +int cwmp_rpc_cpe_reboot_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} + diff --git a/src/ScheduleInform.c b/src/ScheduleInform.c new file mode 100644 index 0000000..fd9a6bc --- /dev/null +++ b/src/ScheduleInform.c @@ -0,0 +1,232 @@ +/* + ScheduleInform.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include +#include +#include "soapH.h" +#include "cwmp.h" +#include "list.h" + +LIST_HEAD(list_schedule_inform); +static pthread_mutex_t mutex_schedule_inform; +static pthread_cond_t threshold_schedule_inform; +static bool thread_is_working=FALSE; + +struct rpc_cpe *cwmp_add_session_rpc_cpe (struct session *session); +int cwmp_rpc_cpe_scheduleInform (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_scheduleInform_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_scheduleInform_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_scheduleInform_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_session_rpc_cpe_destructor (struct cwmp *cwmp, struct session *session, struct rpc_cpe *rpc_cpe); +struct event_container *cwmp_add_event_container (struct cwmp *cwmp, int event_idx, char *command_key); +void cwmp_save_event_container (struct cwmp *cwmp,struct event_container *event_container); +void backup_session_insert_schedule_time(time_t schedule_time,char *commandKey); +void backup_session_delete_schedule_time(time_t schedule_time,char *commandKey); +void backup_session_delete_scheduled_inform(); + +struct rpc_cpe *cwmp_add_session_rpc_cpe_scheduleInform (struct session *session) +{ + struct rpc_cpe *rpc_cpe; + struct soap_cwmp1_methods__rpc *soap_methods; + + rpc_cpe = cwmp_add_session_rpc_cpe (session); + if (rpc_cpe == NULL) + { + return NULL; + } + soap_methods = &(rpc_cpe->soap_methods); + rpc_cpe->method_data = (void *) calloc (1,sizeof(struct _cwmp1__ScheduleInform)); + rpc_cpe->method = cwmp_rpc_cpe_scheduleInform; + rpc_cpe->method_response_data = (void *) calloc (1,sizeof(struct _cwmp1__ScheduleInformResponse)); + rpc_cpe->method_response_data_init = cwmp_rpc_cpe_scheduleInform_response_data_init; + rpc_cpe->method_response = cwmp_rpc_cpe_scheduleInform_response; + rpc_cpe->method_end = cwmp_rpc_cpe_scheduleInform_end; + rpc_cpe->destructor = cwmp_session_rpc_cpe_destructor; + soap_methods->envelope = "cwmp:ScheduleInform"; + soap_methods->envelope_response = "cwmp:ScheduleInformResponse"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize__cwmp1__ScheduleInformResponse; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put__cwmp1__ScheduleInformResponse; + soap_methods->soap_get_cwmp1__rpc_received_data = (void *) soap_get__cwmp1__ScheduleInform; + return rpc_cpe; +} + +void *thread_cwmp_rpc_cpe_scheduleInform (void *v) +{ + struct cwmp *cwmp = (struct cwmp *)v; + struct event_container *event_container; + struct schedule_inform *schedule_inform; + struct timespec si_timeout = {0, 0}; + time_t current_time; + bool add_event_same_time = FALSE; + + thread_is_working = TRUE; + while (list_schedule_inform.next!=&(list_schedule_inform)) + { + schedule_inform = list_entry(list_schedule_inform.next,struct schedule_inform, list); + current_time = time(NULL); + if (current_time >= schedule_inform->scheduled_time) + { + if (add_event_same_time) + { + pthread_mutex_lock (&mutex_schedule_inform); + list_del (&(schedule_inform->list)); + if (schedule_inform->commandKey!=NULL) + { + backup_session_delete_schedule_time(schedule_inform->scheduled_time,schedule_inform->commandKey); + free (schedule_inform->commandKey); + } + free(schedule_inform); + pthread_mutex_unlock (&mutex_schedule_inform); + continue; + } + pthread_mutex_lock (&(cwmp->mutex_session_queue)); + CWMP_LOG(INFO,"Schedule Inform thread: add ScheduleInform event in the queue"); + event_container = cwmp_add_event_container (cwmp, EVENT_IDX_3SCHEDULED, ""); + if (event_container != NULL) + { + cwmp_save_event_container (cwmp,event_container); + } + event_container = cwmp_add_event_container (cwmp, EVENT_IDX_M_ScheduleInform, schedule_inform->commandKey); + if (event_container != NULL) + { + cwmp_save_event_container (cwmp,event_container); + } + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + pthread_cond_signal(&(cwmp->threshold_session_send)); + pthread_mutex_lock (&mutex_schedule_inform); + list_del (&(schedule_inform->list)); + if (schedule_inform->commandKey!=NULL) + { + backup_session_delete_schedule_time(schedule_inform->scheduled_time,schedule_inform->commandKey); + free (schedule_inform->commandKey); + } + free(schedule_inform); + pthread_mutex_unlock (&mutex_schedule_inform); + add_event_same_time = TRUE; + continue; + } + add_event_same_time = FALSE; + pthread_mutex_lock (&mutex_schedule_inform); + si_timeout.tv_sec = schedule_inform->scheduled_time; + pthread_cond_timedwait(&threshold_schedule_inform, &mutex_schedule_inform, &si_timeout); + pthread_mutex_unlock (&mutex_schedule_inform); + } + thread_is_working = FALSE; + return CWMP_OK; +} + +int cwmp_rpc_cpe_scheduleInform (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + struct event_container *event_container; + struct _cwmp1__ScheduleInform *p; + struct schedule_inform *schedule_inform; + time_t scheduled_time; + struct list_head *ilist; + bool cond_signal=FALSE; + pthread_t scheduleInform_thread; + int error; + + pthread_mutex_lock (&mutex_schedule_inform); + p = (struct _cwmp1__ScheduleInform *) this->method_data; + scheduled_time = time(NULL) + p->DelaySeconds; + __list_for_each(ilist,&(list_schedule_inform)) + { + schedule_inform = list_entry(ilist,struct schedule_inform, list); + if (schedule_inform->scheduled_time == scheduled_time) + { + pthread_mutex_unlock (&mutex_schedule_inform); + return CWMP_OK; + } + if (schedule_inform->scheduled_time > scheduled_time) + { + cond_signal = TRUE; + break; + } + } + CWMP_LOG(INFO,"Schedule inform event will start in %us",p->DelaySeconds); + schedule_inform = calloc (1,sizeof(struct schedule_inform)); + if (schedule_inform==NULL) + { + pthread_mutex_unlock (&mutex_schedule_inform); + return CWMP_OK; + } + schedule_inform->commandKey = strdup(p->CommandKey); + schedule_inform->scheduled_time = scheduled_time; + list_add (&(schedule_inform->list), ilist->prev); + backup_session_insert_schedule_time(schedule_inform->scheduled_time,schedule_inform->commandKey); + if (cond_signal) + { + pthread_cond_signal(&threshold_schedule_inform); + } + pthread_mutex_unlock (&mutex_schedule_inform); + + if (!thread_is_working) + { + thread_is_working = TRUE; + error = pthread_create(&scheduleInform_thread, NULL, &thread_cwmp_rpc_cpe_scheduleInform, (void *)cwmp); + if (error<0) + { + CWMP_LOG(ERROR,"Error error when creating the schedule event thread!"); + thread_is_working = FALSE; + return CWMP_OK; + } + + } + + return CWMP_OK; +} + +int cwmp_rpc_cpe_scheduleInform_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_cpe_scheduleInform_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + int error; + CWMP_LOG (INFO,"Trying to send ScheduleInform response to the ACS"); + error = cwmp_soap_send_rpc_cpe_response (cwmp, session, this); + return error; +} + +int cwmp_rpc_cpe_scheduleInform_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} + +int cwmp_scheduleInform_remove_all() +{ + struct schedule_inform *schedule_inform; + + pthread_mutex_lock (&mutex_schedule_inform); + while (list_schedule_inform.next!=&(list_schedule_inform)) + { + schedule_inform = list_entry(list_schedule_inform.next,struct schedule_inform, list); + + list_del (&(schedule_inform->list)); + if (schedule_inform->commandKey!=NULL) + { + backup_session_delete_schedule_time(schedule_inform->scheduled_time,schedule_inform->commandKey); + free (schedule_inform->commandKey); + } + free(schedule_inform); + } + backup_session_delete_scheduled_inform(); + pthread_mutex_unlock (&mutex_schedule_inform); + + return CWMP_OK; +} diff --git a/src/SetParameterAttributes.c b/src/SetParameterAttributes.c new file mode 100644 index 0000000..1ba233c --- /dev/null +++ b/src/SetParameterAttributes.c @@ -0,0 +1,406 @@ +/* + SetParameterAttributes.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 20011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include "soapH.h" +#include "cwmp.h" +#include "list.h" +#include "dm.h" +#include "dm_rpc.h" + +struct rpc_cpe *cwmp_add_session_rpc_cpe (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_setParameterAttributes (struct session *session); +int cwmp_rpc_cpe_setParameterAttributes (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_setParameterAttributes_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_setParameterAttributes_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_rpc_cpe_setParameterAttributes_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); +int cwmp_session_rpc_cpe_destructor (struct cwmp *cwmp, struct session *session, struct rpc_cpe *rpc_cpe); +struct rpc_cpe *cwmp_add_session_rpc_cpe_Fault (struct session *session, int idx); +int cwmp_dm_setParameterAttributes(struct cwmp *cwmp, struct cwmp1__SetParameterAttributesStruct *ParameterAttributesStruct); +int cwmp_delete_notification(char *type,char *name); +int cwmp_add_notification(char *type,char *name); +int cwmp_check_notification(char *name, char *type); +int cwmp_off_notification(struct dm_node *node,char *name, enum xsd__boolean notification_change); +int cwmp_apply_passive_notification(struct dm_node *node,char *name, enum xsd__boolean notification_change); +int cwmp_apply_active_notification(struct dm_node *node,char *name, enum xsd__boolean notification_change); +int cwmp_add_in_accesslist(char *name, enum xsd__boolean access_list_change, char *accessList); +int uci_delete_value(char *cmd); +int uci_revert_value (); +int uci_commit_value (); + +extern const struct CPE_METHOD_CONSTRUCTORS CPE_METHOD_CONSTRUCTORS_ARRAY [COUNT_RPC_CPE]; + +const struct ACCESSLIST_CONST_STRUCT ACCESSLIST_CONST_ARRAY [] = { + {"Subscriber","cwmp.accesslist.subscriber"} +}; + +struct rpc_cpe *cwmp_add_session_rpc_cpe_setParameterAttributes (struct session *session) +{ + struct rpc_cpe *rpc_cpe; + struct soap_cwmp1_methods__rpc *soap_methods; + + rpc_cpe = cwmp_add_session_rpc_cpe (session); + if (rpc_cpe == NULL) + { + return NULL; + } + soap_methods = &(rpc_cpe->soap_methods); + rpc_cpe->method_data = (void *) calloc (1,sizeof(struct _cwmp1__SetParameterAttributes)); + rpc_cpe->method = cwmp_rpc_cpe_setParameterAttributes; + rpc_cpe->method_response_data = (void *) calloc (1,sizeof(struct _cwmp1__SetParameterAttributesResponse)); + rpc_cpe->method_response_data_init = cwmp_rpc_cpe_setParameterAttributes_response_data_init; + rpc_cpe->method_response = cwmp_rpc_cpe_setParameterAttributes_response; + rpc_cpe->method_end = cwmp_rpc_cpe_setParameterAttributes_end; + rpc_cpe->destructor = cwmp_session_rpc_cpe_destructor; + soap_methods->envelope = "cwmp:SetParameterAttributes"; + soap_methods->envelope_response = "cwmp:SetParameterAttributesResponse"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize__cwmp1__SetParameterAttributesResponse; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put__cwmp1__SetParameterAttributesResponse; + soap_methods->soap_get_cwmp1__rpc_received_data = (void *) soap_get__cwmp1__SetParameterAttributes; + return rpc_cpe; +} + +int cwmp_rpc_cpe_setParameterAttributes (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + + struct _cwmp1__SetParameterAttributes *p_soap_cwmp1__SetParameterAttributes; + int i,size,error; + struct cwmp1__SetParameterAttributesStruct *ParameterAttributesStruct,**ptrParameterAttributeStruct; + + p_soap_cwmp1__SetParameterAttributes = (struct _cwmp1__SetParameterAttributes *)this->method_data; + size = p_soap_cwmp1__SetParameterAttributes->ParameterList->__size; + ptrParameterAttributeStruct = p_soap_cwmp1__SetParameterAttributes->ParameterList->__ptrSetParameterAttributesStruct; + + for (i=0;ivalue) != 0)&&(strstr(notification->value,name) == NULL)) + { + cwmp_add_notification(type,notification->value); + } + list_del(notification_list.next); + if(notification != NULL) + { + if(notification->value != NULL) + { + free(notification->value); + } + free(notification); + notification = NULL; + } + } + return CWMP_OK; +} + +int cwmp_check_notification(char *name, char *type) +{ + struct config_uci_list *notification; + bool partial_found = FALSE; + bool found = FALSE; + int is_parent = 0; + LIST_HEAD(notification_list); + + uci_get_list_value(type, ¬ification_list); + + while(!list_empty(¬ification_list)) + { + notification = list_entry (notification_list.next, struct config_uci_list, list); + if((notification != NULL)) + { + if(strstr(notification->value,name) != NULL) + { + partial_found = TRUE; + is_parent = 1; + if(strcmp(notification->value,name) == 0) + { + found = TRUE; + } + } + if(strstr(name,notification->value) != NULL) + { + partial_found = TRUE; + } + list_del(notification_list.next); + free(notification); + notification = NULL; + } + } + if(!partial_found) + { + return CWMP_OK; + } + else + { + if(found) + { + return CWMP_EXACT_FOUND; + } + else + { + if(is_parent == 1) + { + return CWMP_CHILD_FOUND; + } + else + { + return CWMP_PARENT_FOUND; + } + } + } +} + +int cwmp_apply_active_notification(struct dm_node *node,char *name, enum xsd__boolean notification_change) +{ + int error = FAULT_CPE_NO_FAULT_IDX,i; + + if(node != NULL) + { + if(node->active_notify.can_deny) + { + error = FAULT_CPE_NOTIFICATION_REJECTED_IDX; + } + else + { + if(notification_change == xsd__boolean__true_) + { + if(cwmp_check_notification(name,UCI_NOTIFICATION_PASSIVE_PATH) == CWMP_CHILD_FOUND || + cwmp_check_notification(name,UCI_NOTIFICATION_PASSIVE_PATH) == CWMP_EXACT_FOUND ) + { + cwmp_delete_notification(UCI_NOTIFICATION_PASSIVE_PATH,name); + } + if(cwmp_check_notification(name,UCI_NOTIFICATION_DENIED_PATH) == CWMP_CHILD_FOUND|| + cwmp_check_notification(name,UCI_NOTIFICATION_DENIED_PATH) == CWMP_EXACT_FOUND) + { + cwmp_delete_notification(UCI_NOTIFICATION_DENIED_PATH,name); + } + if(cwmp_check_notification(name,UCI_NOTIFICATION_ACTIVE_PATH) == CWMP_OK) + { + cwmp_add_notification(UCI_NOTIFICATION_ACTIVE_PATH,name); + } + else if(cwmp_check_notification(name,UCI_NOTIFICATION_ACTIVE_PATH) == CWMP_CHILD_FOUND) + { + cwmp_delete_notification(UCI_NOTIFICATION_ACTIVE_PATH,name); + cwmp_add_notification(UCI_NOTIFICATION_ACTIVE_PATH,name); + } + } + } + } + else + { + error = FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + } + return error; +} + +int cwmp_apply_passive_notification(struct dm_node *node,char *name, enum xsd__boolean notification_change) +{ + int error = FAULT_CPE_NO_FAULT_IDX,i; + + if(node != NULL) + { + if(node->active_notify.force_enabled) + { + error = FAULT_CPE_NOTIFICATION_REJECTED_IDX; + } + else + { + if(notification_change == xsd__boolean__true_) + { + if(cwmp_check_notification(name,UCI_NOTIFICATION_ACTIVE_PATH) == CWMP_CHILD_FOUND || + cwmp_check_notification(name,UCI_NOTIFICATION_ACTIVE_PATH) == CWMP_EXACT_FOUND ) + { + cwmp_delete_notification(UCI_NOTIFICATION_ACTIVE_PATH,name); + } + if(cwmp_check_notification(name,UCI_NOTIFICATION_DENIED_PATH) == CWMP_CHILD_FOUND|| + cwmp_check_notification(name,UCI_NOTIFICATION_DENIED_PATH) == CWMP_EXACT_FOUND) + { + cwmp_delete_notification(UCI_NOTIFICATION_DENIED_PATH,name); + } + if(cwmp_check_notification(name,UCI_NOTIFICATION_PASSIVE_PATH) == CWMP_OK) + { + cwmp_add_notification(UCI_NOTIFICATION_PASSIVE_PATH,name); + } + else if(cwmp_check_notification(name,UCI_NOTIFICATION_PASSIVE_PATH) == CWMP_CHILD_FOUND) + { + cwmp_delete_notification(UCI_NOTIFICATION_PASSIVE_PATH,name); + cwmp_add_notification(UCI_NOTIFICATION_PASSIVE_PATH,name); + } + } + } + } + else + { + error = FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + } + return error; +} + +int cwmp_off_notification(struct dm_node *node,char *name, enum xsd__boolean notification_change) +{ + int error = FAULT_CPE_NO_FAULT_IDX,i; + + if(node != NULL) + { + if(node->active_notify.force_enabled) + { + error = FAULT_CPE_NOTIFICATION_REJECTED_IDX; + } + else + { + if(notification_change == xsd__boolean__true_) + { + switch(cwmp_check_notification(name,UCI_NOTIFICATION_PASSIVE_PATH)) + { + case CWMP_EXACT_FOUND: + case CWMP_CHILD_FOUND: + cwmp_delete_notification(UCI_NOTIFICATION_PASSIVE_PATH,name); + break; + case CWMP_PARENT_FOUND: + if(cwmp_check_notification(name,UCI_NOTIFICATION_DENIED_PATH) == CWMP_OK) + { + cwmp_add_notification(UCI_NOTIFICATION_DENIED_PATH,name); + } + break; + } + switch(cwmp_check_notification(name,UCI_NOTIFICATION_ACTIVE_PATH)) + { + case CWMP_EXACT_FOUND: + case CWMP_CHILD_FOUND: + cwmp_delete_notification(UCI_NOTIFICATION_ACTIVE_PATH,name); + break; + case CWMP_PARENT_FOUND: + if(cwmp_check_notification(name,UCI_NOTIFICATION_DENIED_PATH) == CWMP_OK) + { + cwmp_add_notification(UCI_NOTIFICATION_DENIED_PATH,name); + } + break; + } + for(i=0;isoap_methods); + rpc_cpe->method_data = (void *) calloc (1,sizeof(struct _cwmp1__SetParameterValues)); + rpc_cpe->method = cwmp_rpc_cpe_setParameterValues; + rpc_cpe->method_response_data = (void *) calloc (1,sizeof(struct _cwmp1__SetParameterValuesResponse)); + rpc_cpe->method_response_data_init = cwmp_rpc_cpe_setParameterValues_response_data_init; + rpc_cpe->method_response = cwmp_rpc_cpe_setParameterValues_response; + rpc_cpe->method_end = cwmp_rpc_cpe_setParameterValues_end; + rpc_cpe->destructor = cwmp_session_rpc_cpe_destructor; + soap_methods->envelope = "cwmp:SetParameterValues"; + soap_methods->envelope_response = "cwmp:SetParameterValuesResponse"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize__cwmp1__SetParameterValuesResponse; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put__cwmp1__SetParameterValuesResponse; + soap_methods->soap_get_cwmp1__rpc_received_data = (void *) soap_get__cwmp1__SetParameterValues; + return rpc_cpe; +} + +int cwmp_rpc_cpe_setParameterValues (struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + struct _cwmp1__SetParameterValues *p_soap_cwmp1__SetParameterValues; + struct _cwmp1__SetParameterValuesResponse *p_soap_cwmp1__SetParameterValuesResponse; + struct cwmp1ParameterValueList *ParameterList; + struct cwmp1__ParameterValueStruct **ptr_ParameterValueStruct,*ParameterValueStruct; + char *parameter_key,buf[128]; + int i,n,size,error; + struct dm_set_handler *dm_set_handler; + struct rpc_cpe *rpc_cpe_fault; + + dm_set_handler = calloc(1,sizeof(struct dm_set_handler)); + + if (dm_set_handler == NULL) + { + return FAULT_CPE_INTERNAL_ERROR_IDX; + } + + list_add_tail(&(dm_set_handler->list),&(list_dm_set_handler)); + + INIT_LIST_HEAD (&(dm_set_handler->cmd_list)); + INIT_LIST_HEAD (&(dm_set_handler->cancel_list)); + INIT_LIST_HEAD (&(dm_set_handler->service_list)); + + p_soap_cwmp1__SetParameterValues = (struct _cwmp1__SetParameterValues *)this->method_data; + p_soap_cwmp1__SetParameterValuesResponse = (struct _cwmp1__SetParameterValuesResponse *)this->method_response_data; + size = p_soap_cwmp1__SetParameterValues->ParameterList->__size; + ptr_ParameterValueStruct = p_soap_cwmp1__SetParameterValues->ParameterList->__ptrParameterValueStruct; + parameter_key = p_soap_cwmp1__SetParameterValues->ParameterKey; + + if (error = check_duplicated_parameter_name (ptr_ParameterValueStruct, size)) + { + if (cwmp_add_session_rpc_cpe_Fault(session,FAULT_CPE_INVALID_ARGUMENTS_IDX)==NULL) + { + return CWMP_GEN_ERR; + } + return CWMP_FAULT_CPE; + } + + for (i=0;iName,(strlen(ParameterValueStruct->Value)<1000)?ParameterValueStruct->Value:"(Unable to display big stings)"); + + error = cwmp_dm_setParameterValues(cwmp, dm_set_handler, ParameterValueStruct->Name, ParameterValueStruct->Value); + + if (error != FAULT_CPE_NO_FAULT_IDX) + { + if (dm_set_handler->uci) + { + CWMP_LOG(INFO,"RUN uci revert"); /* TODO to be removed*/ + uci_revert_value(); + } + dm_run_queue_cancel_handler(dm_set_handler); + dm_free_dm_set_handler_queues(dm_set_handler); + if (dm_set_handler!=NULL) + { + list_del(&(dm_set_handler->list)); + free(dm_set_handler); + } + if ((rpc_cpe_fault = cwmp_add_session_rpc_cpe_Fault(session,error))==NULL) + { + return CWMP_GEN_ERR; + } + cwmp_rpc_cpe_Fault_parameter_cause(rpc_cpe_fault,ParameterValueStruct->Name); + return CWMP_FAULT_CPE; + } + } + + dm_run_queue_cmd_handler(dm_set_handler,FALSE); + p_soap_cwmp1__SetParameterValuesResponse->Status = _cwmp1__SetParameterValuesResponse_Status__0; + + CWMP_LOG(INFO,"RUN uci commit"); + sprintf(buf,"%s=%s",UCI_ACS_PARAMETERKEY_PATH,parameter_key); + uci_set_value (buf); + uci_commit_value(); + + if (dm_set_handler->cwmp_reload==TRUE) + { + CWMP_LOG(INFO,"Add cwmp config reload at the end of the session"); + add_session_end_func(session,dm_cwmp_config_reload,NULL,FALSE); + p_soap_cwmp1__SetParameterValuesResponse->Status = _cwmp1__SetParameterValuesResponse_Status__1; + } + if (dm_set_handler->reboot_required==TRUE) + { + CWMP_LOG(INFO,"Add reboot at the end of the session"); + add_session_end_func(session,cwmp_reboot,NULL,TRUE); + p_soap_cwmp1__SetParameterValuesResponse->Status = _cwmp1__SetParameterValuesResponse_Status__1; + } + if (dm_set_handler->cmd_list.next!=&(dm_set_handler->cmd_list) || + (dm_set_handler->service_list.next!=&(dm_set_handler->service_list) && dm_set_handler->reboot_required==FALSE)) + { + add_session_end_func(session,dm_run_queue_cmd_handler_at_end_session,dm_set_handler,FALSE); + p_soap_cwmp1__SetParameterValuesResponse->Status = _cwmp1__SetParameterValuesResponse_Status__1; + return CWMP_OK; + } + + dm_free_dm_set_handler_queues(dm_set_handler); + + if (dm_set_handler!=NULL) + { + list_del(&(dm_set_handler->list)); + free(dm_set_handler); + } + + return CWMP_OK; +} + +int cwmp_rpc_cpe_setParameterValues_response_data_init(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} +int cwmp_rpc_cpe_setParameterValues_response(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + int error; + CWMP_LOG (INFO,"Trying to send SetParameterValues response to the ACS"); + error = cwmp_soap_send_rpc_cpe_response (cwmp, session, this); + return error; +} +int cwmp_rpc_cpe_setParameterValues_end(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this) +{ + return CWMP_OK; +} + +static int check_duplicated_parameter_name (struct cwmp1__ParameterValueStruct **ptr_ParameterValueStruct, int size) +{ + + struct cwmp1__ParameterValueStruct **p, **q, *pvs, *qvs; + int i,j; + for (i=0,p=ptr_ParameterValueStruct;i<(size-1);i++,p++) + { + pvs = *p; + for (j=i+1,q=p+1;jName,qvs->Name)==0) + { + return CWMP_GEN_ERR; + } + } + } + return CWMP_OK; +} diff --git a/src/TransferComplete.c b/src/TransferComplete.c new file mode 100644 index 0000000..9f23b84 --- /dev/null +++ b/src/TransferComplete.c @@ -0,0 +1,120 @@ +/* + TransferComplete.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include "soapH.h" +#include "cwmp.h" +#include "list.h" +#include "backupSession.h" + +int cwmp_rpc_acs_transferComplete_data_init (struct cwmp *cwmp, struct session *session, struct rpc_acs *this); +int cwmp_rpc_acs_transferComplete_remote_call (struct cwmp *cwmp, struct session *session, struct rpc_acs *this); +int cwmp_rpc_acs_transferComplete_response (struct cwmp *cwmp, struct session *session, struct rpc_acs *this); +int cwmp_rpc_acs_transferComplete_end (struct cwmp *cwmp, struct session *session, struct rpc_acs *this); +int cwmp_rpc_acs_transferComplete_destructor (struct cwmp *cwmp, struct session *session, struct rpc_acs *this); +int cwmp_session_rpc_acs_destructor (struct cwmp *cwmp, struct session *session, struct rpc_acs *rpc_acs); + +void soap_serialize__cwmp1__TransferComplete(struct soap *soap, const struct _cwmp1__TransferComplete *a); +int soap_put__cwmp1__TransferComplete(struct soap *soap, const struct _cwmp1__TransferComplete *a, const char *tag, const char *type); +struct _cwmp1__TransferCompleteResponse * soap_get__cwmp1__TransferCompleteResponse(struct soap *soap, struct _cwmp1__TransferCompleteResponse *p, const char *tag, const char *type); +struct rpc_acs *cwmp_add_session_rpc_acs (struct session *session); +void backup_session_delete_rpc(char *name, char *commandKey, int status); + +static struct _cwmp1__TransferComplete *pcwmp1__TransferComplete_data; + +struct _cwmp1__TransferComplete *cwmp_set_data_rpc_acs_transferComplete () +{ + pcwmp1__TransferComplete_data = calloc (1,sizeof(struct _cwmp1__TransferComplete)); + return pcwmp1__TransferComplete_data; +} + +struct rpc_acs *cwmp_add_session_rpc_acs_transferComplete (struct session *session) +{ + struct rpc_acs *rpc_acs; + struct soap_cwmp1_methods__rpc *soap_methods; + + rpc_acs = cwmp_add_session_rpc_acs (session); + if (rpc_acs == NULL) + { + return NULL; + } + soap_methods = &(rpc_acs->soap_methods); + rpc_acs->method_data = (void *) pcwmp1__TransferComplete_data; + rpc_acs->method_data_init = cwmp_rpc_acs_transferComplete_data_init; + rpc_acs->method_remote_call = cwmp_rpc_acs_transferComplete_remote_call; + rpc_acs->method_response_data = (void *) calloc (1,sizeof(struct _cwmp1__TransferCompleteResponse)); + rpc_acs->method_response = cwmp_rpc_acs_transferComplete_response; + rpc_acs->method_end = cwmp_rpc_acs_transferComplete_end; + rpc_acs->destructor = cwmp_rpc_acs_transferComplete_destructor; + rpc_acs->type = RPC_ACS_TRANSFERCOMPLETE_IDX; + soap_methods->envelope = "cwmp:TransferComplete"; + soap_methods->envelope_response = "cwmp:TransferCompleteResponse"; + soap_methods->soap_serialize_cwmp1__send_data = (void *) soap_serialize__cwmp1__TransferComplete; + soap_methods->soap_put_cwmp1__send_data = (void *) soap_put__cwmp1__TransferComplete; + soap_methods->soap_get_cwmp1__rpc_received_data = (void *) soap_get__cwmp1__TransferCompleteResponse; + return rpc_acs; +} + +int cwmp_rpc_acs_transferComplete_data_init (struct cwmp *cwmp, struct session *session, struct rpc_acs *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_acs_transferComplete_remote_call (struct cwmp *cwmp, struct session *session, struct rpc_acs *this) +{ + CWMP_LOG (INFO,"Trying to call the TransferComplete remote method"); + cwmp_soap_call_rpc_acs (cwmp, session, this); + return CWMP_OK; +} + +int cwmp_rpc_acs_transferComplete_response (struct cwmp *cwmp, struct session *session, struct rpc_acs *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_acs_transferComplete_end (struct cwmp *cwmp, struct session *session, struct rpc_acs *this) +{ + return CWMP_OK; +} + +int cwmp_rpc_acs_transferComplete_destructor (struct cwmp *cwmp, struct session *session, struct rpc_acs *this) +{ + struct _cwmp1__TransferComplete *p; + + p = (struct _cwmp1__TransferComplete *) this->method_data; + backup_session_delete_rpc("TransferComplete", p->CommandKey, RPC_NO_STATUS); + if (p!=NULL) + { + if (p->CommandKey!=NULL) + { + free(p->CommandKey); + } + if (p->FaultStruct!=NULL) + { + if (p->FaultStruct->FaultCode!=NULL) + { + free(p->FaultStruct->FaultCode); + } + if (p->FaultStruct->FaultString!=NULL) + { + free(p->FaultStruct->FaultString); + } + free(p->FaultStruct); + } + } + cwmp_session_rpc_acs_destructor (cwmp, session, this); + return CWMP_OK; +} diff --git a/src/backupSession.c b/src/backupSession.c new file mode 100644 index 0000000..25dd442 --- /dev/null +++ b/src/backupSession.c @@ -0,0 +1,1379 @@ +/* + backupSession.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include +#include +#include +#include +#include "soapH.h" +#include "cwmp.h" +#include "list.h" +#include "backupSession.h" + +static int backup_session_insert (char *element, char *value, char *parent, char *parent_name, struct attribute *attrs, int level); +static int backup_session_delete (char *element, struct attribute *attrs,int level, char *parent_name); +void backup_session_insert_rpc(char *name, char *commandKey, int status); +void backup_session_delete_rpc(char *name, char *commandKey, int status); +void backup_session_insert_event(char *name, char *commandKey, int id, int rpc_status); +void backup_session_delete_event(char *name,char *commandKey, int id, int rpc_status); +void backup_session_insert_parameter(char *name, char *value, char *parent, char *parent_name, int id, char *commandKey); +void backup_session_insert_acs(char *value); +void backup_session_move_inform_to_inform_send (); +void backup_session_move_inform_to_inform_queue (); +void backup_session_insert_schedule_time(time_t schedule_time,char *commandKey); +void backup_session_delete_schedule_time(time_t schedule_time,char *commandKey); +void backup_session_delete_scheduled_inform(); +void backup_session_insert_download(char *commandKey, char *url, time_t id); +void backup_session_delete_download(char *commandKey, char *url, time_t id); +void backup_session_insert_parameter_download(char *name, char *value, char *url, int id, char *commandKey); + +struct event_container *cwmp_add_event_container (struct cwmp *cwmp, int event_idx, char *command_key); +struct _cwmp1__TransferComplete *cwmp_set_data_rpc_acs_transferComplete (); + +static pthread_mutex_t mutex_backup_session; +extern struct list_head list_schedule_inform; +extern struct list_head list_download; +extern const struct EVENT_CONST_STRUCT EVENT_CONST [COUNT_EVENT]; +extern struct FAULT_CPE FAULT_CPE_ARRAY [FAULT_CPE_ARRAY_SIZE]; +static struct cwmp *save_cwmp; +static struct event_container *event_container_save = NULL; +static char *acs_url = NULL; +static char value[256]; +static char *parent = NULL; +static char *rpc_name = NULL; +static char *rpc_commandkey = NULL; +static char *parameter_name = NULL; +static struct _cwmp1__TransferComplete *p_soap_cwmp1__TransferComplete; +static enum backup_loading init_option; +static struct download *download_request = NULL; +extern int count_download_queue; + +void start_bkp_hndl(void *data, const char *el, const char **attr) +{ + char *event_name; + char *event_commandKey; + char *event_id; + int event_idx; + int idx; + int i; + struct schedule_inform *schedule_inform; + struct list_head *ilist; + char *scheduled_commandKey; + time_t scheduled_time; + + if(init_option == ALL) + { + if(strcmp(el,"rpc") == 0) + { + for(i = 0; attr[i] ; i+=2) + { + if(strcmp(attr[i],"name") == 0) + { + rpc_name = strdup(attr[i + 1]); + } + if(strcmp(attr[i],"commandKey") == 0) + { + rpc_commandkey = strdup(attr[i + 1]); + } + } + if(strcmp(rpc_name,"TransferComplete") == 0) + { + parent = strdup(el); + p_soap_cwmp1__TransferComplete = cwmp_set_data_rpc_acs_transferComplete (); + } + } + if(strcmp(el,"event") == 0) + { + parent = strdup(el); + for(i = 0; attr[i] ; i+=2) + { + if(strcmp(attr[i],"name") == 0) + { + event_name = strdup(attr[i+1]); + } + if(strcmp(attr[i],"commandKey") == 0) + { + event_commandKey = strdup(attr[i+1]); + } + if(strcmp(attr[i],"id") == 0) + { + event_id = strdup(attr[i+1]); + } + } + for (i = 0; i< COUNT_EVENT; i++) + { + if(strcmp(event_name,EVENT_CONST [i].CODE) == 0) + { + event_idx = i; + break; + } + } + if ((save_cwmp->env.boot != CWMP_START_BOOT) || (EVENT_CONST[event_idx].RETRY & EVENT_RETRY_AFTER_REBOOT)) + { + event_container_save = cwmp_add_event_container (save_cwmp, event_idx, event_commandKey); + if(event_container_save != NULL) + { + event_container_save->id = atoi(event_id); + } + } + if(event_id != NULL) + { + free(event_id); + event_id = NULL; + } + if(event_commandKey != NULL) + { + free(event_commandKey); + event_commandKey = NULL; + } + if(event_name != NULL) + { + free(event_name); + event_name = NULL; + } + } + if(strcmp(el,"parameter") == 0) + { + for(i = 0; attr[i] ; i+=2) + { + if(strcmp(attr[i],"name") == 0) + { + parameter_name = strdup(attr[i + 1]); + } + } + } + if(strcmp(el,"scheduledTime") == 0) + { + for(i = 0; attr[i] ; i+=2) + { + if(strcmp(attr[i],"commandKey") == 0) + { + scheduled_commandKey = strdup(attr[i + 1]); + } + if(strcmp(attr[i],"time") == 0) + { + scheduled_time = atol(attr[i + 1]); + } + } + __list_for_each(ilist,&(list_schedule_inform)) + { + schedule_inform = list_entry(ilist,struct schedule_inform, list); + if (schedule_inform->scheduled_time > scheduled_time) + { + break; + } + } + schedule_inform = calloc (1,sizeof(struct schedule_inform)); + if (schedule_inform!=NULL) + { + schedule_inform->commandKey = scheduled_commandKey; + schedule_inform->scheduled_time = scheduled_time; + list_add (&(schedule_inform->list), ilist->prev); + } + } + if(strcmp(el,"download") == 0) + { + parent = strdup(el); + download_request = calloc(1,sizeof(struct download)); + for(i = 0; attr[i] ; i+=2) + { + if(strcmp(attr[i],"commandKey") == 0) + { + download_request->CommandKey = strdup(attr[i + 1]); + } + if(strcmp(attr[i],"url") == 0) + { + download_request->URL = strdup(attr[i + 1]); + } + if(strcmp(attr[i],"time") == 0) + { + download_request->scheduled_time = atol(attr[i + 1]); + } + } + } + } +} + +void end_bkp_hndl(void *data, const char *el) +{ + int i,fault_idx; + struct session *session; + struct list_head *ilist; + struct download *idownload_request; + + if(init_option == ALL || init_option == ACS) + { + if(strcmp(el,"url") == 0) + { + acs_url = strdup(value); + } + } + if(init_option == ALL) + { + if(strcmp(el,"rpc") == 0) + { + if(strcmp(rpc_name,"TransferComplete") == 0) + { + if(rpc_commandkey != NULL) + { + p_soap_cwmp1__TransferComplete->CommandKey = strdup(rpc_commandkey); + } + else + { + p_soap_cwmp1__TransferComplete->CommandKey = strdup(""); + } + cwmp_root_cause_TransferComplete (save_cwmp); + } + if(parent != NULL) + { + free(parent); + parent = NULL; + } + if(rpc_name != NULL) + { + free(rpc_name); + rpc_name = NULL; + } + } + if(strcmp(el,"event") == 0) + { + if(parent != NULL) + { + free(parent); + parent = NULL; + } + } + if(strcmp(el,"download") == 0) + { + __list_for_each(ilist,&(list_download)) + { + idownload_request = list_entry(ilist,struct download,list); + if (idownload_request->scheduled_time > download_request->scheduled_time) + { + break; + } + } + list_add (&(download_request->list), ilist->prev); + count_download_queue++; + if(parent != NULL) + { + free(parent); + parent = NULL; + } + } + if(strcmp(el,"parameter") == 0) + { + if(parent != NULL && strcmp(parent,"rpc") == 0) + { + if(strcmp(rpc_name,"TransferComplete") == 0) + { + if(p_soap_cwmp1__TransferComplete != NULL) + { + if(strcmp(parameter_name,"StartTime") == 0) + { + p_soap_cwmp1__TransferComplete->StartTime = atol(value); + } + if(strcmp(parameter_name,"CompleteTime") == 0) + { + p_soap_cwmp1__TransferComplete->CompleteTime = atol(value); + } + if(strcmp(parameter_name,"FaultCode") == 0) + { + p_soap_cwmp1__TransferComplete->FaultStruct = calloc(1,sizeof(struct cwmp1__FaultStruct)); + p_soap_cwmp1__TransferComplete->FaultStruct->FaultCode = strdup(value); + for(i = 0; i < FAULT_CPE_ARRAY_SIZE; i++) + { + if((FAULT_CPE_ARRAY[i].CODE != NULL)&&(strcmp(FAULT_CPE_ARRAY[i].CODE, value) == 0)) + { + fault_idx = i; + break; + } + } + p_soap_cwmp1__TransferComplete->FaultStruct->FaultString = strdup(FAULT_CPE_ARRAY[i].DESCRIPTION); + } + } + } + } + if(parent != NULL && strcmp(parent,"download") == 0) + { + if(download_request != NULL) + { + if(strcmp(parameter_name,"FileType") == 0) + { + download_request->FileType = strdup(value); + } + if(strcmp(parameter_name,"Username") == 0) + { + download_request->Username = strdup(value); + } + if(strcmp(parameter_name,"Password") == 0) + { + download_request->Password = strdup(value); + } + } + } + if(parent != NULL && strcmp(parent,"event") == 0) + { + if(event_container_save != NULL) + { + cwmp_add_parameter_container (save_cwmp,event_container_save, parameter_name); + } + } + if(parameter_name != NULL) + { + free(parameter_name); + parameter_name = NULL; + } + } + } +} + +void char_bkp_hndl(void *data, const char *content,int length) +{ + char tmp[512]; + int i = 0,n = 0; + + if(length!=0) + { + strncpy(tmp, content, length); + tmp[length] = '\0'; + while(istatus != NULL) + { + sprintf(attrib,"name=\"%s\" status=\"%s\"", attrs->name, attrs->status); + } + else + { + if(attrs->commandKey != NULL) + { + sprintf(attrib,"name=\"%s\" commandKey=\"%s\"", attrs->name, attrs->commandKey); + } + else + { + sprintf(attrib,"name=\"%s\"", attrs->name); + } + } + } + else if (strcmp(element,"event") == 0) + { + sprintf(attrib,"name=\"%s\" id=\"%li\" commandKey=\"%s\"", attrs->name, attrs->id, attrs->commandKey); + } + else if (strcmp(element,"parameter") == 0) + { + sprintf(attrib,"name=\"%s\"", attrs->name); + } + else if (strcmp(element,"scheduledTime") == 0) + { + sprintf(attrib,"commandKey=\"%s\" time=\"%li\"", attrs->commandKey, attrs->id); + } + else if (strcmp(element,"download") == 0) + { + sprintf(attrib,"commandKey=\"%s\" url=\"%s\" time=\"%li\"", attrs->commandKey, attrs->url, attrs->id); + } + } + + if(strlen(indent) != 0) + { + if(value != NULL) + { + if(strlen(attrib) != 0) + { + sprintf(start,"%s<%s %s>%s",indent,element,attrib,value); + } + else + { + sprintf(start,"%s<%s>%s",indent,element,value); + } + sprintf(end,"\n",element); + } + else + { + if(strlen(attrib) != 0) + { + sprintf(start,"%s<%s %s>\n",indent,element,attrib); + } + else + { + sprintf(start,"%s<%s>\n",indent,element); + } + sprintf(end,"%s\n",indent,element); + } + } + else + { + if(strlen(attrib) != 0) + { + sprintf(start,"<%s %s>\n",element,attrib); + } + else + { + sprintf(start,"<%s>\n",element); + } + sprintf(end,"",element); + } + + if(parent != NULL) + { + if(parent_name != NULL) + { + if(strcmp(parent,"event") == 0) + { + sprintf(parent_tag,"<%s name=\"%s\" id=\"%li\" commandKey=\"%s\"", parent, parent_name, attrs->id, attrs->commandKey); + } + else if(strcmp(parent,"rpc") == 0) + { + if(attrs->commandKey != NULL) + { + sprintf(parent_tag,"<%s name=\"%s\" commandKey=\"%s\"", parent, parent_name, attrs->commandKey); + } + else + { + sprintf(parent_tag,"<%s name=\"%s\"", parent, parent_name); + } + } + else + { + sprintf(parent_tag,"<%s name=\"%s\"", parent, parent_name); + } + } + else + { + if(strcmp(parent,"download") == 0) + { + if(attrs->commandKey != NULL) + { + sprintf(parent_tag,"<%s commandKey=\"%s\" url=\"%s\" time=\"%li\"", parent, attrs->commandKey, attrs->url, attrs->id); + } + else + { + sprintf(parent_tag,"<%s commandKey=\"\" url=\"%s\" time=\"%li\"", parent, attrs->url, attrs->id); + } + } + else + { + sprintf(parent_tag,"<%s", parent); + } + } + } + /** search element if exist **/ + while(!feof(pFile)) + { + fgets(line,sizeof(line),pFile); + if ((strcmp(element,"parameter") != 0) && + (strstr(line,start) != NULL)) + { + fclose(pFile); + fclose(tmpFile); + remove("tmp.xml"); + pthread_mutex_unlock (&mutex_backup_session); + return CWMP_OK; + } + if ((strcmp(element,"parameter") == 0) && + (parent != NULL) && (strcmp(parent,"event") == 0)&& + (strstr(line,parent_tag) != NULL)) + { + while(strstr(line,"") == NULL) + { + fgets(line,sizeof(line),pFile); + if (strstr(line,start) != NULL) + { + fclose(pFile); + fclose(tmpFile); + remove("tmp.xml"); + pthread_mutex_unlock (&mutex_backup_session); + return CWMP_OK; + } + } + } + if ((strcmp(element,"parameter") == 0) && + (parent != NULL) && (strcmp(parent,"rpc") == 0) && + (strstr(line,parent_tag) != NULL)) + { + while(strstr(line,"") == NULL) + { + fgets(line,sizeof(line),pFile); + if (strstr(line,start) != NULL) + { + fclose(pFile); + fclose(tmpFile); + remove("tmp.xml"); + pthread_mutex_unlock (&mutex_backup_session); + return CWMP_OK; + } + } + } + if ((strcmp(element,"parameter") == 0) && + (parent != NULL) && (strcmp(parent,"download") == 0) && + (strstr(line,parent_tag) != NULL)) + { + while(strstr(line,"") == NULL) + { + fgets(line,sizeof(line),pFile); + if (strstr(line,start) != NULL) + { + fclose(pFile); + fclose(tmpFile); + remove("tmp.xml"); + pthread_mutex_unlock (&mutex_backup_session); + return CWMP_OK; + } + } + } + } + + if((feof(pFile))&&(strcmp(element,"cwmp") == 0)) + { + fputs(start,tmpFile); + fputs(end,tmpFile); + goto end; + } + rewind(pFile); + while(!feof(pFile)) + { + fgets(line,sizeof(line),pFile); + fputs(line,tmpFile); + if(strstr(line,parent_tag) != NULL) + { + if((strcmp(element,"event") == 0)&&(strstr(line,attrs->status) == NULL)) + { + continue; + } + break; + } + } + + fputs(start,tmpFile); + fputs(end,tmpFile); + while(!feof(pFile)) + { + fgets(line,sizeof(line),pFile); + fputs(line,tmpFile); + } +end: + fclose(pFile); + fclose(tmpFile); + rename("tmp.xml", CWMP_BKP_FILE); + pthread_mutex_unlock (&mutex_backup_session); + return CWMP_OK; +} + +static int backup_session_delete (char *element, struct attribute *attrs,int level, char *parent_name) +{ + char line[256]; + char start[256]; + char end[256]; + char attrib[256]; + char id[16]; + int i; + FILE *pFile; + FILE *tmpFile; + bool found = FALSE; + + pthread_mutex_lock (&mutex_backup_session); + attrib[0] = 0; + start[0] = 0; + end[0] = 0; + + pFile = fopen(CWMP_BKP_FILE,"r"); + tmpFile = fopen("tmp.xml","w"); + if(pFile == NULL || tmpFile == NULL) + { + CWMP_LOG(ERROR,"Unable to write in %s file",CWMP_BKP_FILE); + pthread_mutex_unlock (&mutex_backup_session); + exit(EXIT_FAILURE); + } + + if(attrs != NULL) + { + if(strcmp(element,"rpc") == 0) + { + if(attrs->status != NULL) + { + sprintf(attrib,"name=\"%s\" status=\"%s\"", attrs->name, attrs->status); + } + else + { + if(attrs->commandKey != NULL) + { + sprintf(attrib,"name=\"%s\" commandKey=\"%s\"", attrs->name, attrs->commandKey); + } + else + { + sprintf(attrib,"name=\"%s\"", attrs->name); + } + } + } + else if (strcmp(element,"event") == 0) + { + sprintf(attrib,"name=\"%s\" id=\"%li\" commandKey=\"%s\"", attrs->name, attrs->id, attrs->commandKey); + } + else if (strcmp(element,"parameter") == 0) + { + sprintf(attrib,"name=\"%s\"", attrs->name); + sprintf(id,"%li",attrs->id); + } + else if (strcmp(element,"scheduledTime") == 0) + { + sprintf(attrib,"commandKey=\"%s\" time=\"%li\"", attrs->commandKey, attrs->id); + } + else if (strcmp(element,"download") == 0) + { + sprintf(attrib,"commandKey=\"%s\" url=\"%s\" time=\"%li\"", attrs->commandKey, attrs->url, attrs->id); + } + } + + if(strlen(attrib) != 0) + { + sprintf(start,"<%s %s>",element,attrib); + } + else + { + sprintf(start,"<%s>",element); + } + sprintf(end,"\n",element); + + /** search element if exist **/ + + while(!feof(pFile)) + { + fgets(line,sizeof(line),pFile); + if (strstr(line,start) != NULL) + { + found = TRUE; + break; + } + } + if((found == FALSE) && (feof(pFile))) + { + fclose(pFile); + fclose(tmpFile); + remove("tmp.xml"); + pthread_mutex_unlock (&mutex_backup_session); + return CWMP_OK; + } + else + { + found = FALSE; + rewind(pFile); + } + + while(!feof(pFile)) + { + fgets(line,sizeof(line),pFile); + if ( + (strcmp(element,"parameter") == 0) && + (strstr(line,parent_name) != NULL) && + ((attrs != NULL)&&((attrs->id == -1)||((attrs->id != -1) && (strstr(line,id) != NULL)))) + ) + { + found = TRUE; + } + if((strcmp(element,"parameter") != 0)||((strcmp(element,"parameter") == 0)&&(found == TRUE))) + { + if((strstr(line,start) != NULL)&&(strstr(line,end) == NULL)) + { + break; + } + else if((strstr(line,start) != NULL)&&(strstr(line,end) != NULL)) + { + goto end; + } + } + fputs(line,tmpFile); + } + + if(feof(pFile)) + { + pthread_mutex_unlock (&mutex_backup_session); + return CWMP_OK; + } + + while(!feof(pFile)&&(strstr(line,end) == NULL)) + { + fgets(line,sizeof(line),pFile); + } +end: + while(!feof(pFile)) + { + fgets(line,sizeof(line),pFile); + fputs(line,tmpFile); + } + fclose(pFile); + fclose(tmpFile); + rename("tmp.xml", CWMP_BKP_FILE); + pthread_mutex_unlock (&mutex_backup_session); + return CWMP_OK; +} + +void backup_session_insert_event(char *name, char *commandKey, int id, int rpc_status) +{ + struct attribute *attrs; + + attrs = calloc(1,sizeof(struct attribute)); + if(attrs != NULL) + { + attrs->id = id; + attrs->name = strdup(name); + if(rpc_status == RPC_QUEUE) + { + attrs->status = strdup("queue"); + } + else if(rpc_status == RPC_SEND) + { + attrs->status = strdup("send"); + } + if(commandKey != NULL) + { + attrs->commandKey = strdup(commandKey); + } + else + { + attrs->commandKey = NULL; + } + } + backup_session_insert("event",NULL,"rpc",NULL,attrs,3); + if(attrs->name != NULL) + { + free(attrs->name); + } + if(attrs->status != NULL) + { + free(attrs->status); + } + if(attrs->commandKey != NULL) + { + free(attrs->commandKey); + } + free(attrs); +} + +void backup_session_insert_parameter(char *name, char *value, char *parent,char *parent_name, int id, char *commandKey) +{ + struct attribute *attrs; + int level; + attrs = calloc(1,sizeof(struct attribute)); + if(attrs != NULL) + { + attrs->id = id; + attrs->name = strdup(name); + if(commandKey != NULL) + { + attrs->commandKey = strdup(commandKey); + } + } + if(strcmp(parent,"rpc") == 0) + { + level = 3; + } + else if(strcmp(parent,"event") == 0) + { + level = 4; + } + backup_session_insert("parameter",value,parent,parent_name,attrs,level); + if(attrs->name != NULL) + { + free(attrs->name); + } + if(attrs->commandKey != NULL) + { + free(attrs->commandKey); + } + free(attrs); +} + +void backup_session_insert_rpc(char *name, char *commandKey, int status) +{ + struct attribute *attrs; + + attrs = calloc(1,sizeof(struct attribute)); + if(attrs != NULL) + { + attrs->id = -1; + attrs->name = strdup(name); + if(status == RPC_QUEUE) + { + attrs->status = strdup("queue"); + } + else if(status == RPC_SEND) + { + attrs->status = strdup("send"); + } + else + { + attrs->status = NULL; + } + if(commandKey != NULL) + { + attrs->commandKey = strdup(commandKey); + } + else + { + attrs->commandKey = NULL; + } + } + backup_session_insert("rpc",NULL,"cwmp",NULL,attrs,2); + if(attrs->name != NULL) + { + free(attrs->name); + } + if(attrs->status != NULL) + { + free(attrs->status); + } + if(attrs->commandKey != NULL) + { + free(attrs->commandKey); + } + free(attrs); +} + +void backup_session_insert_acs(char *value) +{ + backup_session_delete ("url", NULL, 3, NULL); + backup_session_insert("url", value, "acs", NULL, NULL, 3); +} + +void backup_session_delete_event(char *name,char *commandKey, int id, int rpc_status) +{ + struct attribute *attrs; + + attrs = calloc(1,sizeof(struct attribute)); + if(attrs != NULL) + { + attrs->id = id; + attrs->name = strdup(name); + if(rpc_status == RPC_QUEUE) + { + attrs->status = strdup("queue"); + } + else if(rpc_status == RPC_SEND) + { + attrs->status = strdup("send"); + } + if(commandKey != NULL) + { + attrs->commandKey = strdup(commandKey); + } + else + { + attrs->commandKey = NULL; + } + } + backup_session_delete ("event", attrs, 3, NULL); + if(attrs->name != NULL) + { + free(attrs->name); + } + if(attrs->status != NULL) + { + free(attrs->status); + } + if(attrs->commandKey != NULL) + { + free(attrs->commandKey); + } + free(attrs); +} + +void backup_session_delete_rpc(char *name, char *commandKey, int status) +{ + struct attribute *attrs; + + attrs = calloc(1,sizeof(struct attribute)); + if(attrs != NULL) + { + attrs->id = -1; + attrs->name = strdup(name); + if(status == RPC_QUEUE) + { + attrs->status = strdup("queue"); + } + else if(status == RPC_SEND) + { + attrs->status = strdup("send"); + } + else + { + attrs->status = NULL; + } + if(commandKey != NULL) + { + attrs->commandKey = strdup(commandKey); + } + else + { + attrs->commandKey = NULL; + } + } + backup_session_delete("rpc",attrs,2, NULL); + if(attrs->name != NULL) + { + free(attrs->name); + } + if(attrs->status != NULL) + { + free(attrs->status); + } + if(attrs->commandKey != NULL) + { + free(attrs->commandKey); + } + free(attrs); +} + +void backup_session_move_inform_to_inform_send () +{ + char line[256]; + char start[256]; + FILE *pFile; + FILE *tmpFile; + + pthread_mutex_lock (&mutex_backup_session); + start[0] = 0; + + pFile = fopen(CWMP_BKP_FILE,"r"); + tmpFile = fopen("tmp.xml","w"); + if(pFile == NULL || tmpFile == NULL) + { + CWMP_LOG(ERROR,"Unable to write in %s file",CWMP_BKP_FILE); + pthread_mutex_unlock (&mutex_backup_session); + exit(EXIT_FAILURE); + } + + sprintf(start,"\t\n"); + + while(!feof(pFile)) + { + fgets(line,sizeof(line),pFile); + if(strcmp(line,"\t\n") == 0) + { + break; + } + fputs(line,tmpFile); + } + if(!feof(pFile)) + { + fputs(start,tmpFile); + } + while(!feof(pFile)) + { + fgets(line,sizeof(line),pFile); + fputs(line,tmpFile); + } + fclose(pFile); + fclose(tmpFile); + rename("tmp.xml", CWMP_BKP_FILE); + pthread_mutex_unlock (&mutex_backup_session); +} + +void backup_session_move_inform_to_inform_queue () +{ + char line[256]; + char *buffer; + FILE *pFile; + FILE *tmpFile; + long int max; + + pthread_mutex_lock (&mutex_backup_session); + + + pFile = fopen(CWMP_BKP_FILE,"r"); + + max = get_xml_file_size(pFile); + buffer = calloc(1,max); + + tmpFile = fopen("tmp.xml","w"); + if(pFile == NULL || tmpFile == NULL) + { + CWMP_LOG(ERROR,"Unable to write in %s file",CWMP_BKP_FILE); + exit(EXIT_FAILURE); + } + + while(!feof(pFile)) + { + fgets(line,sizeof(line),pFile); + if(strcmp(line,"\t\n") == 0) + { + break; + } + fputs(line,tmpFile); + } + while(!feof(pFile)) + { + fgets(line,sizeof(line),pFile); + if(strcmp(line,"\t\n") != 0) + { + strcat (buffer,line); + } + else + { + break; + } + } + while(!feof(pFile)) + { + fgets(line,sizeof(line),pFile); + fputs(line,tmpFile); + } + fclose(pFile); + fclose(tmpFile); + rename("tmp.xml", CWMP_BKP_FILE); + pthread_mutex_unlock (&mutex_backup_session); + + if(strlen(buffer) != 0) + { + backup_session_insert_rpc("Inform",NULL,RPC_QUEUE); + } + else + { + return; + } + + pthread_mutex_lock (&mutex_backup_session); + pFile = fopen(CWMP_BKP_FILE,"r"); + tmpFile = fopen("tmp.xml","w"); + if(pFile == NULL || tmpFile == NULL) + { + CWMP_LOG(ERROR,"Unable to write in %s file",CWMP_BKP_FILE); + pthread_mutex_unlock (&mutex_backup_session); + exit(EXIT_FAILURE); + } + + while(!feof(pFile)) + { + fgets(line,sizeof(line),pFile); + fputs(line,tmpFile); + if(strcmp(line,"\t\n") == 0) + { + break; + } + } + if(!feof(pFile)) + { + fputs(buffer,tmpFile); + } + while(!feof(pFile)) + { + fgets(line,sizeof(line),pFile); + fputs(line,tmpFile); + } + fclose(pFile); + fclose(tmpFile); + rename("tmp.xml", CWMP_BKP_FILE); + if(buffer != NULL) + { + free(buffer); + } + pthread_mutex_unlock (&mutex_backup_session); +} + +void backup_session_insert_schedule_time(time_t schedule_time,char *commandKey) +{ + struct attribute *attrs; + + attrs = calloc(1,sizeof(struct attribute)); + if(attrs != NULL) + { + attrs->id = schedule_time; + if(commandKey != NULL) + { + attrs->commandKey = strdup(commandKey); + } + else + { + attrs->commandKey = NULL; + } + } + backup_session_insert("scheduledInform",NULL,"cwmp",NULL,NULL,2); + backup_session_insert("scheduledTime", NULL, "scheduledInform", NULL, attrs, 3); + if(attrs->commandKey != NULL) + { + free(attrs->commandKey); + } + free(attrs); +} + +void backup_session_delete_schedule_time(time_t schedule_time,char *commandKey) +{ + struct attribute *attrs; + + attrs = calloc(1,sizeof(struct attribute)); + if(attrs != NULL) + { + attrs->id = schedule_time; + if(commandKey != NULL) + { + attrs->commandKey = strdup(commandKey); + } + else + { + attrs->commandKey = NULL; + } + } + backup_session_delete("scheduledTime", attrs, 3, NULL); + if(attrs->commandKey != NULL) + { + free(attrs->commandKey); + } + free(attrs); +} + +void backup_session_delete_scheduled_inform() +{ + backup_session_delete("scheduledInform",NULL,2,NULL); +} + +void backup_session_insert_download(char *commandKey, char *url, time_t id) +{ + struct attribute *attrs; + + attrs = calloc(1,sizeof(struct attribute)); + if(attrs != NULL) + { + attrs->id = id; + if(url != NULL) + { + attrs->url = strdup(url); + } + else + { + attrs->url = NULL; + } + if(commandKey != NULL) + { + attrs->commandKey = strdup(commandKey); + } + else + { + attrs->commandKey = NULL; + } + } + backup_session_insert("download",NULL,"cwmp",NULL,attrs,2); + if(attrs->url != NULL) + { + free(attrs->url); + } + if(attrs->commandKey != NULL) + { + free(attrs->commandKey); + } + free(attrs); +} + +void backup_session_delete_download(char *commandKey, char *url, time_t id) +{ + struct attribute *attrs; + + attrs = calloc(1,sizeof(struct attribute)); + if(attrs != NULL) + { + attrs->id = id; + if(url != NULL) + { + attrs->url = strdup(url); + } + else + { + attrs->url = NULL; + } + if(commandKey != NULL) + { + attrs->commandKey = strdup(commandKey); + } + else + { + attrs->commandKey = NULL; + } + } + backup_session_delete("download",attrs,2, NULL); + if(attrs->url != NULL) + { + free(attrs->url); + } + if(attrs->commandKey != NULL) + { + free(attrs->commandKey); + } + free(attrs); +} + +void backup_session_insert_parameter_download(char *name, char *value, char *url, int id, char *commandKey) +{ + struct attribute *attrs; + + attrs = calloc(1,sizeof(struct attribute)); + if(attrs != NULL) + { + attrs->id = id; + attrs->name = strdup(name); + if(commandKey != NULL) + { + attrs->commandKey = strdup(commandKey); + } + if(url != NULL) + { + attrs->url = strdup(url); + } + } + backup_session_insert("parameter",value,"download",NULL,attrs,3); + if(attrs->name != NULL) + { + free(attrs->name); + } + if(attrs->commandKey != NULL) + { + free(attrs->commandKey); + } + if(attrs->url != NULL) + { + free(attrs->url); + } + free(attrs); +} diff --git a/src/config.c b/src/config.c new file mode 100644 index 0000000..b1efd2c --- /dev/null +++ b/src/config.c @@ -0,0 +1,1099 @@ +/* + config.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + + +#include +#include +#include +#include +#include +#include "list.h" +#include "soapH.h" +#include "cwmp.h" +#include +#include "backupSession.h" +#include + +void backup_session_insert_acs(char *value); + +typedef enum uci_config_action { + CMD_SET, + CMD_SET_STATE, + CMD_ADD_LIST, + CMD_DEL, +} uci_config_action; + +void show_help() +{ + fprintf(stdout, "\nUsage: cwmpd [option]\n"); + fprintf(stdout, "-b: this option should be added only in the load phase\n"); + fprintf(stdout, "-g: send GetRPCMethods to ACS\n"); + fprintf(stdout, "-v: show the application version\n"); + fprintf(stdout, "-h: show this help\n\n"); +} +void show_version() +{ +#ifndef CWMP_REVISION + fprintf(stdout, "\nVersion: %s\n\n",CWMP_VERSION); +#else + fprintf(stdout, "\nVersion: %s revision %s\n\n",CWMP_VERSION,CWMP_REVISION); +#endif +} + +int load_dm_list(char *cmd) +{ + struct uci_ptr ptr; + struct uci_context *c = uci_alloc_context(); + char *s,*t; + int error; + struct uci_element *e; + + if (!c) + { + CWMP_LOG(ERROR, "Out of memory"); + return CWMP_GEN_ERR; + } + + s = strdup(cmd); + t = s; + if (uci_lookup_ptr(c, &ptr, s, TRUE) != UCI_OK) + { + CWMP_LOG(ERROR, "Invalid uci command path: %s",cmd); + free(t); + uci_free_context(c); + return CWMP_GEN_ERR; + } + + if(ptr.o == NULL) + { + CWMP_LOG(ERROR,"NO DATA MODEL XML FILES TO BE LOADED"); + free(t); + uci_free_context(c); + return CWMP_GEN_ERR; + } + + if(ptr.o->type == UCI_TYPE_LIST) + { + uci_foreach_element(&ptr.o->v.list, e) + { + if((e != NULL)&&(e->name)) + { + CWMP_LOG(INFO,"LOADING DATA MODEL FILE %s",e->name); + if((error = dm_xml_init_tree(e->name)) != CWMP_OK) + { + CWMP_LOG(ERROR,"LOADING DATA MODEL FILE '%s' FAILED",e->name); + free(t); + uci_free_context(c); + return error; + } + } + else + { + free(t); + uci_free_context(c); + return CWMP_GEN_ERR; + } + } + } + free(t); + uci_free_context(c); + return CWMP_OK; +} + +int uci_get_list_value(char *cmd, struct list_head *list) +{ + struct uci_ptr ptr; + struct uci_context *c = uci_alloc_context(); + struct uci_element *e; + struct config_uci_list *uci_list_elem; + char *s,*t; + int size = 0; + + if (!c) + { + CWMP_LOG(ERROR, "Out of memory"); + return size; + } + + s = strdup(cmd); + t = s; + if (uci_lookup_ptr(c, &ptr, s, TRUE) != UCI_OK) + { + CWMP_LOG(ERROR, "Invalid uci command path: %s",cmd); + free(t); + uci_free_context(c); + return size; + } + + if(ptr.o == NULL) + { + free(t); + uci_free_context(c); + return size; + } + + if(ptr.o->type == UCI_TYPE_LIST) + { + uci_foreach_element(&ptr.o->v.list, e) + { + if((e != NULL)&&(e->name)) + { + uci_list_elem = calloc(1,sizeof(struct config_uci_list)); + if(uci_list_elem == NULL) + { + free(t); + uci_free_context(c); + return CWMP_GEN_ERR; + } + uci_list_elem->value = strdup(e->name); + list_add_tail (&(uci_list_elem->list), list); + size++; + } + else + { + free(t); + uci_free_context(c); + return size; + } + } + } + free(t); + uci_free_context(c); + return size; +} + +int uci_get_value_common(char *cmd,char **value,bool state) +{ + struct uci_ptr ptr; + struct uci_context *c = uci_alloc_context(); + char *s,*t; + char state_path[32]; + + *value = NULL; + if (!c) + { + CWMP_LOG(ERROR, "Out of memory"); + return CWMP_GEN_ERR; + } + if (state) + { + strcpy(state_path,"/var/state"); + uci_add_history_path(c, c->savedir); + uci_set_savedir(c, state_path); + } + s = strdup(cmd); + t = s; + if (uci_lookup_ptr(c, &ptr, s, TRUE) != UCI_OK) + { + CWMP_LOG(ERROR, "Error occurred in uci %s get %s",state?"state":"config",cmd); + free(t); + uci_free_context(c); + return CWMP_GEN_ERR; + } + free(t); + if(ptr.flags & UCI_LOOKUP_COMPLETE) + { + if (ptr.o==NULL || ptr.o->v.string==NULL) + { + CWMP_LOG(INFO, "%s not found or empty value",cmd); + uci_free_context(c); + return CWMP_OK; + } + *value = strdup(ptr.o->v.string); + } + uci_free_context(c); + return CWMP_OK; +} + +int uci_get_state_value(char *cmd,char **value) +{ + int error; + error = uci_get_value_common (cmd,value,TRUE); + return error; +} + +int uci_get_value(char *cmd,char **value) +{ + int error; + error = uci_get_value_common (cmd,value,FALSE); + return error; +} + +static int uci_action_value_common(char *cmd, uci_config_action action) +{ + int ret = UCI_OK; + char *s,*t; + struct uci_context *c = uci_alloc_context(); + struct uci_ptr ptr; + char state_path[32]; + + s = strdup(cmd); + t = s; + + if (!c) + { + CWMP_LOG(ERROR, "Out of memory"); + return CWMP_GEN_ERR; + } + + if (action == CMD_SET_STATE) + { + strcpy(state_path,"/var/state"); + uci_add_history_path(c, c->savedir); + uci_set_savedir(c, state_path); + } + + if (uci_lookup_ptr(c, &ptr, s, TRUE) != UCI_OK) + { + free(t); + uci_free_context(c); + return CWMP_GEN_ERR; + } + switch (action) + { + case CMD_SET: + case CMD_SET_STATE: + ret = uci_set(c, &ptr); + break; + case CMD_DEL: + ret = uci_delete(c, &ptr); + break; + case CMD_ADD_LIST: + ret = uci_add_list(c, &ptr); + break; + } + if (ret == UCI_OK) + { + ret = uci_save(c, ptr.p); + } + else + { + CWMP_LOG(ERROR, "UCI %s %s not succeed %s",action==CMD_SET_STATE?"state":"config",action==CMD_DEL?"delete":"set",cmd); + } + free(t); + uci_free_context(c); + return CWMP_OK; +} + +int uci_delete_value(char *cmd) +{ + int error; + error = uci_action_value_common (cmd,CMD_DEL); + return error; +} + +int uci_set_value(char *cmd) +{ + int error; + error = uci_action_value_common (cmd,CMD_SET); + return error; +} + +int uci_set_state_value(char *cmd) +{ + int error; + error = uci_action_value_common (cmd,CMD_SET_STATE); + return error; +} + +int uci_add_list_value(char *cmd) +{ + int error; + error = uci_action_value_common (cmd,CMD_ADD_LIST); + return error; +} + +static int cwmp_package_commit(struct uci_context *c,char *tuple) +{ + struct uci_element *e = NULL; + struct uci_ptr ptr; + + if (uci_lookup_ptr(c, &ptr, tuple, TRUE) != UCI_OK) { + return CWMP_GEN_ERR; + } + + e = ptr.last; + + if (uci_commit(c, &ptr.p, false) != UCI_OK) + { + return CWMP_GEN_ERR; + } + + uci_unload(c, ptr.p); + return CWMP_OK; +} + +static int cwmp_do_package_cmd(struct uci_context *c) +{ + char **configs = NULL; + char **p; + + if ((uci_list_configs(c, &configs) != UCI_OK) || !configs) + { + return CWMP_GEN_ERR; + } + + for (p = configs; *p; p++) + { + cwmp_package_commit(c,*p); + } + + return CWMP_OK; +} + +int uci_commit_value() +{ + int ret; + struct uci_context *c = uci_alloc_context(); + + if (!c) + { + CWMP_LOG(ERROR, "Out of memory"); + return CWMP_GEN_ERR; + } + + ret = cwmp_do_package_cmd(c); + if(ret == CWMP_OK) + { + uci_free_context(c); + return ret; + } + + uci_free_context(c); + return CWMP_GEN_ERR; +} + +int uci_revert_value () +{ + char **configs = NULL; + char **p; + struct uci_context *ctx = uci_alloc_context(); + struct uci_ptr ptr; + + if (!ctx) + { + return CWMP_GEN_ERR; + } + + if ((uci_list_configs(ctx, &configs) != UCI_OK) || !configs) { + return CWMP_GEN_ERR; + } + + for (p = configs; *p; p++) + { + if (uci_lookup_ptr(ctx, &ptr, *p, TRUE) != UCI_OK) + { + return CWMP_GEN_ERR; + } + uci_revert(ctx, &ptr); + } + uci_free_context(ctx); + + return CWMP_OK; +} + +int uci_apply_web_packages() +{ + FILE *fp; + char cmd[256]; + int error; + + sprintf(cmd,"/bin/opkg install %s",DOWNLOADED_WEBCONTENT_FILE); + fp = popen(cmd,"r"); + error = pclose(fp); + + remove(DOWNLOADED_WEBCONTENT_FILE); + if(error == 0) + { + return FAULT_CPE_NO_FAULT_IDX; + } + else + { + return FAULT_CPE_DOWNLOAD_FAIL_FILE_CORRUPTED_IDX; + } +} + +int uci_apply_configuration() +{ + struct uci_context *ctx = uci_alloc_context(); + struct uci_package *package = NULL; + char *name = NULL; + int ret = UCI_OK; + FILE *pFile; + struct uci_package *p; + struct uci_element *e; + + if (!ctx) + { + CWMP_LOG(ERROR, "Out of memory"); + return FAULT_CPE_INTERNAL_ERROR_IDX; + } + + pFile = fopen(DOWNLOADED_CONFIG_FILE,"rb"); + + if(pFile == NULL) + { + CWMP_LOG(ERROR,"Configuration is not readable"); + uci_free_context(ctx); + return FAULT_CPE_DOWNLOAD_FAIL_FILE_CORRUPTED_IDX; + } + ret = uci_import(ctx, pFile, name, &package, (name != NULL)); + if (ret == UCI_OK) + { + CWMP_LOG(INFO,"Trying to apply configuration file"); + uci_foreach_element(&ctx->root, e) + { + p = uci_to_package(e); + ret = uci_commit(ctx, &p, true); + if(ret != CWMP_OK) + { + CWMP_LOG(ERROR,"Unable to save configuration"); + fclose(pFile); + remove(DOWNLOADED_CONFIG_FILE); + uci_free_context(ctx); + return FAULT_CPE_INTERNAL_ERROR_IDX; + } + } + } + else + { + CWMP_LOG(ERROR,"Can not apply downloaded configuration file"); + fclose(pFile); + remove(DOWNLOADED_CONFIG_FILE); + uci_free_context(ctx); + return FAULT_CPE_DOWNLOAD_FAIL_FILE_CORRUPTED_IDX; + } + fclose(pFile); + uci_free_context(ctx); + return FAULT_CPE_NO_FAULT_IDX; +} + +static int cwmp_check_image() +{ + FILE *fp; + char cmd[256]; + int error; + + sprintf(cmd,". /etc/functions.sh; include /lib/upgrade; platform_check_image %s >/dev/null",DOWNLOADED_FIRMWARE_FILE); + fp = popen(cmd,"r"); + error = pclose(fp); + + if(error == 0) + { + return CWMP_OK; + } + else + { + return CWMP_GEN_ERR; + } + + return CWMP_OK; +} + +static int checkline (const char *str_regex,const char *str_request) +{ + int error; + regex_t preg; + int match; + size_t nmatch = 0; + regmatch_t *pmatch = NULL; + + if((str_request == NULL) || (strcmp(str_request,"") == 0)) + { + return CWMP_GEN_ERR; + } + + error = regcomp (&preg, str_regex, REG_EXTENDED); + if (error == 0) + { + nmatch = preg.re_nsub; + pmatch = malloc (sizeof (*pmatch) * nmatch); + if (pmatch) + { + match = regexec (&preg, str_request, nmatch, pmatch, 0); + regfree (&preg); + if (match == 0) + { + return CWMP_OK; + } + else if (match == REG_NOMATCH) + { + return CWMP_GEN_ERR; + } + else + { + return CWMP_MEM_ERR; + } + } + else + { + return CWMP_MEM_ERR; + } + } + return CWMP_GEN_ERR; +} + +long int cwmp_check_flash_size() +{ + char line[256]; + long int size = 0; + FILE *fp; + char *n = NULL; + char *b = NULL; + char *s = NULL; + char *t = NULL; + char *endptr = NULL; + int i = 0,error; + + fp = fopen("/proc/mtd","r"); + if (fp != NULL) + { + while (fgets(line,sizeof(line),fp)) + { + if(checkline("^([^[:space:]]+)[[:space:]]+([^[:space:]]+)[[:space:]]+([^[:space:]]+)[[:space:]]+\"([^[:space:]]+)\"",line) == CWMP_OK) + { + t = strdup(line); + n = t; + n = strtok(n," "); + i = 0; + while(n != NULL) + { + if(i == 1) + { + s = strdup(n); + } + if(i == 3) + { + break; + } + n = strtok(NULL," "); + i++; + } + n[strlen(n)-1] = 0; + if(strcmp(n,"\"linux\"") == 0 || strcmp(n,"\"firmware\"") == 0) + { + size = strtol(s, &endptr, 16); + break; + } + } + } + } + else if (fp = fopen("/proc/partitions","r")) + { + while (fgets(line,sizeof(line),fp)) + { + if(checkline("[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([^[:space:]]+)[[:space:]]+([^[:space:]]+)",line) == CWMP_OK) + { + i = 0; + t = strdup(line); + n = t; + n = strtok(n," "); + while(n != NULL) + { + if(i == 2) + { + b = strdup(n); + } + if(i == 3) + { + break; + } + n = strtok(NULL," "); + i++; + } + if ((b != NULL) && (n != NULL) && (checkline("([^[:space:]]+)",n) == CWMP_OK)) + { + size = atoi(b) * 1024; + break; + } + } + } + } + if(t != NULL) + { + free(t); + } + if(b != NULL) + { + free(b); + } + if(s != NULL) + { + free(s); + } + fclose(fp); + return size; +} + +static long int cwmp_get_firmware_size() +{ + struct stat st; + long int size = 0; + + if (stat(DOWNLOADED_FIRMWARE_FILE, &st) == 0) + { + size = st.st_size; + } + + return size; +} + +int cwmp_start_upgrade(struct cwmp *cwmp,void *v) +{ + char cmd[256]; + char line[256]; + FILE *fp; + int error; + + CWMP_LOG(INFO,"RUN Firmware upgrade function"); + /** flush file system buffers **/ + sync(); + sprintf(cmd,"killall dropbear uhttpd; sleep 1; /sbin/sysupgrade %s",DOWNLOADED_LAST_VALID_FIRMWARE_FILE); + fp = popen(cmd,"r"); + while (fgets(line,sizeof(line),fp)) + { + continue; + } + error = pclose(fp); + if(error == 0) + { + return CWMP_OK; + } + else + { + return CWMP_GEN_ERR; + } +} + +int cwmp_reset_factory(struct cwmp *cwmp,void *v) +{ + char cmd[256]; + char line[256]; + FILE *fp; + int error; + + CWMP_LOG(INFO,"RUN Factory reset function"); /* TODO to be removed*/ + sprintf(cmd,"killall dropbear uhttpd; sleep 1; mtd -r erase rootfs_data"); + fp = popen(cmd,"r"); + while (fgets(line,sizeof(line),fp)) + { + continue; + } + error = pclose(fp); + if(error == 0) + { + return CWMP_OK; + } + else + { + return CWMP_GEN_ERR; + } +} + +int uci_upgrade_image(struct cwmp *cwmp, struct session *session) +{ + int error; + long int flashsize = 0,filesize = 0; + FILE *fp; + + if(cwmp_check_image() == CWMP_OK) + { + flashsize = cwmp->env.max_firmware_size; + filesize = cwmp_get_firmware_size(); + + if((flashsize > 0)&&(filesize > flashsize)) + { + remove(DOWNLOADED_FIRMWARE_FILE); + return FAULT_CPE_DOWNLOAD_FAIL_FILE_CORRUPTED_IDX; + } + else + { + remove(DOWNLOADED_LAST_VALID_FIRMWARE_FILE); + rename(DOWNLOADED_FIRMWARE_FILE,DOWNLOADED_LAST_VALID_FIRMWARE_FILE); + if(session != NULL) + { + add_session_end_func(session,cwmp_start_upgrade,NULL,FALSE); + } + else + { + add_download_end_func(cwmp_start_upgrade,NULL); + } + return FAULT_CPE_NO_FAULT_IDX; + } + } + else + { + remove(DOWNLOADED_FIRMWARE_FILE); + return FAULT_CPE_DOWNLOAD_FAIL_FILE_CORRUPTED_IDX; + } +} + +int check_global_config (struct config *conf) +{ + if (conf->acsurl==NULL) + { + conf->acsurl = strdup(DEFAULT_ACSURL); + } + return CWMP_OK; +} + +static void uppercase ( char *sPtr ) +{ + while ( *sPtr != '\0' ) + { + *sPtr = toupper ( ( unsigned char ) *sPtr ); + ++sPtr; + } +} + +int get_global_config(struct config *conf) +{ + int error, error2, error3; + char *value = NULL, *value2 = NULL, *value3 = NULL; + + if((error = uci_get_value(UCI_CPE_LOG_FILE_NAME,&value)) == CWMP_OK) + { + if(value != NULL) + { + log_set_log_file_name (value); + free(value); + value = NULL; + } + } + + if((error = uci_get_value(UCI_CPE_LOG_MAX_SIZE,&value)) == CWMP_OK) + { + if(value != NULL) + { + log_set_file_max_size(value); + free(value); + value = NULL; + } + } + + if((error = uci_get_value(UCI_CPE_ENABLE_STDOUT_LOG,&value)) == CWMP_OK) + { + if(value != NULL) + { + log_set_on_console(value); + free(value); + value = NULL; + } + } + + if((error = uci_get_value(UCI_CPE_ENABLE_FILE_LOG,&value)) == CWMP_OK) + { + if(value != NULL) + { + log_set_on_file(value); + free(value); + value = NULL; + } + } + + error = uci_get_value(UCI_DHCP_DISCOVERY_PATH,&value); + error2 = uci_get_state_value(UCI_ACS_URL_PATH,&value2); + error3 = uci_get_state_value(UCI_DHCP_ACS_URL_PATH,&value3); + + if ((((error == CWMP_OK) && (value != NULL) && (strcmp(value,"enable") == 0)) || + ((error2 == CWMP_OK) && ((value2 == NULL) || (value2[0] == 0)))) && + ((error3 == CWMP_OK) && (value3 != NULL) && (value3[0] != 0))) + { + if (conf->acsurl!=NULL) + { + free(conf->acsurl); + } + conf->acsurl = value3; + value3 = NULL; + } + else if ((error2 == CWMP_OK) && (value2 != NULL) && (value2[0] != 0)) + { + if (conf->acsurl!=NULL) + { + free(conf->acsurl); + } + conf->acsurl = value2; + value2 = NULL; + } + if (value!=NULL) + { + free(value); + value = NULL; + } + if (value2!=NULL) + { + free(value2); + value2 = NULL; + } + if (value3!=NULL) + { + free(value3); + value3 = NULL; + } + + if((error = uci_get_value(UCI_ACS_USERID_PATH,&value)) == CWMP_OK) + { + if(value != NULL) + { + if (conf->acs_userid!=NULL) + { + free(conf->acs_userid); + } + conf->acs_userid = value; + value = NULL; + } + } + else + { + return error; + } + if((error = uci_get_value(UCI_ACS_PASSWD_PATH,&value)) == CWMP_OK) + { + if(value != NULL) + { + if (conf->acs_passwd!=NULL) + { + free(conf->acs_passwd); + } + conf->acs_passwd = value; + value = NULL; + } + } + else + { + return error; + } + if((error = uci_get_value(UCI_CPE_USERID_PATH,&value)) == CWMP_OK) + { + if(value != NULL) + { + if (conf->cpe_userid!=NULL) + { + free(conf->cpe_userid); + } + conf->cpe_userid = value; + value = NULL; + } + } + else + { + return error; + } + if((error = uci_get_value(UCI_CPE_PASSWD_PATH,&value)) == CWMP_OK) + { + if(value != NULL) + { + if (conf->cpe_passwd!=NULL) + { + free(conf->cpe_passwd); + } + conf->cpe_passwd = value; + value = NULL; + } + } + else + { + return error; + } + if((error = uci_get_value(UCI_LOG_SEVERITY_PATH,&value)) == CWMP_OK) + { + if(value != NULL) + { + log_set_severity_idx (value); + free(value); + value = NULL; + } + } + else + { + return error; + } + if((error = uci_get_value(UCI_CPE_PORT_PATH,&value)) == CWMP_OK) + { + int a = 0; + + if(value != NULL) + { + a = atoi(value); + free(value); + value = NULL; + } + if(a==0) + { + CWMP_LOG(INFO,"Set the connection request port to the default value: %d",DEFAULT_CONNECTION_REQUEST_PORT); + conf->connection_request_port = DEFAULT_CONNECTION_REQUEST_PORT; + } + else + { + conf->connection_request_port = a; + } + } + else + { + return error; + } + if((error = uci_get_value(UCI_PERIODIC_INFORM_INTERVAL_PATH,&value)) == CWMP_OK) + { + int a = 0; + + if(value != NULL) + { + a = atoi(value); + free(value); + value = NULL; + } + if(a>=PERIOD_INFORM_MIN) + { + conf->period = a; + } + else + { + CWMP_LOG(ERROR,"Period interval of periodic inform should be > %ds. Set to default: %ds",PERIOD_INFORM_MIN,PERIOD_INFORM_DEFAULT); + conf->period = PERIOD_INFORM_DEFAULT; + } + } + else + { + return error; + } + if((error = uci_get_value(UCI_PERIODIC_INFORM_ENABLE_PATH,&value)) == CWMP_OK) + { + if(value != NULL) + { + uppercase(value); + if ((strcmp(value,"TRUE")==0) || (strcmp(value,"1")==0)) + { + conf->periodic_enable = TRUE; + } + else + { + conf->periodic_enable = FALSE; + } + free(value); + value = NULL; + } + else + { + conf->periodic_enable = FALSE; + } + } + else + { + return error; + } + + return CWMP_OK; +} + +int global_env_init (int argc, char** argv, struct env *env) +{ + int i,error=0; + + for (i=1;iboot = CWMP_START_BOOT; + break; + case 'g': + env->periodic = CWMP_START_PERIODIC; + break; + case 'c': + env->iccu = CWMP_START_ICCU; + break; + case 'v': + show_version(); + exit(EXIT_SUCCESS); + break; + case 'h': + show_help(); + exit(EXIT_SUCCESS); + break; + } + } + env->max_firmware_size = cwmp_check_flash_size(); + return CWMP_OK; +} + +int global_conf_init (struct config *conf) +{ + int error; + + if (error = get_global_config(conf)) + { + return error; + } + if (error = check_global_config(conf)) + { + return error; + } + return CWMP_OK; +} + +int save_acs_bkp_config(struct cwmp *cwmp) +{ + int error; + char *acsurl = NULL; + struct config *conf; + + conf = &(cwmp->conf); + error = cwmp_load_saved_session(cwmp, &acsurl, ACS); + if((acsurl == NULL)||(acsurl != NULL && strcmp(acsurl,conf->acsurl) != 0)) + { + backup_session_insert_acs(conf->acsurl); + if(acsurl != NULL) + { + free(acsurl); + } + } + return CWMP_OK; +} + +int cwmp_init(int argc, char** argv,struct cwmp *cwmp) +{ + int error; + struct env env; + memset(&env,0,sizeof(struct env)); + if(error = global_env_init (argc, argv, &env)) + { + return error; + } + memset(cwmp,0,sizeof(struct cwmp)); + memcpy(&(cwmp->env),&env,sizeof(struct env)); + INIT_LIST_HEAD(&(cwmp->head_session_queue)); + INIT_LIST_HEAD(&(cwmp->api_value_change.parameter_list)); + if(error = global_conf_init(&(cwmp->conf))) + { + return error; + } + return CWMP_OK; +} + +int cwmp_config_reload(struct cwmp *cwmp) +{ + int error; + memset(&cwmp->env,0,sizeof(struct env)); + memset(&cwmp->conf,0,sizeof(struct config)); + if(error = global_conf_init(&(cwmp->conf))) + { + return error; + } + return CWMP_OK; +} diff --git a/src/config/cwmp b/src/config/cwmp new file mode 100644 index 0000000..b3a601a --- /dev/null +++ b/src/config/cwmp @@ -0,0 +1,25 @@ +config 'cwmp' 'acs' + option 'url' 'http://192.168.1.238:8080/openacs/acs' + option 'userid' 'inteno' + option 'passwd' 'inteno' + option 'periodic_inform_enable' 'true' + option 'periodic_inform_interval' '1800' + option 'ParameterKey' '' + option 'dhcp_discovery' 'disable' + +config 'cwmp' 'cpe' + option 'log_to_console' 'disable' + option 'log_to_file' 'enable' + option 'log_severity' 'INFO' + option 'log_file_name' '/var/log/cwmpd.log' + option 'log_max_size' '102400' + option 'userid' 'cpeinteno' + option 'passwd' 'cpeinteno' + option 'port' '7547' + +config 'cwmp' 'dm' + list 'xml' '/etc/cwmpd/dm/tr098.xml' + +config 'cwmp' 'notification' + +config 'cwmp' 'accesslist' diff --git a/src/connectionRequest.c b/src/connectionRequest.c new file mode 100644 index 0000000..ef0e575 --- /dev/null +++ b/src/connectionRequest.c @@ -0,0 +1,135 @@ +/* + connectionRequest.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include "cwmp.h" +#include "httpda.h" + +struct event_container *cwmp_add_event_container (struct cwmp *cwmp, int event_idx, char *command_key); + +static bool get_connection_request = FALSE; + +void *thread_connection_request_listener (void *v) +{ + struct cwmp *cwmp = (struct cwmp *) v; + struct event_container *event_container; + struct soap soap; + SOAP_SOCKET m,s; + int port,valid_socket; + + port = cwmp->conf.connection_request_port; + soap_init(&soap); + soap_register_plugin(&soap, http_da); + + + soap.send_timeout = 30; + soap.recv_timeout = 30; + soap.accept_timeout = 864000; + + m = soap_bind(&soap, NULL, port, 100); + if (!soap_valid_socket(m)) + { + CWMP_LOG(ERROR,"Soap socket bind error in the connection request listener thread. Quit the thread!"); + soap_destroy(&soap); + soap_end(&soap); + soap_done(&soap); + return NULL; + } + CWMP_LOG(INFO,"Bind the connection request listener, port=%d.",port); + for (;;) + { + get_connection_request = FALSE; + s = soap_accept(&soap); + soap_valid_socket(s); + soap_serve(cwmp,&soap); + soap_closesock(&soap); + soap_end(&soap); + if (!get_connection_request) + { + continue; + } + CWMP_LOG(INFO,"Connection Request thread: add connection request event in the queue"); + pthread_mutex_lock (&(cwmp->mutex_session_queue)); + event_container = cwmp_add_event_container (cwmp, EVENT_IDX_6CONNECTION_REQUEST, ""); + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + pthread_cond_signal(&(cwmp->threshold_session_send)); + } + soap_done(&soap); + return CWMP_OK; +} + +SOAP_FMAC5 int SOAP_FMAC6 soap_serve_request(struct cwmp *cwmp, struct soap *soap) +{ + char *userid,*passwd; + char *authrealm = "Inteno CWMP"; + + userid = cwmp->conf.cpe_userid; + passwd = cwmp->conf.cpe_passwd; + if (userid==NULL || passwd==NULL) + { + return soap->error=503; + } + if (soap->authrealm && soap->userid) + { + if (!strcmp(soap->authrealm, authrealm) && !strcmp(soap->userid, userid)) + { + if (!http_da_verify_get(soap, passwd)) // HTTP POST DA verification + { + soap_end_send(soap); + get_connection_request = TRUE; + return SOAP_OK; + } + } + } + soap->authrealm = authrealm; // realm to send to client + return soap->error=401; // Not authorized, challenge with digest authentication +} + +SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct cwmp *cwmp, struct soap *soap) +{ + static int cr_request = 0; + static time_t restrict_start_time = 0; + time_t current_time; + + current_time = time(NULL); + if ((restrict_start_time==0) || ((current_time-restrict_start_time) > CONNECTION_REQUEST_RESTRICT_PERIOD)) + { + restrict_start_time = current_time; + cr_request = 1; + } + else + { + cr_request++; + if (cr_request>CONNECTION_REQUEST_RESTRICT_REQUEST) + { + restrict_start_time = current_time; + soap->error = 503; + return soap_send_fault(soap); + } + } + + soap_begin_recv(soap); + + if (soap_serve_request(cwmp,soap) || + soap_response(soap, SOAP_OK) || + soap_end_send(soap)) + { + return soap_send_fault(soap); + } + + return SOAP_OK; +} + diff --git a/src/cwmp.c b/src/cwmp.c new file mode 100644 index 0000000..f31b09f --- /dev/null +++ b/src/cwmp.c @@ -0,0 +1,684 @@ +/* + cwmp.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include +#include +#include "cwmp.h" +#include "backupSession.h" + +#define CWMP_DAEMON_MULTITHREAD 1/* TODO KMD need for debug*/ + +struct cwmp cwmp_main; +static pthread_mutex_t thread_sync_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_cond_t thread_sync_cond = PTHREAD_COND_INITIALIZER; +static bool thread_sync_wait = TRUE; + +struct rpc_acs *cwmp_add_session_rpc_acs_inform (struct session *session); +struct rpc_cpe *cwmp_soap_receive_rpc_cpe (struct cwmp *cwmp,struct session *session); +struct event_container *cwmp_add_event_container (struct cwmp *cwmp, int event_idx, char *command_key); +struct paramater_container *cwmp_add_parameter_container (struct cwmp *cwmp, struct event_container *event_container, char *name); +void backup_session_move_inform_to_inform_send (); +void backup_session_move_inform_to_inform_queue (); +void cwmp_save_event_container (struct cwmp *cwmp,struct event_container *event_container); +void *cwmp_schedule_session (void *v); +void *thread_event_periodic (void *v); +void *thread_connection_request_listener (void *v); +void *thread_cwmp_rpc_cpe_scheduleInform (void *v); +void *thread_cwmp_rpc_cpe_download (void *v); +void *thread_kernel_api_cwmp_value_change_parameters (void *v); +void *thread_lib_api_cwmp_value_change_parameters (void *v); + +struct rpc_acs *cwmp_add_session_rpc_acs (struct session *session) +{ + struct rpc_acs *rpc_acs; + + rpc_acs = calloc (1,sizeof(struct rpc_acs)); + if (rpc_acs==NULL) + { + return NULL; + } + list_add_tail (&(rpc_acs->list), &(session->head_rpc_acs)); + return rpc_acs; +} + +struct rpc_cpe *cwmp_add_session_rpc_cpe (struct session *session) +{ + struct rpc_cpe *rpc_cpe; + + rpc_cpe = calloc (1,sizeof(struct rpc_cpe)); + if (rpc_cpe==NULL) + { + return NULL; + } + list_add_tail (&(rpc_cpe->list), &(session->head_rpc_cpe)); + return rpc_cpe; +} + +struct rpc_acs *cwmp_add_session_rpc_acs_head (struct session *session) +{ + struct rpc_acs *rpc_acs; + + rpc_acs = calloc (1,sizeof(struct rpc_acs)); + if (rpc_acs==NULL) + { + return NULL; + } + list_add (&(rpc_acs->list), &(session->head_rpc_acs)); + return rpc_acs; +} + +int cwmp_session_rpc_cpe_destructor (struct cwmp *cwmp, struct session *session, struct rpc_cpe *rpc_cpe) +{ + if (rpc_cpe == NULL) + { + return CWMP_OK; + } + + if (rpc_cpe->method_data!=NULL) + { + free (rpc_cpe->method_data); + } + if (rpc_cpe->method_response_data!=NULL) + { + free (rpc_cpe->method_response_data); + } + list_del(&(rpc_cpe->list)); + free (rpc_cpe); + return CWMP_OK; +} + +int cwmp_get_retry_interval (struct cwmp *cwmp) +{ + switch (cwmp->retry_count_session) + { + case 0: return MAX_INT32; + case 1: return 6; + case 2: return 11; + case 3: return 21; + case 4: return 41; + case 5: return 81; + case 6: return 161; + case 7: return 321; + case 8: return 641; + case 9: return 1281; + default: return 2561; + } +} + +int cwmp_session_rpc_acs_destructor (struct cwmp *cwmp, struct session *session, struct rpc_acs *rpc_acs) +{ + if (rpc_acs == NULL) + { + return CWMP_OK; + } + + if (rpc_acs->method_data!=NULL) + { + free (rpc_acs->method_data); + } + if (rpc_acs->method_response_data!=NULL) + { + free (rpc_acs->method_response_data); + } + list_del(&(rpc_acs->list)); + free (rpc_acs); + return CWMP_OK; +} + +void thread_sync() +{ + pthread_mutex_lock(&thread_sync_mutex); + thread_sync_wait = FALSE; + pthread_cond_signal(&thread_sync_cond); + pthread_mutex_unlock(&thread_sync_mutex); +} + +void thread_wait_sync() +{ + pthread_mutex_lock(&thread_sync_mutex); + if(thread_sync_wait) + { + pthread_cond_wait(&thread_sync_cond,&thread_sync_mutex); + } + thread_sync_wait = TRUE; + pthread_mutex_unlock(&thread_sync_mutex); +} + +void *cwmp_schedule_session (void *v) +{ + struct list_head *ilist; + struct session *session; + int t,error = CWMP_OK; + static struct timespec time_to_wait = {0, 0}; + bool retry = FALSE; + struct cwmp *cwmp = (struct cwmp *) v; + + thread_sync(); + while (1) + { + pthread_mutex_lock (&(cwmp->mutex_session_send)); + ilist = (&(cwmp->head_session_queue))->next; + while ((ilist == &(cwmp->head_session_queue)) || retry) + { + t = cwmp_get_retry_interval(cwmp); + time_to_wait.tv_sec = time(NULL) + t; + CWMP_LOG(INFO,"Waiting the next session"); + pthread_cond_timedwait(&(cwmp->threshold_session_send), &(cwmp->mutex_session_send), &time_to_wait); + ilist = (&(cwmp->head_session_queue))->next; + retry = FALSE; + } + session = list_entry(ilist, struct session, list); + cwmp_prepare_session_to_session_send (cwmp,session); + if (error = cwmp_move_session_to_session_send (cwmp, session)) + { + CWMP_LOG(EMERG,"FATAL error in the mutex process in the session shceduler!"); + exit(EXIT_FAILURE); + } + error = cwmp_schedule_rpc (cwmp,session); + run_session_end_func(cwmp,&(session->head_session_end_func)); + if (session->error == CWMP_RETRY_SESSION) + { + error = cwmp_move_session_to_session_queue (cwmp, session); + CWMP_LOG(INFO,"Retry session, retry count = %d, retry in %ds",cwmp->retry_count_session,cwmp_get_retry_interval(cwmp)); + retry = TRUE; + pthread_mutex_unlock (&(cwmp->mutex_session_send)); + continue; + } + cwmp_session_destructor (cwmp, session); + cwmp->session_send = NULL; + cwmp->retry_count_session = 0; + pthread_mutex_unlock (&(cwmp->mutex_session_send)); +# if !CWMP_DAEMON_MULTITHREAD /* TODO KMD need for debug*/ + break; +#endif + } + return CWMP_OK; +} + +int cwmp_schedule_rpc (struct cwmp *cwmp, struct session *session) +{ + struct list_head *ilist; + struct rpc_acs *rpc_acs; + struct rpc_cpe *rpc_cpe; + int error=0,e; + + cwmp_session_soap_init(session); + + while (1) + { + session->error = CWMP_OK; + __list_for_each(ilist, &(session->head_rpc_acs)) + { + rpc_acs = list_entry (ilist, struct rpc_acs, list); + if (!(error = rpc_acs->method_data_init (cwmp, session, rpc_acs))) + { + rpc_acs->method_remote_call(cwmp, session, rpc_acs); + if (rpc_acs->error==CWMP_SUCCESS_RPC && session->error!=CWMP_RETRY_SESSION) + { + error = rpc_acs->method_response (cwmp, session, rpc_acs); + } + } + + if (e = rpc_acs->method_end (cwmp, session, rpc_acs)) + { + error = e; + } + + cwmp_session_soap_destroy_end (session); + if (error || session->error==CWMP_RETRY_SESSION) + { + session->error = CWMP_RETRY_SESSION; + goto end_rpc_sheculer; + } + ilist = ilist->prev; + if (error = rpc_acs->destructor (cwmp, session, rpc_acs)) + { + session->error = CWMP_RETRY_SESSION; + goto end_rpc_sheculer; + } + + if (session->hold_request) + { + break; + } + } + + while (1) + { + session->error = CWMP_OK; + cwmp_soap_send_http_empty (cwmp,session); + + if (session->error == CWMP_RETRY_SESSION) + { + goto end_rpc_sheculer; + } + session->error = CWMP_OK; + e = cwmp_soap_recv_http_empty (cwmp,session); + if (session->error == CWMP_RETRY_SESSION) + { + goto end_rpc_sheculer; + } + else if (e == CWMP_UNAUTHORIZED_401) + { + CWMP_LOG(INFO,"Receive http 401: need authentication"); + cwmp_session_soap_destroy_end (session); + continue; + } + else if (session->error == CWMP_CONTINUE_SESSION || + session->error == CWMP_SUCCESS_SESSION) + { + break; + } + session->error = CWMP_RETRY_SESSION; + goto end_rpc_sheculer; + } + if (session->error == CWMP_CONTINUE_SESSION) + { + while (1) + { + rpc_cpe = cwmp_soap_receive_rpc_cpe (cwmp, session); + if (rpc_cpe == NULL) + { + session->error = CWMP_RETRY_SESSION; + goto end_rpc_sheculer; + } + while (1) + { + if (!(error = rpc_cpe->method(cwmp, session, rpc_cpe))) + { + if (!(error = rpc_cpe->method_response_data_init(cwmp, session, rpc_cpe))) + { + while (1) + { + cwmp_session_soap_destroy_end (session); + if (error = rpc_cpe->method_response(cwmp, session, rpc_cpe)) + { + session->error = CWMP_RETRY_SESSION; + break; + } + session->error = CWMP_OK; + e = cwmp_soap_recv_http_empty (cwmp,session); + if (session->error == CWMP_RETRY_SESSION || + session->error == CWMP_CONTINUE_SESSION || + session->error == CWMP_SUCCESS_SESSION) + { + break; + } + else if (e == CWMP_UNAUTHORIZED_401) + { + CWMP_LOG(INFO,"Receive http 401: need authentication"); + continue; + } + session->error = CWMP_RETRY_SESSION; + break; + } + } + else if(error != CWMP_FAULT_CPE) + { + session->error = CWMP_RETRY_SESSION; + } + } + else if(error != CWMP_FAULT_CPE) + { + session->error = CWMP_RETRY_SESSION; + } + + if (rpc_cpe->method_end(cwmp, session, rpc_cpe) || + rpc_cpe->destructor(cwmp, session, rpc_cpe)) + { + session->error = CWMP_RETRY_SESSION; + } + + if (session->error == CWMP_RETRY_SESSION) + { + goto end_rpc_sheculer; + } + + ilist = session->head_rpc_cpe.next; + if (ilist == &(session->head_rpc_cpe)) + { + break; + } + rpc_cpe = list_entry(ilist, struct rpc_cpe, list); + } + if (session->error != CWMP_CONTINUE_SESSION) + { + break; + } + } + } + if (session->head_rpc_acs.next==&(session->head_rpc_acs)) + { + break; + } + } +end_rpc_sheculer: + cwmp_session_done(session); + return session->error; +} + +int cwmp_prepare_session_to_session_send (struct cwmp *cwmp, struct session *session) +{ + cwmp_root_cause_event_api_value_change (cwmp,session); + return CWMP_OK; +} + +int cwmp_move_session_to_session_send (struct cwmp *cwmp, struct session *session) +{ + pthread_mutex_lock (&(cwmp->mutex_session_queue)); + if (cwmp->session_send != NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return cwmp->error = CWMP_MUTEX_ERR; + } + list_del (&(session->list)); + strcpy (session->acs_url, cwmp->conf.acsurl); + cwmp->session_send = session; + cwmp->head_event_container = NULL; + backup_session_move_inform_to_inform_send (); + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_OK; +} + +int cwmp_move_session_to_session_queue (struct cwmp *cwmp, struct session *session) +{ + struct list_head *ilist,*jlist; + struct rpc_acs *rpc_acs,*queue_rpc_acs; + struct event_container *event_container_old, *event_container_new; + struct paramater_container *paramater_container_old, *paramater_container_new; + struct session *session_queue; + bool dup; + + pthread_mutex_lock (&(cwmp->mutex_session_queue)); + cwmp->retry_count_session ++; + cwmp->session_send = NULL; + if (cwmp->head_session_queue.next == &(cwmp->head_session_queue)) + { + list_add_tail (&(session->list), &(cwmp->head_session_queue)); + session->hold_request = 0; + session->digest_auth = 0; + cwmp->head_event_container = &(session->head_event_container); + if (session->head_rpc_acs.next != &(session->head_rpc_acs)) + { + rpc_acs = list_entry(session->head_rpc_acs.next, struct rpc_acs, list); + if (rpc_acs->type != RPC_ACS_INFORM_IDX) + { + if (cwmp_add_session_rpc_acs_inform (session) == NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_MEM_ERR; + } + } + } + else + { + if (cwmp_add_session_rpc_acs_inform (session) == NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_MEM_ERR; + } + } + backup_session_move_inform_to_inform_queue (); + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_OK; + } + __list_for_each(ilist, &(session->head_event_container)) + { + event_container_old = list_entry (ilist, struct event_container, list); + event_container_new = cwmp_add_event_container (cwmp, event_container_old->idx, event_container_old->event.CommandKey); + if (event_container_new == NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_MEM_ERR; + } + __list_for_each(jlist, &(event_container_old->head_paramater_container)) + { + paramater_container_old = list_entry(jlist,struct paramater_container, list); + paramater_container_new = cwmp_add_parameter_container (cwmp,event_container_new, paramater_container_old->paramater.Name); + } + cwmp_save_event_container (cwmp,event_container_new); + } + session_queue = list_entry(cwmp->head_event_container,struct session, head_event_container); + __list_for_each(ilist, &(session->head_rpc_acs)) + { + rpc_acs = list_entry(ilist, struct rpc_acs, list); + dup = FALSE; + __list_for_each(jlist, &(session_queue->head_rpc_acs)) + { + queue_rpc_acs = list_entry(jlist, struct rpc_acs, list); + if (queue_rpc_acs->type == rpc_acs->type && + (rpc_acs->type == RPC_ACS_INFORM_IDX || + rpc_acs->type == RPC_ACS_GETRPCMETHODS_IDX)) + { + dup = TRUE; + break; + } + } + if (dup) + { + continue; + } + ilist = ilist->prev; + list_del(&(rpc_acs->list)); + list_add_tail (&(rpc_acs->list), &(session_queue->head_rpc_acs)); + } + cwmp_session_destructor (cwmp, session); + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_OK; +} + +int cwmp_session_destructor (struct cwmp *cwmp, struct session *session) +{ + struct rpc_acs *rpc_acs; + struct rpc_cpe *rpc_cpe; + struct session_end_func *session_end_func; + + while (session->head_rpc_acs.next != &(session->head_rpc_acs)) + { + rpc_acs = list_entry(session->head_rpc_acs.next, struct rpc_acs, list); + rpc_acs->destructor (cwmp, session, rpc_acs); + } + while (session->head_rpc_cpe.next != &(session->head_rpc_cpe)) + { + rpc_cpe = list_entry(session->head_rpc_cpe.next, struct rpc_cpe, list); + rpc_cpe->destructor (cwmp, session, rpc_cpe); + } + while (session->head_session_end_func.next != &(session->head_session_end_func)) + { + session_end_func = list_entry(session->head_session_end_func.next, struct session_end_func, list); + list_del (&(session_end_func->list)); + free (session_end_func); + } + if (session->list.next != LIST_POISON1 && session->list.prev != LIST_POISON2) + { + list_del (&(session->list)); + } + free (session); + + return CWMP_OK; +} + +struct session *cwmp_add_queue_session (struct cwmp *cwmp) +{ + struct session *session; + + session = calloc (1,sizeof(struct session)); + if (session==NULL) + { + return NULL; + } + list_add_tail (&(session->list), &(cwmp->head_session_queue)); + INIT_LIST_HEAD (&(session->head_event_container)); + INIT_LIST_HEAD (&(session->head_session_end_func)); + INIT_LIST_HEAD (&(session->head_rpc_acs)); + INIT_LIST_HEAD (&(session->head_rpc_cpe)); + if (cwmp_add_session_rpc_acs_inform (session) == NULL) + { + free (session); + return NULL; + } + + return session; +} + +int add_session_end_func (struct session *session, int (*func)(struct cwmp *cwmp, void *input),void *input, bool end) +{ + struct session_end_func *session_end_func; + struct list_head *ilist; + + __list_for_each(ilist,&(session->head_session_end_func)) + { + session_end_func = list_entry(ilist, struct session_end_func, list); + if ((session_end_func->func==func) && + (session_end_func->input==input)) + { + return CWMP_OK; + } + } + + session_end_func = calloc(1,sizeof(struct session_end_func)); + session_end_func->func = func; + session_end_func->input = input; + + if (end==TRUE) + { + list_add_tail(&(session_end_func->list),&(session->head_session_end_func)); + } + else + { + list_add(&(session_end_func->list),&(session->head_session_end_func)); + } + return CWMP_OK; +} +int run_session_end_func (struct cwmp *cwmp, struct list_head *head_func) +{ + struct list_head *ilist; + struct session_end_func *session_end_func; + int error = CWMP_OK; + __list_for_each(ilist,head_func) + { + session_end_func = list_entry(ilist, struct session_end_func, list); + error = session_end_func->func(cwmp,session_end_func->input); + ilist = ilist->prev; + list_del(&(session_end_func->list)); + free (session_end_func); + } + return error; +} + +int cwmp_apply_acs_changes (struct cwmp *cwmp) +{ + int error; + if (error = cwmp_config_reload(cwmp)) + { + return error; + } + if (error = cwmp_root_cause_events(cwmp)) + { + return error; + } + return CWMP_OK; +} + +int main(int argc, char **argv) +{ + + struct cwmp *cwmp = &cwmp_main; + int error; + pthread_t session_scheduler_thread; + pthread_t periodic_event_thread; + pthread_t connection_request_thread; + pthread_t scheduleInform_thread; + pthread_t download_thread; + pthread_t kernel_value_change_thread; + pthread_t lib_value_change_thread; + + if (error = cwmp_init(argc, argv, cwmp)) + { + return error; + } + CWMP_LOG(INFO,"STARTING CWMP"); + + if (error = load_dm_list(UCI_DM_XML_FILE_LIST)) + { + return error; + } + + if (error = cwmp_load_saved_session(cwmp, NULL, ALL)) + { + return error; + } + + if (error = cwmp_root_cause_events(cwmp)) + { + return error; + } +# if !CWMP_DAEMON_MULTITHREAD /* TODO KMD need for debug*/ + + cwmp_schedule_session(cwmp); + +#else + error = pthread_create(&session_scheduler_thread, NULL, &cwmp_schedule_session, (void *)cwmp); + if (error<0) + { + CWMP_LOG(EMERG,"FATAL error when creating the session scheduler thread!"); + exit(EXIT_FAILURE); + } + + error = pthread_create(&periodic_event_thread, NULL, &thread_event_periodic, (void *)cwmp); + if (error<0) + { + CWMP_LOG(ERROR,"Error error when creating the periodic event thread!"); + } + error = pthread_create(&connection_request_thread, NULL, &thread_connection_request_listener, (void *)cwmp); + if (error<0) + { + CWMP_LOG(ERROR,"Error when creating the connection request thread!"); + } + error = pthread_create(&scheduleInform_thread, NULL, &thread_cwmp_rpc_cpe_scheduleInform, (void *)cwmp); + if (error<0) + { + CWMP_LOG(ERROR,"Error when creating the scheduled inform thread!"); + } + thread_wait_sync(); + error = pthread_create(&download_thread, NULL, &thread_cwmp_rpc_cpe_download, (void *)cwmp); + if (error<0) + { + CWMP_LOG(ERROR,"Error when creating the download thread!"); + } + error = pthread_create(&kernel_value_change_thread, NULL, &thread_kernel_api_cwmp_value_change_parameters, NULL); + if (error<0) + { + CWMP_LOG(ERROR,"Error when creating the kernel value change thread!"); + } + error = pthread_create(&lib_value_change_thread, NULL, &thread_lib_api_cwmp_value_change_parameters, NULL); + if (error<0) + { + CWMP_LOG(ERROR,"Error when creating the lib/cli value change thread!"); + } + pthread_join(session_scheduler_thread, NULL); + pthread_join(periodic_event_thread, NULL); + pthread_join(connection_request_thread, NULL); + pthread_join(scheduleInform_thread, NULL); + pthread_join(download_thread, NULL); + pthread_join(kernel_value_change_thread, NULL); + pthread_join(lib_value_change_thread, NULL); +#endif + + CWMP_LOG(INFO,"EXIT CWMP"); + return CWMP_OK; +} diff --git a/src/cwmp_api.c b/src/cwmp_api.c new file mode 100644 index 0000000..a993abb --- /dev/null +++ b/src/cwmp_api.c @@ -0,0 +1,287 @@ +/* + cwmp.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include +#include +#include +#include +#include +#include +#include "soapH.h" +#include "cwmp.h" +#include "dm.h" +#include "dm_rpc.h" +#include "cwmp_kernel.h" +#include "cwmp_lib.h" + +struct event_container *cwmp_add_event_container (struct cwmp *cwmp, int event_idx, char *command_key); + +extern struct cwmp cwmp_main; + +struct api_value_change_thread_input { + struct cwmp *cwmp; + char *path; + struct sub_path *sub_path; + int sub_path_size; +}; + +void *thread_api_cwmp_value_change_parameters (void *v) +{ + struct api_value_change_thread_input *t_input; + struct cwmp *cwmp; + struct event_container *event_container; + int error,i,n=0; + bool is_actif; + + + t_input = (struct api_value_change_thread_input *)v; + cwmp = t_input->cwmp; + pthread_mutex_lock (&(cwmp->api_value_change.mutex)); + error = cwmp_dm_getParameterPaths_by_correspondence(cwmp,t_input->path,t_input->sub_path,t_input->sub_path_size,&(cwmp->api_value_change.parameter_list),&n,FALSE,TRUE,&is_actif); + cwmp->api_value_change.parameter_size += n; + + if (error==FAULT_CPE_NO_FAULT_IDX && is_actif) + { + pthread_mutex_lock (&(cwmp->mutex_session_queue)); + event_container = cwmp_add_event_container (cwmp, EVENT_IDX_4VALUE_CHANGE, ""); + if (event_container == NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return NULL; + } + cwmp_save_event_container (cwmp,event_container); + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + pthread_cond_signal(&(cwmp->threshold_session_send)); + } + + for (i=0;isub_path_size;i++) + { + if (t_input->sub_path[i].dm_indice.indice!=NULL) + { + free(t_input->sub_path[i].dm_indice.indice); + } + } + free(t_input->sub_path); + if (t_input->path!=NULL) + { + free(t_input->path); + } + + free(t_input); + pthread_mutex_unlock (&(cwmp->api_value_change.mutex)); + return NULL; +} + +int api_cwmp_value_change_parameters (int argc, char **argv) +{ + struct cwmp *cwmp = &cwmp_main; + struct api_value_change_thread_input *t_input; + va_list args; + pthread_t thread; + int error; + + if (argc < 1) + { + return CWMP_OK; + } + t_input = calloc (1,sizeof(struct api_value_change_thread_input)); + t_input->sub_path = calloc (DM_MAX_INDICE,sizeof(struct sub_path)); + t_input->cwmp = cwmp; + cwmp_dm_get_sub_indice_path(argc,argv,&(t_input->path),t_input->sub_path,&(t_input->sub_path_size)); + + error = pthread_create(&thread, NULL, &thread_api_cwmp_value_change_parameters, (void *)t_input); + if (error<0) + { + free (t_input->sub_path); + free (t_input); + CWMP_LOG(ERROR,"Error when creating a value change api thread!"); + } + return CWMP_OK; +} + + +/* kernel api */ + +void *thread_kernel_api_cwmp_value_change_parameters (void *v) +{ + int i, argc, sock_fd; + char **argv; + struct sockaddr_nl src_addr, dest_addr; + struct nlmsghdr *nlh = NULL; + struct iovec iov; + struct msghdr msg; + + + sock_fd = socket(PF_NETLINK, SOCK_RAW, NETLINK_USER); + if(sock_fd<0) + { + CWMP_LOG(ERROR,"Error when creating NetLink socket to kernel: Quit kernel value change thread!"); + return NULL; + } + + memset(&src_addr, 0, sizeof(src_addr)); + src_addr.nl_family = AF_NETLINK; + src_addr.nl_pid = getpid(); + bind(sock_fd, (struct sockaddr*)&src_addr, sizeof(src_addr)); + + memset(&dest_addr, 0, sizeof(dest_addr)); + dest_addr.nl_family = AF_NETLINK; + dest_addr.nl_pid = 0; /* For Linux Kernel */ + dest_addr.nl_groups = 0; /* unicast */ + + nlh = (struct nlmsghdr *)malloc(NLMSG_SPACE(NETLINK_MAX_PAYLOAD)); + + + argv = calloc ((DM_MAX_INDICE+1),sizeof(char *)); + + while (1) + { + memset(nlh, 0, NLMSG_SPACE(NETLINK_MAX_PAYLOAD)); + nlh->nlmsg_len = NLMSG_SPACE(NETLINK_MAX_PAYLOAD); + nlh->nlmsg_pid = getpid(); + nlh->nlmsg_flags = 0; + + iov.iov_base = (void *)nlh; + iov.iov_len = nlh->nlmsg_len; + msg.msg_name = (void *)&dest_addr; + msg.msg_namelen = sizeof(dest_addr); + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + strcpy(NLMSG_DATA(nlh), NETLINK_CWMP_ID); + sendmsg(sock_fd,&msg,0); + argc = 0; + while (argc<(DM_MAX_INDICE+1)) + { + + memset(nlh, 0, NLMSG_SPACE(NETLINK_MAX_PAYLOAD)); + nlh->nlmsg_len = NLMSG_SPACE(NETLINK_MAX_PAYLOAD); + nlh->nlmsg_pid = getpid(); + nlh->nlmsg_flags = 0; + + iov.iov_base = (void *)nlh; + iov.iov_len = nlh->nlmsg_len; + msg.msg_name = (void *)&dest_addr; + msg.msg_namelen = sizeof(dest_addr); + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + /* Read message from kernel */ + recvmsg(sock_fd, &msg, 0); + if (strcmp(NLMSG_DATA(nlh),NETLINK_END_DATA)==0) + { + break; + } + if (strcmp(NLMSG_DATA(nlh),NETLINK_NULL)==0) + { + argv[argc] = NULL; + } + else + { + argv[argc] = strdup (NLMSG_DATA(nlh)); + } + + argc++; + } + CWMP_LOG(INFO,"Receive Parameter Value change from Kernel space"); + api_cwmp_value_change_parameters(argc,argv); + for (i=0;i +#include +#include +#include +#include +#include "cwmp_lib.h" + +int lib_api_cwmp_value_change_call (int count, ...) +{ + FILE *fp; + register int i, s, len; + struct sockaddr_un saun; + va_list args; + char *str,buf[256]; + + + if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) + { + printf("[CWMP] Error when creating process from other process: Quit\r\n"); + return 1; + } + + saun.sun_family = AF_UNIX; + strcpy(saun.sun_path, AF_UNIX_ADDRESS); + + len = sizeof(saun.sun_family) + strlen(saun.sun_path); + + if (connect(s, (struct sockaddr *) &saun, len) < 0) + { + printf("[CWMP] Error when creating socket from other process: Quit\r\n"); + return 1; + } + + va_start(args, count); + for (i=0;i +#include +#include +#include +#include +#include "cwmp_lib.h" + +int main (int argc, char **argv) +{ + FILE *fp; + register int i, s, len; + struct sockaddr_un saun; + char buf[256]; + + + if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) + { + printf("[CWMP] Error when creating process from api CLI: Quit\r\n"); + return 1; + } + + saun.sun_family = AF_UNIX; + strcpy(saun.sun_path, AF_UNIX_ADDRESS); + + len = sizeof(saun.sun_family) + strlen(saun.sun_path); + + if (connect(s, (const struct sockaddr *) &saun, len) < 0) + { + printf("[CWMP] Error when creating socket from api CLI: Quit\r\n"); + return 1; + } + printf("[CWMP] Send Value change to the cwmp client from api CLI\r\n"); + for (i=1;i +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cwmp.h" +#include "list.h" +#include "dm.h" +#include +#include + +LIST_HEAD(head_dm_tree); +LIST_HEAD(parameter_handler_list); +LIST_HEAD(object_handler_list); +LIST_HEAD(forced_inform_parameter_list); +static int Depth; +static char last_content[512]; +static char *last_object_name = NULL; +static char *last_tag_name = NULL; +static struct dm_node *node; +static struct dm_node *current_object; +static struct list_data_handler *tmp_handler = NULL; +static struct forced_inform_parameter *forced_inform_parameter = NULL; + +char *TYPE_VALUES_ARRAY [] = +{ + [TYPE_VALUE_string_IDX] = "xsd:string", + [TYPE_VALUE_int_IDX] = "xsd:int", + [TYPE_VALUE_unsignedInt_IDX] = "xsd:unsignedInt", + [TYPE_VALUE_boolean_IDX] = "xsd:boolean", + [TYPE_VALUE_dateTime_IDX] = "xsd:dateTime", + [TYPE_VALUE_base64Binary_IDX] = "xsd:base64Binary", + [TYPE_VALUE_integer_IDX] = "xsd:integer", + [TYPE_VALUE_unsignedByte_IDX] = "xsd:unsignedByte", + [TYPE_VALUE_unsignedLong_IDX] = "xsd:unsignedLong", + [TYPE_VALUE_unsignedShort_IDX] = "xsd:unsignedShort", + [TYPE_VALUE_anyURI_IDX] = "xsd:anyURI", + [TYPE_VALUE_byte_IDX] = "xsd:byte", + [TYPE_VALUE_date_IDX] = "xsd:date", + [TYPE_VALUE_time_IDX] = "xsd:time", + [TYPE_VALUE_decimal_IDX] = "xsd:decimal", + [TYPE_VALUE_double_IDX] = "xsd:double", + [TYPE_VALUE_duration_IDX] = "xsd:duration", + [TYPE_VALUE_ENTITIES_IDX] = "xsd:ENTITIES", + [TYPE_VALUE_ENTITY_IDX] = "xsd:ENTITY", + [TYPE_VALUE_float_IDX] = "xsd:float", + [TYPE_VALUE_gDay_IDX] = "xsd:gDay", + [TYPE_VALUE_gMonth_IDX] = "xsd:gMonth", + [TYPE_VALUE_gMonthDay_IDX] = "xsd:gMonthDay", + [TYPE_VALUE_gYear_IDX] = "xsd:gYear", + [TYPE_VALUE_gYearMonth_IDX] = "xsd:gYearMonth", + [TYPE_VALUE_hexBinary_IDX] = "xsd:hexBinary", + [TYPE_VALUE_ID_IDX] = "xsd:ID", + [TYPE_VALUE_IDREF_IDX] = "xsd:IDREF", + [TYPE_VALUE_IDREFS_IDX] = "xsd:IDREFS", + [TYPE_VALUE_language_IDX] = "xsd:language", + [TYPE_VALUE_long_IDX] = "xsd:long", + [TYPE_VALUE_Name_IDX] = "xsd:Name", + [TYPE_VALUE_NCName_IDX] = "xsd:NCName", + [TYPE_VALUE_negativeInteger_IDX] = "xsd:negativeInteger", + [TYPE_VALUE_NMTOKEN_IDX] = "xsd:NMTOKEN", + [TYPE_VALUE_NMTOKENS_IDX] = "xsd:NMTOKENS", + [TYPE_VALUE_nonNegativeInteger_IDX] = "xsd:nonNegativeInteger", + [TYPE_VALUE_nonPositiveInteger_IDX] = "xsd:nonPositiveInteger", + [TYPE_VALUE_normalizedString_IDX] = "xsd:normalizedString", + [TYPE_VALUE_NOTATION_IDX] = "xsd:NOTATION", + [TYPE_VALUE_positiveInteger_IDX] = "xsd:positiveInteger", + [TYPE_VALUE_QName_IDX] = "xsd:QName", + [TYPE_VALUE_short_IDX] = "xsd:short", + [TYPE_VALUE_token_IDX] = "xsd:token" +}; + +int dm_get_csv_data(char *data, int ns, char ***T) +{ + char **s, *p, *t, *pch; + s = calloc (ns,sizeof(char *)); + assert (s); + *T = s; + p = strdup (data); + t = p; + pch = strtok (p,","); + while (pch != NULL) + { + *s = strdup(pch); + s++; + pch = strtok (NULL, ","); + } + free(t); + return DM_OK; +} + +int dm_get_xml_map (char *data, struct dm_map *dm_map) +{ + + char **T, *p, *pch, *t, *t2; + unsigned short i,n=0; + + p = strdup(data); + t = p; + while (t=strchr(t+1,',')) + { + n++; + } + if (n>0) n++; + T = calloc(n,sizeof(char *)); + assert(T); + dm_map->size = n; + dm_map->map = T; + t = p; + pch = strtok (p,","); + while (pch != NULL) + { + *T = strdup(pch); + T++; + pch = strtok (NULL, ","); + } + free(t); + return DM_OK; +} + +int dm_get_xml_data (char *data, struct dm_data *dm_data) +{ + + char ***T, *p, *pch, *t, *s; + unsigned short i,ns=0,nT=0; + + if (data==NULL||data[0]==0) + { + return DM_OK; + } + + p = strdup(data); + t = p; + + while (t=strchr(t+1,';')) + { + nT++; + } + nT++; + t = p; + dm_data->line_size = nT; + T = calloc(nT,sizeof(char **)); + assert (T); + dm_data->data = T; + pch = strtok (p,";"); + for (i=0;icolumn_size = ns; + } + dm_get_csv_data (pch,ns,T); + pch = strtok (pch+strlen(pch)+1, ";"); + } + free(t); + return DM_OK; +} + +int dm_get_system_data_array(char *cmd, struct dm_data *dm_data) +{ + + char ***T, **buf[256], *p, *t; + unsigned short i,ns=0,nT=0; + FILE *fp; + char line[256]; + char error; + fd_set set; + struct timeval timeout; + + FD_ZERO(&set); + timeout.tv_sec = SYSTEM_CMD_TIMEOUT; + + fp=popen(cmd,"r"); + if (fp==NULL) + { + return DM_ERR; + } + FD_SET(fileno(fp), &set); + if (select(FD_SETSIZE, &set, NULL, NULL, &timeout)!=1) + { + fp=popen("\n","r"); + pclose(fp); + return DM_ERR; + } + line[0] = 0; + while(fgets(line,sizeof(line),fp)) + { + t = line; + t = strtok(t,"\r\n"); + if(line[0]==0) + { + continue; + } + if (ns==0) + { + while (t=strchr(t+1,',')) + { + ns++; + } + ns++; + dm_data->column_size = ns; + } + dm_get_csv_data (line,ns,&buf[nT]); + nT++; + line[0] = 0; + } + error = pclose(fp); + if (nT!=0) + { + T = calloc(nT,sizeof(char **)); + assert (T); + dm_data->data = T; + dm_data->line_size = nT; + memcpy(T,buf,nT*sizeof(char **)); + } + + if(error == 0) + { + return DM_OK; + } + else + { + return DM_ERR; + } +} +int dm_free_data_array(struct dm_data *dm_data) +{ + char ***T,**s; + unsigned short nT,ns,i,j; + if(dm_data==NULL) + { + return DM_OK; + } + T = dm_data->data; + nT = dm_data->line_size; + ns = dm_data->column_size; + if (T==NULL) + { + return DM_OK; + } + for (i=0;idata); + free(dm_data); + return DM_OK; +} + +int dm_get_system_data(char *cmd, char **ret) +{ + + FILE *fp; + int size=8191; + char buffer[8192]; + int error; + fd_set set; + struct timeval timeout; + + FD_ZERO(&set); + timeout.tv_sec = SYSTEM_CMD_TIMEOUT; + + buffer[0]=0; + fp=popen(cmd,"r"); + if (fp==NULL) + { + return DM_ERR; + } + FD_SET(fileno(fp), &set); + if (select(FD_SETSIZE, &set, NULL, NULL, &timeout)!=1) + { + fp=popen("\n","r"); + pclose(fp); + return DM_ERR; + } + size = fread (buffer,1,size,fp); + if (size>1 && (buffer[size-2]=='\r' || buffer[size-2]=='\n')) + { + buffer[size-2]=0; + } + else if (size>0 && (buffer[size-1]=='\r' || buffer[size-1]=='\n')) + { + buffer[size-1]=0; + } + else + { + buffer[size]=0; + } + *ret = strdup(buffer); + error = pclose(fp); + + if(error == 0) + { + return DM_OK; + } + else + { + return DM_ERR; + } +} +int dm_call_system_cmd(char *cmd) +{ + + FILE *fp; + int error; + + fp=popen(cmd,"r"); + if (fp==NULL) + { + return DM_ERR; + } + error = pclose(fp); + + if(error == 0) + { + return DM_OK; + } + else + { + return DM_ERR; + } +} + + +long int get_xml_file_size(FILE *pFile) +{ + long int size; + + if(pFile!=NULL) + { + fseek (pFile, 0, SEEK_END); + + size = ftell (pFile); + rewind(pFile); + return size; + } + return 0; +} + +int dm_add_node(struct dm_node *node) +{ + struct list_head *ilist; + struct list_head *jlist; + char *path = NULL; + char object_name[512]; + struct dm_node *inode = NULL; + struct dm_node *jnode = NULL; + int error = DM_OK; + int size; + + if(last_object_name == NULL) + { + return DM_GEN_ERR; + } + if(node->type == DM_OBJECT) + { + size = strlen(last_object_name); + strcpy(object_name,last_object_name); + object_name[size] = '\0'; + } + else + { + size = strlen(last_object_name) + strlen(node->name); + strcpy(object_name,last_object_name); + strcat(object_name,node->name); + object_name[size] = '\0'; + } + path = object_name; + path = strtok (path,"."); + if(head_dm_tree.next != &head_dm_tree) + { + __list_for_each(ilist, &(head_dm_tree)) + { + inode = (struct dm_node *) list_entry (ilist, struct dm_node, list); + + if((inode != NULL)&&((inode->type == DM_OBJECT)||(inode->type == DM_INSTANCE))&&(strcmp(inode->name,path) == 0)) + { + do + { + path = strtok (NULL, "."); + if((path != NULL)&&(strcmp(path,"{i}") == 0)) + { + path = strtok (NULL, "."); + } + if(path == NULL) + { + return DM_GEN_ERR; + } + + __list_for_each(jlist, &(inode->head_child)) + { + jnode = (struct dm_node *) list_entry (jlist, struct dm_node, list); + + if((jnode != NULL)&&((jnode->type == DM_OBJECT)||(jnode->type == DM_INSTANCE))&&(strcmp(path,jnode->name) == 0)) + { + inode = jnode; + break; + } + } + } + while((jnode != NULL)&&(strcmp(path,jnode->name) == 0)); + + if((inode->type == DM_OBJECT)||(inode->type == DM_INSTANCE)) + { + list_add_tail(&(node->list), &(inode->head_child)); + } + if((path != NULL)&&(node->type == DM_OBJECT)) + { + node->name = strdup(path); + } + goto finally; + } + } + list_add_tail(&(node->list), &(head_dm_tree)); + if((path != NULL)&&(node->type == DM_OBJECT)) + { + node->name = strdup(path); + } + } + else + { + list_add_tail(&(node->list), &(head_dm_tree)); + if((path != NULL)&&(node->type == DM_OBJECT)) + { + node->name = strdup(path); + } + } + +finally: + if(path != NULL) + { + path = strtok (NULL, "."); + if(path != NULL) + { + if((node->type == DM_OBJECT)&&(strcmp(path,"{i}") == 0)) + { + node->type = DM_INSTANCE; + } + else + { + error = DM_GEN_ERR; + } + } + } + else + { + error = DM_GEN_ERR; + } + return error; +} + +int dm_free_node (struct dm_node *node) +{ + char *pstruct_dm_regexp; + char *pstruct_dm_string; + char *pstruct_dm_debug; + char *pstruct_dm_default_value; + struct dm_uci *pstruct_dm_uci; + struct dm_system *pstruct_dm_system; + struct dm_correspondence *pstruct_dm_correspondence; + struct data_handler **data_handler; + char **dm_map,**el; + char ***dm_data; + int k; + unsigned short i,j; + + if(node != NULL) + { + + if(node->name != NULL) + { + free(node->name); + } + for(i=0; isize_data_handler; i++) + { + if(data_handler[i] != NULL) + { + switch(data_handler[i]->type) + { + case DM_CORRESPONDENCE: + pstruct_dm_correspondence = (struct dm_correspondence *)data_handler[i]->handler; + if(pstruct_dm_correspondence != NULL) + { + if(pstruct_dm_correspondence->dm_data != NULL) + { + dm_data = pstruct_dm_correspondence->dm_data->data; + for (j=0;jdm_data->line_size;j++) + { + for (j=0;jdm_data->column_size;j++) + { + el = *dm_data; + if(*el != NULL) + { + free(*el); + } + el++; + } + } + free(pstruct_dm_correspondence->dm_data); + } + if(pstruct_dm_correspondence->dm_map != NULL) + { + dm_map = pstruct_dm_correspondence->dm_map->map; + for (j=0;jdm_map->size;j++) + { + if(dm_map[j] != NULL) + { + free(dm_map[j]); + } + } + free(pstruct_dm_correspondence->dm_map); + } + free(pstruct_dm_correspondence); + } + break; + case DM_SYSTEM: + pstruct_dm_system = (struct dm_system *)data_handler[i]->handler; + if(pstruct_dm_system != NULL) + { + if(pstruct_dm_system->cmd != NULL) + { + free(pstruct_dm_system->cmd); + } + if(pstruct_dm_system->dm_map != NULL) + { + dm_map = pstruct_dm_system->dm_map->map; + for (j=0;jdm_map->size;j++) + { + if(dm_map[j] != NULL) + { + free(dm_map[j]); + } + } + free(pstruct_dm_system->dm_map); + } + free(pstruct_dm_system); + } + break; + case DM_UCI: + pstruct_dm_uci = (struct dm_uci *)data_handler[i]->handler; + if(pstruct_dm_uci != NULL) + { + if(pstruct_dm_uci->cmd != NULL) + { + free(pstruct_dm_uci->cmd); + } + free(pstruct_dm_uci); + } + break; + case DM_DEBUG: + pstruct_dm_debug = (char *)data_handler[i]->handler; + if(pstruct_dm_debug != NULL) + { + free(pstruct_dm_debug); + } + break; + case DM_STRING: + pstruct_dm_string = (char *)data_handler[i]->handler; + if(pstruct_dm_string != NULL) + { + free(pstruct_dm_string); + } + break; + case DM_DEFAULT_VALUE: + pstruct_dm_default_value = (char *)data_handler[i]->handler; + if(pstruct_dm_default_value != NULL) + { + free(pstruct_dm_default_value); + } + break; + case DM_REGEXP: + pstruct_dm_regexp = (char *)data_handler[i]->handler; + if(pstruct_dm_regexp != NULL) + { + free(pstruct_dm_regexp); + } + break; + } + } + free(data_handler[i]); + } + free(node); + } + return DM_OK; +} + +int dm_get_handler(struct dm_node *node,struct list_head *list) +{ + bool contain_get = FALSE; + struct dm_system *pstruct_dm_system; + struct data_handler **data_handler; + struct list_data_handler *idata_handler; + char name[512]; + struct dm_node *tmp_dm_head; + + if(!list_empty(list)) + { + data_handler = calloc(node->size_data_handler,sizeof(struct data_handler*)); + node->data_handler = data_handler; + } + while(!list_empty(list)) + { + idata_handler = list_entry (list->next, struct list_data_handler, list); + + if(idata_handler != NULL) + { + *data_handler = idata_handler->data_handler; + switch(idata_handler->data_handler->type) + { + case DM_SYSTEM: + pstruct_dm_system = (struct dm_system *)idata_handler->data_handler->handler; + switch(pstruct_dm_system->type) + { + case DM_GET: + contain_get = TRUE; + break; + case DM_SET: + break; + case DM_APPLY: + break; + } + break; + case DM_UCI: + contain_get = TRUE; + break; + case DM_STRING: + contain_get = TRUE; + break; + case DM_DEFAULT_VALUE: + contain_get = TRUE; + break; + } + data_handler++; + list_del(list->next); + if(idata_handler != NULL) + { + free(idata_handler); + idata_handler = NULL; + } + } + } + if(node->type == DM_PARAMETER) + { + if((node->size_data_handler == 0) || (contain_get == FALSE)) + { + DM_LOG(DEBUG,"PARAMETER:loading:NO :%s%s",last_object_name,node->name); + if(forced_inform_parameter != NULL) + { + if(forced_inform_parameter->name != NULL) + { + free(forced_inform_parameter->name); + } + free(forced_inform_parameter); + forced_inform_parameter = NULL; + } + dm_free_node(node); + } + else + { + dm_add_node(node); + if(forced_inform_parameter != NULL) + { + list_add_tail(&(forced_inform_parameter->list),&(forced_inform_parameter_list)); + } + name[0] = 0; + while(!list_empty(&head_dm_tree)) + { + tmp_dm_head = (struct dm_node *) list_entry (head_dm_tree.next, struct dm_node, list); + if(strstr(last_object_name,tmp_dm_head->name) != NULL) + { + break; + } + } + if(node->active_notify.force_default_enabled) + { + sprintf(name,"%s%s",last_object_name,node->name); + if(cwmp_check_notification(name,UCI_NOTIFICATION_PASSIVE_PATH) == CWMP_OK && + cwmp_check_notification(name,UCI_NOTIFICATION_DENIED_PATH) == CWMP_OK) + { + cwmp_apply_active_notification(node,name, xsd__boolean__true_); + } + tmp_dm_head->active_notify.force_default_enabled = TRUE; + } + if(node->active_notify.force_enabled) + { + sprintf(name,"%s%s",last_object_name,node->name); + cwmp_apply_active_notification(node,name, xsd__boolean__true_); + tmp_dm_head->active_notify.force_enabled = TRUE; + } + if(node->active_notify.can_deny) + { + tmp_dm_head->active_notify.can_deny = TRUE; + } + DM_LOG(DEBUG,"PARAMETER:loading:YES:%s%s",last_object_name,node->name); + } + } + return DM_OK; +} + +void start_hndl(void *data, const char *el, const char **attr) +{ + int i,j,type_idx = 0; + struct data_handler **data_handler; + struct list_data_handler *idata_handler; + struct list_head *ilist; + struct dm_uci *pstruct_dm_uci; + struct dm_system *pstruct_dm_system; + char forced_inform_name[256]; + + if((last_object_name == NULL) && + ((strcmp(el,"parameter") == 0) || + (strcmp(el,"system") == 0) || + (strcmp(el,"uci") ==0) || +#ifdef WITH_DM_XML_DEBUG + (strcmp(el,"debug") == 0) || +#endif + (strcmp(el,"correspondence") == 0) || + (strcmp(el,"string") == 0))) + { + DM_LOG(ERROR,"data model xml file not well formed"); + exit(EXIT_FAILURE); + } + if((strcmp(el,"object") == 0)||(strcmp(el,"parameter") == 0)) + { + if(strcmp(el,"object") == 0) + { + node = calloc(1,sizeof(struct dm_node)); + INIT_LIST_HEAD(&(node->head_child)); + current_object = node; + } + if(strcmp(el,"parameter") == 0) + { + node = (struct dm_node *) calloc(1,sizeof(struct dm_node_leaf)); + } + node->size_data_handler = 0; + for (i = 0; attr[i]; i += 2) + { + if(strcmp(attr[i],"name") == 0) + { + if(strcmp(el,"object") == 0) + { + last_object_name = strdup(attr[i + 1]); + node->name = NULL; + node->type = DM_OBJECT; + } + if(strcmp(el,"parameter") == 0) + { + node->name = strdup(attr[i + 1]); + node->type = DM_PARAMETER; + } + } + if(strcmp(attr[i],"access") == 0) + { + if(strcmp(el,"object") == 0) + { + if(strcmp(attr[i + 1],"readOnly") == 0) + { + node->permission = DM_PRESENT; + } + if(strcmp(attr[i + 1],"readWrite") == 0) + { + node->permission = DM_CREATE; + } + } + if(strcmp(el,"parameter") == 0) + { + if(strcmp(attr[i + 1],"readOnly") == 0) + { + node->permission = DM_READ; + } + if(strcmp(attr[i + 1],"readWrite") == 0) + { + node->permission = DM_READ_WRITE; + } + } + } + if(strcmp(attr[i],"defaultValue") == 0) + { + tmp_handler = calloc(1,sizeof(struct list_data_handler)); + + if(tmp_handler != NULL) + { + tmp_handler->data_handler = calloc(1,sizeof(struct data_handler)); + if(node == current_object) + { + list_add_tail(&(tmp_handler->list),&(object_handler_list)); + } + else + { + list_add_tail(&(tmp_handler->list),&(parameter_handler_list)); + } + } + tmp_handler->data_handler->type = DM_DEFAULT_VALUE; + tmp_handler->data_handler->handler = (void *)strdup(attr[i + 1]); + node->size_data_handler++; + } + if(strcmp(attr[i],"regExp") == 0) + { + tmp_handler = calloc(1,sizeof(struct list_data_handler)); + + if(tmp_handler != NULL) + { + tmp_handler->data_handler = calloc(1,sizeof(struct data_handler)); + if(node == current_object) + { + list_add_tail(&(tmp_handler->list),&(object_handler_list)); + } + else + { + list_add_tail(&(tmp_handler->list),&(parameter_handler_list)); + } + } + tmp_handler->data_handler->type = DM_REGEXP; + tmp_handler->data_handler->handler = (void *)strdup(attr[i + 1]); + node->size_data_handler++; + } + if(strcmp(attr[i],"forcedInform") == 0) + { + if(strcmp(el,"parameter") == 0) + { + if(strcmp(attr[i + 1],"true") == 0) + { + forced_inform_parameter = calloc(1,sizeof(struct forced_inform_parameter)); + if(forced_inform_parameter != NULL) + { + sprintf(forced_inform_name,"%s%s",last_object_name,node->name); + forced_inform_parameter->name = strdup(forced_inform_name); + forced_inform_parameter->node = (struct dm_node_leaf *)node; + } + } + } + } + if(strcmp(attr[i],"activeNotify") == 0) + { + if(strcmp(attr[i + 1],"forceDefaultEnabled") == 0) + { + node->active_notify.force_default_enabled = TRUE; + if(node->type == DM_PARAMETER) + { + current_object->active_notify.force_default_enabled = TRUE; + } + } + else if(strcmp(attr[i + 1],"forceEnabled") == 0) + { + node->active_notify.force_enabled = TRUE; + if(node->type == DM_PARAMETER) + { + current_object->active_notify.force_enabled = TRUE; + } + } + else if(strcmp(attr[i + 1],"canDeny") == 0) + { + node->active_notify.can_deny = TRUE; + if(node->type == DM_PARAMETER) + { + current_object->active_notify.can_deny = TRUE; + } + } + } + if(strcmp(attr[i],"type") == 0) + { + if(node->type == DM_PARAMETER) + { + struct dm_node_leaf *leaf = (struct dm_node_leaf *)node; + for (j=0;jvalue_type = type_idx; + } + } + } + } + if( (strcmp(el,"system") == 0) || + (strcmp(el,"uci") ==0) || +#ifdef WITH_DM_XML_DEBUG + (strcmp(el,"debug") == 0) || +#endif + (strcmp(el,"correspondence") == 0) || + (strcmp(el,"string") == 0)) + { + tmp_handler = calloc(1,sizeof(struct list_data_handler)); + + if(tmp_handler != NULL) + { + tmp_handler->data_handler = calloc(1,sizeof(struct data_handler)); + if(node == current_object) + { + list_add_tail(&(tmp_handler->list),&(object_handler_list)); + } + else + { + list_add_tail(&(tmp_handler->list),&(parameter_handler_list)); + } + } + if(last_tag_name != NULL) + { + DM_LOG(ERROR,"data model xml file not well formed"); + exit(EXIT_FAILURE); + } + else + { + last_tag_name = strdup(el); + } + node->size_data_handler++; + + } + if(strcmp(el,"system") == 0) + { + if(tmp_handler->data_handler != NULL) + { + tmp_handler->data_handler->type = DM_SYSTEM; + tmp_handler->data_handler->handler = (void *)calloc(1,sizeof(struct dm_system)); + } + + pstruct_dm_system = (struct dm_system *)tmp_handler->data_handler->handler; + /* + * Setting SYSTEM default values + */ + pstruct_dm_system->type = DM_GET; + pstruct_dm_system->reboot_required = FALSE; + pstruct_dm_system->end_session = FALSE; + for (i = 0; attr[i]; i += 2) + { + if(strcmp(attr[i],"type") == 0) + { + if(strcmp(attr[i+1],"get") == 0) + { + pstruct_dm_system->type = DM_GET; + } + if(strcmp(attr[i+1],"set") == 0) + { + pstruct_dm_system->type = DM_SET; + } + if(strcmp(attr[i+1],"apply") == 0) + { + pstruct_dm_system->type = DM_APPLY; + } + if(strcmp(attr[i+1],"cancel") == 0) + { + pstruct_dm_system->type = DM_CANCEL; + } + if(strcmp(attr[i+1],"addObject") == 0) + { + pstruct_dm_system->type = DM_ADD; + } + if(strcmp(attr[i+1],"deleteObject") == 0) + { + pstruct_dm_system->type = DM_DEL; + } + } + if(strcmp(attr[i],"rebootRequired") == 0) + { + if(strcmp(attr[i+1],"false") == 0) + { + pstruct_dm_system->reboot_required = FALSE; + } + if(strcmp(attr[i+1],"true") == 0) + { + pstruct_dm_system->reboot_required = TRUE; + } + } + if(strcmp(attr[i],"endSession") == 0) + { + if(strcmp(attr[i+1],"false") == 0) + { + pstruct_dm_system->end_session = FALSE; + } + if(strcmp(attr[i+1],"true") == 0) + { + pstruct_dm_system->end_session = TRUE; + } + } + } + } + if(strcmp(el,"uci") == 0) + { + if(tmp_handler->data_handler != NULL) + { + tmp_handler->data_handler->type = DM_UCI; + tmp_handler->data_handler->handler = (void *)calloc(1,sizeof(struct dm_uci)); + } + + pstruct_dm_uci = (struct dm_uci *)tmp_handler->data_handler->handler; + /* + * Setting UCI default values + */ + pstruct_dm_uci->reboot_required = FALSE; + pstruct_dm_uci->end_session = FALSE; + for (i = 0; attr[i]; i += 2) + { + if(strcmp(attr[i],"rebootRequired") == 0) + { + if(strcmp(attr[i+1],"false") == 0) + { + pstruct_dm_uci->reboot_required = FALSE; + } + if(strcmp(attr[i+1],"true") == 0) + { + pstruct_dm_uci->reboot_required = TRUE; + } + } + if(strcmp(attr[i],"endSession") == 0) + { + if(strcmp(attr[i+1],"false") == 0) + { + pstruct_dm_uci->end_session = FALSE; + } + if(strcmp(attr[i+1],"true") == 0) + { + pstruct_dm_uci->end_session = TRUE; + } + } + } + } +#ifdef WITH_DM_XML_DEBUG + if(strcmp(el,"debug") == 0) + { + if(tmp_handler->data_handler != NULL) + { + tmp_handler->data_handler->type = DM_DEBUG; + } + } +#endif + if(strcmp(el,"correspondence") == 0) + { + if(tmp_handler->data_handler != NULL) + { + tmp_handler->data_handler->type = DM_CORRESPONDENCE; + tmp_handler->data_handler->handler = (void *)calloc(1,sizeof(struct dm_correspondence)); + } + } + if(strcmp(el,"string") == 0) + { + if(tmp_handler->data_handler != NULL) + { + tmp_handler->data_handler->type = DM_STRING; + } + } + if(strcmp(el,"object") == 0) + { + dm_add_node(node); + DM_LOG(DEBUG,"OBJECT :loading:YES:%s",last_object_name); + } + Depth++; +} + +void end_hndl(void *data, const char *el) +{ + struct dm_data *dm_data=NULL; + struct dm_map *dm_map=NULL; + char *pstruct_dm_string; + char *pstruct_dm_debug; + struct dm_uci *pstruct_dm_uci; + struct dm_system *pstruct_dm_system; + struct dm_correspondence *pstruct_dm_correspondence; + + if(strcmp(el,"parameter") == 0) + { + dm_get_handler(node,¶meter_handler_list); + node = current_object; + forced_inform_parameter = NULL; + } + if(strcmp(el,"object") == 0) + { + if(last_object_name != NULL) + { + free(last_object_name); + last_object_name = NULL; + } + dm_get_handler(node,&object_handler_list); + node = NULL; + current_object = NULL; + } + if(tmp_handler != NULL) + { +#ifdef WITH_DM_XML_DEBUG + if(strcmp(el,"debug") == 0) + { + if((last_tag_name != NULL)&&(strcmp(el,last_tag_name) == 0)) + { + tmp_handler->data_handler->handler = (void *)strdup(last_content); + DM_XML_LOG(INFO,"%s",last_content); + } + else + { + DM_LOG(ERROR,"data model xml file not well formed"); + exit(EXIT_FAILURE); + } + } +#endif + if(strcmp(el,"string") == 0) + { + if((last_tag_name != NULL)&&(strcmp(el,last_tag_name) == 0)) + { + tmp_handler->data_handler->handler = (void *)strdup(last_content); + } + else + { + DM_LOG(ERROR,"data model xml file not well formed"); + exit(EXIT_FAILURE); + } + } + if(strcmp(el,"cmd") == 0) + { + if((last_tag_name != NULL)&&((strcmp(last_tag_name,"uci") == 0)||(strcmp(last_tag_name,"system") == 0))) + { + if(tmp_handler->data_handler->type == DM_UCI) + { + pstruct_dm_uci = (struct dm_uci *)tmp_handler->data_handler->handler; + pstruct_dm_uci->cmd = strdup(last_content); + } + if(tmp_handler->data_handler->type == DM_SYSTEM) + { + pstruct_dm_system = (struct dm_system *)tmp_handler->data_handler->handler; + pstruct_dm_system->cmd = strdup(last_content); + } + } + else + { + DM_LOG(ERROR,"data model xml file not well formed"); + exit(EXIT_FAILURE); + } + + } + + if(strcmp(el,"data") == 0) + { + if((last_tag_name != NULL)&&(strcmp(last_tag_name,"correspondence") == 0)) + { + if(tmp_handler->data_handler->type == DM_CORRESPONDENCE) + { + pstruct_dm_correspondence = (struct dm_correspondence *)tmp_handler->data_handler->handler; + dm_data = calloc(1,sizeof(struct dm_data)); + if(dm_data != NULL) + { + dm_get_xml_data(last_content,dm_data); + pstruct_dm_correspondence->dm_data = dm_data; + } + } + } + else + { + DM_LOG(ERROR,"data model xml file not well formed"); + exit(EXIT_FAILURE); + } + } + + if(strcmp(el,"map") == 0) + { + if((last_tag_name != NULL)&&((strcmp(last_tag_name,"correspondence") == 0)||(strcmp(last_tag_name,"system") == 0))) + { + if(tmp_handler->data_handler->type == DM_SYSTEM) + { + pstruct_dm_system = (struct dm_system *)tmp_handler->data_handler->handler; + dm_map = calloc(1,sizeof(struct dm_map)); + if(dm_map != NULL) + { + dm_get_xml_map(last_content,dm_map); + pstruct_dm_system->dm_map = dm_map; + } + } + if(tmp_handler->data_handler->type == DM_CORRESPONDENCE) + { + pstruct_dm_correspondence = (struct dm_correspondence *)tmp_handler->data_handler->handler; + dm_map = calloc(1,sizeof(struct dm_map)); + if(dm_map != NULL) + { + dm_get_xml_map(last_content,dm_map); + pstruct_dm_correspondence->dm_map = dm_map; + } + } + } + else + { + DM_LOG(ERROR,"data model xml file not well formed"); + exit(EXIT_FAILURE); + } + } + } + if( (strcmp(el,"system") == 0) || + (strcmp(el,"uci") ==0) || +#ifdef WITH_DM_XML_DEBUG + (strcmp(el,"debug") == 0) || +#endif + (strcmp(el,"correspondence") == 0) || + (strcmp(el,"string") == 0)) + { + switch(tmp_handler->data_handler->type) + { + case DM_SYSTEM: + pstruct_dm_system = (struct dm_system *)tmp_handler->data_handler->handler; + if(pstruct_dm_system->cmd == NULL) + { + DM_LOG(ERROR,"data model xml file not well formed"); + exit(EXIT_FAILURE); + } + break; + case DM_UCI: + pstruct_dm_uci = (struct dm_uci *)tmp_handler->data_handler->handler; + if(pstruct_dm_uci->cmd == NULL) + { + DM_LOG(ERROR,"data model xml file not well formed"); + exit(EXIT_FAILURE); + } + break; + case DM_CORRESPONDENCE: + pstruct_dm_correspondence = (struct dm_correspondence *)tmp_handler->data_handler->handler; + if((pstruct_dm_correspondence->dm_data == NULL)||(pstruct_dm_correspondence->dm_map == NULL)) + { + DM_LOG(ERROR,"data model xml file not well formed"); + exit(EXIT_FAILURE); + } + break; + case DM_STRING: + pstruct_dm_string = (char *)tmp_handler->data_handler->handler; + if(pstruct_dm_string == NULL) + { + DM_LOG(ERROR,"data model xml file not well formed"); + exit(EXIT_FAILURE); + } + break; + case DM_DEBUG: + pstruct_dm_debug = (char *)tmp_handler->data_handler->handler; + if(pstruct_dm_debug == NULL) + { + DM_LOG(ERROR,"data model xml file not well formed"); + exit(EXIT_FAILURE); + } + break; + } + tmp_handler = NULL; + if(last_tag_name != NULL) + { + free(last_tag_name); + last_tag_name = NULL; + } + } + Depth--; +} + +void char_hndl(void *data, const char *content,int length) +{ + char tmp[512]; + int i = 0,n = 0; + + if(length!=0) + { + strncpy(tmp, content, length); + tmp[length] = '\0'; + while(irm_eo; + } + regfree(regex); + free(regex); + if((result->rm_so == 0)&&(result->rm_eo == strlen(pch))) + { + return DM_OK; + } + return DM_GEN_ERR; +} + +/*********************************************************************************************/ +/** browse tree **/ +/*********************************************************************************************/ + +int is_numeric(const char *p) +{ + if (*p) + { + char c; + while ((c=*p++)) + { + if (!isdigit(c)) return 0; + } + return 1; + } + return 0; +} + +static int get_data_array_by_column (struct dm_index_path *index_path, + int pos_xp, + struct dm_data **data, + unsigned short *ic, + char *map_column) +{ + struct dm_data *d; + struct dm_map *m; + unsigned short i; + m = index_path[pos_xp].map; + d = index_path[pos_xp].data; + if (m==NULL||d==NULL) + { + *data = NULL; + *ic = 0; + return 1; + } + for (i=0;isize;i++) + { + if (strcmp(map_column,m->map[i])==0) + { + *ic=i; + if (icolumn_size) + { + *data = d; + return 0; + } + else + { + *data = NULL; + return 1; + } + } + } + *data = NULL; + return 1; +} + + +static int get_data_array_correspondence ( struct dm_index_path *index_path, + int pos_xp, + char *map_corr, + char *corr) +{ + struct dm_data *d; + unsigned short i,ic,mc,error; + struct dm_index_path *exp; + exp = &index_path[pos_xp]; + if (error = get_data_array_by_column (index_path,pos_xp,&d,&ic,"index")) + { + return error; + } + if (error = get_data_array_by_column (index_path,pos_xp,&d,&mc,map_corr)) + { + return error; + } + for (i=0;iline_size;i++) + { + if (strcmp(exp->index,d->data[i][ic])==0) + { + strcpy(corr,d->data[i][mc]); + return 0; + } + } + return 1; +} + +static int check_index_exist(struct dm_index_path *index_path, + int pos_xp, + char *index) +{ + struct dm_data *d; + unsigned short i,ic,error; + struct dm_index_path *exp; + exp = &index_path[pos_xp]; + if (error = get_data_array_by_column (index_path,pos_xp,&d,&ic,"index")) + { + return error; + } + for (i=0;iline_size;i++) + { + if (strcmp(index,d->data[i][ic])==0) + { + exp->indice = i; + return 0; + } + } + return 1; +} + +int get_string_correspondence (char *ret, char *src, struct dm_index_path *index_path, int pos_xp) +{ + char *t,*pch,*s,*is; + char corr[128]; + int i,len,error = 0; + + ret[0] = 0; + s = src; + is = src; + if (index_path==NULL) + { + strcpy(ret,src); + return 0; + } + while (s=strchr(s,'$')) + { + len = strlen(ret); + if ((s-is)<0) + { + return 1; + } + memcpy(ret+len,is,s-is); + ret[len+s-is] = 0; + s++; + is = s; + pch = strdup(s); + t = pch; + pch = strtok(pch,"{"); + if (pch==NULL) + { + free(t); + return 1; + } + is = is + strlen(pch) +1; + i = atoi(pch); + if (i<1) + { + free(t); + return 1; + } + pch = strtok(NULL,"}"); + if (pch==NULL) + { + free(t); + return 1; + } + is = is + strlen(pch) +1; + if (error = get_data_array_correspondence (index_path,i-1,pch,corr)) + { + free(t); + return error; + } + strcat(ret,corr); + free(t); + } + if ((is-src)node = node; + enp->index_path = NULL; + *pos_np +=1; + return DM_OK; +} + +int free_element_node_path (struct dm_node_path *node_path, int *pos_np, int *pos_xp) +{ + struct dm_node_path *enp; + struct dm_index_path *exp; + + *pos_np -=1; + enp = &node_path[*pos_np]; + exp = enp->index_path; + + if (exp!=NULL) + { + free_element_index_path(exp,pos_xp); + } + memset(enp,0,sizeof(struct dm_node_path)); + return DM_OK; +} + +int free_element_index_path (struct dm_index_path *exp, int *pos_xp) +{ + *pos_xp -=1; + if (exp->data!=NULL && exp->data_type == DM_SYSTEM_DATA) + { + dm_free_data_array(exp->data); + } + if (exp->index!=NULL) + { + free(exp->index); + } + + memset(exp,0,sizeof(struct dm_index_path)); + return DM_OK; +} + +int free_all_index_path (struct dm_index_path *index_path) +{ + int i; + struct dm_index_path *exp; + for (i=0;idata!=NULL && exp->data_type == DM_SYSTEM_DATA) + { + dm_free_data_array(exp->data); + } + if (exp->index!=NULL) + { + free(exp->index); + } + } + return DM_OK; +} + + +int add_element_index_path (struct dm_node *node, + struct dm_node_path *node_path, + int *pos_np, + struct dm_index_path *index_path, + int *pos_xp, + char *index, + int indice) +{ + struct dm_node_path *enp; + struct dm_index_path *exp; + struct data_handler **data_handler; + __u8 i,size_dh; + char cmd[256]; + + enp = &node_path[(*pos_np)-1]; + + if (node == NULL || node->type != DM_INSTANCE) + { + return DM_ERR; + } + + if (enp->index_path!=NULL) + { + exp = enp->index_path; + if (exp->index!=NULL) + { + free(exp->index); + } + exp->index = strdup(index); + if (indice>=0) + { + exp->indice = indice; + } + return DM_OK; + } + else + { + exp = &index_path[*pos_xp]; + } + + enp->index_path = exp; + data_handler = node->data_handler; + size_dh = node->size_data_handler; + *pos_xp +=1; + + for (i=0;itype == DM_CORRESPONDENCE) + { + struct dm_correspondence *corresp; + corresp = (struct dm_correspondence *)data_handler[i]->handler; + exp->data = corresp->dm_data; + exp->map = corresp->dm_map; + exp->data_type = DM_XML_DATA; + exp->node_path = enp; + exp->index = (index!=NULL) ? strdup(index) : NULL; + if (indice>=0) + { + exp->indice = indice; + } + break; + } + else if (data_handler[i]->type == DM_SYSTEM) + { + struct dm_system *system; + struct dm_data *dm_data; + system = (struct dm_system *)data_handler[i]->handler; + if (system->type != DM_GET) + { + continue; + } + dm_data = calloc(1,sizeof(struct dm_data)); + assert(dm_data); + get_string_correspondence (cmd,system->cmd,index_path,(*pos_xp)-1); + dm_get_system_data_array(cmd,dm_data); + exp->data = dm_data; + exp->map = system->dm_map; + exp->data_type = DM_SYSTEM_DATA; + exp->node_path = enp; + exp->index = (index!=NULL) ? strdup(index) : NULL; + if (indice>=0) + { + exp->indice = indice; + } + break; + } + } + return DM_OK; +} + +int dm_browse_subtree (struct list_head *list, + struct dm_rpc *dm_rpc, + struct dm_node_path *node_path, + int *pos_np, + struct dm_index_path *index_path, + int *pos_xp) +{ + struct list_head *ilist,*jlist; + struct dm_node *node=NULL; + struct dm_data *data=NULL; + int error,subtree; + unsigned short i,ic; + + error = FAULT_CPE_NO_FAULT_IDX; + __list_for_each(jlist,list) + { + node = list_entry(jlist,struct dm_node,list); + add_element_node_path(node, node_path, pos_np); + if ((node->type == DM_INSTANCE) && (error = add_element_index_path(node, node_path, pos_np, index_path, pos_xp, NULL, -1))) + { + DM_XML_GET_HANDLER_DEBUG(node,index_path,*pos_xp); + error = FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + goto end_subtree; + } + DM_XML_GET_HANDLER_DEBUG(node,index_path,*pos_xp); + if (error = dm_rpc->method(node, dm_rpc, node_path, *pos_np, index_path, *pos_xp)) + { + goto end_subtree; + } + if (dm_rpc->subtree==FALSE) + { + goto end_subtree; + } + if (node->type == DM_INSTANCE) + { + if (get_data_array_indexes (index_path,(*pos_xp)-1,&data,&ic)) + { + goto end_subtree; + } + ilist = &(node->head_child); + for (i=0;iline_size;i++) + { + if (error = add_element_index_path(node, node_path, pos_np, index_path, pos_xp, data->data[i][ic], i)) + { + error = FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + goto end_subtree; + } + if (error = dm_rpc->method(node, dm_rpc, node_path, *pos_np, index_path, *pos_xp)) + { + goto end_subtree; + } + if (dm_rpc->subtree==FALSE) + { + continue; + } + if (error = dm_browse_subtree (ilist,dm_rpc,node_path,pos_np,index_path,pos_xp)) + { + goto end_subtree; + } + } + } + else if (node->type == DM_OBJECT) + { + ilist = &(node->head_child); + if (error = dm_browse_subtree (ilist,dm_rpc,node_path,pos_np,index_path,pos_xp)) + { + goto end_subtree; + } + } +end_subtree: + free_element_node_path(node_path, pos_np, pos_xp); + if (error) + { + return error; + } + } + return FAULT_CPE_NO_FAULT_IDX; +} + +int dm_browse_tree (char *name, struct dm_rpc *dm_rpc) +{ + struct dm_node_path node_path[NODE_PATH_SIZE]; + struct dm_index_path index_path[INDEX_PATH_SIZE]; + int pos_np=0,pos_xp=0; + char *pch,*t; + struct list_head *ilist,*jlist; + struct dm_node *node=NULL; + bool found,subtree,pch_is_numeric; + int namelen,error; + + error = FAULT_CPE_NO_FAULT_IDX; + if (name[0]=='.') + { + DM_LOG(INFO,"Invalid path name: %s",name); + return FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + } + + namelen = strlen(name); + pch = strdup(name); + t = pch; + pch = strtok (pch,"."); + ilist = &head_dm_tree; + error = FAULT_CPE_NO_FAULT_IDX; + pch_is_numeric = TRUE; + memset(node_path,0,NODE_PATH_SIZE*sizeof(struct dm_node_path)); + memset(index_path,0,INDEX_PATH_SIZE*sizeof(struct dm_index_path)); + if (namelen!=0) + { + while (pch != NULL && (pch-t)name)==0) + { + found = TRUE; + if (node->type == DM_OBJECT || + node->type == DM_INSTANCE) + { + ilist = &(node->head_child); + } + add_element_node_path(node,node_path, &pos_np); + if ((node->type == DM_INSTANCE) && (error = add_element_index_path(node, node_path, &pos_np, index_path, &pos_xp, NULL, -1))) + { + DM_XML_GET_HANDLER_DEBUG(node,index_path,pos_xp); + error = FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + goto endbrowse; + } + DM_XML_GET_HANDLER_DEBUG(node,index_path,pos_xp); + break; + } + } + if (!found) + { + break; + } + pch = strtok (pch+strlen(pch)+1, "."); + } + + if (!found || + ((node->type == DM_OBJECT || node->type == DM_INSTANCE) && name[namelen-1]!='.') || + (node->type == DM_PARAMETER && name[namelen-1]=='.')) + { + DM_LOG(INFO,"Invalid path name: %s",name); + error = FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + goto endbrowse; + } + + } + + if (error = dm_rpc->method(node, dm_rpc, node_path, pos_np, index_path, pos_xp)) + { + goto endbrowse; + } + + if (dm_rpc->subtree == TRUE) + { + if (node!=NULL && node->type==DM_INSTANCE && !pch_is_numeric) + { + struct dm_data *data=NULL; + unsigned short i,ic; + if (get_data_array_indexes (index_path,pos_xp-1,&data,&ic)) + { + goto endbrowse; + } + for (i=0;iline_size;i++) + { + if (error = add_element_index_path(node, node_path, &pos_np, index_path, &pos_xp, data->data[i][ic], i)) + { + error = FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + goto endbrowse; + } + if (error = dm_rpc->method(node, dm_rpc, node_path, pos_np, index_path, pos_xp)) + { + goto endbrowse; + } + if (dm_rpc->subtree==FALSE) + { + continue; + } + if (error = dm_browse_subtree (ilist,dm_rpc,node_path,&pos_np,index_path,&pos_xp)) + { + goto endbrowse; + } + } + } + else { + error = dm_browse_subtree (ilist,dm_rpc,node_path,&pos_np,index_path,&pos_xp); + } + goto endbrowse; + } + +endbrowse: + free_all_index_path (index_path); + free(t); + return error; +} + +#ifdef WITH_DM_XML_DEBUG +int dm_get_handler_debug (struct dm_node *node, struct dm_index_path *index_path, int pos_xp) +{ + struct data_handler **data_handler; + __u8 i,size_dh; + char corr[512]; + + data_handler = node->data_handler; + size_dh = node->size_data_handler; + + for (i=0;itype == DM_DEBUG) + { + char *debug; + debug = (char *)data_handler[i]->handler; + get_string_correspondence (corr,debug,index_path,pos_xp-1); + DM_XML_LOG(INFO,corr); + } + } + return DM_OK; +} +#endif diff --git a/src/dm/scripts/templateScript b/src/dm/scripts/templateScript new file mode 100644 index 0000000..e69de29 diff --git a/src/dm/xml/tr098.xml b/src/dm/xml/tr098.xml new file mode 100644 index 0000000..23d6ff1 --- /dev/null +++ b/src/dm/xml/tr098.xml @@ -0,0 +1,1337 @@ + + + + + + + + + + + + + + + + + + 000000 + + + + + Inteno + + + 0000000000 + + + broadcom + + + OpenWrt + + + + + + + 1.1 + + + + uci -P /var/state -q get provisioning.iup.provisioningcode + + + + + + + + + + + + + + + + + + uci export + + + + + + + + uci set cwmp.acs.dhcp_discovery=disable + + + cwmp.acs.url + + ACS URL parameter from xml debug tag + + + + + + cwmp.acs.periodic_inform_enable + + + + + cwmp.acs.periodic_inform_interval + + + + + + cwmp.acs.ParameterKey + + + + + uci -P /etc/cwmpd/.iccu -q get cwmp.cpe.iccu_url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1,lan,true + index,correspondence,Enable + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1,1 + index,correspondence + + + $1{Enable} + Enable parameter from xml debug tag + + + + network.$1{correspondence}.ipaddr + + + + + network.$1{correspondence}.netmask + + + + + network.$1{correspondence}.proto + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/dm_rpc.c b/src/dm_rpc.c new file mode 100644 index 0000000..4bfd307 --- /dev/null +++ b/src/dm_rpc.c @@ -0,0 +1,1748 @@ +/* + dm_rpc.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ +#include +#include "soapH.h" +#include "cwmp.h" +#include "list.h" +#include "dm.h" +#include "dm_rpc.h" + +extern struct list_head head_dm_tree; +extern struct FAULT_CPE FAULT_CPE_ARRAY [FAULT_CPE_ARRAY_SIZE]; +extern struct list_head list_dm_set_handler; + +int get_node_path_name (char *name, + struct dm_node *node, + struct dm_rpc *dm_rpc, + struct dm_node_path *node_path, + int pos_np, + struct dm_index_path *index_path, + int pos_xp) +{ + char *ret; + int i; + struct dm_node_path *enp; + struct dm_index_path *exp; + for (i=0;iindex_path; + if (enp->node== NULL) + { + break; + } + strcat(name,enp->node->name); + if (enp->node->type == DM_PARAMETER) + { + continue; + } + strcat(name,"."); + if (enp->node->type==DM_INSTANCE && exp!=NULL && exp->index!=NULL) + { + strcat(name,exp->index); + strcat(name,"."); + } + } + return DM_OK; +} + +/** + ------------------------------------------------------- +| GetParameter Value Data Model API | + ------------------------------------------------------- +**/ +int get_node_paramater_value ( + struct dm_node *node, + struct dm_index_path *index_path, + int pos_xp, + char **ret + ) +{ + struct data_handler **data_handler; + __u8 i,size_dh; + char corr[256]; + + data_handler = node->data_handler; + size_dh = node->size_data_handler; + *ret = NULL; + for (i=0;itype == DM_UCI) + { + struct dm_uci *uci; + uci = (struct dm_uci *)data_handler[i]->handler; + get_string_correspondence (corr,uci->cmd,index_path,pos_xp-1); + if (*ret !=NULL) + { + free (*ret); + } + uci_get_value (corr,ret); + break; + } + else if (data_handler[i]->type == DM_SYSTEM) + { + struct dm_system *system; + system = (struct dm_system *)data_handler[i]->handler; + if (system->type != DM_GET) + { + continue; + } + get_string_correspondence (corr,system->cmd,index_path,pos_xp-1); + if (*ret !=NULL) + { + free (*ret); + } + dm_get_system_data(corr,ret); + break; + } + else if (data_handler[i]->type == DM_STRING || data_handler[i]->type == DM_DEFAULT_VALUE) + { + char *value; + value = (char *)data_handler[i]->handler; + get_string_correspondence (corr,value,index_path,pos_xp-1); + *ret = strdup(corr); + } + } + if (*ret == NULL) + { + return DM_ERR; + } + return DM_OK; +} +int dm_list_add_ParameterValues(char *name, + char *value, + struct dm_node *node, + struct list_head *list) +{ + struct cwmp1__ParameterValueStruct *ParameterValueStruct; + struct handler_ParameterValueStruct *handler_ParameterValueStruct; + struct dm_node_leaf *parameter_node = (struct dm_node_leaf *)node; + extern char *TYPE_VALUES_ARRAY [COUNT_TYPE_VALUES]; + + ParameterValueStruct = calloc(1,sizeof(struct cwmp1__ParameterValueStruct)); + handler_ParameterValueStruct = calloc(1,sizeof(struct handler_ParameterValueStruct)); + if (ParameterValueStruct == NULL || + handler_ParameterValueStruct == NULL) + { + return FAULT_CPE_INTERNAL_ERROR_IDX; + } + ParameterValueStruct->Name = strdup(name); + ParameterValueStruct->Value = value; + ParameterValueStruct->Type = TYPE_VALUES_ARRAY [parameter_node->value_type]; + handler_ParameterValueStruct->ParameterValueStruct = ParameterValueStruct; + list_add_tail(&handler_ParameterValueStruct->list,list); + return FAULT_CPE_NO_FAULT_IDX; +} + +int dm_node_getParameterValues (struct dm_node *node, + struct dm_rpc *dm_rpc, + struct dm_node_path *node_path, + int pos_np, + struct dm_index_path *index_path, + int pos_xp) +{ + + struct dm_input_getParameterValues *input; + char name[512],*value; + int len,error; + + input = (struct dm_input_getParameterValues *)dm_rpc->input; + + if (node == NULL || node->type == DM_OBJECT || node->type == DM_INSTANCE) + { + dm_rpc->subtree = TRUE; + return FAULT_CPE_NO_FAULT_IDX; + } + dm_rpc->subtree = FALSE; + name[0] = 0; + if (error = get_node_path_name(name, node, dm_rpc, node_path, pos_np, index_path, pos_xp)) + { + return FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + } + if (error = get_node_paramater_value(node,index_path,pos_xp,&value)) + { + char t[1]; + t[0] = 0; + value = strdup(t); + } + + dm_list_add_ParameterValues(name, value, node, input->list); + *(input->n) +=1; + + return FAULT_CPE_NO_FAULT_IDX; +} + +int cwmp_dm_getParameterValues(struct cwmp *cwmp, char *path, struct list_head *list, int *n) +{ + struct dm_rpc dm_rpc; + struct dm_input_getParameterValues input; + int error; + + memset(&dm_rpc,0,sizeof(struct dm_rpc)); + + *n = 0; + input.list = list; + input.n = n; + dm_rpc.input = &input; + dm_rpc.method = dm_node_getParameterValues; + + error = dm_browse_tree (path, &dm_rpc); + + return error; +} + + +/** + ------------------------------------------------------- +| GetParameterName Data Model API | + ------------------------------------------------------- +**/ +int dm_list_add_ParameterName ( char *name, + struct dm_node *node, + struct list_head *list) +{ + struct cwmp1__ParameterInfoStruct *ParameterInfoStruct; + struct handler_ParameterInfoStruct *handler_ParameterInfoStruct; + int inode; + + ParameterInfoStruct = calloc(1,sizeof(struct cwmp1__ParameterInfoStruct)); + handler_ParameterInfoStruct = calloc(1,sizeof(struct handler_ParameterInfoStruct)); + if (ParameterInfoStruct == NULL || + handler_ParameterInfoStruct == NULL) + { + return FAULT_CPE_INTERNAL_ERROR_IDX; + } + ParameterInfoStruct->Name = strdup(name); + ParameterInfoStruct->Writable = (node->permission == DM_READ_WRITE || node->permission == DM_CREATE) ? xsd__boolean__true_ : xsd__boolean__false_; + handler_ParameterInfoStruct->ParameterInfoStruct = ParameterInfoStruct; + list_add_tail(&handler_ParameterInfoStruct->list,list); + return FAULT_CPE_NO_FAULT_IDX; +} + +int dm_node_getParameterNames( struct dm_node *node, + struct dm_rpc *dm_rpc, + struct dm_node_path *node_path, + int pos_np, + struct dm_index_path *index_path, + int pos_xp) +{ + + struct dm_input_getParameterNames *input; + struct list_head *ilist,*list; + struct dm_node *inode; + char name[512]; + int len; + + input = (struct dm_input_getParameterNames *)dm_rpc->input; + + if (node == NULL) + { + if (input->NextLevel == xsd__boolean__false_) + { + dm_rpc->subtree = TRUE; + return FAULT_CPE_NO_FAULT_IDX; + } + else + { + list = &head_dm_tree; + name[0] = 0; + len = 0; + dm_rpc->subtree = FALSE; + } + } + else + { + if (input->NextLevel == xsd__boolean__true_ && + node->type == DM_PARAMETER) + { + return FAULT_CPE_INVALID_ARGUMENTS_IDX; + } + + if (input->NextLevel == xsd__boolean__false_ && + (node->type == DM_OBJECT || + node->type == DM_INSTANCE)) + { + dm_rpc->subtree = TRUE; + } + else + { + dm_rpc->subtree = FALSE; + } + name[0] = 0; + get_node_path_name(name, node, dm_rpc, node_path, pos_np, index_path, pos_xp); + + len = strlen(name); + list = &(node->head_child); + } + if (node!=NULL && input->NextLevel == xsd__boolean__false_) + { + dm_list_add_ParameterName(name, node, input->list); + *(input->n) +=1; + } + else if (node!=NULL && node->type==DM_INSTANCE && index_path[pos_xp-1].index==NULL) + { + struct dm_data *data=NULL; + unsigned short i,ilen,ic; + if (get_data_array_indexes (index_path,pos_xp-1,&data,&ic)) + { + return FAULT_CPE_NO_FAULT_IDX; + } + for (i=0;iline_size;i++) + { + ilen = strlen(data->data[i][ic]); + memcpy(name+len,data->data[i][ic],ilen); + name[len+ilen] = '.'; + name[len+ilen+1] = 0; + dm_list_add_ParameterName(name, node, input->list); + *(input->n) +=1; + } + } + else + { + struct dm_node *inode; + int i,ilen; + __list_for_each(ilist,list) + { + inode = list_entry(ilist, struct dm_node, list); + DM_XML_GET_HANDLER_DEBUG(inode,index_path,pos_xp); + ilen = strlen(inode->name); + memcpy(name+len,inode->name,ilen); + if (inode->type == DM_PARAMETER) + { + name[len+ilen] = 0; + } + else + { + name[len+ilen] = '.'; + name[len+ilen+1] = 0; + } + dm_list_add_ParameterName(name, inode, input->list); + *(input->n) +=1; + } + } + + return FAULT_CPE_NO_FAULT_IDX; +} + +int cwmp_dm_getParameterNames(struct cwmp *cwmp, char *path, struct list_head *list, int *n, enum xsd__boolean NextLevel) +{ + struct dm_rpc dm_rpc; + struct dm_input_getParameterNames input; + int error; + + memset(&dm_rpc,0,sizeof(struct dm_rpc)); + + *n = 0; + input.list = list; + input.n = n; + input.NextLevel = NextLevel; + dm_rpc.input = &input; + dm_rpc.method = dm_node_getParameterNames; + + error = dm_browse_tree (path, &dm_rpc); + + return error; +} + +/** + ------------------------------------------------------- +| get parameter paths by correspondence Data Model API | + ------------------------------------------------------- +**/ + +static int check_index_correspondence ( struct dm_node_path *node_path, + int pos_np, + struct dm_index_path *index_path, + int pos_xp, + struct dm_input_getParameterPaths_by_correspondence *input, + int n) +{ + struct dm_indice *dm_indice; + struct dm_node_path *enp; + struct dm_index_path *exp; + + + dm_indice = &(input->sub_path[n].dm_indice); + if (dm_indice->indice==NULL) + { + return DM_OK; + } + enp = &node_path[pos_np-1]; + exp = enp->index_path; + if (exp->index!=NULL) + { + if (dm_indice->type==DM_INDICE_INDEX) + { + if(strcmp(dm_indice->indice,exp->index)!=0) + { + return DM_ERR; + } + } + else if (dm_indice->type==DM_INDICE_CORRESPONDENCE) + { + struct dm_data *data=NULL; + unsigned short cc; + if (get_data_array_correspondence_column(index_path,pos_xp-1,&data,&cc)) + { + return DM_ERR; + } + if ((exp->indice<0) || strcmp(dm_indice->indice,data->data[exp->indice][cc])!=0) + { + return DM_ERR; + } + } + } + return DM_OK; +} + +int dm_node_getParameterPaths_by_correspondence(struct dm_node *node, + struct dm_rpc *dm_rpc, + struct dm_node_path *node_path, + int pos_np, + struct dm_index_path *index_path, + int pos_xp) +{ + + struct dm_input_getParameterPaths_by_correspondence *input; + char name[512]; + int i,error; + char *value=NULL; + bool add_parameter=FALSE; + struct list_head *ilist; + + input = (struct dm_input_getParameterPaths_by_correspondence *)dm_rpc->input; + + if (node == NULL) + { + return FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + } + + for (i=0;isub_path_size;i++) + { + if (input->sub_path[i].node==node) + { + if (node->type == DM_PARAMETER) + { + add_parameter = TRUE; + break; + } + else + { + if (check_index_correspondence(node_path,pos_np,index_path,pos_xp,input,i)) + { + dm_rpc->subtree = FALSE; + return FAULT_CPE_NO_FAULT_IDX; + } + dm_rpc->subtree = TRUE; + return FAULT_CPE_NO_FAULT_IDX; + } + } + else if (input->sub_path[i].node==NULL) + { + if (i==0) + { + input->sub_path[i].name = node->name; + input->sub_path[i].node = node; + dm_rpc->subtree = TRUE; + return FAULT_CPE_NO_FAULT_IDX; + } + else if (strcmp(input->sub_path[i].name,node->name)==0) + { + input->sub_path[i].node = node; + if (node->type != DM_PARAMETER) + { + if (check_index_correspondence(node_path,pos_np,index_path,pos_xp,input,i)) + { + dm_rpc->subtree = FALSE; + return FAULT_CPE_NO_FAULT_IDX; + } + dm_rpc->subtree = TRUE; + return FAULT_CPE_NO_FAULT_IDX; + } + else + { + add_parameter = TRUE; + break; + } + } + else + { + dm_rpc->subtree = FALSE; + return FAULT_CPE_NO_FAULT_IDX; + } + } + } + + if (add_parameter==FALSE) + { + if (input->sub_path_size == 0) + { + if (node->type==DM_PARAMETER) + { + add_parameter=TRUE; + } + else + { + dm_rpc->subtree = TRUE; + return FAULT_CPE_NO_FAULT_IDX; + } + } + else if (input->sub_path[input->sub_path_size-1].node!=NULL) + { + i = pos_np; + while (i>0) + { + i--; + if (input->sub_path[input->sub_path_size-1].node==node_path[i].node) + { + if (node->type==DM_PARAMETER) + { + add_parameter = TRUE; + break; + } + else + { + dm_rpc->subtree = TRUE; + return FAULT_CPE_NO_FAULT_IDX; + } + } + } + } + } + if (add_parameter==FALSE) + { + dm_rpc->subtree = FALSE; + return FAULT_CPE_NO_FAULT_IDX; + } + + dm_rpc->subtree = FALSE; + name[0] = 0; + if (error = get_node_path_name(name, node, dm_rpc, node_path, pos_np, index_path, pos_xp)) + { + return FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + } + + if (input->get_attribute) + { + int attribute; + attribute = dm_getParameterAttributes(name); + switch (attribute) + { + case _cwmp1__SetParameterAttributesStruct_Notification__0: + return FAULT_CPE_NO_FAULT_IDX; + break; + case _cwmp1__SetParameterAttributesStruct_Notification__2: + input->is_actif = TRUE; + break; + default: + break; + } + } + + for (ilist = input->list->next; ilist != input->elist->next; ilist = ilist->next) + { + struct handler_ParameterValueStruct *handler_ParameterValueStruct; + handler_ParameterValueStruct = list_entry(ilist,struct handler_ParameterValueStruct,list); + if (strcmp(handler_ParameterValueStruct->ParameterValueStruct->Name,name)==0) + { + return FAULT_CPE_NO_FAULT_IDX; + } + } + + if (input->get_value) + { + if (error = get_node_paramater_value(node,index_path,pos_xp,&value)) + { + char t[1]; + t[0] = 0; + value = strdup(t); + } + } + + dm_list_add_ParameterValues(name, value, node, input->list); + *(input->n) +=1; + + return FAULT_CPE_NO_FAULT_IDX; +} + +int cwmp_dm_get_sub_indice_path (int argc, char **argv, char **prefix_path, struct sub_path *sub_path, int *sub_path_size) +{ + int i=1,len,size=0; + char *s=NULL,*t=NULL,*buf_path,*prefix_end; + + buf_path = strdup(argv[0]); + *prefix_path = buf_path; + prefix_end = strstr(buf_path,"{i}."); + if (prefix_end!=NULL && (prefix_end + 4)!=0) + { + sub_path[size].dm_indice.indice = (i>=argc)?NULL:strdup(argv[i]); + sub_path[size].dm_indice.type = DM_INDICE_CORRESPONDENCE; + size++; + i++; + s = prefix_end + 4; /* 4 = length of "{i}." */ + t = s; + len = strlen(t); + + *prefix_end = 0; + s = strtok(s,"."); + + while (s!=NULL && (s-t)=argc)?NULL:strdup(argv[i]); + sub_path[size-1].dm_indice.type = DM_INDICE_CORRESPONDENCE; + i++; + } + s = strtok(s+strlen(s)+1,"."); + } + } + *sub_path_size = size; + return CWMP_OK; +} + +int cwmp_dm_getParameterPaths_by_correspondence(struct cwmp *cwmp, char *path, struct sub_path *sub_path, int sub_path_size, struct list_head *list, int *n, bool get_value, bool get_attribute, bool *is_actif) +{ + struct dm_rpc dm_rpc; + struct dm_input_getParameterPaths_by_correspondence input; + int error; + + memset(&dm_rpc,0,sizeof(struct dm_rpc)); + memset(&input,0,sizeof(struct dm_input_getParameterPaths_by_correspondence)); + *n = 0; + input.list = list; + input.elist = list->prev; + input.n = n; + input.get_value = get_value; + input.get_attribute = get_attribute; + input.sub_path = sub_path; + input.sub_path_size = sub_path_size; + + dm_rpc.input = &input; + dm_rpc.method = dm_node_getParameterPaths_by_correspondence; + + error = dm_browse_tree (path, &dm_rpc); + + *is_actif = input.is_actif; + + return error; +} + +/** + ------------------------------------------------------- +| SetParameterValue Data Model API | + ------------------------------------------------------- +**/ + +static int bind_service_handler_queue_by_uci_conf (struct dm_set_handler *dm_set_handler, char *conf) +{ + struct service_handler *service_handler; + struct dm_set_handler *dm_sh; + struct list_head *ilist,*jlist; + struct list_head list_uci_affect; + struct config_uci_list *affect; + char uci_path[256]; + + if (strcmp(conf,UCI_TRACK_CONF_CWMP)!=0) + { + __list_for_each(ilist,&list_dm_set_handler) + { + dm_sh = list_entry(ilist, struct dm_set_handler, list); + __list_for_each(jlist,&(dm_sh->service_list)) + { + service_handler = list_entry(jlist, struct service_handler, list); + if (strcmp(conf,service_handler->service)==0) + { + return DM_OK; + } + } + + } + service_handler = calloc(1,sizeof(struct service_handler)); + service_handler->service = strdup(conf); + list_add_tail(&(service_handler->list),&(dm_set_handler->service_list)); + } + else + { + if (dm_set_handler->cwmp_reload==TRUE) + { + return DM_OK; + } + dm_set_handler->cwmp_reload=TRUE; + } + INIT_LIST_HEAD (&list_uci_affect); + sprintf(uci_path,"%s.@%s[%d].%s",UCI_TRACK_CONF,conf,0,UCI_TRACK_AFFECTS); + uci_get_list_value (uci_path, &list_uci_affect); + while(list_uci_affect.next!=&list_uci_affect) + { + affect = list_entry (list_uci_affect.next, struct config_uci_list, list); + bind_service_handler_queue_by_uci_conf (dm_set_handler,affect->value); + list_del(list_uci_affect.next); + if(affect->value != NULL) + { + free(affect->value); + } + free(affect); + } + return DM_OK; +} + +static int bind_service_handler_queue (struct dm_set_handler *dm_set_handler, char *uci_cmd) +{ + struct service_handler *service_handler; + struct dm_set_handler *dm_sh; + struct list_head *ilist,*jlist; + char *s,conf[128]; + int len; + s = strstr(uci_cmd,"."); + if (s==NULL) + { + return DM_OK; + } + len = s - uci_cmd; + memcpy(conf,uci_cmd,len); + conf[len] = 0; + bind_service_handler_queue_by_uci_conf (dm_set_handler,conf); + return DM_OK; +} + +static int bind_cmd_handler_queue(struct dm_set_handler *dm_set_handler, char *cmd, enum param_type type, __u8 end_session) +{ + struct cmd_handler *cmd_handler; + struct dm_set_handler *dm_sh; + struct list_head *ilist,*jlist; + + __list_for_each(ilist,&(dm_set_handler->cmd_list)) + { + cmd_handler = list_entry(ilist, struct cmd_handler, list); + if (strcmp(cmd,cmd_handler->cmd)==0) + { + return DM_OK; + } + } + if (end_session==TRUE) + { + __list_for_each(ilist,&list_dm_set_handler) + { + dm_sh = list_entry(ilist, struct dm_set_handler, list); + __list_for_each(jlist,&(dm_sh->cmd_list)) + { + cmd_handler = list_entry(jlist, struct cmd_handler, list); + if (strcmp(cmd,cmd_handler->cmd)==0) + { + return DM_OK; + } + } + } + } + + cmd_handler = calloc(1,sizeof(struct cmd_handler)); + if (cmd_handler==NULL) + { + return DM_ERR; + } + cmd_handler->cmd = strdup(cmd); + cmd_handler->type = type; + cmd_handler->end_session = end_session; + list_add(&(cmd_handler->list),&(dm_set_handler->cmd_list)); + return DM_OK; +} + +static int bind_cancel_handler_queue(struct dm_set_handler *dm_set_handler, char *cmd) +{ + struct cancel_handler *cancel_handler; + struct list_head *ilist; + + __list_for_each(ilist,&(dm_set_handler->cancel_list)) + { + cancel_handler = list_entry(ilist, struct cancel_handler, list); + if (strcmp(cmd,cancel_handler->cmd)==0) + { + return DM_OK; + } + } + + cancel_handler = calloc(1,sizeof(struct cancel_handler)); + if (cancel_handler==NULL) + { + return DM_ERR; + } + cancel_handler->cmd = strdup(cmd); + list_add(&(cancel_handler->list),&(dm_set_handler->cancel_list)); + return DM_OK; +} + +int dm_run_queue_cancel_handler(struct dm_set_handler *dm_set_handler) +{ + struct list_head *ilist; + struct cancel_handler *cancel_handler; + int error=DM_OK; + ilist = &(dm_set_handler->cancel_list); + while (ilist->next!=&(dm_set_handler->cancel_list)) + { + cancel_handler = list_entry(ilist->next,struct cancel_handler, list); + CWMP_LOG(INFO,"RUN cancel handler function %s",cancel_handler->cmd); /* TODO to be removed*/ + if (dm_call_system_cmd(cancel_handler->cmd)) + { + error = DM_ERR; + } + if (cancel_handler->cmd!=NULL) + { + free(cancel_handler->cmd); + } + list_del(ilist->next); + free(cancel_handler); + } + return DM_OK; +} + +int dm_run_queue_cmd_handler(struct dm_set_handler *dm_set_handler,__u8 end_session) +{ + struct list_head *ilist; + struct cmd_handler *cmd_handler; + int error=DM_OK; + bool uci=FALSE; + ilist = &(dm_set_handler->cmd_list); + while (ilist->next!=&(dm_set_handler->cmd_list)) + { + cmd_handler = list_entry(ilist->next,struct cmd_handler, list); + if (cmd_handler->end_session != end_session) + { + ilist = ilist->next; + continue; + } + if (cmd_handler->type == DM_UCI) + { + CWMP_LOG(INFO,"RUN uci set cmd handler %s",cmd_handler->cmd); /* TODO to be removed*/ + if (uci_set_value (cmd_handler->cmd)) + { + error = DM_ERR; + } + uci = TRUE; + } + else if (cmd_handler->type == DM_SYSTEM) + { + CWMP_LOG(INFO,"RUN system cmd handler %s",cmd_handler->cmd); /* TODO to be removed*/ + if (dm_call_system_cmd(cmd_handler->cmd)) + { + error = DM_ERR; + } + } + if (cmd_handler->cmd!=NULL) + { + free(cmd_handler->cmd); + } + list_del(ilist->next); + free(cmd_handler); + } + if (uci == TRUE) + { + uci_commit_value(); + } + return DM_OK; +} + +int dm_run_queue_service_handler(struct dm_set_handler *dm_set_handler) +{ + struct list_head *ilist; + struct service_handler *service_handler; + char buf[256],*init; + + ilist = &(dm_set_handler->service_list); + while (ilist->next!=&(dm_set_handler->service_list)) + { + service_handler = list_entry(ilist->next,struct service_handler, list); + + sprintf(buf,"%s.@%s[%d].%s",UCI_TRACK_CONF,service_handler->service,0,UCI_TRACK_INIT); + if(uci_get_value(buf,&init)==CWMP_OK && init!=NULL) + { + CWMP_LOG(INFO,"Restart service %s",init); /* TODO to be removed*/ + sprintf(buf,"/etc/init.d/%s restart",init); + dm_call_system_cmd(buf); + } + + if (service_handler->service!=NULL) + { + free(service_handler->service); + } + list_del(ilist->next); + free(service_handler); + } + + return DM_OK; +} + +int dm_free_dm_set_handler_queues (struct dm_set_handler *dm_set_handler) +{ + struct list_head *ilist; + struct cancel_handler *cancel_handler; + struct cmd_handler *cmd_handler; + struct service_handler *service_handler; + int error=DM_OK; + ilist = &(dm_set_handler->cancel_list); + while (ilist->next!=ilist) + { + cancel_handler = list_entry(ilist->next,struct cancel_handler, list); + if (cancel_handler->cmd!=NULL) + { + free(cancel_handler->cmd); + } + list_del(ilist->next); + free(cancel_handler); + } + ilist = &(dm_set_handler->cmd_list); + while (ilist->next!=ilist) + { + cmd_handler = list_entry(ilist->next,struct cmd_handler, list); + if (cmd_handler->cmd!=NULL) + { + free(cmd_handler->cmd); + } + list_del(ilist->next); + free(cmd_handler); + } + ilist = &(dm_set_handler->service_list); + while (ilist->next!=ilist) + { + service_handler = list_entry(ilist->next,struct service_handler, list); + if (service_handler->service!=NULL) + { + free(service_handler->service); + } + list_del(ilist->next); + free(service_handler); + } + return DM_OK; +} + +int dm_run_queue_cmd_handler_at_end_session (struct cwmp *cwmp, struct dm_set_handler *dm_set_handler) +{ + int error; + CWMP_LOG(INFO,"RUN End Sessions Functions"); /* TODO to be removed*/ + error = dm_run_queue_cmd_handler(dm_set_handler,TRUE); + if (dm_set_handler->reboot_required==FALSE) + { + dm_run_queue_service_handler(dm_set_handler); + } + dm_free_dm_set_handler_queues(dm_set_handler); + if (dm_set_handler!=NULL) + { + list_del(&(dm_set_handler->list)); + free(dm_set_handler); + } + return error; +} +int dm_cwmp_config_reload (struct cwmp *cwmp, void *v ) +{ + CWMP_LOG(INFO,"Reload CWMP Config"); /* TODO to be removed*/ + if (cwmp_apply_acs_changes(cwmp)) + { + return DM_GEN_ERR; + } + return DM_ERR; +} +static int enqueue_apply_cancel_handlers(struct dm_set_handler *dm_set_handler, + struct dm_node_path *node_path, + int pos_np, + struct dm_index_path *index_path, + int pos_xp) +{ + struct data_handler **data_handler; + unsigned short error,k; + __u8 i,size_dh; + struct dm_node *node; + char corr[256]; + for (k=0;k<(pos_np);k++) + { + node = node_path[k].node; + data_handler = node->data_handler; + size_dh = node->size_data_handler; + for (i=0;itype == DM_SYSTEM) + { + struct dm_system *system; + system = (struct dm_system *)data_handler[i]->handler; + if (system->type == DM_APPLY) + { + get_string_correspondence(corr,system->cmd,index_path,pos_xp-1); + if (system->reboot_required) + { + dm_set_handler->reboot_required = TRUE; + } + if (bind_cmd_handler_queue(dm_set_handler,corr,DM_SYSTEM,system->end_session)) + { + return DM_ERR; + } + } + else if (system->type == DM_CANCEL) + { + get_string_correspondence(corr,system->cmd,index_path,pos_xp-1); + if (system->reboot_required) + { + dm_set_handler->reboot_required = TRUE; + } + if (bind_cancel_handler_queue(dm_set_handler,corr)) + { + return DM_ERR; + } + } + } + } + } + return DM_OK; +} + +static int set_node_paramater_value (struct dm_node *node, + struct dm_index_path *index_path, + int pos_xp, + char *value, + struct dm_set_handler *dm_set_handler) +{ + struct data_handler **data_handler; + unsigned short error,j; + __u8 size_dh,i; + char corr[256],*serr=NULL; + + data_handler = node->data_handler; + size_dh = node->size_data_handler; + for (i=0;itype == DM_UCI) + { + struct dm_uci *uci; + uci = (struct dm_uci *)data_handler[i]->handler; + get_string_correspondence (corr,uci->cmd,index_path,pos_xp-1); + + bind_service_handler_queue(dm_set_handler,corr); + + sprintf(corr,"%s=%s",corr,value); + + if (uci->reboot_required) + { + dm_set_handler->reboot_required = TRUE; + } + + if (uci->end_session) + { + if (bind_cmd_handler_queue(dm_set_handler,corr,DM_UCI,TRUE)) + { + return FAULT_CPE_INTERNAL_ERROR_IDX; + } + return FAULT_CPE_NO_FAULT_IDX; + } + + if (error = uci_set_value (corr)) + { + return FAULT_CPE_INTERNAL_ERROR_IDX; + } + dm_set_handler->uci = TRUE; + return FAULT_CPE_NO_FAULT_IDX; + } + else if (data_handler[i]->type == DM_SYSTEM) + { + struct dm_system *system; + system = (struct dm_system *)data_handler[i]->handler; + if (system->type != DM_SET) + { + continue; + } + get_string_correspondence(corr,system->cmd,index_path,pos_xp-1); + + sprintf(corr,"%s %s",corr,value); + + if (system->reboot_required) + { + dm_set_handler->reboot_required = TRUE; + } + + if (system->end_session) + { + if (bind_cmd_handler_queue(dm_set_handler,corr,DM_SYSTEM,TRUE)) + { + return FAULT_CPE_INTERNAL_ERROR_IDX; + } + return FAULT_CPE_NO_FAULT_IDX; + } + + if (error = dm_get_system_data(corr,&serr)) + { + if (serr!=NULL) + { + free(serr); + } + return FAULT_CPE_INTERNAL_ERROR_IDX; + } + if (serr!=NULL) + { + char buf[16]; + for (j=1;jtype == DM_REGEXP) + { + char *regexp; + regexp = (char *)data_handler[i]->handler; + if (regexp!=NULL && (error = dm_match_patterns(value,regexp))) + { + return FAULT_CPE_INVALID_PARAMETER_VALUE_IDX; + } + } + } + return FAULT_CPE_NO_FAULT_IDX; +} + + +int dm_node_setParameterValues (struct dm_node *node, + struct dm_rpc *dm_rpc, + struct dm_node_path *node_path, + int pos_np, + struct dm_index_path *index_path, + int pos_xp) +{ + + struct dm_input_setParameterValues *input; + char name[512]; + int len,error; + + if (node == NULL || node->type == DM_OBJECT || node->type == DM_INSTANCE) + { + return FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + } + + if (node->permission != DM_READ_WRITE) + { + return FAULT_CPE_NON_WRITABLE_PARAMETER_IDX; + } + + input = (struct dm_input_setParameterValues *)dm_rpc->input; + dm_rpc->subtree = FALSE; + + error = set_node_paramater_value(node,index_path,pos_xp,input->value,input->dm_set_handler); + + enqueue_apply_cancel_handlers(input->dm_set_handler,node_path,pos_np,index_path,pos_xp); + + return error; +} + +int cwmp_dm_setParameterValues(struct cwmp *cwmp, struct dm_set_handler *dm_set_handler, char *path, char *value) +{ + struct dm_rpc dm_rpc; + struct dm_input_setParameterValues input; + int error; + + memset(&dm_rpc,0,sizeof(struct dm_rpc)); + + input.value = value; + input.dm_set_handler = dm_set_handler; + dm_rpc.input = &input; + dm_rpc.method = dm_node_setParameterValues; + + error = dm_browse_tree (path, &dm_rpc); + + return error; +} +/** + ------------------------------------------------------------- +| GetParameterAttributes Data Model API | + ------------------------------------------------------------- +**/ +int dm_list_add_ParameterAttributes(char *name, + struct dm_node *node, + struct list_head *list) +{ + struct cwmp1__ParameterAttributeStruct *ParameterAttributeStruct; + struct handler_ParameterAttributeStruct *handler_ParameterAttributeStruct; + struct list_head *ilist; + int is_active,is_passive,i; + char **ptr_AccessList; + extern const struct ACCESSLIST_CONST_STRUCT ACCESSLIST_CONST_ARRAY [COUNT_ACCESSLIST]; + + ParameterAttributeStruct = calloc(1,sizeof(struct cwmp1__ParameterAttributeStruct)); + handler_ParameterAttributeStruct = calloc(1,sizeof(struct handler_ParameterAttributeStruct)); + + if (ParameterAttributeStruct == NULL || + handler_ParameterAttributeStruct == NULL) + { + return FAULT_CPE_INTERNAL_ERROR_IDX; + } + + ParameterAttributeStruct->Name = strdup(name); + + if((is_passive = cwmp_check_notification(name, UCI_NOTIFICATION_PASSIVE_PATH)) != CWMP_OK) + { + ParameterAttributeStruct->Notification = _cwmp1__ParameterAttributeStruct_Notification__1; + } + if((is_active = cwmp_check_notification(name, UCI_NOTIFICATION_ACTIVE_PATH)) != CWMP_OK) + { + ParameterAttributeStruct->Notification = _cwmp1__ParameterAttributeStruct_Notification__2; + } + if (!is_active && !is_passive) + { + ParameterAttributeStruct->Notification = _cwmp1__ParameterAttributeStruct_Notification__0; + } + ParameterAttributeStruct->AccessList = calloc(1,sizeof(struct cwmp1AccessList *)); + ptr_AccessList = calloc(sizearray(ACCESSLIST_CONST_ARRAY),sizeof(struct cwmp1AccessList *)); + if(ParameterAttributeStruct->AccessList==NULL || + ptr_AccessList == NULL) + { + return FAULT_CPE_INTERNAL_ERROR_IDX; + } + ParameterAttributeStruct->AccessList->__ptrstring = ptr_AccessList; + for(i=0;iAccessList->__size++; + } + } + handler_ParameterAttributeStruct->ParameterAttributeStruct = ParameterAttributeStruct; + list_add_tail(&handler_ParameterAttributeStruct->list,list); + return FAULT_CPE_NO_FAULT_IDX; +} + +int dm_node_getParameterAttributes (struct dm_node *node, + struct dm_rpc *dm_rpc, + struct dm_node_path *node_path, + int pos_np, + struct dm_index_path *index_path, + int pos_xp) +{ + struct dm_input_getParameterAttributes *input; + char name[512]; + int len,error; + + input = (struct dm_input_getParameterAttributes *)dm_rpc->input; + + if (node == NULL || node->type == DM_OBJECT || node->type == DM_INSTANCE) + { + dm_rpc->subtree = TRUE; + return FAULT_CPE_NO_FAULT_IDX; + } + dm_rpc->subtree = FALSE; + name[0] = 0; + if (error = get_node_path_name(name, node, dm_rpc, node_path, pos_np, index_path, pos_xp)) + { + return FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + } + + dm_list_add_ParameterAttributes(name, node, input->list); + *(input->n) +=1; + + return FAULT_CPE_NO_FAULT_IDX; +} + +int cwmp_dm_getParameterAttributes(struct cwmp *cwmp, char *path, struct list_head *list, int *n) +{ + struct dm_rpc dm_rpc; + struct dm_input_getParameterAttributes input; + int error; + + memset(&dm_rpc,0,sizeof(struct dm_rpc)); + + *n = 0; + input.list = list; + input.n = n; + dm_rpc.input = &input; + dm_rpc.method = dm_node_getParameterAttributes; + + error = dm_browse_tree (path, &dm_rpc); + + return error; +} + +int dm_getParameterAttributes (char *path) +{ + int n = 0; + int len_passive,len_active,len_denied,len1; + struct config_uci_list *notification; + LIST_HEAD(notification_list); + + len1 = 0; + len_denied = 0; + len_passive = 0; + len_active = 0; + + n = strlen(path); + + uci_get_list_value(UCI_NOTIFICATION_DENIED_PATH, ¬ification_list); + while(!list_empty(¬ification_list)) + { + notification = list_entry (notification_list.next, struct config_uci_list, list); + if((notification != NULL)) + { + len1 = strlen(notification->value); + if(strncmp(path,notification->value,len1) == 0) + { + if(len_deniedvalue); + if(strncmp(path,notification->value,len1) == 0) + { + if(len_passivevalue); + if(strncmp(path,notification->value,len1) == 0) + { + if(len_activelen_active)&&(len_denied>len_passive))) + { + return _cwmp1__SetParameterAttributesStruct_Notification__0; + } + if((len_passive>len_active)&&(len_passive>len_denied)) + { + return _cwmp1__SetParameterAttributesStruct_Notification__1; + } + if((len_active>len_passive)&&(len_active>len_denied)) + { + return _cwmp1__SetParameterAttributesStruct_Notification__2; + } + return _cwmp1__SetParameterAttributesStruct_Notification__0; +} +/** + ------------------------------------------------------------- +| SetParameterAttributes Data Model API | + ------------------------------------------------------------- +**/ +int dm_node_setParameterAttributes (struct dm_node *node, + struct dm_rpc *dm_rpc, + struct dm_node_path *node_path, + int pos_np, + struct dm_index_path *index_path, + int pos_xp) +{ + + struct dm_input_setParameterAttributes *input; + int len,error,i; + struct cwmp1__SetParameterAttributesStruct *ParameterAttributesStruct; + char **AccessList; + int size_AccessList = 0; + + input = (struct dm_input_setParameterAttributes *)dm_rpc->input; + + if (node == NULL) + { + return FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + } + + if (node != NULL) + { + dm_rpc->subtree = FALSE; + ParameterAttributesStruct = input->ParameterAttributesStruct; + switch(ParameterAttributesStruct->Notification) + { + case _cwmp1__SetParameterAttributesStruct_Notification__0: + if(error = cwmp_off_notification(node,*(ParameterAttributesStruct->Name), ParameterAttributesStruct->NotificationChange)) + { + uci_revert_value (); + return error; + } + break; + case _cwmp1__SetParameterAttributesStruct_Notification__1: + if(error = cwmp_apply_passive_notification(node,*(ParameterAttributesStruct->Name), ParameterAttributesStruct->NotificationChange)) + { + uci_revert_value (); + return error; + } + AccessList = ParameterAttributesStruct->AccessList->__ptrstring; + size_AccessList = ParameterAttributesStruct->AccessList->__size; + + for(i=0;iName), ParameterAttributesStruct->AccessListChange, *AccessList)) + { + uci_revert_value (); + return error; + } + AccessList++; + } + break; + case _cwmp1__SetParameterAttributesStruct_Notification__2: + if(error = cwmp_apply_active_notification(node,*(ParameterAttributesStruct->Name), ParameterAttributesStruct->NotificationChange)) + { + uci_revert_value (); + return error; + } + AccessList = ParameterAttributesStruct->AccessList->__ptrstring; + size_AccessList = ParameterAttributesStruct->AccessList->__size; + + for(i=0;iName), ParameterAttributesStruct->AccessListChange, *AccessList)) + { + uci_revert_value (); + return error; + } + AccessList++; + } + break; + } + } + + return FAULT_CPE_NO_FAULT_IDX; +} + +int cwmp_dm_setParameterAttributes(struct cwmp *cwmp, struct cwmp1__SetParameterAttributesStruct *ParameterAttributesStruct) +{ + struct dm_rpc dm_rpc; + struct dm_input_setParameterAttributes input; + int error; + char *path; + + path = *(ParameterAttributesStruct->Name); + + memset(&dm_rpc,0,sizeof(struct dm_rpc)); + + input.ParameterAttributesStruct = ParameterAttributesStruct; + dm_rpc.input = &input; + dm_rpc.method = dm_node_setParameterAttributes; + + error = dm_browse_tree (path, &dm_rpc); + + return error; +} +/** + ------------------------------------------------ +| AddObject Data Model API | + ------------------------------------------------ +**/ +static int add_node_add_object (struct dm_node *node, + struct dm_index_path *index_path, + int pos_xp, + int *InstanceNumber, + char *path, + struct dm_set_handler *dm_set_handler) +{ + struct data_handler **data_handler; + unsigned short error,j; + __u8 size_dh,i; + char corr[256],*dm_system_output=NULL; + char instanceName[256]; + extern const struct ACCESSLIST_CONST_STRUCT ACCESSLIST_CONST_ARRAY [COUNT_ACCESSLIST]; + + data_handler = node->data_handler; + size_dh = node->size_data_handler; + for (i=0;itype == DM_SYSTEM) + { + struct dm_system *system; + system = (struct dm_system *)data_handler[i]->handler; + if (system->type != DM_ADD) + { + continue; + } + get_string_correspondence(corr,system->cmd,index_path,pos_xp-1); + + if (system->reboot_required) + { + dm_set_handler->reboot_required = TRUE; + } + + if (error = dm_get_system_data(corr,&dm_system_output)) + { + if (dm_system_output!=NULL) + { + free(dm_system_output); + } + return FAULT_CPE_INTERNAL_ERROR_IDX; + } + + if (dm_system_output!=NULL) + { + char buf[16]; + for (j=1;jindex_path; + + if (node == NULL || node->type == DM_OBJECT || node->type == DM_PARAMETER || exp->index != NULL) + { + return FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + } + + if (node->permission != DM_CREATE) + { + return FAULT_CPE_REQUEST_DENIED_IDX; + } + + input = (struct dm_input_addObject *)dm_rpc->input; + dm_rpc->subtree = FALSE; + + error = add_node_add_object(node,index_path,pos_xp,input->n,input->path,input->dm_set_handler); + + enqueue_apply_cancel_handlers(input->dm_set_handler,node_path,pos_np,index_path,pos_xp); + + return error; +} + +int cwmp_dm_addObject(struct cwmp *cwmp, struct dm_set_handler *dm_set_handler, char *path, int *n) +{ + struct dm_rpc dm_rpc; + struct dm_input_addObject input; + int error; + + memset(&dm_rpc,0,sizeof(struct dm_rpc)); + + *n = 0; + input.path = path; + input.n = n; + input.dm_set_handler = dm_set_handler; + dm_rpc.input = &input; + dm_rpc.method = dm_node_addObject; + + error = dm_browse_tree (path, &dm_rpc); + + return error; +} +/** + ------------------------------------------------ +| DeleteObject Data Model API | + ------------------------------------------------ +**/ +static int del_node_delete_object (struct dm_node *node, + struct dm_index_path *index_path, + int pos_xp, + char *path, + struct dm_set_handler *dm_set_handler) +{ + struct data_handler **data_handler; + unsigned short error,j; + __u8 size_dh,i; + char corr[256],*dm_system_output=NULL; + + data_handler = node->data_handler; + size_dh = node->size_data_handler; + for (i=0;itype == DM_SYSTEM) + { + struct dm_system *system; + system = (struct dm_system *)data_handler[i]->handler; + if (system->type != DM_DEL) + { + continue; + } + get_string_correspondence(corr,system->cmd,index_path,pos_xp-1); + + sprintf(corr,"%s %s",corr,path); + + if (system->reboot_required) + { + dm_set_handler->reboot_required = TRUE; + } + + if (error = dm_get_system_data(corr,&dm_system_output)) + { + if (dm_system_output!=NULL) + { + free(dm_system_output); + } + return FAULT_CPE_INTERNAL_ERROR_IDX; + } + + if (dm_system_output!=NULL) + { + char buf[16]; + for (j=1;jindex_path; + + if (node == NULL || node->type == DM_OBJECT || node->type == DM_PARAMETER || exp->index == NULL) + { + return FAULT_CPE_INVALID_PARAMETER_NAME_IDX; + } + + if (node->permission != DM_CREATE) + { + return FAULT_CPE_REQUEST_DENIED_IDX; + } + + input = (struct dm_input_deleteObject *)dm_rpc->input; + dm_rpc->subtree = FALSE; + + error = del_node_delete_object(node,index_path,pos_xp,input->path,input->dm_set_handler); + + enqueue_apply_cancel_handlers(input->dm_set_handler,node_path,pos_np,index_path,pos_xp); + + return error; +} + +int cwmp_dm_deleteObject(struct cwmp *cwmp, struct dm_set_handler *dm_delete_handler, char *path) +{ + struct dm_rpc dm_rpc; + struct dm_input_deleteObject input; + int error; + + memset(&dm_rpc,0,sizeof(struct dm_rpc)); + + input.path = path; + input.dm_set_handler = dm_delete_handler; + dm_rpc.input = &input; + dm_rpc.method = dm_node_deleteObject; + + error = dm_browse_tree (path, &dm_rpc); + + return error; +} diff --git a/src/event.c b/src/event.c new file mode 100644 index 0000000..666b069 --- /dev/null +++ b/src/event.c @@ -0,0 +1,485 @@ +/* + event.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ +#include +#include "cwmp.h" +#include "backupSession.h" +#include "dm.h" +#include "dm_rpc.h" + +struct rpc_acs *cwmp_add_session_rpc_acs_getRPCMethods (struct session *session); +struct rpc_acs *cwmp_add_session_rpc_acs_transferComplete (struct session *session); +struct session *cwmp_add_queue_session (struct cwmp *cwmp); +void backup_session_insert_rpc(char *name, char *commandKey, int status); +void backup_session_delete_rpc(char *name, char *commandKey, int status); +void backup_session_insert_event(char *name, char *commandKey, int id, int rpc_status); +void backup_session_insert_parameter(char *name, char *value, char *parent,char *parent_name, int id, char *commandKey); +int cwmp_scheduleInform_remove_all(); +int cwmp_scheduledDownload_remove_all(); + + +const struct EVENT_CONST_STRUCT EVENT_CONST [] = { + [EVENT_IDX_0BOOTSTRAP] = {"0 BOOTSTRAP", EVENT_TYPE_SINGLE, EVENT_RETRY_AFTER_TRANSMIT_FAIL|EVENT_RETRY_AFTER_REBOOT}, + [EVENT_IDX_1BOOT] = {"1 BOOT", EVENT_TYPE_SINGLE, EVENT_RETRY_AFTER_TRANSMIT_FAIL}, + [EVENT_IDX_2PERIODIC] = {"2 PERIODIC", EVENT_TYPE_SINGLE, EVENT_RETRY_AFTER_TRANSMIT_FAIL|EVENT_RETRY_AFTER_REBOOT}, + [EVENT_IDX_3SCHEDULED] = {"3 SCHEDULED", EVENT_TYPE_SINGLE, EVENT_RETRY_AFTER_TRANSMIT_FAIL|EVENT_RETRY_AFTER_REBOOT}, + [EVENT_IDX_4VALUE_CHANGE] = {"4 VALUE CHANGE", EVENT_TYPE_SINGLE, EVENT_RETRY_AFTER_TRANSMIT_FAIL}, + [EVENT_IDX_5KICKED] = {"5 KICKED", EVENT_TYPE_SINGLE, EVENT_RETRY_AFTER_TRANSMIT_FAIL|EVENT_RETRY_AFTER_REBOOT}, + [EVENT_IDX_6CONNECTION_REQUEST] = {"6 CONNECTION REQUEST", EVENT_TYPE_SINGLE, 0}, + [EVENT_IDX_7TRANSFER_COMPLETE] = {"7 TRANSFER COMPLETE", EVENT_TYPE_SINGLE, EVENT_RETRY_AFTER_TRANSMIT_FAIL|EVENT_RETRY_AFTER_REBOOT}, + [EVENT_IDX_8DIAGNOSTICS_COMPLETE] = {"8 DIAGNOSTICS COMPLETE", EVENT_TYPE_SINGLE, EVENT_RETRY_AFTER_TRANSMIT_FAIL}, + [EVENT_IDX_9REQUEST_DOWNLOAD] = {"9 REQUEST DOWNLOAD", EVENT_TYPE_SINGLE, EVENT_RETRY_AFTER_TRANSMIT_FAIL|EVENT_RETRY_AFTER_REBOOT}, + [EVENT_IDX_10AUTONOMOUS_TRANSFER_COMPLETE] = {"10 AUTONOMOUS TRANSFER COMPLETE", EVENT_TYPE_SINGLE, EVENT_RETRY_AFTER_TRANSMIT_FAIL|EVENT_RETRY_AFTER_REBOOT}, + [EVENT_IDX_M_Reboot] = {"M Reboot", EVENT_TYPE_MULTIPLE,EVENT_RETRY_AFTER_TRANSMIT_FAIL|EVENT_RETRY_AFTER_REBOOT}, + [EVENT_IDX_M_ScheduleInform] = {"M ScheduleInform", EVENT_TYPE_MULTIPLE,EVENT_RETRY_AFTER_TRANSMIT_FAIL|EVENT_RETRY_AFTER_REBOOT}, + [EVENT_IDX_M_Download] = {"M Download", EVENT_TYPE_MULTIPLE,EVENT_RETRY_AFTER_TRANSMIT_FAIL|EVENT_RETRY_AFTER_REBOOT}, + [EVENT_IDX_M_Upload] = {"M Upload", EVENT_TYPE_MULTIPLE,EVENT_RETRY_AFTER_TRANSMIT_FAIL|EVENT_RETRY_AFTER_REBOOT} +}; + + +void cwmp_save_event_container (struct cwmp *cwmp,struct event_container *event_container) +{ + + struct cwmp1__EventStruct *pEventStruct; + struct list_head *ilist; + struct paramater_container *paramater_container; + struct cwmp1__ParameterValueStruct *ptr_ParameterValueStruct; + char section[256]; + + pEventStruct = &(event_container->event); + if (EVENT_CONST[event_container->idx].RETRY != 0) + { + backup_session_insert_rpc("Inform",NULL,RPC_QUEUE); + backup_session_insert_event(pEventStruct->EventCode, pEventStruct->CommandKey, event_container->id, RPC_QUEUE); + + __list_for_each(ilist,&(event_container->head_paramater_container)) + { + paramater_container = list_entry(ilist, struct paramater_container, list); + ptr_ParameterValueStruct = &(paramater_container->paramater); + backup_session_insert_parameter(ptr_ParameterValueStruct->Name,NULL,"event",pEventStruct->EventCode,event_container->id,pEventStruct->CommandKey); + } + } + return; +} + +struct event_container *cwmp_add_event_container (struct cwmp *cwmp, int event_idx, char *command_key) +{ + static unsigned int id; + struct event_container *event_container; + struct session *session; + struct list_head *ilist; + + if (cwmp->head_event_container == NULL) + { + session = cwmp_add_queue_session(cwmp); + if (session == NULL) + { + return NULL; + } + cwmp->head_event_container = &(session->head_event_container); + } + session = list_entry (cwmp->head_event_container, struct session,head_event_container); + __list_for_each(ilist, cwmp->head_event_container) + { + event_container = list_entry (ilist, struct event_container, list); + if (event_container->idx==event_idx && + EVENT_CONST[event_idx].TYPE==EVENT_TYPE_SINGLE) + { + return event_container; + } + if(event_container->idx > event_idx) + { + break; + } + } + event_container = calloc (1,sizeof(struct event_container)); + if (event_container==NULL) + { + return NULL; + } + INIT_LIST_HEAD (&(event_container->head_paramater_container)); + list_add (&(event_container->list), ilist->prev); + event_container->event.EventCode = strdup(EVENT_CONST[event_idx].CODE); + event_container->event.CommandKey = strdup(command_key); + if((id<0) || (id>=MAX_INT_ID) ) + { + id=0; + } + id++; + event_container->id = id; + event_container->idx = event_idx; + session->event_size++; + return event_container; +} + +struct paramater_container *cwmp_add_parameter_container + (struct cwmp *cwmp, + struct event_container *event_container, + char *name) +{ + struct paramater_container *paramater_container; + struct cwmp1__ParameterValueStruct *ptr_ParameterValueStruct; + struct list_head *ilist; + struct session *session; + + __list_for_each(ilist,&(event_container->head_paramater_container)) + { + paramater_container = list_entry(ilist, struct paramater_container, list); + ptr_ParameterValueStruct = &(paramater_container->paramater); + if(strcmp(ptr_ParameterValueStruct->Name,name)==0) + { + return paramater_container; + } + } + paramater_container = calloc (1, sizeof(struct paramater_container)); + if(paramater_container == NULL) + { + return NULL; + } + paramater_container->paramater.Name = strdup(name); + list_add_tail(&(paramater_container->list), &(event_container->head_paramater_container)); + session = list_entry (cwmp->head_event_container, struct session,head_event_container); + session->parameter_size++; + return paramater_container; +} + +int cwmp_root_cause_event_boot (struct cwmp *cwmp) +{ + struct event_container *event_container; + if (cwmp->env.boot == CWMP_START_BOOT) + { + pthread_mutex_lock (&(cwmp->mutex_session_queue)); + cwmp->env.boot = 0; + event_container = cwmp_add_event_container (cwmp, EVENT_IDX_1BOOT, ""); + if (event_container == NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_MEM_ERR; + } + cwmp_save_event_container (cwmp,event_container); + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + } + return CWMP_OK; +} +int event_remove_all_event_container(struct session *session, int rem_from) +{ + struct cwmp1__EventStruct *eventStruct; + struct event_container *event_container; + struct paramater_container *paramater_container; + struct cwmp1__ParameterValueStruct *paramater; + + while (session->head_event_container.next!=&(session->head_event_container)) + { + event_container = list_entry(session->head_event_container.next, struct event_container, list); + eventStruct = &(event_container->event); + if (eventStruct->EventCode!=NULL) + { + free (eventStruct->EventCode); + } + if (eventStruct->CommandKey!=NULL) + { + free (eventStruct->CommandKey); + } + while (event_container->head_paramater_container.next!=&(event_container->head_paramater_container)) + { + paramater_container = list_entry(event_container->head_paramater_container.next, struct paramater_container, list); + paramater = &(paramater_container->paramater); + if (paramater->Name!=NULL) + { + free (paramater->Name); + } + if (paramater->Value!=NULL) + { + free(paramater->Value); + } + list_del(&(paramater_container->list)); + free(paramater_container); + } + list_del(&(event_container->list)); + free (event_container); + } + session->event_size = 0; + session->parameter_size = 0; + backup_session_delete_rpc("Inform",NULL,rem_from); + return CWMP_OK; +} + +int cwmp_root_cause_event_bootstrap (struct cwmp *cwmp) +{ + char *acsurl = NULL; + int error,cmp=0; + struct event_container *event_container; + struct session *session; + + error = cwmp_load_saved_session(cwmp, &acsurl, ACS); + + if(acsurl == NULL) + { + save_acs_bkp_config (cwmp); + } + + if (acsurl == NULL || ((acsurl != NULL)&&(cmp = strcmp(cwmp->conf.acsurl,acsurl)))) + { + pthread_mutex_lock (&(cwmp->mutex_session_queue)); + if (cwmp->head_event_container!=NULL && cwmp->head_session_queue.next!=&(cwmp->head_session_queue)) + { + session = list_entry(cwmp->head_event_container,struct session, head_event_container); + event_remove_all_event_container (session,RPC_QUEUE); + } + event_container = cwmp_add_event_container (cwmp, EVENT_IDX_0BOOTSTRAP, ""); + if (acsurl != NULL) + { + free(acsurl); + } + if (event_container == NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_MEM_ERR; + } + cwmp_save_event_container (cwmp,event_container); + cwmp_scheduleInform_remove_all(); + cwmp_scheduledDownload_remove_all(); + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + } + + if (cmp) + { + struct paramater_container *paramater_container; + pthread_mutex_lock (&(cwmp->mutex_session_queue)); + event_container = cwmp_add_event_container (cwmp, EVENT_IDX_4VALUE_CHANGE, ""); + if (event_container == NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_MEM_ERR; + } + paramater_container = cwmp_add_parameter_container (cwmp,event_container, "InternetGatewayDevice.ManagementServer.URL"); + cwmp_save_event_container (cwmp,event_container); + save_acs_bkp_config (cwmp); + cwmp_scheduleInform_remove_all(); + cwmp_scheduledDownload_remove_all(); + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + } + + return CWMP_OK; +} + +int cwmp_root_cause_TransferComplete (struct cwmp *cwmp) +{ + struct event_container *event_container; + struct session *session; + struct rpc_acs *rpc_acs; + struct _cwmp1__TransferComplete *p; + + pthread_mutex_lock (&(cwmp->mutex_session_queue)); + event_container = cwmp_add_event_container (cwmp, EVENT_IDX_7TRANSFER_COMPLETE, ""); + if (event_container == NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_MEM_ERR; + } + session = list_entry (cwmp->head_event_container, struct session,head_event_container); + if((rpc_acs = cwmp_add_session_rpc_acs_transferComplete (session)) == NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_MEM_ERR; + } + p = (struct _cwmp1__TransferComplete *) rpc_acs->method_data; + event_container = cwmp_add_event_container (cwmp, EVENT_IDX_M_Download, p->CommandKey); + if (event_container == NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_MEM_ERR; + } + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_OK; +} + +int cwmp_root_cause_getRPCMethod (struct cwmp *cwmp) +{ + char acsurl[256]; + int error,cmp=0; + struct event_container *event_container; + struct session *session; + + if (cwmp->env.periodic == CWMP_START_PERIODIC) + { + pthread_mutex_lock (&(cwmp->mutex_session_queue)); + cwmp->env.periodic = 0; + event_container = cwmp_add_event_container (cwmp, EVENT_IDX_2PERIODIC, ""); + if (event_container == NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_MEM_ERR; + } + cwmp_save_event_container (cwmp,event_container); + session = list_entry (cwmp->head_event_container, struct session,head_event_container); + if(cwmp_add_session_rpc_acs_getRPCMethods (session) == NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_MEM_ERR; + } + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + } + + return CWMP_OK; +} + +int cwmp_root_cause_event_iccu_value_change (struct cwmp *cwmp) +{ + struct event_container *event_container; + if (cwmp->env.iccu == CWMP_START_ICCU) + { + pthread_mutex_lock (&(cwmp->mutex_session_queue)); + cwmp->env.iccu = 0; + event_container = cwmp_add_event_container (cwmp, EVENT_IDX_4VALUE_CHANGE, ""); + if (event_container == NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_MEM_ERR; + } + cwmp_add_parameter_container (cwmp, event_container, "InternetGatewayDevice.ManagementServer.ConnectionRequestURL"); + cwmp_save_event_container (cwmp,event_container); + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + } + return CWMP_OK; +} + +int cwmp_root_cause_event_api_value_change(struct cwmp *cwmp, struct session *session) +{ + struct event_container *event_container; + struct list_head *ilist; + + if (cwmp->api_value_change.parameter_list.next != &(cwmp->api_value_change.parameter_list)) + { + pthread_mutex_lock (&(cwmp->mutex_session_queue)); + pthread_mutex_lock (&(cwmp->api_value_change.mutex)); + event_container = cwmp_add_event_container (cwmp, EVENT_IDX_4VALUE_CHANGE, ""); + if (event_container == NULL) + { + pthread_mutex_unlock (&(cwmp->api_value_change.mutex)); + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + return CWMP_MEM_ERR; + } + __list_for_each(ilist,&(cwmp->api_value_change.parameter_list)) + { + struct handler_ParameterValueStruct *handler_ParameterValueStruct; + handler_ParameterValueStruct = list_entry(ilist,struct handler_ParameterValueStruct,list); + cwmp_add_parameter_container (cwmp, event_container, handler_ParameterValueStruct->ParameterValueStruct->Name); + ilist = ilist->prev; + list_del(&(handler_ParameterValueStruct->list)); + free (handler_ParameterValueStruct->ParameterValueStruct->Name); + free (handler_ParameterValueStruct->ParameterValueStruct); + free (handler_ParameterValueStruct); + } + cwmp->api_value_change.parameter_size = 0; + cwmp_save_event_container (cwmp,event_container); + pthread_mutex_unlock (&(cwmp->api_value_change.mutex)); + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + } + return CWMP_OK; +} + +void *thread_event_periodic (void *v) +{ + struct cwmp *cwmp = (struct cwmp *) v; + struct event_container *event_container; + static int periodic_interval; + static bool periodic_enable; + static struct timespec periodic_timeout = {0, 0}; + + periodic_interval = cwmp->conf.period; + periodic_enable = cwmp->conf.periodic_enable; + + for(;;) + { + pthread_mutex_lock (&(cwmp->mutex_periodic)); + periodic_timeout.tv_sec = time(NULL) + periodic_interval; + if (cwmp->conf.periodic_enable) + { + pthread_cond_timedwait(&(cwmp->threshold_periodic), &(cwmp->mutex_periodic), &periodic_timeout); + } + else + { + pthread_cond_wait(&(cwmp->threshold_periodic), &(cwmp->mutex_periodic)); + } + pthread_mutex_unlock (&(cwmp->mutex_periodic)); + if (periodic_interval != cwmp->conf.period || periodic_enable != cwmp->conf.periodic_enable) + { + periodic_enable = cwmp->conf.periodic_enable; + periodic_interval = cwmp->conf.period; + continue; + } + CWMP_LOG(INFO,"Periodic thread: add periodic event in the queue"); + pthread_mutex_lock (&(cwmp->mutex_session_queue)); + event_container = cwmp_add_event_container (cwmp, EVENT_IDX_2PERIODIC, ""); + if (event_container == NULL) + { + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + continue; + } + cwmp_save_event_container (cwmp,event_container); + pthread_mutex_unlock (&(cwmp->mutex_session_queue)); + pthread_cond_signal(&(cwmp->threshold_session_send)); + } + return CWMP_OK; +} + +int cwmp_root_cause_event_periodic (struct cwmp *cwmp) +{ + static int period = 0; + static bool periodic_enable = FALSE; + if (period==cwmp->conf.period && periodic_enable==cwmp->conf.periodic_enable) + { + return CWMP_OK; + } + period = cwmp->conf.period; + periodic_enable = cwmp->conf.periodic_enable; + CWMP_LOG(INFO,periodic_enable?"Periodic event is enabled. Interval period = %ds":"Periodic event is disabled", period); + pthread_cond_signal(&(cwmp->threshold_periodic)); + return CWMP_OK; +} + +int cwmp_root_cause_events (struct cwmp *cwmp) +{ + int error; + + if (error = cwmp_root_cause_event_bootstrap(cwmp)) + { + return error; + } + + if (error = cwmp_root_cause_event_boot(cwmp)) + { + return error; + } + + if (error = cwmp_root_cause_event_iccu_value_change(cwmp)) + { + return error; + } + + if (error = cwmp_root_cause_getRPCMethod(cwmp)) + { + return error; + } + + if (error = cwmp_root_cause_event_periodic(cwmp)) + { + return error; + } + return CWMP_OK; +} + diff --git a/src/httpda.c b/src/httpda.c new file mode 100644 index 0000000..62fd47b --- /dev/null +++ b/src/httpda.c @@ -0,0 +1,710 @@ +/* + httpda.c + + gSOAP HTTP Digest Authentication plugin. + Supports both Basic and Digest authentication. + +gSOAP XML Web services tools +Copyright (C) 2000-2005, Robert van Engelen, Genivia Inc., All Rights Reserved. +This part of the software is released under one of the following licenses: +GPL, the gSOAP public license, or Genivia's license for commercial use. +-------------------------------------------------------------------------------- +gSOAP public license. + +The contents of this file are subject to the gSOAP Public License Version 1.3 +(the "License"); you may not use this file except in compliance with the +License. You may obtain a copy of the License at +http://www.cs.fsu.edu/~engelen/soaplicense.html +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +for the specific language governing rights and limitations under the License. + +The Initial Developer of the Original Code is Robert A. van Engelen. +Copyright (C) 2000-2005, Robert van Engelen, Genivia, Inc., All Rights Reserved. +-------------------------------------------------------------------------------- +GPL license. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA + +Author contact information: +engelen@genivia.com / engelen@acm.org + +This program is released under the GPL with the additional exemption that +compiling, linking, and/or using OpenSSL is allowed. +-------------------------------------------------------------------------------- +A commercial use license is available from Genivia, Inc., contact@genivia.com +-------------------------------------------------------------------------------- +*/ + +#include "httpda.h" + +#ifdef __cplusplus +extern "C" { +#endif + +const char http_da_id[12] = HTTP_DA_ID; + +/* session database and lock */ +static struct http_da_session *http_da_session = NULL; +static MUTEX_TYPE http_da_session_lock; + +#define HTTP_DA_NONCELEN 21 +#define HTTP_DA_OPAQUELEN 9 + +/******************************************************************************\ + * + * Forward decls + * +\******************************************************************************/ + +static int http_da_init(struct soap *soap, struct http_da_data *data); +static int http_da_copy(struct soap *soap, struct soap_plugin *dst, struct soap_plugin *src); +static void http_da_delete(struct soap *soap, struct soap_plugin *p); + +static int http_da_post_header(struct soap *soap, const char *key, const char *val); +static int http_da_parse_header(struct soap *soap, const char *key, const char *val); +static int http_da_prepareinit(struct soap *soap); +static int http_da_preparesend(struct soap *soap, const char *buf, size_t len); +static int http_da_preparerecv(struct soap *soap, const char *buf, size_t len); +static int http_da_disconnect(struct soap *soap); + +static int http_da_verify_method(struct soap *soap, char *method, char *passwd); +static void http_da_session_start(const char *realm, const char *nonce, const char *opaque); +static int http_da_session_update(const char *realm, const char *nonce, const char *opaque, const char *cnonce, const char *ncount); +static void http_da_session_cleanup(); + +void http_da_calc_nonce(struct soap *soap, char nonce[HTTP_DA_NONCELEN]); +void http_da_calc_opaque(struct soap *soap, char opaque[HTTP_DA_OPAQUELEN]); +static void http_da_calc_HA1(struct soap *soap, void **context, char *alg, char *userid, char *realm, char *passwd, char *nonce, char *cnonce, char HA1hex[33]); +static void http_da_calc_response(struct soap *soap, void **context, char HA1hex[33], char *nonce, char *ncount, char *cnonce, char *qop, char *method, char *uri, char entityHAhex[33], char response[33]); + +/******************************************************************************\ + * + * Plugin registry + * +\******************************************************************************/ + +int http_da(struct soap *soap, struct soap_plugin *p, void *arg) +{ + p->id = http_da_id; + p->data = (void*)SOAP_MALLOC(soap, sizeof(struct http_da_data)); + p->fcopy = http_da_copy; + p->fdelete = http_da_delete; + if (p->data) + { + if (http_da_init(soap, (struct http_da_data*)p->data)) + { + SOAP_FREE(soap, p->data); + return SOAP_EOM; + } + } + return SOAP_OK; +} + +static int http_da_init(struct soap *soap, struct http_da_data *data) +{ + data->fposthdr = soap->fposthdr; + soap->fposthdr = http_da_post_header; + data->fparsehdr = soap->fparsehdr; + soap->fparsehdr = http_da_parse_header; + data->fprepareinit = soap->fprepareinit; + soap->fprepareinit = http_da_prepareinit; + data->context = NULL; + memset(data->digest, 0, sizeof(data->digest)); + + return SOAP_OK; +} + +static int http_da_copy(struct soap *soap, struct soap_plugin *dst, struct soap_plugin *src) +{ + *dst = *src; + dst->data = (void*)SOAP_MALLOC(soap, sizeof(struct http_da_data)); + memcpy(dst->data, src->data, sizeof(struct http_da_data)); + ((struct http_da_data*)dst->data)->context = NULL; + memset(((struct http_da_data*)dst->data)->digest, 0, sizeof(((struct http_da_data*)dst->data)->digest)); + ((struct http_da_data*)dst->data)->nonce = NULL; + ((struct http_da_data*)dst->data)->opaque = NULL; + ((struct http_da_data*)dst->data)->qop = NULL; + ((struct http_da_data*)dst->data)->alg = NULL; + ((struct http_da_data*)dst->data)->nc = 0; + ((struct http_da_data*)dst->data)->ncount = NULL; + ((struct http_da_data*)dst->data)->cnonce = NULL; + ((struct http_da_data*)dst->data)->response = NULL; + return SOAP_OK; +} + +static void http_da_delete(struct soap *soap, struct soap_plugin *p) +{ + struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id); + if (data) + { + if (data->context) + md5_handler(soap, &data->context, MD5_DELETE, NULL, 0); + SOAP_FREE(soap, data); + } +} + +/******************************************************************************\ + * + * Callbacks + * +\******************************************************************************/ + +static int http_da_post_header(struct soap *soap, const char *key, const char *val) +{ + struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id); + + if (!data) + return SOAP_PLUGIN_ERROR; + + /* client's HTTP Authorization response */ + if (key && !strcmp(key, "Authorization")) + { + char HA1[33], entityHAhex[33], response[33]; + char cnonce[HTTP_DA_NONCELEN]; + char ncount[9]; + char *qop, *method; + + md5_handler(soap, &data->context, MD5_FINAL, data->digest, 0); + + http_da_calc_nonce(soap, cnonce); + http_da_calc_HA1(soap, &data->context, data->alg, soap->userid, soap->authrealm, soap->passwd, data->nonce, cnonce, HA1); + + if (data->qop && !soap_tag_cmp(data->qop, "*auth-int*")) + { + qop = "auth-int"; + soap_s2hex(soap, (unsigned char*)data->digest, entityHAhex, 16); + } + else if (data->qop) + qop = "auth"; + else + qop = NULL; + + if (soap->status == SOAP_GET) + method = "GET"; + else + method = "POST"; + + sprintf(ncount, "%8.8lx", data->nc++); + + http_da_calc_response(soap, &data->context, HA1, data->nonce, ncount, cnonce, qop, method, soap->path, entityHAhex, response); + + sprintf(soap->tmpbuf, "Digest realm=\"%s\", username=\"%s\", nonce=\"%s\", uri=\"%s\", nc=%s, cnonce=\"%s\", response=\"%s\"", soap->authrealm, soap->userid, data->nonce, soap->path, ncount, cnonce, response); + if (data->opaque) + sprintf(soap->tmpbuf + strlen(soap->tmpbuf), ", opaque=\"%s\"", data->opaque); + if (qop) + sprintf(soap->tmpbuf + strlen(soap->tmpbuf), ", qop=\"%s\"", qop); + + return data->fposthdr(soap, key, soap->tmpbuf); + } + + /* server's HTTP Authorization response */ + if (key && !strcmp(key, "WWW-Authenticate")) + { + char nonce[HTTP_DA_NONCELEN]; + char opaque[HTTP_DA_OPAQUELEN]; + + http_da_calc_nonce(soap, nonce); + http_da_calc_opaque(soap, opaque); + + http_da_session_start(soap->authrealm, nonce, opaque); + + sprintf(soap->tmpbuf, "Digest realm=\"%s\", qop=\"auth,auth-int\", nonce=\"%s\", opaque=\"%s\"", soap->authrealm, nonce, opaque); + + return data->fposthdr(soap, key, soap->tmpbuf); + } + + return data->fposthdr(soap, key, val); +} + +static int http_da_parse_header(struct soap *soap, const char *key, const char *val) +{ + struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id); + + if (!data) + return SOAP_PLUGIN_ERROR; + + /* check if server received Authorization Digest HTTP header from client */ + if (!soap_tag_cmp(key, "Authorization") && !soap_tag_cmp(val, "Digest *")) + { + soap->authrealm = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "realm")); + soap->userid = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "username")); + soap->passwd = NULL; + data->nonce = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "nonce")); + data->opaque = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "opaque")); + data->qop = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "qop")); + data->alg = NULL; + data->ncount = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "nc")); + data->cnonce = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "cnonce")); + data->response = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "response")); + if (data->qop && !soap_tag_cmp(data->qop, "auth-int")) + { + if (soap->fpreparerecv != http_da_preparerecv) + { + data->fpreparerecv = soap->fpreparerecv; + soap->fpreparerecv = http_da_preparerecv; + } + if (soap->fdisconnect != http_da_disconnect) + { + data->fdisconnect = soap->fdisconnect; + soap->fdisconnect = http_da_disconnect; + } + md5_handler(soap, &data->context, MD5_INIT, NULL, 0); + } + return SOAP_OK; + } + + /* check if client received WWW-Authenticate Digest HTTP header from server */ + if (!soap_tag_cmp(key, "WWW-Authenticate") && !soap_tag_cmp(val, "Digest *")) + { + soap->authrealm = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "realm")); + data->nonce = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "nonce")); + data->opaque = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "opaque")); + data->qop = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "qop")); + data->alg = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "algorithm")); + data->nc = 1; + data->ncount = NULL; + data->cnonce = NULL; + data->response = NULL; + return SOAP_OK; + } + + return data->fparsehdr(soap, key, val); +} + +static int http_da_prepareinit(struct soap *soap) +{ + struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id); + + if (!data) + return SOAP_PLUGIN_ERROR; + + if ((soap->mode & SOAP_IO) != SOAP_IO_STORE && (soap->mode & (SOAP_ENC_DIME | SOAP_ENC_MIME))) + { /* TODO: handle attachments automatically, does not work yet */ + soap->mode &= ~SOAP_IO; + soap->mode |= SOAP_IO_STORE; + } + else + { + if (soap->fpreparerecv == http_da_preparerecv) + soap->fpreparerecv = data->fpreparerecv; + if (soap->fdisconnect == http_da_disconnect) + soap->fdisconnect = data->fdisconnect; + + if (soap->userid && soap->passwd) + { + md5_handler(soap, &data->context, MD5_INIT, NULL, 0); + if (soap->fpreparesend != http_da_preparesend) + { + data->fpreparesend = soap->fpreparesend; + soap->fpreparesend = http_da_preparesend; + } + } + + if (data->fprepareinit) + return data->fprepareinit(soap); + } + + return SOAP_OK; +} + +static int http_da_preparesend(struct soap *soap, const char *buf, size_t len) +{ + struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id); + + if (!data) + return SOAP_PLUGIN_ERROR; + + md5_handler(soap, &data->context, MD5_UPDATE, (char*)buf, len); + + if (data->fpreparesend) + return data->fpreparesend(soap, buf, len); + + return SOAP_OK; +} + +static int http_da_preparerecv(struct soap *soap, const char *buf, size_t len) +{ + struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id); + + if (!data) + return SOAP_PLUGIN_ERROR; + + md5_handler(soap, &data->context, MD5_UPDATE, (char*)buf, len); + + if (data->fpreparerecv) + return data->fpreparerecv(soap, buf, len); + + return SOAP_OK; +} + +static int http_da_disconnect(struct soap *soap) +{ + struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id); + + if (!data) + return SOAP_PLUGIN_ERROR; + + md5_handler(soap, &data->context, MD5_FINAL, data->digest, 0); + + soap->fpreparerecv = data->fpreparerecv; + soap->fdisconnect = data->fdisconnect; + + if (soap->fdisconnect) + return soap->fdisconnect(soap); + + return SOAP_OK; +} + +/******************************************************************************\ + * + * Client-side digest authentication state management + * +\******************************************************************************/ + +void http_da_save(struct soap *soap, struct http_da_info *info, const char *realm, const char *userid, const char *passwd) +{ + struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id); + if (!data) + return; + info->authrealm = soap->authrealm = soap_strdup(NULL, realm); + info->userid = soap->userid = soap_strdup(NULL, userid); + info->passwd = soap->passwd = soap_strdup(NULL, passwd); + info->nonce = soap_strdup(NULL, data->nonce); + info->opaque = soap_strdup(NULL, data->opaque); + info->qop = soap_strdup(NULL, data->qop); + info->alg = soap_strdup(NULL, data->alg); +} + +void http_da_restore(struct soap *soap, struct http_da_info *info) +{ + struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id); + if (!data) + return; + soap->authrealm = info->authrealm; + soap->userid = info->userid; + soap->passwd = info->passwd; + data->nonce = info->nonce; + data->opaque = info->opaque; + data->qop = info->qop; + data->alg = info->alg; +} + +void http_da_release(struct soap *soap, struct http_da_info *info) +{ + struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id); + if (!data) + return; + + soap->authrealm = NULL; + soap->userid = NULL; + soap->passwd = NULL; + data->nonce = NULL; + data->opaque = NULL; + data->qop = NULL; + data->alg = NULL; + + if (info->authrealm) + { + free(info->authrealm); + info->authrealm = NULL; + } + if (info->userid) + { + free(info->userid); + info->userid = NULL; + } + if (info->passwd) + { + free(info->passwd); + info->passwd = NULL; + } + if (info->nonce) + { + free(info->nonce); + info->nonce = NULL; + } + if (info->opaque) + { + free(info->opaque); + info->opaque = NULL; + } + if (info->qop) + { + free(info->qop); + info->qop = NULL; + } + if (info->alg) + { + free(info->alg); + info->alg = NULL; + } +} + +/******************************************************************************\ + * + * Server-side digest authentication verification + * +\******************************************************************************/ + +int http_da_verify_post(struct soap *soap, char *passwd) +{ + return http_da_verify_method(soap, "POST", passwd); +} + +int http_da_verify_get(struct soap *soap, char *passwd) +{ + return http_da_verify_method(soap, "GET", passwd); +} + +static int http_da_verify_method(struct soap *soap, char *method, char *passwd) +{ + struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id); + char HA1[33], entityHAhex[33], response[33]; + + if (!data) + return SOAP_ERR; + + /* reject if none or basic authentication was used */ + if (!soap->authrealm + || !soap->userid + || soap->passwd) /* passwd is set when basic auth is used */ + return SOAP_ERR; + + /* require at least qop="auth" to prevent replay attacks */ + if (!data->qop) + return SOAP_ERR; + + if (http_da_session_update(soap->authrealm, data->nonce, data->opaque, data->cnonce, data->ncount)) + return SOAP_ERR; + + http_da_calc_HA1(soap, &data->context, NULL, soap->userid, soap->authrealm, passwd, data->nonce, data->cnonce, HA1); + + if (!soap_tag_cmp(data->qop, "auth-int")) + soap_s2hex(soap, (unsigned char*)data->digest, entityHAhex, 16); + + http_da_calc_response(soap, &data->context, HA1, data->nonce, data->ncount, data->cnonce, data->qop, method, soap->path, entityHAhex, response); + +#ifdef SOAP_DEBUG + fprintf(stderr, "Debug message: verifying client response=%s with calculated digest=%s\n", data->response, response); +#endif + + /* check digest response values */ + if (strcmp(data->response, response)) + return SOAP_ERR; + + return SOAP_OK; +} + +/******************************************************************************\ + * + * Digest authentication session database management + * +\******************************************************************************/ + +static void http_da_session_start(const char *realm, const char *nonce, const char *opaque) +{ + struct http_da_session *session; + time_t now = time(NULL); + + if (now % 10 == 0) /* don't do this all the time to improve efficiency */ + http_da_session_cleanup(); + +#ifdef SOAP_DEBUG + fprintf(stderr, "Starting session realm=%s nonce=%s\n", realm, nonce); +#endif + + MUTEX_LOCK(http_da_session_lock); + + session = (struct http_da_session*)malloc(sizeof(struct http_da_session)); + if (session) + { + session->next = http_da_session; + session->modified = now; + session->realm = soap_strdup(NULL, realm); + session->nonce = soap_strdup(NULL, nonce); + session->opaque = soap_strdup(NULL, opaque); + session->nc = 0; + http_da_session = session; + } + + MUTEX_UNLOCK(http_da_session_lock); +} + +static int http_da_session_update(const char *realm, const char *nonce, const char *opaque, const char *cnonce, const char *ncount) +{ + struct http_da_session *session; + + if (!realm || !nonce || !opaque || !cnonce || !ncount) + return SOAP_ERR; + +#ifdef SOAP_DEBUG + fprintf(stderr, "Debug message: updating session realm=%s nonce=%s\n", realm, nonce); +#endif + + MUTEX_LOCK(http_da_session_lock); + + for (session = http_da_session; session; session = session->next) + if (!strcmp(session->realm, realm) && !strcmp(session->nonce, nonce) && !strcmp(session->opaque, opaque)) + break; + + if (session) + { + unsigned long nc = soap_strtoul(ncount, NULL, 16); + + if (session->nc >= nc) + { + session->modified = 0; /* replay attack: terminate session */ + session = NULL; + } + else + { + session->nc = nc; + session->modified = time(NULL); + } + } + + MUTEX_UNLOCK(http_da_session_lock); + + if (!session) + return SOAP_ERR; + + return SOAP_OK; +} + +static void http_da_session_cleanup() +{ + struct http_da_session **session; + time_t now = time(NULL); + + MUTEX_LOCK(http_da_session_lock); + + session = &http_da_session; + while (*session) + { + if ((*session)->modified + HTTP_DA_SESSION_TIMEOUT < now) + { + struct http_da_session *p = *session; + +#ifdef SOAP_DEBUG + fprintf(stderr, "Deleting session realm=%s nonce=%s\n", p->realm, p->nonce); +#endif + + if (p->realm) + free(p->realm); + if (p->nonce) + free(p->nonce); + if (p->opaque) + free(p->opaque); + + *session = p->next; + free(p); + } + else + session = &(*session)->next; + } + + MUTEX_UNLOCK(http_da_session_lock); +} + +/******************************************************************************\ + * + * Calculate hex nonce and opaque values + * +\******************************************************************************/ + +void http_da_calc_nonce(struct soap *soap, char nonce[HTTP_DA_NONCELEN]) +{ + static short count = 0xCA53; + sprintf(nonce, "%8.8x%4.4hx%8.8x", (int)time(NULL), count++, soap_random); +} + +void http_da_calc_opaque(struct soap *soap, char opaque[HTTP_DA_OPAQUELEN]) +{ + sprintf(opaque, "%8.8x", soap_random); +} + +/******************************************************************************\ + * + * Calculate HA1, HA2, and response digest as per RFC 2617 specification + * +\******************************************************************************/ + +static void http_da_calc_HA1(struct soap *soap, void **context, char *alg, char *userid, char *realm, char *passwd, char *nonce, char *cnonce, char HA1hex[33]) +{ + char HA1[16]; + + md5_handler(soap, context, MD5_INIT, NULL, 0); + md5_handler(soap, context, MD5_UPDATE, userid, strlen(userid)); + md5_handler(soap, context, MD5_UPDATE, ":", 1); + md5_handler(soap, context, MD5_UPDATE, realm, strlen(realm)); + md5_handler(soap, context, MD5_UPDATE, ":", 1); + md5_handler(soap, context, MD5_UPDATE, passwd, strlen(passwd)); + md5_handler(soap, context, MD5_FINAL, HA1, 0); + + if (alg && !soap_tag_cmp(alg, "MD5-sess")) + { + md5_handler(soap, context, MD5_INIT, NULL, 0); + md5_handler(soap, context, MD5_UPDATE, HA1, 16); + md5_handler(soap, context, MD5_UPDATE, ":", 1); + md5_handler(soap, context, MD5_UPDATE, nonce, strlen(nonce)); + md5_handler(soap, context, MD5_UPDATE, ":", 1); + md5_handler(soap, context, MD5_UPDATE, cnonce, strlen(cnonce)); + md5_handler(soap, context, MD5_FINAL, HA1, 0); + }; + + soap_s2hex(soap, (unsigned char*)HA1, HA1hex, 16); +}; + +static void http_da_calc_response(struct soap *soap, void **context, char HA1hex[33], char *nonce, char *ncount, char *cnonce, char *qop, char *method, char *uri, char entityHAhex[33], char response[33]) +{ + char HA2[16], HA2hex[33], responseHA[16]; + + md5_handler(soap, context, MD5_INIT, NULL, 0); + md5_handler(soap, context, MD5_UPDATE, method, strlen(method)); + md5_handler(soap, context, MD5_UPDATE, ":", 1); + md5_handler(soap, context, MD5_UPDATE, uri, strlen(uri)); + if (!soap_tag_cmp(qop, "auth-int")) + { + md5_handler(soap, context, MD5_UPDATE, ":", 1); + md5_handler(soap, context, MD5_UPDATE, entityHAhex, 32); + } + md5_handler(soap, context, MD5_FINAL, HA2, 0); + + soap_s2hex(soap, (unsigned char*)HA2, HA2hex, 16); + + md5_handler(soap, context, MD5_INIT, NULL, 0); + md5_handler(soap, context, MD5_UPDATE, HA1hex, 32); + md5_handler(soap, context, MD5_UPDATE, ":", 1); + md5_handler(soap, context, MD5_UPDATE, nonce, strlen(nonce)); + md5_handler(soap, context, MD5_UPDATE, ":", 1); + if (qop && *qop) + { + md5_handler(soap, context, MD5_UPDATE, ncount, strlen(ncount)); + md5_handler(soap, context, MD5_UPDATE, ":", 1); + md5_handler(soap, context, MD5_UPDATE, cnonce, strlen(cnonce)); + md5_handler(soap, context, MD5_UPDATE, ":", 1); + md5_handler(soap, context, MD5_UPDATE, qop, strlen(qop)); + md5_handler(soap, context, MD5_UPDATE, ":", 1); + } + md5_handler(soap, context, MD5_UPDATE, HA2hex, 32); + md5_handler(soap, context, MD5_FINAL, responseHA, 0); + + soap_s2hex(soap, (unsigned char*)responseHA, response, 16); +} + +#ifdef __cplusplus +} +#endif + diff --git a/src/inc/backupSession.h b/src/inc/backupSession.h new file mode 100644 index 0000000..1a622ec --- /dev/null +++ b/src/inc/backupSession.h @@ -0,0 +1,34 @@ +/* + backupSession.h + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#define RPC_NO_STATUS -1 +#define RPC_QUEUE 0 +#define RPC_SEND 1 + +typedef struct attribute +{ + long int id; + char *name; + char *status; + char *commandKey; + char *url; +} attribute; + +typedef enum backup_loading { + ALL, + ACS +} backup_loading; diff --git a/src/inc/cwmp-1-1.h b/src/inc/cwmp-1-1.h new file mode 100644 index 0000000..912358a --- /dev/null +++ b/src/inc/cwmp-1-1.h @@ -0,0 +1,1258 @@ +/* cwmp-1-1.h + Generated by wsdl2h 1.2.11 from cwmp-1-1.wsdl and typemap.dat + 2008-09-30 10:26:18 GMT + Copyright (C) 2001-2008 Robert van Engelen, Genivia Inc. All Rights Reserved. + This part of the software is released under one of the following licenses: + GPL or Genivia's license for commercial use. +*/ + +/* NOTE: + + - Compile this file with soapcpp2 to complete the code generation process. + - Use soapcpp2 option -I to specify paths for #import + To build with STL, 'stlvector.h' is imported from 'import' dir in package. + - Use wsdl2h options -c and -s to generate pure C code or C++ code without STL. + - Use 'typemap.dat' to control namespace bindings and type mappings. + It is strongly recommended to customize the names of the namespace prefixes + generated by wsdl2h. To do so, modify the prefix bindings in the Namespaces + section below and add the modified lines to 'typemap.dat' to rerun wsdl2h. + - Use Doxygen (www.doxygen.org) to browse this file. + - Use wsdl2h option -l to view the software license terms. + + DO NOT include this file directly into your project. + Include only the soapcpp2-generated headers and source code files. +*/ + +//gsoapopt cw + +/******************************************************************************\ + * * + * urn:dslforum-org:cwmp-1-1 * + * * +\******************************************************************************/ + + +/******************************************************************************\ + * * + * Import * + * * +\******************************************************************************/ + + +/******************************************************************************\ + * * + * Schema Namespaces * + * * +\******************************************************************************/ + + +/* NOTE: + +It is strongly recommended to customize the names of the namespace prefixes +generated by wsdl2h. To do so, modify the prefix bindings below and add the +modified lines to typemap.dat to rerun wsdl2h: + +cwmp1 = "urn:dslforum-org:cwmp-1-1" + +*/ + +//gsoap cwmp1 schema namespace: urn:dslforum-org:cwmp-1-1 +//gsoap cwmp1 schema form: unqualified + +/******************************************************************************\ + * * + * Schema Types * + * * +\******************************************************************************/ + + +/// Built-in type "SOAP-ENC:base64". +struct SOAP_ENC__base64 { unsigned char *__ptr; int __size; }; + +/// Primitive built-in type "xs:anySimpleType" +typedef char* xsd__anySimpleType; + +/// Built-in type "xs:boolean". +enum xsd__boolean { xsd__boolean__false_, xsd__boolean__true_ }; + + +/// union of values from "xs:unsignedInt" +/// union of values from "xs:unsignedInt" +/// union of values from "xs:unsignedInt" +/// union of values from "xs:unsignedInt" +/// union of values from "xs:unsignedInt" +/// union of values from "xs:unsignedInt" +typedef char* cwmp1__FaultCodeType; + +/// "urn:dslforum-org:cwmp-1-1":ParameterKeyType is a simpleType restriction of xs:string. +/// Length of this string is within 0..32 characters +typedef char* cwmp1__ParameterKeyType:32; + +/// "urn:dslforum-org:cwmp-1-1":CommandKeyType is a simpleType restriction of xs:string. +/// Length of this string is within 0..32 characters +typedef char* cwmp1__CommandKeyType:32; + +/// "urn:dslforum-org:cwmp-1-1":ObjectNameType is a simpleType restriction of xs:string. +/// Length of this string is within 0..256 characters +/// Content pattern is ".*\\." +typedef char* cwmp1__ObjectNameType ".*\\.":256; + +/// "urn:dslforum-org:cwmp-1-1":FaultStruct is a complexType. +/// @brief Fault information for TransferComplete and AutonomousTransferComplete +struct cwmp1__FaultStruct +{ +/// @brief Transfer fault codes + +/// union of values from "xs:unsignedInt" +/// union of values from "xs:unsignedInt" +/// union of values from "xs:unsignedInt" + char* + FaultCode 1; ///< Required element. +/// Length of this string is within 0..256 characters + char* + FaultString 1; ///< Required element. +}; + +/// "urn:dslforum-org:cwmp-1-1":DeviceIdStruct is a complexType. +struct cwmp1__DeviceIdStruct +{ +/// Length of this string is within 0..64 characters + char* + Manufacturer 1; ///< Required element. +/// Length of this string is exactly 6 characters +/// Content pattern is "[0-9A-F]{6}" + char* + OUI 1; ///< Required element. +/// Length of this string is within 0..64 characters + char* + ProductClass 1; ///< Required element. +/// Length of this string is within 0..64 characters + char* + SerialNumber 1; ///< Required element. +}; + +/// "urn:dslforum-org:cwmp-1-1":EventStruct is a complexType. +struct cwmp1__EventStruct +{ +/// Length of this string is within 0..64 characters +/// Content pattern is "0 BOOTSTRAP" +/// Content pattern is "1 BOOT" +/// Content pattern is "2 PERIODIC" +/// Content pattern is "3 SCHEDULED" +/// Content pattern is "4 VALUE CHANGE" +/// Content pattern is "5 KICKED" +/// Content pattern is "6 CONNECTION REQUEST" +/// Content pattern is "7 TRANSFER COMPLETE" +/// Content pattern is "8 DIAGNOSTICS COMPLETE" +/// Content pattern is "9 REQUEST DOWNLOAD" +/// Content pattern is "10 AUTONOMOUS TRANSFER COMPLETE" +/// Content pattern is "\\d+( \\S+)+" +/// Content pattern is "M Reboot" +/// Content pattern is "M ScheduleInform" +/// Content pattern is "M Download" +/// Content pattern is "M Upload" +/// Content pattern is "M \\S+" +/// Content pattern is "M X_\\S+" +/// Content pattern is "X [0-9A-F]{6} .*" + char* + EventCode 1; ///< Required element. +/// Element CommandKey of type "urn:dslforum-org:cwmp-1-1":CommandKeyType. + cwmp1__CommandKeyType CommandKey 1; ///< Required element. +}; + +/// "urn:dslforum-org:cwmp-1-1":ParameterValueStruct is a complexType. +struct cwmp1__ParameterValueStruct +{ +/// Length of this string is within 0..256 characters + char* + Name 1; ///< Required element. +/// Element Value of type xs:anySimpleType. + xsd__anySimpleType Value 1; ///< Required element. +}; + +/// "urn:dslforum-org:cwmp-1-1":ParameterInfoStruct is a complexType. +struct cwmp1__ParameterInfoStruct +{ +/// Length of this string is within 0..256 characters + char* + Name 1; ///< Required element. +/// Element Writable of type xs:boolean. + enum xsd__boolean Writable 1; ///< Required element. +}; + +/// "urn:dslforum-org:cwmp-1-1":SetParameterAttributesStruct is a complexType. +struct cwmp1__SetParameterAttributesStruct +{ +/// Length of this string is within 0..256 characters + char* + *Name ; ///< Nullable pointer. +/// Element NotificationChange of type xs:boolean. + enum xsd__boolean NotificationChange 1; ///< Required element. + enum _cwmp1__SetParameterAttributesStruct_Notification + { +/// @brief Notification off. The CPE need not inform the ACS of a change to the specified parameter(s) + _cwmp1__SetParameterAttributesStruct_Notification__0 = 0, ///< xs:int value="0" +/// @brief Passive notification. Whenever the specified parameter value changes, the CPE MUST include the new value in the ParameterList in the Inform message that is sent the next time a session is established to the ACS + _cwmp1__SetParameterAttributesStruct_Notification__1 = 1, ///< xs:int value="1" +/// @brief Active notification. Whenever the specified parameter value changes, the CPE MUST initiate a session to the ACS, and include the new value in the ParameterList in the associated Inform message + _cwmp1__SetParameterAttributesStruct_Notification__2 = 2, ///< xs:int value="2" + } + Notification 1; ///< Required element. +/// Element AccessListChange of type xs:boolean. + enum xsd__boolean AccessListChange 1; ///< Required element. +/// Element AccessList of type "urn:dslforum-org:cwmp-1-1":AccessList. + struct cwmp1AccessList* AccessList 1; ///< Required element. +}; + +/// "urn:dslforum-org:cwmp-1-1":ParameterAttributeStruct is a complexType. +struct cwmp1__ParameterAttributeStruct +{ +/// Length of this string is within 0..256 characters + char* + Name 1; ///< Required element. + enum _cwmp1__ParameterAttributeStruct_Notification + { + _cwmp1__ParameterAttributeStruct_Notification__0 = 0, ///< xs:int value="0" + _cwmp1__ParameterAttributeStruct_Notification__1 = 1, ///< xs:int value="1" + _cwmp1__ParameterAttributeStruct_Notification__2 = 2, ///< xs:int value="2" + } + Notification 1; ///< Required element. +/// Element AccessList of type "urn:dslforum-org:cwmp-1-1":AccessList. + struct cwmp1AccessList* AccessList 1; ///< Required element. +}; + +/// "urn:dslforum-org:cwmp-1-1":QueuedTransferStruct is a complexType. +struct cwmp1__QueuedTransferStruct +{ +/// Element CommandKey of type "urn:dslforum-org:cwmp-1-1":CommandKeyType. + cwmp1__CommandKeyType CommandKey 1; ///< Required element. + enum _cwmp1__QueuedTransferStruct_State + { +/// @brief 1 - Not yet started + _cwmp1__QueuedTransferStruct_State__1 = 1, ///< xs:int value="1" +/// @brief 2 - In progress + _cwmp1__QueuedTransferStruct_State__2 = 2, ///< xs:int value="2" +/// @brief 3 - Completed + _cwmp1__QueuedTransferStruct_State__3 = 3, ///< xs:int value="3" + } + State 1; ///< Required element. +}; + +/// "urn:dslforum-org:cwmp-1-1":AllQueuedTransferStruct is a complexType. +struct cwmp1__AllQueuedTransferStruct +{ +/// Element CommandKey of type "urn:dslforum-org:cwmp-1-1":CommandKeyType. + cwmp1__CommandKeyType CommandKey 1; ///< Required element. + enum _cwmp1__AllQueuedTransferStruct_State + { +/// @brief 1 - Not yet started + _cwmp1__AllQueuedTransferStruct_State__1 = 1, ///< xs:int value="1" +/// @brief 2 - In progress + _cwmp1__AllQueuedTransferStruct_State__2 = 2, ///< xs:int value="2" +/// @brief 3 - Completed + _cwmp1__AllQueuedTransferStruct_State__3 = 3, ///< xs:int value="3" + } + State 1; ///< Required element. +/// Element IsDownload of type xs:boolean. + enum xsd__boolean IsDownload 1; ///< Required element. +/// Length of this string is within 0..64 characters +/// Content pattern is "1 Firmware Upgrade Image" +/// Content pattern is "2 Web Content" +/// Content pattern is "3 Vendor Configuration File" +/// Content pattern is "4 Vendor Log File" +/// Content pattern is "X [0-9A-F]{6} .*" + char* + FileType 1; ///< Required element. +/// Element FileSize of type xs:unsignedInt. + unsigned int FileSize 1; ///< Required element. +/// Length of this string is within 0..256 characters + char* + TargetFileName 1; ///< Required element. +}; + +/// "urn:dslforum-org:cwmp-1-1":ArgStruct is a complexType. +struct cwmp1__ArgStruct +{ +/// Length of this string is within 0..64 characters + char* + Name 1; ///< Required element. +/// Length of this string is within 0..256 characters + char* + Value 1; ///< Required element. +}; + +/// "urn:dslforum-org:cwmp-1-1":OptionStruct is a complexType. +struct cwmp1__OptionStruct +{ +/// Length of this string is within 0..64 characters + char* + OptionName 1; ///< Required element. +/// Element VoucherSN of type xs:unsignedInt. + unsigned int VoucherSN 1; ///< Required element. + enum _cwmp1__OptionStruct_State + { +/// @brief Option is disabled and not setup + _cwmp1__OptionStruct_State__0 = 0, ///< xs:unsignedInt value="0" +/// @brief Option is enabled and not setup + _cwmp1__OptionStruct_State__1 = 1, ///< xs:unsignedInt value="1" +/// @brief Option is disabled and setup + _cwmp1__OptionStruct_State__2 = 2, ///< xs:unsignedInt value="2" +/// @brief Option is enabled and setup + _cwmp1__OptionStruct_State__3 = 3, ///< xs:unsignedInt value="3" + } + State 1; ///< Required element. + enum _cwmp1__OptionStruct_Mode + { +/// @brief 0 - Disabled + _cwmp1__OptionStruct_Mode__0 = 0, ///< xs:int value="0" +/// @brief 1 - Enabled with expiration + _cwmp1__OptionStruct_Mode__1 = 1, ///< xs:int value="1" +/// @brief 2 - Enabled without expiration + _cwmp1__OptionStruct_Mode__2 = 2, ///< xs:int value="2" + } + Mode 1; ///< Required element. +/// Element StartDate of type xs:dateTime. + time_t StartDate 1; ///< Required element. +/// Element ExpirationDate of type xs:dateTime. + time_t* ExpirationDate 0; ///< Optional element. + enum _cwmp1__OptionStruct_IsTransferable + { +/// @brief Non-transferable + _cwmp1__OptionStruct_IsTransferable__0 = 0, ///< xs:int value="0" +/// @brief Transferable + _cwmp1__OptionStruct_IsTransferable__1 = 1, ///< xs:int value="1" + } + IsTransferable 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":Fault of complexType. + +/// "urn:dslforum-org:cwmp-1-1":Fault is a complexType. +struct _cwmp1__Fault +{ +/// Element FaultCode of type "urn:dslforum-org:cwmp-1-1":FaultCodeType. + cwmp1__FaultCodeType FaultCode 1; ///< Required element. +/// Element FaultString of type xs:string. + char* FaultString 0; ///< Optional element. +/// Size of SetParameterValuesFault array is 0..unbounded + int __sizeSetParameterValuesFault ; + struct _cwmp1__Fault_SetParameterValuesFault + { +/// Element ParameterName of type xs:string. + char* ParameterName 1; ///< Required element. +/// Element FaultCode of type "urn:dslforum-org:cwmp-1-1":FaultCodeType. + cwmp1__FaultCodeType FaultCode 1; ///< Required element. +/// Element FaultString of type xs:string. + char* FaultString 0; ///< Optional element. + } *SetParameterValuesFault 0; +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":GetRPCMethods of complexType. +/// @brief GeRPCMethods message - Annex A.3.1.1 + +/// "urn:dslforum-org:cwmp-1-1":GetRPCMethods is a complexType. +struct _cwmp1__GetRPCMethods +{ +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":GetRPCMethodsResponse of complexType. +/// @brief GeRPCMethodsResponse message - Annex A.3.1.1 + +/// "urn:dslforum-org:cwmp-1-1":GetRPCMethodsResponse is a complexType. +struct _cwmp1__GetRPCMethodsResponse +{ +/// Element MethodList of type "urn:dslforum-org:cwmp-1-1":MethodList. + struct cwmp1MethodList* MethodList 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":SetParameterValues of complexType. +/// @brief SetParameterValues message - Annex A.3.2.1 + +/// "urn:dslforum-org:cwmp-1-1":SetParameterValues is a complexType. +struct _cwmp1__SetParameterValues +{ +/// Element ParameterList of type "urn:dslforum-org:cwmp-1-1":ParameterValueList. + struct cwmp1ParameterValueList* ParameterList 1; ///< Required element. +/// Element ParameterKey of type "urn:dslforum-org:cwmp-1-1":ParameterKeyType. + cwmp1__ParameterKeyType ParameterKey 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":SetParameterValuesResponse of complexType. +/// @brief SetParameterValuesResponse message - Annex A.3.2.1 + +/// "urn:dslforum-org:cwmp-1-1":SetParameterValuesResponse is a complexType. +struct _cwmp1__SetParameterValuesResponse +{ + enum _cwmp1__SetParameterValuesResponse_Status + { +/// @brief All Parameter changes have been validated and applied + _cwmp1__SetParameterValuesResponse_Status__0 = 0, ///< xs:int value="0" +/// @brief All Parameter changes have been validated and committed, but some or all are not yet applied (for example, if a reboot is required before the new values are applied) + _cwmp1__SetParameterValuesResponse_Status__1 = 1, ///< xs:int value="1" + } + Status 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":GetParameterValues of complexType. +/// @brief GetParameterValues message - Annex A.3.2.2 + +/// "urn:dslforum-org:cwmp-1-1":GetParameterValues is a complexType. +struct _cwmp1__GetParameterValues +{ +/// Element ParameterNames of type "urn:dslforum-org:cwmp-1-1":ParameterNames. + struct cwmp1ParameterNames* ParameterNames 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":GetParameterValuesResponse of complexType. +/// @brief GetParameterValuesResponse message - Annex A.3.2.2 + +/// "urn:dslforum-org:cwmp-1-1":GetParameterValuesResponse is a complexType. +struct _cwmp1__GetParameterValuesResponse +{ +/// Element ParameterList of type "urn:dslforum-org:cwmp-1-1":ParameterValueList. + struct cwmp1ParameterValueList* ParameterList 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":GetParameterNames of complexType. +/// @brief GetParameterNames message - Annex A.3.2.3 + +/// "urn:dslforum-org:cwmp-1-1":GetParameterNames is a complexType. +struct _cwmp1__GetParameterNames +{ +/// Length of this string is within 0..256 characters + char* + *ParameterPath ; ///< Nullable pointer. +/// Element NextLevel of type xs:boolean. + enum xsd__boolean NextLevel 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":GetParameterNamesResponse of complexType. +/// @brief GetParameterNamesResponse message - Annex A.3.2.3 + +/// "urn:dslforum-org:cwmp-1-1":GetParameterNamesResponse is a complexType. +struct _cwmp1__GetParameterNamesResponse +{ +/// Element ParameterList of type "urn:dslforum-org:cwmp-1-1":ParameterInfoList. + struct cwmp1ParameterInfoList* ParameterList 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":SetParameterAttributes of complexType. +/// @brief SetParameterAttributes message - Annex A.3.2.4 + +/// "urn:dslforum-org:cwmp-1-1":SetParameterAttributes is a complexType. +struct _cwmp1__SetParameterAttributes +{ +/// Element ParameterList of type "urn:dslforum-org:cwmp-1-1":SetParameterAttributesList. + struct cwmp1SetParameterAttributesList* ParameterList 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":SetParameterAttributesResponse of complexType. +/// @brief SetParameterAttributesResponse message - Annex A.3.2.4 + +/// "urn:dslforum-org:cwmp-1-1":SetParameterAttributesResponse is a complexType. +struct _cwmp1__SetParameterAttributesResponse +{ +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":GetParameterAttributes of complexType. +/// @brief GetParameterAttributes message - Annex A.3.2.5 + +/// "urn:dslforum-org:cwmp-1-1":GetParameterAttributes is a complexType. +struct _cwmp1__GetParameterAttributes +{ +/// Element ParameterNames of type "urn:dslforum-org:cwmp-1-1":ParameterNames. + struct cwmp1ParameterNames* ParameterNames 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":GetParameterAttributesResponse of complexType. +/// @brief GetParameterAttributesResponse message - Annex A.3.2.5 + +/// "urn:dslforum-org:cwmp-1-1":GetParameterAttributesResponse is a complexType. +struct _cwmp1__GetParameterAttributesResponse +{ +/// Element ParameterList of type "urn:dslforum-org:cwmp-1-1":ParameterAttributeList. + struct cwmp1ParameterAttributeList* ParameterList 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":AddObject of complexType. +/// @brief AddObject message - Annex A.3.2.6 + +/// "urn:dslforum-org:cwmp-1-1":AddObject is a complexType. +struct _cwmp1__AddObject +{ +/// Element ObjectName of type "urn:dslforum-org:cwmp-1-1":ObjectNameType. + cwmp1__ObjectNameType ObjectName 1; ///< Required element. +/// Element ParameterKey of type "urn:dslforum-org:cwmp-1-1":ParameterKeyType. + cwmp1__ParameterKeyType ParameterKey 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":AddObjectResponse of complexType. +/// @brief AddObjectResponse message - Annex A.3.2.6 + +/// "urn:dslforum-org:cwmp-1-1":AddObjectResponse is a complexType. +struct _cwmp1__AddObjectResponse +{ +/// Value range is [1..] + unsigned int + InstanceNumber 1; ///< Required element. + enum _cwmp1__AddObjectResponse_Status + { +/// @brief The object has been created + _cwmp1__AddObjectResponse_Status__0 = 0, ///< xs:int value="0" +/// @brief The object creation has been validated and committed, but not yet applied + _cwmp1__AddObjectResponse_Status__1 = 1, ///< xs:int value="1" + } + Status 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":DeleteObject of complexType. +/// @brief DeleteObject message - Annex A.3.2.7 + +/// "urn:dslforum-org:cwmp-1-1":DeleteObject is a complexType. +struct _cwmp1__DeleteObject +{ +/// Element ObjectName of type "urn:dslforum-org:cwmp-1-1":ObjectNameType. + cwmp1__ObjectNameType ObjectName 1; ///< Required element. +/// Element ParameterKey of type "urn:dslforum-org:cwmp-1-1":ParameterKeyType. + cwmp1__ParameterKeyType ParameterKey 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":DeleteObjectResponse of complexType. +/// @brief DeleteObjectResponse message - Annex A.3.2.7 + +/// "urn:dslforum-org:cwmp-1-1":DeleteObjectResponse is a complexType. +struct _cwmp1__DeleteObjectResponse +{ + enum _cwmp1__DeleteObjectResponse_Status + { +/// @brief The object has been deleted + _cwmp1__DeleteObjectResponse_Status__0 = 0, ///< xs:int value="0" +/// @brief The object deletion has been validated and committed, but not yet applied + _cwmp1__DeleteObjectResponse_Status__1 = 1, ///< xs:int value="1" + } + Status 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":Download of complexType. +/// @brief Download message - Annex A.3.2.8 + +/// "urn:dslforum-org:cwmp-1-1":Download is a complexType. +struct _cwmp1__Download +{ +/// Element CommandKey of type "urn:dslforum-org:cwmp-1-1":CommandKeyType. + cwmp1__CommandKeyType CommandKey 1; ///< Required element. +/// Length of this string is within 0..64 characters +/// Content pattern is "1 Firmware Upgrade Image" +/// Content pattern is "2 Web Content" +/// Content pattern is "3 Vendor Configuration File" +/// Content pattern is "X [0-9A-F]{6} .*" + char* + FileType 1; ///< Required element. +/// Length of this string is within 0..256 characters + char* + URL 1; ///< Required element. +/// Length of this string is within 0..256 characters + char* + Username 1; ///< Required element. +/// Length of this string is within 0..256 characters + char* + Password 1; ///< Required element. +/// Element FileSize of type xs:unsignedInt. + unsigned int FileSize 1; ///< Required element. +/// Length of this string is within 0..256 characters + char* + TargetFileName 1; ///< Required element. +/// Element DelaySeconds of type xs:unsignedInt. + unsigned int DelaySeconds 1; ///< Required element. +/// Length of this string is within 0..256 characters + char* + SuccessURL 1; ///< Required element. +/// Length of this string is within 0..256 characters + char* + FailureURL 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":DownloadResponse of complexType. +/// @brief DownloadResponse message - Annex A.3.2.8 + +/// "urn:dslforum-org:cwmp-1-1":DownloadResponse is a complexType. +struct _cwmp1__DownloadResponse +{ + enum _cwmp1__DownloadResponse_Status + { +/// @brief Download has completed and been applied + _cwmp1__DownloadResponse_Status__0 = 0, ///< xs:int value="0" +/// @brief Download has not yet been completed and applied + _cwmp1__DownloadResponse_Status__1 = 1, ///< xs:int value="1" + } + Status 1; ///< Required element. +/// Element StartTime of type xs:dateTime. + time_t StartTime 1; ///< Required element. +/// Element CompleteTime of type xs:dateTime. + time_t CompleteTime 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":Reboot of complexType. +/// @brief Reboot message - Annex A.3.2.9 + +/// "urn:dslforum-org:cwmp-1-1":Reboot is a complexType. +struct _cwmp1__Reboot +{ +/// Element CommandKey of type "urn:dslforum-org:cwmp-1-1":CommandKeyType. + cwmp1__CommandKeyType CommandKey 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":RebootResponse of complexType. +/// @brief RebootResponse message - Annex A.3.2.9 + +/// "urn:dslforum-org:cwmp-1-1":RebootResponse is a complexType. +struct _cwmp1__RebootResponse +{ +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":GetQueuedTransfers of complexType. +/// @brief GetQueuedTransfers message - Annex A.4.1.1 + +/// "urn:dslforum-org:cwmp-1-1":GetQueuedTransfers is a complexType. +struct _cwmp1__GetQueuedTransfers +{ +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":GetQueuedTransfersResponse of complexType. +/// @brief GetQueuedTransfersResponse message - Annex A.4.1.1 + +/// "urn:dslforum-org:cwmp-1-1":GetQueuedTransfersResponse is a complexType. +struct _cwmp1__GetQueuedTransfersResponse +{ +/// Element TransferList of type "urn:dslforum-org:cwmp-1-1":TransferList. + struct cwmp1TransferList* TransferList 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":ScheduleInform of complexType. +/// @brief ScheduleInform message - Annex A.4.1.2 + +/// "urn:dslforum-org:cwmp-1-1":ScheduleInform is a complexType. +struct _cwmp1__ScheduleInform +{ +/// Element DelaySeconds of type xs:unsignedInt. + unsigned int DelaySeconds 1; ///< Required element. +/// Element CommandKey of type "urn:dslforum-org:cwmp-1-1":CommandKeyType. + cwmp1__CommandKeyType CommandKey 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":ScheduleInformResponse of complexType. +/// @brief ScheduleInformResponse message - Annex A.4.1.2 + +/// "urn:dslforum-org:cwmp-1-1":ScheduleInformResponse is a complexType. +struct _cwmp1__ScheduleInformResponse +{ +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":SetVouchers of complexType. +/// @brief SetVouchers message - Annex A.4.1.3 + +/// "urn:dslforum-org:cwmp-1-1":SetVouchers is a complexType. +struct _cwmp1__SetVouchers +{ +/// Element VoucherList of type "urn:dslforum-org:cwmp-1-1":VoucherList. + struct cwmp1VoucherList* VoucherList 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":SetVouchersResponse of complexType. +/// @brief SetVouchersResponse message - Annex A.4.1.3 + +/// "urn:dslforum-org:cwmp-1-1":SetVouchersResponse is a complexType. +struct _cwmp1__SetVouchersResponse +{ +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":GetOptions of complexType. +/// @brief GetOptions message - Annex A.4.1.4 + +/// "urn:dslforum-org:cwmp-1-1":GetOptions is a complexType. +struct _cwmp1__GetOptions +{ +/// Length of this string is within 0..64 characters + char* + OptionName 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":GetOptionsResponse of complexType. +/// @brief GetOptionsResponse message - Annex A.4.1.4 + +/// "urn:dslforum-org:cwmp-1-1":GetOptionsResponse is a complexType. +struct _cwmp1__GetOptionsResponse +{ +/// Element OptionList of type "urn:dslforum-org:cwmp-1-1":OptionList. + struct cwmp1OptionList* OptionList 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":Upload of complexType. +/// @brief Upload message - Annex A.4.1.5 + +/// "urn:dslforum-org:cwmp-1-1":Upload is a complexType. +struct _cwmp1__Upload +{ +/// Element CommandKey of type "urn:dslforum-org:cwmp-1-1":CommandKeyType. + cwmp1__CommandKeyType CommandKey 1; ///< Required element. +/// Length of this string is within 0..64 characters +/// Content pattern is "1 Vendor Configuration File" +/// Content pattern is "2 Vendor Log File" +/// Content pattern is "X [0-9A-F]{6} .*" + char* + FileType 1; ///< Required element. +/// Length of this string is within 0..256 characters + char* + URL 1; ///< Required element. +/// Length of this string is within 0..256 characters + char* + Username 1; ///< Required element. +/// Length of this string is within 0..256 characters + char* + Password 1; ///< Required element. +/// Element DelaySeconds of type xs:unsignedInt. + unsigned int DelaySeconds 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":UploadResponse of complexType. +/// @brief UploadResponse message - Annex A.4.1.5 + +/// "urn:dslforum-org:cwmp-1-1":UploadResponse is a complexType. +struct _cwmp1__UploadResponse +{ + enum _cwmp1__UploadResponse_Status + { +/// @brief Upload has been completed + _cwmp1__UploadResponse_Status__0 = 0, ///< xs:int value="0" +/// @brief Upload has not yet completed + _cwmp1__UploadResponse_Status__1 = 1, ///< xs:int value="1" + } + Status 1; ///< Required element. +/// Element StartTime of type xs:dateTime. + time_t StartTime 1; ///< Required element. +/// Element CompleteTime of type xs:dateTime. + time_t CompleteTime 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":FactoryReset of complexType. +/// @brief FactoryReset message - Annex A.4.1.6 + +/// "urn:dslforum-org:cwmp-1-1":FactoryReset is a complexType. +struct _cwmp1__FactoryReset +{ +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":FactoryResetResponse of complexType. +/// @brief FactoryResetResponse message - Annex A.4.1.6 + +/// "urn:dslforum-org:cwmp-1-1":FactoryResetResponse is a complexType. +struct _cwmp1__FactoryResetResponse +{ +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":GetAllQueuedTransfers of complexType. +/// @brief GetAllQueuedTransfers message - Annex A.4.1.7 + +/// "urn:dslforum-org:cwmp-1-1":GetAllQueuedTransfers is a complexType. +struct _cwmp1__GetAllQueuedTransfers +{ +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":GetAllQueuedTransfersResponse of complexType. +/// @brief GetAllQueuedTransfersResponse message - Annex A.4.1.7 + +/// "urn:dslforum-org:cwmp-1-1":GetAllQueuedTransfersResponse is a complexType. +struct _cwmp1__GetAllQueuedTransfersResponse +{ +/// Element TransferList of type "urn:dslforum-org:cwmp-1-1":AllTransferList. + struct cwmp1AllTransferList* TransferList 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":Inform of complexType. +/// @brief Inform message - Annex A.3.3.1 + +/// "urn:dslforum-org:cwmp-1-1":Inform is a complexType. +struct _cwmp1__Inform +{ +/// Element DeviceId of type "urn:dslforum-org:cwmp-1-1":DeviceIdStruct. + struct cwmp1__DeviceIdStruct* DeviceId 1; ///< Required element. +/// Element Event of type "urn:dslforum-org:cwmp-1-1":EventList. + struct cwmp1EventList* Event 1; ///< Required element. +/// Element MaxEnvelopes of type xs:unsignedInt. + unsigned int MaxEnvelopes 1; ///< Required element. +/// Element CurrentTime of type xs:dateTime. + time_t CurrentTime 1; ///< Required element. +/// Element RetryCount of type xs:unsignedInt. + unsigned int RetryCount 1; ///< Required element. +/// Element ParameterList of type "urn:dslforum-org:cwmp-1-1":ParameterValueList. + struct cwmp1ParameterValueList* ParameterList 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":InformResponse of complexType. +/// @brief InformResponse message - Annex A.3.3.1 + +/// "urn:dslforum-org:cwmp-1-1":InformResponse is a complexType. +struct _cwmp1__InformResponse +{ +/// Element MaxEnvelopes of type xs:unsignedInt. + unsigned int MaxEnvelopes 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":TransferComplete of complexType. +/// @brief TransferComplete message - Annex A.3.3.2 + +/// "urn:dslforum-org:cwmp-1-1":TransferComplete is a complexType. +struct _cwmp1__TransferComplete +{ +/// Element CommandKey of type "urn:dslforum-org:cwmp-1-1":CommandKeyType. + cwmp1__CommandKeyType CommandKey 1; ///< Required element. +/// Element FaultStruct of type "urn:dslforum-org:cwmp-1-1":FaultStruct. + struct cwmp1__FaultStruct* FaultStruct 1; ///< Required element. +/// Element StartTime of type xs:dateTime. + time_t StartTime 1; ///< Required element. +/// Element CompleteTime of type xs:dateTime. + time_t CompleteTime 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":TransferCompleteResponse of complexType. +/// @brief TransferCompleteResponse message - Annex A.3.3.2 + +/// "urn:dslforum-org:cwmp-1-1":TransferCompleteResponse is a complexType. +struct _cwmp1__TransferCompleteResponse +{ +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":AutonomousTransferComplete of complexType. +/// @brief AutonomousTransferComplete message - Annex A.3.3.3 + +/// "urn:dslforum-org:cwmp-1-1":AutonomousTransferComplete is a complexType. +struct _cwmp1__AutonomousTransferComplete +{ +/// Length of this string is within 0..1024 characters + char* + AnnounceURL 1; ///< Required element. +/// Length of this string is within 0..1024 characters + char* + TransferURL 1; ///< Required element. +/// Element IsDownload of type xs:boolean. + enum xsd__boolean IsDownload 1; ///< Required element. +/// Length of this string is within 0..64 characters +/// Content pattern is "1 Firmware Upgrade Image" +/// Content pattern is "2 Web Content" +/// Content pattern is "3 Vendor Configuration File" +/// Content pattern is "4 Vendor Log File" +/// Content pattern is "X [0-9A-F]{6} .*" + char* + FileType 1; ///< Required element. +/// Element FileSize of type xs:unsignedInt. + unsigned int FileSize 1; ///< Required element. +/// Length of this string is within 0..256 characters + char* + TargetFileName 1; ///< Required element. +/// Element FaultStruct of type "urn:dslforum-org:cwmp-1-1":FaultStruct. + struct cwmp1__FaultStruct* FaultStruct 1; ///< Required element. +/// Element StartTime of type xs:dateTime. + time_t StartTime 1; ///< Required element. +/// Element CompleteTime of type xs:dateTime. + time_t CompleteTime 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":AutonomousTransferCompleteResponse of complexType. +/// @brief AutonomousTransferCompleteResponse message - Annex A.3.3.3 + +/// "urn:dslforum-org:cwmp-1-1":AutonomousTransferCompleteResponse is a complexType. +struct _cwmp1__AutonomousTransferCompleteResponse +{ +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":Kicked of complexType. +/// @brief Kicked message - Annex A.4.2.1 + +/// "urn:dslforum-org:cwmp-1-1":Kicked is a complexType. +struct _cwmp1__Kicked +{ +/// Length of this string is within 0..32 characters + char* + Command 1; ///< Required element. +/// Length of this string is within 0..64 characters + char* + Referer 1; ///< Required element. +/// Length of this string is within 0..256 characters + char* + Arg 1; ///< Required element. +/// Length of this string is within 0..1024 characters + char* + Next 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":KickedResponse of complexType. +/// @brief KickedResponse message - Annex A.4.2.1 + +/// "urn:dslforum-org:cwmp-1-1":KickedResponse is a complexType. +struct _cwmp1__KickedResponse +{ +/// Length of this string is within 0..1024 characters + char* + NextURL 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":RequestDownload of complexType. +/// @brief RequestDownload message - Annex A.4.2.2 + +/// "urn:dslforum-org:cwmp-1-1":RequestDownload is a complexType. +struct _cwmp1__RequestDownload +{ +/// Length of this string is within 0..64 characters +/// Content pattern is "1 Firmware Upgrade Image" +/// Content pattern is "2 Web Content" +/// Content pattern is "3 Vendor Configuration File" +/// Content pattern is "X [0-9A-F]{6} .*" + char* + FileType 1; ///< Required element. +/// Element FileTypeArg of type "urn:dslforum-org:cwmp-1-1":FileTypeArg. + struct cwmp1FileTypeArg* FileTypeArg 1; ///< Required element. +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":RequestDownloadResponse of complexType. +/// @brief RequestDownloadResponse message - Annex A.4.2.2 + +/// "urn:dslforum-org:cwmp-1-1":RequestDownloadResponse is a complexType. +struct _cwmp1__RequestDownloadResponse +{ +}; + +/// "urn:dslforum-org:cwmp-1-1":MethodList is a complexType with complexContent restriction of SOAP-ENC:Array. +/// SOAP encoded array of xs:string +struct cwmp1MethodList +{ +/// Pointer to array of char*. + char* *__ptrstring ; +/// Size of the dynamic array. + int __size ; +/// Offset for partially transmitted arrays (uncomment only when required). +// int __offset ; +}; + +/// "urn:dslforum-org:cwmp-1-1":EventList is a complexType with complexContent restriction of SOAP-ENC:Array. +/// SOAP encoded array of "urn:dslforum-org:cwmp-1-1":EventStruct +struct cwmp1EventList +{ +/// Pointer to array of struct cwmp1__EventStruct*. + struct cwmp1__EventStruct* *__ptrEventStruct ; +/// Size of the dynamic array. + int __size ; +/// Offset for partially transmitted arrays (uncomment only when required). +// int __offset ; +}; + +/// "urn:dslforum-org:cwmp-1-1":ParameterValueList is a complexType with complexContent restriction of SOAP-ENC:Array. +/// SOAP encoded array of "urn:dslforum-org:cwmp-1-1":ParameterValueStruct +struct cwmp1ParameterValueList +{ +/// Pointer to array of struct cwmp1__ParameterValueStruct*. + struct cwmp1__ParameterValueStruct* *__ptrParameterValueStruct ; +/// Size of the dynamic array. + int __size ; +/// Offset for partially transmitted arrays (uncomment only when required). +// int __offset ; +}; + +/// "urn:dslforum-org:cwmp-1-1":ParameterInfoList is a complexType with complexContent restriction of SOAP-ENC:Array. +/// SOAP encoded array of "urn:dslforum-org:cwmp-1-1":ParameterInfoStruct +struct cwmp1ParameterInfoList +{ +/// Pointer to array of struct cwmp1__ParameterInfoStruct*. + struct cwmp1__ParameterInfoStruct* *__ptrParameterInfoStruct ; +/// Size of the dynamic array. + int __size ; +/// Offset for partially transmitted arrays (uncomment only when required). +// int __offset ; +}; + +/// "urn:dslforum-org:cwmp-1-1":ParameterNames is a complexType with complexContent restriction of SOAP-ENC:Array. +/// SOAP encoded array of xs:string +struct cwmp1ParameterNames +{ +/// Pointer to array of char*. + char* *__ptrstring ; +/// Size of the dynamic array. + int __size ; +/// Offset for partially transmitted arrays (uncomment only when required). +// int __offset ; +}; + +/// "urn:dslforum-org:cwmp-1-1":AccessList is a complexType with complexContent restriction of SOAP-ENC:Array. +/// SOAP encoded array of xs:string +struct cwmp1AccessList +{ +/// Pointer to array of char*. + char* *__ptrstring ; +/// Size of the dynamic array. + int __size ; +/// Offset for partially transmitted arrays (uncomment only when required). +// int __offset ; +}; + +/// "urn:dslforum-org:cwmp-1-1":SetParameterAttributesList is a complexType with complexContent restriction of SOAP-ENC:Array. +/// SOAP encoded array of "urn:dslforum-org:cwmp-1-1":SetParameterAttributesStruct +struct cwmp1SetParameterAttributesList +{ +/// Pointer to array of struct cwmp1__SetParameterAttributesStruct*. + struct cwmp1__SetParameterAttributesStruct* *__ptrSetParameterAttributesStruct; +/// Size of the dynamic array. + int __size ; +/// Offset for partially transmitted arrays (uncomment only when required). +// int __offset ; +}; + +/// "urn:dslforum-org:cwmp-1-1":ParameterAttributeList is a complexType with complexContent restriction of SOAP-ENC:Array. +/// SOAP encoded array of "urn:dslforum-org:cwmp-1-1":ParameterAttributeStruct +struct cwmp1ParameterAttributeList +{ +/// Pointer to array of struct cwmp1__ParameterAttributeStruct*. + struct cwmp1__ParameterAttributeStruct* *__ptrParameterAttributeStruct ; +/// Size of the dynamic array. + int __size ; +/// Offset for partially transmitted arrays (uncomment only when required). +// int __offset ; +}; + +/// "urn:dslforum-org:cwmp-1-1":TransferList is a complexType with complexContent restriction of SOAP-ENC:Array. +/// SOAP encoded array of "urn:dslforum-org:cwmp-1-1":QueuedTransferStruct +struct cwmp1TransferList +{ +/// Pointer to array of struct cwmp1__QueuedTransferStruct*. + struct cwmp1__QueuedTransferStruct* *__ptrQueuedTransferStruct ; +/// Size of the dynamic array. + int __size ; +/// Offset for partially transmitted arrays (uncomment only when required). +// int __offset ; +}; + +/// "urn:dslforum-org:cwmp-1-1":AllTransferList is a complexType with complexContent restriction of SOAP-ENC:Array. +/// SOAP encoded array of "urn:dslforum-org:cwmp-1-1":AllQueuedTransferStruct +struct cwmp1AllTransferList +{ +/// Pointer to array of struct cwmp1__AllQueuedTransferStruct*. + struct cwmp1__AllQueuedTransferStruct* *__ptrAllQueuedTransferStruct ; +/// Size of the dynamic array. + int __size ; +/// Offset for partially transmitted arrays (uncomment only when required). +// int __offset ; +}; + +/// "urn:dslforum-org:cwmp-1-1":VoucherList is a complexType with complexContent restriction of SOAP-ENC:Array. +/// SOAP encoded array of SOAP-ENC:base64 +struct cwmp1VoucherList +{ +/// Pointer to array of struct SOAP_ENC__base64*. + struct SOAP_ENC__base64* *__ptrbase64 ; +/// Size of the dynamic array. + int __size ; +/// Offset for partially transmitted arrays (uncomment only when required). +// int __offset ; +}; + +/// "urn:dslforum-org:cwmp-1-1":OptionList is a complexType with complexContent restriction of SOAP-ENC:Array. +/// SOAP encoded array of "urn:dslforum-org:cwmp-1-1":OptionStruct +struct cwmp1OptionList +{ +/// Pointer to array of struct cwmp1__OptionStruct*. + struct cwmp1__OptionStruct* *__ptrOptionStruct ; +/// Size of the dynamic array. + int __size ; +/// Offset for partially transmitted arrays (uncomment only when required). +// int __offset ; +}; + +/// "urn:dslforum-org:cwmp-1-1":FileTypeArg is a complexType with complexContent restriction of SOAP-ENC:Array. +/// SOAP encoded array of "urn:dslforum-org:cwmp-1-1":ArgStruct +struct cwmp1FileTypeArg +{ +/// Pointer to array of struct cwmp1__ArgStruct*. + struct cwmp1__ArgStruct* *__ptrArgStruct ; +/// Size of the dynamic array. + int __size ; +/// Offset for partially transmitted arrays (uncomment only when required). +// int __offset ; +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":ID of complexType. + +/// "urn:dslforum-org:cwmp-1-1":ID is a complexType with simpleContent. +struct _cwmp1__ID +{ +/// __item wraps 'xs:string' simpleContent. + char* __item ; +/// Imported attribute reference SOAP-ENV:mustUnderstand. + @char* SOAP_ENV__mustUnderstand 1; ///< Fixed value="1". +}; + + +/// Element "urn:dslforum-org:cwmp-1-1":HoldRequests of complexType. + +/// "urn:dslforum-org:cwmp-1-1":HoldRequests is a complexType with simpleContent. +struct _cwmp1__HoldRequests +{ +/// __item wraps 'xs:boolean' simpleContent. + enum xsd__boolean __item ; +/// Imported attribute reference SOAP-ENV:mustUnderstand. + @char* SOAP_ENV__mustUnderstand 1; ///< Fixed value="1". +}; + +/******************************************************************************\ + * * + * Services * + * * +\******************************************************************************/ + + +//gsoap cwmp1 service name: cwmpBinding +//gsoap cwmp1 service type: cwmpPortType +//gsoap cwmp1 service port: http://192.168.2.30:8080/openacs/acs +//gsoap cwmp1 service namespace: urn:dslforum-org:cwmp-1-1 +//gsoap cwmp1 service transport: http://schemas.xmlsoap.org/soap/http + +/** @mainpage cwmp Definitions + +@section cwmp_bindings Bindings + - @ref cwmpBinding + +*/ + +/** + +@page cwmpBinding Binding "cwmpBinding" + +@section cwmpService_service Service Documentation "cwmpService" +Metanoia cwmp service definition + +@section cwmpBinding_operations Operations of Binding "cwmpBinding" + - @ref cwmp1__Inform + +@section cwmpBinding_ports Endpoints of Binding "cwmpBinding" + - http://192.168.2.30:8080/openacs/acs + +Note: use wsdl2h option -N to change the service binding prefix name + +*/ + +/******************************************************************************\ + * * + * cwmpBinding * + * * +\******************************************************************************/ + + +/******************************************************************************\ + * * + * cwmp1__Inform * + * * +\******************************************************************************/ + + +/// Operation "cwmp1__Inform" of service binding "cwmpBinding" + +/** + +Operation details: + +Service definition of function GetRPCMethods + - SOAP RPC encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + +C stub function (defined in soapClient.c[pp] generated by soapcpp2): +@code + int soap_call_cwmp1__Inform( + struct soap *soap, + NULL, // char *endpoint = NULL selects default endpoint for this operation + NULL, // char *action = NULL selects default action for this operation + // request parameters: + struct cwmp1__DeviceIdStruct* DeviceId, + struct cwmp1EventList* Event, + unsigned int MaxEnvelopesI, + time_t CurrentTime, + unsigned int RetryCount, + struct cwmp1ParameterValueList* ParameterList, + // response parameters: + unsigned int *MaxEnvelopesO + ); +@endcode + +C server function (called from the service dispatcher defined in soapServer.c[pp]): +@code + int cwmp1__Inform( + struct soap *soap, + // request parameters: + struct cwmp1__DeviceIdStruct* DeviceId, + struct cwmp1EventList* Event, + unsigned int MaxEnvelopesI, + time_t CurrentTime, + unsigned int RetryCount, + struct cwmp1ParameterValueList* ParameterList, + // response parameters: + unsigned int *MaxEnvelopesO + ); +@endcode + +*/ + +//gsoap cwmp1 service method-style: Inform rpc +//gsoap cwmp1 service method-encoding: Inform http://schemas.xmlsoap.org/soap/encoding/ +//gsoap cwmp1 service method-action: Inform "" +int cwmp1__Inform( + struct cwmp1__DeviceIdStruct* DeviceId, ///< Request parameter + struct cwmp1EventList* Event, ///< Request parameter + unsigned int MaxEnvelopesI, ///< Request parameter + time_t CurrentTime, ///< Request parameter + unsigned int RetryCount, ///< Request parameter + struct cwmp1ParameterValueList* ParameterList, ///< Request parameter + unsigned int *MaxEnvelopesO ///< Response parameter +); + +/* End of cwmp-1-1.h */ diff --git a/src/inc/cwmp.h b/src/inc/cwmp.h new file mode 100644 index 0000000..4f459f8 --- /dev/null +++ b/src/inc/cwmp.h @@ -0,0 +1,348 @@ +/* + cwmp.h + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include +#include +#include + +#include "soapH.h" +#include "list.h" + +#define DEFAULT_LOG_FILE_SIZE 10240 +#define DEFAULT_LOG_FILE_NAME "/var/log/cwmpd.log" +#define EMERG 0 +#define ALERT 1 +#define CRITIC 2 +#define ERROR 3 +#define WARNING 4 +#define NOTICE 5 +#define INFO 6 +#define DEBUG 7 + +#define EVENT_RETRY_AFTER_TRANSMIT_FAIL 0x1 +#define EVENT_RETRY_AFTER_REBOOT 0x2 +#define EVENT_RETRY_AFTER_BOOTSTRAP 0x4 +#define EVENT_TYPE_SINGLE 0x0 +#define EVENT_TYPE_MULTIPLE 0x1 +#define EVENT_IDX_0BOOTSTRAP 0 +#define EVENT_IDX_1BOOT 1 +#define EVENT_IDX_2PERIODIC 2 +#define EVENT_IDX_3SCHEDULED 3 +#define EVENT_IDX_4VALUE_CHANGE 4 +#define EVENT_IDX_5KICKED 5 +#define EVENT_IDX_6CONNECTION_REQUEST 6 +#define EVENT_IDX_7TRANSFER_COMPLETE 7 +#define EVENT_IDX_8DIAGNOSTICS_COMPLETE 8 +#define EVENT_IDX_9REQUEST_DOWNLOAD 9 +#define EVENT_IDX_10AUTONOMOUS_TRANSFER_COMPLETE 10 +#define EVENT_IDX_M_Reboot 11 +#define EVENT_IDX_M_ScheduleInform 12 +#define EVENT_IDX_M_Download 13 +#define EVENT_IDX_M_Upload 14 +#define MAX_SIZE_RPC_METHODS_RESPONSE 14 +#define MAX_INT32 2147483646 +#define MAX_INT_ID MAX_INT32 +#define MIN_INT_ID 836464 +#define PERIOD_INFORM_MIN 100 +#define PERIOD_INFORM_DEFAULT 86400 +#define CONNECTION_REQUEST_RESTRICT_PERIOD 10 +#define CONNECTION_REQUEST_RESTRICT_REQUEST 5 +#define RPC_ACS_INFORM_IDX 1 +#define RPC_ACS_GETRPCMETHODS_IDX 2 +#define RPC_ACS_TRANSFERCOMPLETE_IDX 3 + + +#define FAULT_CPE_ARRAY_SIZE 21 +#define FAULT_CPE_NO_FAULT_IDX 0 +#define FAULT_CPE_METHOD_NOT_SUPPORTED_IDX 1 +#define FAULT_CPE_REQUEST_DENIED_IDX 2 +#define FAULT_CPE_INTERNAL_ERROR_IDX 3 +#define FAULT_CPE_INVALID_ARGUMENTS_IDX 4 +#define FAULT_CPE_RESOURCES_EXCEEDED_IDX 5 +#define FAULT_CPE_INVALID_PARAMETER_NAME_IDX 6 +#define FAULT_CPE_INVALID_PARAMETER_TYPE_IDX 7 +#define FAULT_CPE_INVALID_PARAMETER_VALUE_IDX 8 +#define FAULT_CPE_NON_WRITABLE_PARAMETER_IDX 9 +#define FAULT_CPE_NOTIFICATION_REJECTED_IDX 10 +#define FAULT_CPE_DOWNLOAD_FAILURE_IDX 11 +#define FAULT_CPE_UPLOAD_FAILURE_IDX 12 +#define FAULT_CPE_FILE_TRANSFER_AUTHENTICATION_FAILURE_IDX 13 +#define FAULT_CPE_FILE_TRANSFER_UNSUPPORTED_PROTOCOL_IDX 14 +#define FAULT_CPE_DOWNLOAD_FAIL_MULTICAST_GROUP_IDX 15 +#define FAULT_CPE_DOWNLOAD_FAIL_CONTACT_SERVER_IDX 16 +#define FAULT_CPE_DOWNLOAD_FAIL_ACCESS_FILE_IDX 17 +#define FAULT_CPE_DOWNLOAD_FAIL_COMPLETE_DOWNLOAD_IDX 18 +#define FAULT_CPE_DOWNLOAD_FAIL_FILE_CORRUPTED_IDX 19 +#define FAULT_CPE_DOWNLOAD_FAIL_FILE_AUTHENTICATION_IDX 20 + +#define CWMP_START_BOOT 1 +#define CWMP_START_PERIODIC 2 +#define CWMP_START_ICCU 3 +#define CWMP_OK 0 /* No Error */ +#define CWMP_GEN_ERR 1 /* General Error */ +#define CWMP_MEM_ERR 2 /* Memory Error */ +#define CWMP_OWF_ERR 3 /* Open Writing File Error */ +#define CWMP_ORF_ERR 4 /* Open Reading File Error */ +#define CWMP_MUTEX_ERR 5 +#define CWMP_FAIL_RPC 6 +#define CWMP_RETRY_RPC 7 +#define CWMP_SUCCESS_RPC 8 +#define CWMP_UNAUTHORIZED_401 9 +#define CWMP_GET_RETRY_8005 10 +#define CWMP_RETRY_SESSION 11 +#define CWMP_CONTINUE_SESSION 12 +#define CWMP_SUCCESS_SESSION 13 +#define CWMP_FAULT_CPE 14 +#define CWMP_EXACT_FOUND 15 +#define CWMP_CHILD_FOUND 16 +#define CWMP_PARENT_FOUND 17 +#define MAX_EVENTS 64 +#define SOAP_TIMEOUT 30 + +#define DEFAULT_ACSURL "http://192.168.1.1:8080/openacs/acs" +#define DEFAULT_CONNECTION_REQUEST_PORT 7547 +#define COUNT_RPC_CPE 17 +#define COUNT_EVENT 15 +#define COUNT_ACCESSLIST 1 +#define DOWNLOADED_CONFIG_FILE "/tmp/configuration.cfg" +#define DOWNLOADED_FIRMWARE_FILE "/tmp/firmware.img" +#define DOWNLOADED_LAST_VALID_FIRMWARE_FILE "/tmp/valid_firmware.img" +#define DOWNLOADED_WEBCONTENT_FILE "/tmp/webcontent.ipk" +#define UCI_DM_XML_FILE_LIST "cwmp.dm.xml" +#define UCI_DHCP_DISCOVERY_PATH "cwmp.acs.dhcp_discovery" +#define UCI_DHCP_ACS_URL_PATH "provisioning.iup.tr069url" +#define UCI_STATE_CONNECTION_REQUEST_URL_PATH "cwmp.acs.cr_url" +#define UCI_ACS_URL_PATH "cwmp.acs.url" +#define UCI_PERIODIC_INFORM_INTERVAL_PATH "cwmp.acs.periodic_inform_interval" +#define UCI_PERIODIC_INFORM_ENABLE_PATH "cwmp.acs.periodic_inform_enable" +#define UCI_ACS_USERID_PATH "cwmp.acs.userid" +#define UCI_ACS_PASSWD_PATH "cwmp.acs.passwd" +#define UCI_ACS_PARAMETERKEY_PATH "cwmp.acs.ParameterKey" +#define UCI_LOG_SEVERITY_PATH "cwmp.cpe.log_severity" +#define UCI_CPE_USERID_PATH "cwmp.cpe.userid" +#define UCI_CPE_PASSWD_PATH "cwmp.cpe.passwd" +#define UCI_CPE_PORT_PATH "cwmp.cpe.port" +#define UCI_NOTIFICATION_PASSIVE_PATH "cwmp.notification.passive" +#define UCI_NOTIFICATION_ACTIVE_PATH "cwmp.notification.active" +#define UCI_NOTIFICATION_DENIED_PATH "cwmp.notification.deny" +#define UCI_CPE_LOG_FILE_NAME "cwmp.cpe.log_file_name" +#define UCI_CPE_LOG_MAX_SIZE "cwmp.cpe.log_max_size" +#define UCI_CPE_ENABLE_STDOUT_LOG "cwmp.cpe.log_to_console" +#define UCI_CPE_ENABLE_FILE_LOG "cwmp.cpe.log_to_file" + +#define UCI_TRACK_CONF "ucitrack" +#define UCI_TRACK_INIT "init" +#define UCI_TRACK_AFFECTS "affects" +#define UCI_TRACK_CONF_CWMP "cwmp" + +#define FIRMWARE_FILE_TYPE "1 Firmware Upgrade Image" +#define WEB_CONTENT_FILE_TYPE "2 Web Content" +#define CONFIGURATION_FILE_TYPE "3 Vendor Configuration File" +#define DOWNLOAD_PROTOCOL_HTTP "http://" +#define DOWNLOAD_PROTOCOL_FTP "ftp://" +#define MAX_DOWNLOAD_QUEUE 10 +#define ENABLE_CHECK_SIZE 0x0 +#define DISABLE_CHECK_SIZE 0x1 + +#define ENCODING_STYLE_URL "http://schemas.xmlsoap.org/soap/encoding/" + +typedef enum bool { + FALSE, + TRUE +} bool; + + +typedef struct config { + char *acsurl; + char *confFile; + char *acs_userid; + char *acs_passwd; + char *cpe_userid; + char *cpe_passwd; + int connection_request_port; + int period; + bool periodic_enable; +} config; + +typedef struct env { + unsigned short boot; + unsigned short periodic; + unsigned short iccu; + long int max_firmware_size; +} env; + +typedef struct api_value_change { + struct list_head parameter_list; + int parameter_size; + pthread_mutex_t mutex; +} api_value_change; + +typedef struct cwmp { + struct env env; + struct config conf; + struct list_head head_session_queue; + pthread_mutex_t mutex_session_queue; + struct session *session_send; + pthread_mutex_t mutex_session_send; + pthread_cond_t threshold_session_send; + pthread_mutex_t mutex_periodic; + pthread_cond_t threshold_periodic; + int retry_count_session; + struct list_head *head_event_container; + struct api_value_change api_value_change; + int error; +} cwmp; + +typedef struct session { + struct list_head list; + char acs_url[256]; + struct list_head head_event_container; + int event_size; + int parameter_size; + unsigned int single_event_flag; + struct list_head head_rpc_cpe; + struct list_head head_rpc_acs; + struct list_head head_session_end_func; + struct soap soap; + bool hold_request; + bool digest_auth; + int error; +} session; + +typedef struct session_end_func { + struct list_head list; + int (*func)(struct cwmp *cwmp, void *input); + void *input; +} session_end_func; + + +typedef struct event_container { + struct list_head list; + struct cwmp1__EventStruct event; + struct list_head head_paramater_container; + int id; + int idx; +} event_container; + +typedef struct paramater_container { + struct list_head list; + struct cwmp1__ParameterValueStruct paramater; +} paramater_container; + +typedef struct soap_cwmp1_methods__rpc +{ + void (*soap_serialize_cwmp1__send_data)(struct soap *soap, void *data); + int (*soap_put_cwmp1__send_data)(struct soap *soap, void *data, char *envelope, char *action); + void *(*soap_get_cwmp1__rpc_received_data)(struct soap *, void *data, char *envelope_response, char *action); + char *envelope; + char *envelope_response; +} soap_cwmp1_methods__rpc; +typedef struct fault +{ + int code_idx; + char *parameter_cause; +} fault; +typedef struct rpc_acs { + struct list_head list; + void *method_data; + int (*method_data_init)(struct cwmp *cwmp, struct session *session, struct rpc_acs *this); + int (*method_remote_call)(struct cwmp *cwmp, struct session *session, struct rpc_acs *this); + void *method_response_data; + int (*method_response)(struct cwmp *cwmp, struct session *session, struct rpc_acs *this); + int (*method_end)(struct cwmp *cwmp, struct session *session, struct rpc_acs *this); + int (*destructor)(struct cwmp *cwmp, struct session *session, struct rpc_acs *this); + struct soap_cwmp1_methods__rpc soap_methods; + struct fault fault; + int type; + int error; +} rpc_acs; + +typedef struct rpc_cpe { + struct list_head list; + void *method_data; + int (*method)(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); + void *method_response_data; + int (*method_response_data_init)(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); + int (*method_response)(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); + int (*method_end)(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); + int (*destructor)(struct cwmp *cwmp, struct session *session, struct rpc_cpe *this); + struct soap_cwmp1_methods__rpc soap_methods; + struct fault fault; + int error; +} rpc_cpe; + +typedef struct CPE_METHOD_CONSTRUCTORS +{ + char *METHOD; + struct rpc_cpe *(*CONSTRUCTOR)(struct session *session); +} CPE_METHOD_CONSTRUCTORS; + +typedef struct FAULT_CPE +{ + char *CODE; + int TYPE; + char *DESCRIPTION; +} FAULT_CPE; + +typedef struct EVENT_CONST_STRUCT +{ + char *CODE; + unsigned int TYPE; + unsigned short RETRY; + +} EVENT_CONST_STRUCT; + +typedef struct schedule_inform { + struct list_head list; + time_t scheduled_time; + char *commandKey; +} schedule_inform; + +typedef struct download { + struct list_head list; + time_t scheduled_time; + char *CommandKey; + char *FileType; + char *URL; + char *Username; + char *Password; +} download; + +struct download_end_func { + int (*func)(struct cwmp *cwmp, void *input); + void *input; +}; + +#define sizearray(a) (sizeof(a) / sizeof((a)[0])) +typedef struct config_uci_list { + struct list_head list; + char *value; +} config_uci_list; + +typedef struct ACCESSLIST_CONST_STRUCT +{ + char *NAME; + char *UCI_ACCESSLIST_PATH; +} ACCESSLIST_CONST_STRUCT; + +#ifdef WITH_CWMP_DEBUG +# ifndef CWMP_LOG +# define CWMP_LOG(SEV,MESSAGE,args...) puts_log(SEV,MESSAGE,##args); +# endif +#else +# define CWMP_LOG(SEV,MESSAGE,args...) +#endif diff --git a/src/inc/cwmpBinding.nsmap b/src/inc/cwmpBinding.nsmap new file mode 100644 index 0000000..ada4c20 --- /dev/null +++ b/src/inc/cwmpBinding.nsmap @@ -0,0 +1,11 @@ + +#include "soapH.h" +SOAP_NMAC struct Namespace namespaces[] = +{ + {"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/", "http://www.w3.org/*/soap-envelope", NULL}, + {"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", "http://www.w3.org/*/soap-encoding", NULL}, + {"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL}, + {"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL}, + {"cwmp", "urn:dslforum-org:cwmp-1-0", "urn:dslforum-org:cwmp*", NULL}, + {NULL, NULL, NULL, NULL} +}; diff --git a/src/inc/cwmp_kernel.h b/src/inc/cwmp_kernel.h new file mode 100644 index 0000000..dc0c862 --- /dev/null +++ b/src/inc/cwmp_kernel.h @@ -0,0 +1,8 @@ + +#define NETLINK_MAX_PAYLOAD 1024 +#define NETLINK_USER 31 +#define NETLINK_CWMP_ID "NETLINK_CWMP_ID" +#define NETLINK_END_DATA "END_DATA" +#define NETLINK_NULL "NULL" + +int kernel_api_cwmp_value_change_call (int count, ...); diff --git a/src/inc/cwmp_lib.h b/src/inc/cwmp_lib.h new file mode 100644 index 0000000..7fe3bf7 --- /dev/null +++ b/src/inc/cwmp_lib.h @@ -0,0 +1,6 @@ + +#define AF_UNIX_ADDRESS ".AF_UNIX_CWMP_ID" +#define AF_UNIX_END_DATA "END_DATA" +#define AF_UNIX_NULL "NULL" + +int lib_api_cwmp_value_change_call (int count, ...); diff --git a/src/inc/dm.h b/src/inc/dm.h new file mode 100644 index 0000000..d30356a --- /dev/null +++ b/src/inc/dm.h @@ -0,0 +1,227 @@ +/* + dm.h + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ +#include +#define DM_OK 0 +#define DM_ERR 1 +#define DM_GEN_ERR 2 +#define DM_MEM_ERR 3 +#define DM_ORF_ERR 4 +#define NODE_PATH_SIZE 16 +#define INDEX_PATH_SIZE 8 + +#define COUNT_TYPE_VALUES 44 +#define SYSTEM_CMD_TIMEOUT 10 + +#define TYPE_VALUE_string_IDX 0 +#define TYPE_VALUE_int_IDX 1 +#define TYPE_VALUE_unsignedInt_IDX 2 +#define TYPE_VALUE_boolean_IDX 3 +#define TYPE_VALUE_dateTime_IDX 4 +#define TYPE_VALUE_base64Binary_IDX 5 +#define TYPE_VALUE_integer_IDX 6 +#define TYPE_VALUE_unsignedByte_IDX 7 +#define TYPE_VALUE_unsignedLong_IDX 8 +#define TYPE_VALUE_unsignedShort_IDX 9 +#define TYPE_VALUE_anyURI_IDX 10 +#define TYPE_VALUE_byte_IDX 11 +#define TYPE_VALUE_date_IDX 12 +#define TYPE_VALUE_time_IDX 13 +#define TYPE_VALUE_decimal_IDX 14 +#define TYPE_VALUE_double_IDX 15 +#define TYPE_VALUE_duration_IDX 16 +#define TYPE_VALUE_ENTITIES_IDX 17 +#define TYPE_VALUE_ENTITY_IDX 18 +#define TYPE_VALUE_float_IDX 19 +#define TYPE_VALUE_gDay_IDX 20 +#define TYPE_VALUE_gMonth_IDX 21 +#define TYPE_VALUE_gMonthDay_IDX 22 +#define TYPE_VALUE_gYear_IDX 23 +#define TYPE_VALUE_gYearMonth_IDX 24 +#define TYPE_VALUE_hexBinary_IDX 25 +#define TYPE_VALUE_ID_IDX 26 +#define TYPE_VALUE_IDREF_IDX 27 +#define TYPE_VALUE_IDREFS_IDX 28 +#define TYPE_VALUE_language_IDX 29 +#define TYPE_VALUE_long_IDX 30 +#define TYPE_VALUE_Name_IDX 31 +#define TYPE_VALUE_NCName_IDX 32 +#define TYPE_VALUE_negativeInteger_IDX 33 +#define TYPE_VALUE_NMTOKEN_IDX 34 +#define TYPE_VALUE_NMTOKENS_IDX 35 +#define TYPE_VALUE_nonNegativeInteger_IDX 36 +#define TYPE_VALUE_nonPositiveInteger_IDX 37 +#define TYPE_VALUE_normalizedString_IDX 38 +#define TYPE_VALUE_NOTATION_IDX 39 +#define TYPE_VALUE_positiveInteger_IDX 40 +#define TYPE_VALUE_QName_IDX 41 +#define TYPE_VALUE_short_IDX 42 +#define TYPE_VALUE_token_IDX 43 + +typedef struct dm_notification { + __u8 can_deny :1; + __u8 force_enabled :1; + __u8 force_default_enabled :1; +} dm_notification; + +typedef enum node_type { + DM_OBJECT, + DM_INSTANCE, + DM_PARAMETER +} node_type; + +typedef enum param_type { + DM_SYSTEM, + DM_UCI, + DM_STRING, + DM_DEBUG, + DM_CORRESPONDENCE, + DM_DEFAULT_VALUE, + DM_REGEXP +} param_type; + +typedef enum action_type { + DM_APPLY, + DM_GET, + DM_SET, + DM_CANCEL, + DM_ADD, + DM_DEL +} action_type; + +typedef enum permission { + DM_READ, + DM_READ_WRITE, + DM_CREATE, + DM_PRESENT +} permission; + +typedef struct dm_data { + unsigned short line_size; + unsigned short column_size; + char ***data; +} dm_data; + +typedef struct dm_map { + unsigned short size; + char **map; +} dm_map; + +typedef struct dm_uci { + __u8 reboot_required; + __u8 end_session; + char *cmd; +} dm_uci; + +typedef struct dm_system { + __u8 type; + __u8 reboot_required; + __u8 end_session; + struct dm_map *dm_map; + char *cmd; +} dm_system; + +typedef struct dm_correspondence { + struct dm_data *dm_data; + struct dm_map *dm_map; +} dm_correspondence; + +typedef struct dm_debug { + char *data; +} dm_debug; + +typedef struct data_handler { + enum param_type type; + void *handler; +} data_handler; + +struct list_data_handler { + struct list_head list; + struct data_handler *data_handler; +} list_data_handler; + +typedef struct dm_node { + struct list_head list; + char *name; + struct data_handler **data_handler; + __u8 type:4; + __u8 permission:4; + __u8 size_data_handler; + struct dm_notification active_notify; + /* the position of above parameters should be the same of struct dm_node_leaf*/ + struct list_head head_child; +} dm_node; + +typedef struct dm_node_leaf { + struct list_head list; + char *name; + struct data_handler **data_handler; + __u8 type:4; + __u8 permission:4; + __u8 size_data_handler; + struct dm_notification active_notify; + /* the position of above parameters should be the same of struct dm_node*/ + __u8 value_type; +} dm_node_leaf; + +typedef struct forced_inform_parameter { + char *name; + struct list_head list; + struct dm_node_leaf *node; +} _forced_inform_parameter; + +enum dm_data_type { + DM_XML_DATA, + DM_SYSTEM_DATA +}; + +typedef struct dm_index_path { + struct dm_map *map; + struct dm_data *data; + enum dm_data_type data_type; + char *index; + int indice; + struct dm_node_path *node_path; +} dm_index_path; + +typedef struct dm_node_path { + struct dm_node *node; + struct dm_index_path *index_path; +} dm_node_path; + +typedef struct dm_rpc { + void *input; + int (*method)(struct dm_node *node, struct dm_rpc *dm_rpc, struct dm_node_path *node_path, int pos_np, struct dm_index_path *index_path, int pos_xp); + bool subtree; +} dm_rpc; + +#ifdef WITH_DM_DEBUG +# ifndef DM_LOG +# define DM_LOG(SEV,MESSAGE,args...) puts_log(SEV,MESSAGE,##args); +# endif +#else +# define DM_LOG(SEV,MESSAGE,args...) +#endif + +#ifdef WITH_DM_XML_DEBUG +# ifndef DM_XML_LOG +# define DM_XML_LOG(SEV,MESSAGE,args...) puts_log(SEV,MESSAGE,##args); +# define DM_XML_GET_HANDLER_DEBUG(NODE,INDEX_PATH,POS_XP) dm_get_handler_debug(NODE,INDEX_PATH,POS_XP); +# endif +#else +# define DM_XML_LOG(SEV,MESSAGE,args...) +# define DM_XML_GET_HANDLER_DEBUG(NODE,INDEX_PATH,POS_XP) +#endif diff --git a/src/inc/dm_rpc.h b/src/inc/dm_rpc.h new file mode 100644 index 0000000..864eee5 --- /dev/null +++ b/src/inc/dm_rpc.h @@ -0,0 +1,121 @@ +/* + dm_rpc.h + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +typedef struct dm_indice { + int type; + char *indice; +} dm_indice; + +typedef struct sub_path { + char *name; + struct dm_node *node; + struct dm_indice dm_indice; +} sub_path; + +typedef struct dm_input_getParameterValues { + int *n; + struct list_head *list; +} dm_input_getParameterValues; + +typedef struct dm_input_getParameterNames { + int *n; + struct list_head *list; + enum xsd__boolean NextLevel; +} dm_input_getParameterNames; + +typedef struct dm_input_getParameterAttributes { + int *n; + struct list_head *list; +} dm_input_getParameterAttributes; + +typedef struct dm_input_setParameterAttributes { + struct cwmp1__SetParameterAttributesStruct *ParameterAttributesStruct; +} dm_input_setParameterAttributes; + +typedef struct dm_input_getParameterPaths_by_correspondence { + struct list_head *list; + struct list_head *elist; + int *n; + struct dm_node *prefix_node; + struct sub_path *sub_path; + int sub_path_size; + bool get_value; + bool get_attribute; + bool is_actif; +} dm_input_getParameterPaths_by_correspondence; + +typedef struct dm_input_setParameterValues { + char *value; + struct dm_set_handler *dm_set_handler; +} dm_input_setParameterValues; + +typedef struct dm_input_addObject { + int *n; + char *path; + struct dm_set_handler *dm_set_handler; +} dm_input_addObject; + +typedef struct dm_input_deleteObject { + char *path; + struct dm_set_handler *dm_set_handler; +} dm_input_deleteObject; + +typedef struct handler_ParameterInfoStruct { + struct list_head list; + struct cwmp1__ParameterInfoStruct *ParameterInfoStruct; +} handler_ParameterInfoStruct; + +typedef struct handler_ParameterValueStruct { + struct list_head list; + struct cwmp1__ParameterValueStruct *ParameterValueStruct; +} handler_ParameterValueStruct; + +typedef struct dm_set_handler { + struct list_head list; + struct list_head cmd_list; + struct list_head cancel_list; + struct list_head service_list; + bool reboot_required; + bool cwmp_reload; + bool uci; +} dm_set_handler; + +typedef struct service_handler { + struct list_head list; + char *service; +} service_handler; + +typedef struct cmd_handler { + struct list_head list; + char *cmd; + enum param_type type; + __u8 end_session; +} cmd_handler; + +typedef struct cancel_handler { + struct list_head list; + char *cmd; +} cancel_handler; + +typedef struct handler_ParameterAttributeStruct { + struct list_head list; + struct cwmp1__ParameterAttributeStruct *ParameterAttributeStruct; +} handler_ParameterAttributeStruct; + +#define DM_INDICE_INDEX 1 +#define DM_INDICE_CORRESPONDENCE 2 +#define DM_MAX_INDICE 16 diff --git a/src/inc/httpda.h b/src/inc/httpda.h new file mode 100644 index 0000000..29c1f9a --- /dev/null +++ b/src/inc/httpda.h @@ -0,0 +1,121 @@ +/* + httpda.h + + gSOAP HTTP Digest Authentication plugin. + Supports both Basic and Digest authentication. + +gSOAP XML Web services tools +Copyright (C) 2000-2005, Robert van Engelen, Genivia Inc., All Rights Reserved. +This part of the software is released under one of the following licenses: +GPL, the gSOAP public license, or Genivia's license for commercial use. +-------------------------------------------------------------------------------- +gSOAP public license. + +The contents of this file are subject to the gSOAP Public License Version 1.3 +(the "License"); you may not use this file except in compliance with the +License. You may obtain a copy of the License at +http://www.cs.fsu.edu/~engelen/soaplicense.html +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +for the specific language governing rights and limitations under the License. + +The Initial Developer of the Original Code is Robert A. van Engelen. +Copyright (C) 2000-2005, Robert van Engelen, Genivia, Inc., All Rights Reserved. +-------------------------------------------------------------------------------- +GPL license. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA + +Author contact information: +engelen@genivia.com / engelen@acm.org + +This program is released under the GPL with the additional exemption that +compiling, linking, and/or using OpenSSL is allowed. +-------------------------------------------------------------------------------- +A commercial use license is available from Genivia, Inc., contact@genivia.com +-------------------------------------------------------------------------------- +*/ + +#ifndef HTTPDA_H +#define HTTPDA_H + +#include "stdsoap2.h" +#include "md5evp.h" /* requires MD5 */ +#include "threads.h" /* mutex for multi-threaded server implementations */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define HTTP_DA_ID "HTTP-DA-1.0" /* plugin identification */ + +#define HTTP_DA_SESSION_TIMEOUT (600) /* sessions time out after ten minutes */ + +extern const char http_da_id[]; + +struct http_da_data +{ + int (*fposthdr)(struct soap*, const char*, const char*); + int (*fparsehdr)(struct soap*, const char*, const char*); + int (*fprepareinit)(struct soap*); + int (*fpreparesend)(struct soap*, const char*, size_t); + int (*fpreparerecv)(struct soap*, const char*, size_t); + int (*fdisconnect)(struct soap*); + void *context; /* ptr to MD5 context for MD5 handler */ + char digest[16]; /* MD5 entity body digest */ + char *nonce; /* client/server-side copy of server's nonce value */ + char *opaque; /* client/server-side copy of server's opaque value */ + char *qop; /* client/server-side copy of server's qop value(s) */ + char *alg; /* client-side: server's algorithm value */ + unsigned long nc; /* client-side: generated nonce count */ + char *ncount; /* server-side: client's nonce count */ + char *cnonce; /* server-side: client's nonce */ + char *response; /* server-side: client's response digest key */ +}; + +struct http_da_session +{ + struct http_da_session *next; + time_t modified; + char *realm; + char *nonce; + char *opaque; + unsigned long nc; +}; + +int http_da(struct soap *soap, struct soap_plugin *p, void *arg); + +int http_da_verify_post(struct soap *soap, char *passwd); +int http_da_verify_get(struct soap *soap, char *passwd); + +struct http_da_info +{ + char *authrealm; + char *userid; + char *passwd; + char *nonce; + char *opaque; + char *qop; + char *alg; +}; + +void http_da_save(struct soap *soap, struct http_da_info *info, const char *realm, const char *userid, const char *passwd); +void http_da_restore(struct soap *soap, struct http_da_info *info); +void http_da_release(struct soap *soap, struct http_da_info *info); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/inc/list.h b/src/inc/list.h new file mode 100644 index 0000000..3ace4e2 --- /dev/null +++ b/src/inc/list.h @@ -0,0 +1,471 @@ +#ifndef _LINUX_LIST_H +#define _LINUX_LIST_H + +/* + * These are non-NULL pointers that will result in page faults + * under normal circumstances, used to verify that nobody uses + * non-initialized list entries. + */ +#define LIST_POISON1 ((void *) 0x00100100) +#define LIST_POISON2 ((void *) 0x00200200) + +/* + * Simple doubly linked list implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_add(struct list_head *new, + struct list_head *prev, + struct list_head *next) +{ + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static inline void list_add(struct list_head *new, struct list_head *head) +{ + __list_add(new, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static inline void list_add_tail(struct list_head *new, struct list_head *head) +{ + __list_add(new, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_del(struct list_head * prev, struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * Note: list_empty on entry does not return true after this, the entry is + * in an undefined state. + */ +static inline void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + entry->next = LIST_POISON1; + entry->prev = LIST_POISON2; +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +static inline void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_move - delete from one list and add as another's head + * @list: the entry to move + * @head: the head that will precede our entry + */ +static inline void list_move(struct list_head *list, struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add(list, head); +} + +/** + * list_move_tail - delete from one list and add as another's tail + * @list: the entry to move + * @head: the head that will follow our entry + */ +static inline void list_move_tail(struct list_head *list, + struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add_tail(list, head); +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static inline int list_empty(const struct list_head *head) +{ + return head->next == head; +} + +/** + * list_empty_careful - tests whether a list is + * empty _and_ checks that no other CPU might be + * in the process of still modifying either member + * + * NOTE: using list_empty_careful() without synchronization + * can only be safe if the only activity that can happen + * to the list entry is list_del_init(). Eg. it cannot be used + * if another CPU could re-list_add() it. + * + * @head: the list to test. + */ +static inline int list_empty_careful(const struct list_head *head) +{ + struct list_head *next = head->next; + return (next == head) && (next == head->prev); +} + +static inline void __list_splice(struct list_head *list, + struct list_head *head) +{ + struct list_head *first = list->next; + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +static inline void list_splice(struct list_head *list, struct list_head *head) +{ + if (!list_empty(list)) + __list_splice(list, head); +} + +/** + * list_splice_init - join two lists and reinitialise the emptied list. + * @list: the new list to add. + * @head: the place to add it in the first list. + * + * The list at @list is reinitialised + */ +static inline void list_splice_init(struct list_head *list, + struct list_head *head) +{ + if (!list_empty(list)) { + __list_splice(list, head); + INIT_LIST_HEAD(list); + } +} + +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + +/** + * container_of - cast a member of a structure out to the containing structure + * + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) + +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; prefetch(pos->next), pos != (head); \ + pos = pos->next) + +/** + * __list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + * + * This variant differs from list_for_each() in that it's the + * simplest possible list iteration code, no prefetching is done. + * Use this for code that knows the list to be very short (empty + * or 1 entry) most of the time. + */ +#define __list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); pos = pos->next) + +/** + * list_for_each_prev - iterate over a list backwards + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each_prev(pos, head) \ + for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \ + pos = pos->prev) + +/** + * list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct list_head to use as a loop counter. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member); \ + prefetch(pos->member.next), &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_for_each_entry_reverse - iterate backwards over list of given type. + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_reverse(pos, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member); \ + prefetch(pos->member.prev), &pos->member != (head); \ + pos = list_entry(pos->member.prev, typeof(*pos), member)) + +/** + * list_prepare_entry - prepare a pos entry for use as a start point in + * list_for_each_entry_continue + * @pos: the type * to use as a start point + * @head: the head of the list + * @member: the name of the list_struct within the struct. + */ +#define list_prepare_entry(pos, head, member) \ + ((pos) ? : list_entry(head, typeof(*pos), member)) + +/** + * list_for_each_entry_continue - iterate over list of given type + * continuing after existing point + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_continue(pos, head, member) \ + for (pos = list_entry(pos->member.next, typeof(*pos), member); \ + prefetch(pos->member.next), &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * @pos: the type * to use as a loop counter. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_safe(pos, n, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + +/* + * Double linked lists with a single pointer list head. + * Mostly useful for hash tables where the two pointer list head is + * too wasteful. + * You lose the ability to access the tail in O(1). + */ + +struct hlist_head { + struct hlist_node *first; +}; + +struct hlist_node { + struct hlist_node *next, **pprev; +}; + +#define HLIST_HEAD_INIT { .first = NULL } +#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } +#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) +#define INIT_HLIST_NODE(ptr) ((ptr)->next = NULL, (ptr)->pprev = NULL) + +static inline int hlist_unhashed(const struct hlist_node *h) +{ + return !h->pprev; +} + +static inline int hlist_empty(const struct hlist_head *h) +{ + return !h->first; +} + +static inline void __hlist_del(struct hlist_node *n) +{ + struct hlist_node *next = n->next; + struct hlist_node **pprev = n->pprev; + *pprev = next; + if (next) + next->pprev = pprev; +} + +static inline void hlist_del(struct hlist_node *n) +{ + __hlist_del(n); + n->next = LIST_POISON1; + n->pprev = LIST_POISON2; +} + +static inline void hlist_del_init(struct hlist_node *n) +{ + if (n->pprev) { + __hlist_del(n); + INIT_HLIST_NODE(n); + } +} + +static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) +{ + struct hlist_node *first = h->first; + n->next = first; + if (first) + first->pprev = &n->next; + h->first = n; + n->pprev = &h->first; +} + +/* next must be != NULL */ +static inline void hlist_add_before(struct hlist_node *n, + struct hlist_node *next) +{ + n->pprev = next->pprev; + n->next = next; + next->pprev = &n->next; + *(n->pprev) = n; +} + +static inline void hlist_add_after(struct hlist_node *n, + struct hlist_node *next) +{ + next->next = n->next; + n->next = next; + next->pprev = &n->next; + + if(next->next) + next->next->pprev = &next->next; +} + +#define hlist_entry(ptr, type, member) container_of(ptr,type,member) + +#define hlist_for_each(pos, head) \ + for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \ + pos = pos->next) + +#define hlist_for_each_safe(pos, n, head) \ + for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ + pos = n) + +/** + * hlist_for_each_entry - iterate over list of given type + * @tpos: the type * to use as a loop counter. + * @pos: the &struct hlist_node to use as a loop counter. + * @head: the head for your list. + * @member: the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry(tpos, pos, head, member) \ + for (pos = (head)->first; \ + pos && ({ prefetch(pos->next); 1;}) && \ + ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + pos = pos->next) + +/** + * hlist_for_each_entry_continue - iterate over a hlist continuing after existing point + * @tpos: the type * to use as a loop counter. + * @pos: the &struct hlist_node to use as a loop counter. + * @member: the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry_continue(tpos, pos, member) \ + for (pos = (pos)->next; \ + pos && ({ prefetch(pos->next); 1;}) && \ + ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + pos = pos->next) + +/** + * hlist_for_each_entry_from - iterate over a hlist continuing from existing point + * @tpos: the type * to use as a loop counter. + * @pos: the &struct hlist_node to use as a loop counter. + * @member: the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry_from(tpos, pos, member) \ + for (; pos && ({ prefetch(pos->next); 1;}) && \ + ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + pos = pos->next) + +/** + * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * @tpos: the type * to use as a loop counter. + * @pos: the &struct hlist_node to use as a loop counter. + * @n: another &struct hlist_node to use as temporary storage + * @head: the head for your list. + * @member: the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ + for (pos = (head)->first; \ + pos && ({ n = pos->next; 1; }) && \ + ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + pos = n) + +#endif diff --git a/src/inc/md5evp.h b/src/inc/md5evp.h new file mode 100644 index 0000000..a522db7 --- /dev/null +++ b/src/inc/md5evp.h @@ -0,0 +1,81 @@ +/* + +md5evp.h + +gSOAP HTTP Content-MD5 digest plugin. + +gSOAP XML Web services tools +Copyright (C) 2000-2005, Robert van Engelen, Genivia Inc., All Rights Reserved. +This part of the software is released under one of the following licenses: +GPL, the gSOAP public license, or Genivia's license for commercial use. +-------------------------------------------------------------------------------- +gSOAP public license. + +The contents of this file are subject to the gSOAP Public License Version 1.3 +(the "License"); you may not use this file except in compliance with the +License. You may obtain a copy of the License at +http://www.cs.fsu.edu/~engelen/soaplicense.html +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +for the specific language governing rights and limitations under the License. + +The Initial Developer of the Original Code is Robert A. van Engelen. +Copyright (C) 2000-2005, Robert van Engelen, Genivia, Inc., All Rights Reserved. +-------------------------------------------------------------------------------- +GPL license. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA + +Author contact information: +engelen@genivia.com / engelen@acm.org + +This program is released under the GPL with the additional exemption that +compiling, linking, and/or using OpenSSL is allowed. +-------------------------------------------------------------------------------- +A commercial use license is available from Genivia, Inc., contact@genivia.com +-------------------------------------------------------------------------------- + + Defines MD5 handler using EVP interface (e.g. using OpenSSL) + + int md5_handler(struct soap *soap, void **context, enum md5_action action, char *buf, size_t len) + context can be set and passed to subsequent calls. Parameters: + action = + MD5_INIT: init context + MD5_UPDATE: update context with data from buf with size len + MD5_FINAL: fill buf with 16 bytes MD5 hash value + MD5_DELETE: delete context + buf input data, output MD5 128 bit hash value + len length of input data + +*/ + +#ifndef MD5EVP_H +#define MD5EVP_H + +#include "stdsoap2.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +enum md5_action { MD5_INIT, MD5_UPDATE, MD5_FINAL, MD5_DELETE }; + +int md5_handler(struct soap *soap, void **context, enum md5_action action, char *buf, size_t len); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/inc/soapH.h b/src/inc/soapH.h new file mode 100644 index 0000000..4a6eaaf --- /dev/null +++ b/src/inc/soapH.h @@ -0,0 +1,1532 @@ +/* soapH.h + Generated by gSOAP 2.7.12 from cwmp-1-1.h + Copyright(C) 2000-2008, Robert van Engelen, Genivia Inc. All Rights Reserved. + This part of the software is released under one of the following licenses: + GPL, the gSOAP public license, or Genivia's license for commercial use. +*/ + +#ifndef soapH_H +#define soapH_H +#include "soapStub.h" +#ifdef __cplusplus +extern "C" { +#endif +#ifndef WITH_NOIDREF +SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap*, const void*, int); +SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap*, const void*, const char*, int, int); +SOAP_FMAC3 void *SOAP_FMAC4 soap_getelement(struct soap*, int*); +SOAP_FMAC3 int SOAP_FMAC4 soap_putindependent(struct soap*); +SOAP_FMAC3 int SOAP_FMAC4 soap_getindependent(struct soap*); +#endif +SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap*); + +#ifndef SOAP_TYPE_byte +#define SOAP_TYPE_byte (3) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap*, char *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_byte(struct soap*, const char *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_byte(struct soap*, const char*, int, const char *, const char*); +SOAP_FMAC3 char * SOAP_FMAC4 soap_get_byte(struct soap*, char *, const char*, const char*); +SOAP_FMAC3 char * SOAP_FMAC4 soap_in_byte(struct soap*, const char*, char *, const char*); + +#ifndef SOAP_TYPE_int +#define SOAP_TYPE_int (1) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap*, int *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_int(struct soap*, const int *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_int(struct soap*, const char*, int, const int *, const char*); +SOAP_FMAC3 int * SOAP_FMAC4 soap_get_int(struct soap*, int *, const char*, const char*); +SOAP_FMAC3 int * SOAP_FMAC4 soap_in_int(struct soap*, const char*, int *, const char*); + +#ifndef SOAP_TYPE_unsignedByte +#define SOAP_TYPE_unsignedByte (9) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_unsignedByte(struct soap*, unsigned char *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_unsignedByte(struct soap*, const unsigned char *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_unsignedByte(struct soap*, const char*, int, const unsigned char *, const char*); +SOAP_FMAC3 unsigned char * SOAP_FMAC4 soap_get_unsignedByte(struct soap*, unsigned char *, const char*, const char*); +SOAP_FMAC3 unsigned char * SOAP_FMAC4 soap_in_unsignedByte(struct soap*, const char*, unsigned char *, const char*); + +#ifndef SOAP_TYPE_unsignedInt +#define SOAP_TYPE_unsignedInt (8) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_unsignedInt(struct soap*, unsigned int *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_unsignedInt(struct soap*, const unsigned int *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_unsignedInt(struct soap*, const char*, int, const unsigned int *, const char*); +SOAP_FMAC3 unsigned int * SOAP_FMAC4 soap_get_unsignedInt(struct soap*, unsigned int *, const char*, const char*); +SOAP_FMAC3 unsigned int * SOAP_FMAC4 soap_in_unsignedInt(struct soap*, const char*, unsigned int *, const char*); + +#ifndef SOAP_TYPE_time +#define SOAP_TYPE_time (37) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_time(struct soap*, time_t *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_time(struct soap*, const time_t *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_time(struct soap*, const char*, int, const time_t *, const char*); +SOAP_FMAC3 time_t * SOAP_FMAC4 soap_get_time(struct soap*, time_t *, const char*, const char*); +SOAP_FMAC3 time_t * SOAP_FMAC4 soap_in_time(struct soap*, const char*, time_t *, const char*); + +#ifndef SOAP_TYPE__cwmp1__UploadResponse_Status +#define SOAP_TYPE__cwmp1__UploadResponse_Status (95) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__UploadResponse_Status(struct soap*, enum _cwmp1__UploadResponse_Status *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__UploadResponse_Status(struct soap*, const enum _cwmp1__UploadResponse_Status *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__UploadResponse_Status(struct soap*, const char*, int, const enum _cwmp1__UploadResponse_Status *, const char*); + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__UploadResponse_Status2s(struct soap*, enum _cwmp1__UploadResponse_Status); +SOAP_FMAC3 enum _cwmp1__UploadResponse_Status * SOAP_FMAC4 soap_get__cwmp1__UploadResponse_Status(struct soap*, enum _cwmp1__UploadResponse_Status *, const char*, const char*); +SOAP_FMAC3 enum _cwmp1__UploadResponse_Status * SOAP_FMAC4 soap_in__cwmp1__UploadResponse_Status(struct soap*, const char*, enum _cwmp1__UploadResponse_Status *, const char*); + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__UploadResponse_Status(struct soap*, const char*, enum _cwmp1__UploadResponse_Status *); + +#ifndef SOAP_TYPE__cwmp1__DownloadResponse_Status +#define SOAP_TYPE__cwmp1__DownloadResponse_Status (76) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__DownloadResponse_Status(struct soap*, enum _cwmp1__DownloadResponse_Status *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__DownloadResponse_Status(struct soap*, const enum _cwmp1__DownloadResponse_Status *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__DownloadResponse_Status(struct soap*, const char*, int, const enum _cwmp1__DownloadResponse_Status *, const char*); + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__DownloadResponse_Status2s(struct soap*, enum _cwmp1__DownloadResponse_Status); +SOAP_FMAC3 enum _cwmp1__DownloadResponse_Status * SOAP_FMAC4 soap_get__cwmp1__DownloadResponse_Status(struct soap*, enum _cwmp1__DownloadResponse_Status *, const char*, const char*); +SOAP_FMAC3 enum _cwmp1__DownloadResponse_Status * SOAP_FMAC4 soap_in__cwmp1__DownloadResponse_Status(struct soap*, const char*, enum _cwmp1__DownloadResponse_Status *, const char*); + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__DownloadResponse_Status(struct soap*, const char*, enum _cwmp1__DownloadResponse_Status *); + +#ifndef SOAP_TYPE__cwmp1__DeleteObjectResponse_Status +#define SOAP_TYPE__cwmp1__DeleteObjectResponse_Status (73) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__DeleteObjectResponse_Status(struct soap*, enum _cwmp1__DeleteObjectResponse_Status *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__DeleteObjectResponse_Status(struct soap*, const enum _cwmp1__DeleteObjectResponse_Status *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__DeleteObjectResponse_Status(struct soap*, const char*, int, const enum _cwmp1__DeleteObjectResponse_Status *, const char*); + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__DeleteObjectResponse_Status2s(struct soap*, enum _cwmp1__DeleteObjectResponse_Status); +SOAP_FMAC3 enum _cwmp1__DeleteObjectResponse_Status * SOAP_FMAC4 soap_get__cwmp1__DeleteObjectResponse_Status(struct soap*, enum _cwmp1__DeleteObjectResponse_Status *, const char*, const char*); +SOAP_FMAC3 enum _cwmp1__DeleteObjectResponse_Status * SOAP_FMAC4 soap_in__cwmp1__DeleteObjectResponse_Status(struct soap*, const char*, enum _cwmp1__DeleteObjectResponse_Status *, const char*); + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__DeleteObjectResponse_Status(struct soap*, const char*, enum _cwmp1__DeleteObjectResponse_Status *); + +#ifndef SOAP_TYPE__cwmp1__AddObjectResponse_Status +#define SOAP_TYPE__cwmp1__AddObjectResponse_Status (70) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__AddObjectResponse_Status(struct soap*, enum _cwmp1__AddObjectResponse_Status *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__AddObjectResponse_Status(struct soap*, const enum _cwmp1__AddObjectResponse_Status *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__AddObjectResponse_Status(struct soap*, const char*, int, const enum _cwmp1__AddObjectResponse_Status *, const char*); + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__AddObjectResponse_Status2s(struct soap*, enum _cwmp1__AddObjectResponse_Status); +SOAP_FMAC3 enum _cwmp1__AddObjectResponse_Status * SOAP_FMAC4 soap_get__cwmp1__AddObjectResponse_Status(struct soap*, enum _cwmp1__AddObjectResponse_Status *, const char*, const char*); +SOAP_FMAC3 enum _cwmp1__AddObjectResponse_Status * SOAP_FMAC4 soap_in__cwmp1__AddObjectResponse_Status(struct soap*, const char*, enum _cwmp1__AddObjectResponse_Status *, const char*); + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__AddObjectResponse_Status(struct soap*, const char*, enum _cwmp1__AddObjectResponse_Status *); + +#ifndef SOAP_TYPE__cwmp1__SetParameterValuesResponse_Status +#define SOAP_TYPE__cwmp1__SetParameterValuesResponse_Status (51) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetParameterValuesResponse_Status(struct soap*, enum _cwmp1__SetParameterValuesResponse_Status *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetParameterValuesResponse_Status(struct soap*, const enum _cwmp1__SetParameterValuesResponse_Status *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetParameterValuesResponse_Status(struct soap*, const char*, int, const enum _cwmp1__SetParameterValuesResponse_Status *, const char*); + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__SetParameterValuesResponse_Status2s(struct soap*, enum _cwmp1__SetParameterValuesResponse_Status); +SOAP_FMAC3 enum _cwmp1__SetParameterValuesResponse_Status * SOAP_FMAC4 soap_get__cwmp1__SetParameterValuesResponse_Status(struct soap*, enum _cwmp1__SetParameterValuesResponse_Status *, const char*, const char*); +SOAP_FMAC3 enum _cwmp1__SetParameterValuesResponse_Status * SOAP_FMAC4 soap_in__cwmp1__SetParameterValuesResponse_Status(struct soap*, const char*, enum _cwmp1__SetParameterValuesResponse_Status *, const char*); + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__SetParameterValuesResponse_Status(struct soap*, const char*, enum _cwmp1__SetParameterValuesResponse_Status *); + +#ifndef SOAP_TYPE__cwmp1__OptionStruct_IsTransferable +#define SOAP_TYPE__cwmp1__OptionStruct_IsTransferable (39) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__OptionStruct_IsTransferable(struct soap*, enum _cwmp1__OptionStruct_IsTransferable *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__OptionStruct_IsTransferable(struct soap*, const enum _cwmp1__OptionStruct_IsTransferable *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__OptionStruct_IsTransferable(struct soap*, const char*, int, const enum _cwmp1__OptionStruct_IsTransferable *, const char*); + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__OptionStruct_IsTransferable2s(struct soap*, enum _cwmp1__OptionStruct_IsTransferable); +SOAP_FMAC3 enum _cwmp1__OptionStruct_IsTransferable * SOAP_FMAC4 soap_get__cwmp1__OptionStruct_IsTransferable(struct soap*, enum _cwmp1__OptionStruct_IsTransferable *, const char*, const char*); +SOAP_FMAC3 enum _cwmp1__OptionStruct_IsTransferable * SOAP_FMAC4 soap_in__cwmp1__OptionStruct_IsTransferable(struct soap*, const char*, enum _cwmp1__OptionStruct_IsTransferable *, const char*); + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__OptionStruct_IsTransferable(struct soap*, const char*, enum _cwmp1__OptionStruct_IsTransferable *); + +#ifndef SOAP_TYPE__cwmp1__OptionStruct_Mode +#define SOAP_TYPE__cwmp1__OptionStruct_Mode (36) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__OptionStruct_Mode(struct soap*, enum _cwmp1__OptionStruct_Mode *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__OptionStruct_Mode(struct soap*, const enum _cwmp1__OptionStruct_Mode *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__OptionStruct_Mode(struct soap*, const char*, int, const enum _cwmp1__OptionStruct_Mode *, const char*); + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__OptionStruct_Mode2s(struct soap*, enum _cwmp1__OptionStruct_Mode); +SOAP_FMAC3 enum _cwmp1__OptionStruct_Mode * SOAP_FMAC4 soap_get__cwmp1__OptionStruct_Mode(struct soap*, enum _cwmp1__OptionStruct_Mode *, const char*, const char*); +SOAP_FMAC3 enum _cwmp1__OptionStruct_Mode * SOAP_FMAC4 soap_in__cwmp1__OptionStruct_Mode(struct soap*, const char*, enum _cwmp1__OptionStruct_Mode *, const char*); + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__OptionStruct_Mode(struct soap*, const char*, enum _cwmp1__OptionStruct_Mode *); + +#ifndef SOAP_TYPE__cwmp1__OptionStruct_State +#define SOAP_TYPE__cwmp1__OptionStruct_State (35) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__OptionStruct_State(struct soap*, enum _cwmp1__OptionStruct_State *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__OptionStruct_State(struct soap*, const enum _cwmp1__OptionStruct_State *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__OptionStruct_State(struct soap*, const char*, int, const enum _cwmp1__OptionStruct_State *, const char*); + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__OptionStruct_State2s(struct soap*, enum _cwmp1__OptionStruct_State); +SOAP_FMAC3 enum _cwmp1__OptionStruct_State * SOAP_FMAC4 soap_get__cwmp1__OptionStruct_State(struct soap*, enum _cwmp1__OptionStruct_State *, const char*, const char*); +SOAP_FMAC3 enum _cwmp1__OptionStruct_State * SOAP_FMAC4 soap_in__cwmp1__OptionStruct_State(struct soap*, const char*, enum _cwmp1__OptionStruct_State *, const char*); + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__OptionStruct_State(struct soap*, const char*, enum _cwmp1__OptionStruct_State *); + +#ifndef SOAP_TYPE__cwmp1__AllQueuedTransferStruct_State +#define SOAP_TYPE__cwmp1__AllQueuedTransferStruct_State (32) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__AllQueuedTransferStruct_State(struct soap*, enum _cwmp1__AllQueuedTransferStruct_State *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__AllQueuedTransferStruct_State(struct soap*, const enum _cwmp1__AllQueuedTransferStruct_State *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__AllQueuedTransferStruct_State(struct soap*, const char*, int, const enum _cwmp1__AllQueuedTransferStruct_State *, const char*); + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__AllQueuedTransferStruct_State2s(struct soap*, enum _cwmp1__AllQueuedTransferStruct_State); +SOAP_FMAC3 enum _cwmp1__AllQueuedTransferStruct_State * SOAP_FMAC4 soap_get__cwmp1__AllQueuedTransferStruct_State(struct soap*, enum _cwmp1__AllQueuedTransferStruct_State *, const char*, const char*); +SOAP_FMAC3 enum _cwmp1__AllQueuedTransferStruct_State * SOAP_FMAC4 soap_in__cwmp1__AllQueuedTransferStruct_State(struct soap*, const char*, enum _cwmp1__AllQueuedTransferStruct_State *, const char*); + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__AllQueuedTransferStruct_State(struct soap*, const char*, enum _cwmp1__AllQueuedTransferStruct_State *); + +#ifndef SOAP_TYPE__cwmp1__QueuedTransferStruct_State +#define SOAP_TYPE__cwmp1__QueuedTransferStruct_State (30) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__QueuedTransferStruct_State(struct soap*, enum _cwmp1__QueuedTransferStruct_State *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__QueuedTransferStruct_State(struct soap*, const enum _cwmp1__QueuedTransferStruct_State *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__QueuedTransferStruct_State(struct soap*, const char*, int, const enum _cwmp1__QueuedTransferStruct_State *, const char*); + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__QueuedTransferStruct_State2s(struct soap*, enum _cwmp1__QueuedTransferStruct_State); +SOAP_FMAC3 enum _cwmp1__QueuedTransferStruct_State * SOAP_FMAC4 soap_get__cwmp1__QueuedTransferStruct_State(struct soap*, enum _cwmp1__QueuedTransferStruct_State *, const char*, const char*); +SOAP_FMAC3 enum _cwmp1__QueuedTransferStruct_State * SOAP_FMAC4 soap_in__cwmp1__QueuedTransferStruct_State(struct soap*, const char*, enum _cwmp1__QueuedTransferStruct_State *, const char*); + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__QueuedTransferStruct_State(struct soap*, const char*, enum _cwmp1__QueuedTransferStruct_State *); + +#ifndef SOAP_TYPE__cwmp1__ParameterAttributeStruct_Notification +#define SOAP_TYPE__cwmp1__ParameterAttributeStruct_Notification (28) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__ParameterAttributeStruct_Notification(struct soap*, enum _cwmp1__ParameterAttributeStruct_Notification *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__ParameterAttributeStruct_Notification(struct soap*, const enum _cwmp1__ParameterAttributeStruct_Notification *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__ParameterAttributeStruct_Notification(struct soap*, const char*, int, const enum _cwmp1__ParameterAttributeStruct_Notification *, const char*); + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__ParameterAttributeStruct_Notification2s(struct soap*, enum _cwmp1__ParameterAttributeStruct_Notification); +SOAP_FMAC3 enum _cwmp1__ParameterAttributeStruct_Notification * SOAP_FMAC4 soap_get__cwmp1__ParameterAttributeStruct_Notification(struct soap*, enum _cwmp1__ParameterAttributeStruct_Notification *, const char*, const char*); +SOAP_FMAC3 enum _cwmp1__ParameterAttributeStruct_Notification * SOAP_FMAC4 soap_in__cwmp1__ParameterAttributeStruct_Notification(struct soap*, const char*, enum _cwmp1__ParameterAttributeStruct_Notification *, const char*); + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__ParameterAttributeStruct_Notification(struct soap*, const char*, enum _cwmp1__ParameterAttributeStruct_Notification *); + +#ifndef SOAP_TYPE__cwmp1__SetParameterAttributesStruct_Notification +#define SOAP_TYPE__cwmp1__SetParameterAttributesStruct_Notification (24) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetParameterAttributesStruct_Notification(struct soap*, enum _cwmp1__SetParameterAttributesStruct_Notification *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetParameterAttributesStruct_Notification(struct soap*, const enum _cwmp1__SetParameterAttributesStruct_Notification *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetParameterAttributesStruct_Notification(struct soap*, const char*, int, const enum _cwmp1__SetParameterAttributesStruct_Notification *, const char*); + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__SetParameterAttributesStruct_Notification2s(struct soap*, enum _cwmp1__SetParameterAttributesStruct_Notification); +SOAP_FMAC3 enum _cwmp1__SetParameterAttributesStruct_Notification * SOAP_FMAC4 soap_get__cwmp1__SetParameterAttributesStruct_Notification(struct soap*, enum _cwmp1__SetParameterAttributesStruct_Notification *, const char*, const char*); +SOAP_FMAC3 enum _cwmp1__SetParameterAttributesStruct_Notification * SOAP_FMAC4 soap_in__cwmp1__SetParameterAttributesStruct_Notification(struct soap*, const char*, enum _cwmp1__SetParameterAttributesStruct_Notification *, const char*); + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__SetParameterAttributesStruct_Notification(struct soap*, const char*, enum _cwmp1__SetParameterAttributesStruct_Notification *); + +#ifndef SOAP_TYPE_xsd__boolean +#define SOAP_TYPE_xsd__boolean (12) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__boolean(struct soap*, enum xsd__boolean *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__boolean(struct soap*, const enum xsd__boolean *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__boolean(struct soap*, const char*, int, const enum xsd__boolean *, const char*); + +SOAP_FMAC3S const char* SOAP_FMAC4S soap_xsd__boolean2s(struct soap*, enum xsd__boolean); +SOAP_FMAC3 enum xsd__boolean * SOAP_FMAC4 soap_get_xsd__boolean(struct soap*, enum xsd__boolean *, const char*, const char*); +SOAP_FMAC3 enum xsd__boolean * SOAP_FMAC4 soap_in_xsd__boolean(struct soap*, const char*, enum xsd__boolean *, const char*); + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2xsd__boolean(struct soap*, const char*, enum xsd__boolean *); + +#ifndef WITH_NOGLOBAL + +#ifndef SOAP_TYPE_SOAP_ENV__Fault +#define SOAP_TYPE_SOAP_ENV__Fault (151) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Fault(struct soap*, const char*, int, const struct SOAP_ENV__Fault *, const char*); +SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_get_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_in_SOAP_ENV__Fault(struct soap*, const char*, struct SOAP_ENV__Fault *, const char*); + +#endif + +#ifndef WITH_NOGLOBAL + +#ifndef SOAP_TYPE_SOAP_ENV__Reason +#define SOAP_TYPE_SOAP_ENV__Reason (150) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap*, const char*, int, const struct SOAP_ENV__Reason *, const char*); +SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_get_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason *, const char*); + +#endif + +#ifndef WITH_NOGLOBAL + +#ifndef SOAP_TYPE_SOAP_ENV__Detail +#define SOAP_TYPE_SOAP_ENV__Detail (147) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap*, const char*, int, const struct SOAP_ENV__Detail *, const char*); +SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_get_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct soap*, const char*, struct SOAP_ENV__Detail *, const char*); + +#endif + +#ifndef WITH_NOGLOBAL + +#ifndef SOAP_TYPE_SOAP_ENV__Code +#define SOAP_TYPE_SOAP_ENV__Code (145) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap*, const char*, int, const struct SOAP_ENV__Code *, const char*); +SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_get_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap*, const char*, struct SOAP_ENV__Code *, const char*); + +#endif + +#ifndef WITH_NOGLOBAL + +#ifndef SOAP_TYPE_SOAP_ENV__Header +#define SOAP_TYPE_SOAP_ENV__Header (144) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap*, const char*, int, const struct SOAP_ENV__Header *, const char*); +SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_get_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct soap*, const char*, struct SOAP_ENV__Header *, const char*); + +#endif + +#ifndef SOAP_TYPE_cwmp1__Inform +#define SOAP_TYPE_cwmp1__Inform (143) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__Inform(struct soap*, struct cwmp1__Inform *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__Inform(struct soap*, const struct cwmp1__Inform *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__Inform(struct soap*, const struct cwmp1__Inform *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__Inform(struct soap*, const char*, int, const struct cwmp1__Inform *, const char*); +SOAP_FMAC3 struct cwmp1__Inform * SOAP_FMAC4 soap_get_cwmp1__Inform(struct soap*, struct cwmp1__Inform *, const char*, const char*); +SOAP_FMAC3 struct cwmp1__Inform * SOAP_FMAC4 soap_in_cwmp1__Inform(struct soap*, const char*, struct cwmp1__Inform *, const char*); + +#ifndef SOAP_TYPE_cwmp1__InformResponse +#define SOAP_TYPE_cwmp1__InformResponse (142) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__InformResponse(struct soap*, struct cwmp1__InformResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__InformResponse(struct soap*, const struct cwmp1__InformResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__InformResponse(struct soap*, const struct cwmp1__InformResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__InformResponse(struct soap*, const char*, int, const struct cwmp1__InformResponse *, const char*); +SOAP_FMAC3 struct cwmp1__InformResponse * SOAP_FMAC4 soap_get_cwmp1__InformResponse(struct soap*, struct cwmp1__InformResponse *, const char*, const char*); +SOAP_FMAC3 struct cwmp1__InformResponse * SOAP_FMAC4 soap_in_cwmp1__InformResponse(struct soap*, const char*, struct cwmp1__InformResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__HoldRequests +#define SOAP_TYPE__cwmp1__HoldRequests (139) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__HoldRequests(struct soap*, struct _cwmp1__HoldRequests *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__HoldRequests(struct soap*, const struct _cwmp1__HoldRequests *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__HoldRequests(struct soap*, const struct _cwmp1__HoldRequests *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__HoldRequests(struct soap*, const char*, int, const struct _cwmp1__HoldRequests *, const char*); +SOAP_FMAC3 struct _cwmp1__HoldRequests * SOAP_FMAC4 soap_get__cwmp1__HoldRequests(struct soap*, struct _cwmp1__HoldRequests *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__HoldRequests * SOAP_FMAC4 soap_in__cwmp1__HoldRequests(struct soap*, const char*, struct _cwmp1__HoldRequests *, const char*); + +#ifndef SOAP_TYPE__cwmp1__ID +#define SOAP_TYPE__cwmp1__ID (138) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__ID(struct soap*, struct _cwmp1__ID *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__ID(struct soap*, const struct _cwmp1__ID *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__ID(struct soap*, const struct _cwmp1__ID *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__ID(struct soap*, const char*, int, const struct _cwmp1__ID *, const char*); +SOAP_FMAC3 struct _cwmp1__ID * SOAP_FMAC4 soap_get__cwmp1__ID(struct soap*, struct _cwmp1__ID *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__ID * SOAP_FMAC4 soap_in__cwmp1__ID(struct soap*, const char*, struct _cwmp1__ID *, const char*); + +#ifndef SOAP_TYPE__cwmp1__RequestDownloadResponse +#define SOAP_TYPE__cwmp1__RequestDownloadResponse (117) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__RequestDownloadResponse(struct soap*, struct _cwmp1__RequestDownloadResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__RequestDownloadResponse(struct soap*, const struct _cwmp1__RequestDownloadResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__RequestDownloadResponse(struct soap*, const struct _cwmp1__RequestDownloadResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__RequestDownloadResponse(struct soap*, const char*, int, const struct _cwmp1__RequestDownloadResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__RequestDownloadResponse * SOAP_FMAC4 soap_get__cwmp1__RequestDownloadResponse(struct soap*, struct _cwmp1__RequestDownloadResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__RequestDownloadResponse * SOAP_FMAC4 soap_in__cwmp1__RequestDownloadResponse(struct soap*, const char*, struct _cwmp1__RequestDownloadResponse *, const char*); + +#ifndef SOAP_TYPE_cwmp1FileTypeArg +#define SOAP_TYPE_cwmp1FileTypeArg (115) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1FileTypeArg(struct soap*, struct cwmp1FileTypeArg *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1FileTypeArg(struct soap*, struct cwmp1FileTypeArg const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1FileTypeArg(struct soap*, const struct cwmp1FileTypeArg *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1FileTypeArg(struct soap*, const char*, int, const struct cwmp1FileTypeArg *, const char*); +SOAP_FMAC3 struct cwmp1FileTypeArg * SOAP_FMAC4 soap_get_cwmp1FileTypeArg(struct soap*, struct cwmp1FileTypeArg *, const char*, const char*); +SOAP_FMAC3 struct cwmp1FileTypeArg * SOAP_FMAC4 soap_in_cwmp1FileTypeArg(struct soap*, const char*, struct cwmp1FileTypeArg *, const char*); + +#ifndef SOAP_TYPE__cwmp1__RequestDownload +#define SOAP_TYPE__cwmp1__RequestDownload (114) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__RequestDownload(struct soap*, struct _cwmp1__RequestDownload *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__RequestDownload(struct soap*, const struct _cwmp1__RequestDownload *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__RequestDownload(struct soap*, const struct _cwmp1__RequestDownload *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__RequestDownload(struct soap*, const char*, int, const struct _cwmp1__RequestDownload *, const char*); +SOAP_FMAC3 struct _cwmp1__RequestDownload * SOAP_FMAC4 soap_get__cwmp1__RequestDownload(struct soap*, struct _cwmp1__RequestDownload *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__RequestDownload * SOAP_FMAC4 soap_in__cwmp1__RequestDownload(struct soap*, const char*, struct _cwmp1__RequestDownload *, const char*); + +#ifndef SOAP_TYPE__cwmp1__KickedResponse +#define SOAP_TYPE__cwmp1__KickedResponse (113) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__KickedResponse(struct soap*, struct _cwmp1__KickedResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__KickedResponse(struct soap*, const struct _cwmp1__KickedResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__KickedResponse(struct soap*, const struct _cwmp1__KickedResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__KickedResponse(struct soap*, const char*, int, const struct _cwmp1__KickedResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__KickedResponse * SOAP_FMAC4 soap_get__cwmp1__KickedResponse(struct soap*, struct _cwmp1__KickedResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__KickedResponse * SOAP_FMAC4 soap_in__cwmp1__KickedResponse(struct soap*, const char*, struct _cwmp1__KickedResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__Kicked +#define SOAP_TYPE__cwmp1__Kicked (112) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__Kicked(struct soap*, struct _cwmp1__Kicked *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__Kicked(struct soap*, const struct _cwmp1__Kicked *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__Kicked(struct soap*, const struct _cwmp1__Kicked *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__Kicked(struct soap*, const char*, int, const struct _cwmp1__Kicked *, const char*); +SOAP_FMAC3 struct _cwmp1__Kicked * SOAP_FMAC4 soap_get__cwmp1__Kicked(struct soap*, struct _cwmp1__Kicked *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__Kicked * SOAP_FMAC4 soap_in__cwmp1__Kicked(struct soap*, const char*, struct _cwmp1__Kicked *, const char*); + +#ifndef SOAP_TYPE__cwmp1__AutonomousTransferCompleteResponse +#define SOAP_TYPE__cwmp1__AutonomousTransferCompleteResponse (111) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__AutonomousTransferCompleteResponse(struct soap*, struct _cwmp1__AutonomousTransferCompleteResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__AutonomousTransferCompleteResponse(struct soap*, const struct _cwmp1__AutonomousTransferCompleteResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__AutonomousTransferCompleteResponse(struct soap*, const struct _cwmp1__AutonomousTransferCompleteResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__AutonomousTransferCompleteResponse(struct soap*, const char*, int, const struct _cwmp1__AutonomousTransferCompleteResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__AutonomousTransferCompleteResponse * SOAP_FMAC4 soap_get__cwmp1__AutonomousTransferCompleteResponse(struct soap*, struct _cwmp1__AutonomousTransferCompleteResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__AutonomousTransferCompleteResponse * SOAP_FMAC4 soap_in__cwmp1__AutonomousTransferCompleteResponse(struct soap*, const char*, struct _cwmp1__AutonomousTransferCompleteResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__AutonomousTransferComplete +#define SOAP_TYPE__cwmp1__AutonomousTransferComplete (110) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__AutonomousTransferComplete(struct soap*, struct _cwmp1__AutonomousTransferComplete *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__AutonomousTransferComplete(struct soap*, const struct _cwmp1__AutonomousTransferComplete *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__AutonomousTransferComplete(struct soap*, const struct _cwmp1__AutonomousTransferComplete *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__AutonomousTransferComplete(struct soap*, const char*, int, const struct _cwmp1__AutonomousTransferComplete *, const char*); +SOAP_FMAC3 struct _cwmp1__AutonomousTransferComplete * SOAP_FMAC4 soap_get__cwmp1__AutonomousTransferComplete(struct soap*, struct _cwmp1__AutonomousTransferComplete *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__AutonomousTransferComplete * SOAP_FMAC4 soap_in__cwmp1__AutonomousTransferComplete(struct soap*, const char*, struct _cwmp1__AutonomousTransferComplete *, const char*); + +#ifndef SOAP_TYPE__cwmp1__TransferCompleteResponse +#define SOAP_TYPE__cwmp1__TransferCompleteResponse (109) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__TransferCompleteResponse(struct soap*, struct _cwmp1__TransferCompleteResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__TransferCompleteResponse(struct soap*, const struct _cwmp1__TransferCompleteResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__TransferCompleteResponse(struct soap*, const struct _cwmp1__TransferCompleteResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__TransferCompleteResponse(struct soap*, const char*, int, const struct _cwmp1__TransferCompleteResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__TransferCompleteResponse * SOAP_FMAC4 soap_get__cwmp1__TransferCompleteResponse(struct soap*, struct _cwmp1__TransferCompleteResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__TransferCompleteResponse * SOAP_FMAC4 soap_in__cwmp1__TransferCompleteResponse(struct soap*, const char*, struct _cwmp1__TransferCompleteResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__TransferComplete +#define SOAP_TYPE__cwmp1__TransferComplete (107) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__TransferComplete(struct soap*, struct _cwmp1__TransferComplete *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__TransferComplete(struct soap*, const struct _cwmp1__TransferComplete *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__TransferComplete(struct soap*, const struct _cwmp1__TransferComplete *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__TransferComplete(struct soap*, const char*, int, const struct _cwmp1__TransferComplete *, const char*); +SOAP_FMAC3 struct _cwmp1__TransferComplete * SOAP_FMAC4 soap_get__cwmp1__TransferComplete(struct soap*, struct _cwmp1__TransferComplete *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__TransferComplete * SOAP_FMAC4 soap_in__cwmp1__TransferComplete(struct soap*, const char*, struct _cwmp1__TransferComplete *, const char*); + +#ifndef SOAP_TYPE__cwmp1__InformResponse +#define SOAP_TYPE__cwmp1__InformResponse (106) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__InformResponse(struct soap*, struct _cwmp1__InformResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__InformResponse(struct soap*, const struct _cwmp1__InformResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__InformResponse(struct soap*, const struct _cwmp1__InformResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__InformResponse(struct soap*, const char*, int, const struct _cwmp1__InformResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__InformResponse * SOAP_FMAC4 soap_get__cwmp1__InformResponse(struct soap*, struct _cwmp1__InformResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__InformResponse * SOAP_FMAC4 soap_in__cwmp1__InformResponse(struct soap*, const char*, struct _cwmp1__InformResponse *, const char*); + +#ifndef SOAP_TYPE_cwmp1EventList +#define SOAP_TYPE_cwmp1EventList (104) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1EventList(struct soap*, struct cwmp1EventList *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1EventList(struct soap*, struct cwmp1EventList const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1EventList(struct soap*, const struct cwmp1EventList *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1EventList(struct soap*, const char*, int, const struct cwmp1EventList *, const char*); +SOAP_FMAC3 struct cwmp1EventList * SOAP_FMAC4 soap_get_cwmp1EventList(struct soap*, struct cwmp1EventList *, const char*, const char*); +SOAP_FMAC3 struct cwmp1EventList * SOAP_FMAC4 soap_in_cwmp1EventList(struct soap*, const char*, struct cwmp1EventList *, const char*); + +#ifndef SOAP_TYPE__cwmp1__Inform +#define SOAP_TYPE__cwmp1__Inform (102) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__Inform(struct soap*, struct _cwmp1__Inform *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__Inform(struct soap*, const struct _cwmp1__Inform *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__Inform(struct soap*, const struct _cwmp1__Inform *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__Inform(struct soap*, const char*, int, const struct _cwmp1__Inform *, const char*); +SOAP_FMAC3 struct _cwmp1__Inform * SOAP_FMAC4 soap_get__cwmp1__Inform(struct soap*, struct _cwmp1__Inform *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__Inform * SOAP_FMAC4 soap_in__cwmp1__Inform(struct soap*, const char*, struct _cwmp1__Inform *, const char*); + +#ifndef SOAP_TYPE_cwmp1AllTransferList +#define SOAP_TYPE_cwmp1AllTransferList (100) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1AllTransferList(struct soap*, struct cwmp1AllTransferList *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1AllTransferList(struct soap*, struct cwmp1AllTransferList const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1AllTransferList(struct soap*, const struct cwmp1AllTransferList *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1AllTransferList(struct soap*, const char*, int, const struct cwmp1AllTransferList *, const char*); +SOAP_FMAC3 struct cwmp1AllTransferList * SOAP_FMAC4 soap_get_cwmp1AllTransferList(struct soap*, struct cwmp1AllTransferList *, const char*, const char*); +SOAP_FMAC3 struct cwmp1AllTransferList * SOAP_FMAC4 soap_in_cwmp1AllTransferList(struct soap*, const char*, struct cwmp1AllTransferList *, const char*); + +#ifndef SOAP_TYPE__cwmp1__GetAllQueuedTransfersResponse +#define SOAP_TYPE__cwmp1__GetAllQueuedTransfersResponse (99) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetAllQueuedTransfersResponse(struct soap*, struct _cwmp1__GetAllQueuedTransfersResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetAllQueuedTransfersResponse(struct soap*, const struct _cwmp1__GetAllQueuedTransfersResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetAllQueuedTransfersResponse(struct soap*, const struct _cwmp1__GetAllQueuedTransfersResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetAllQueuedTransfersResponse(struct soap*, const char*, int, const struct _cwmp1__GetAllQueuedTransfersResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__GetAllQueuedTransfersResponse * SOAP_FMAC4 soap_get__cwmp1__GetAllQueuedTransfersResponse(struct soap*, struct _cwmp1__GetAllQueuedTransfersResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__GetAllQueuedTransfersResponse * SOAP_FMAC4 soap_in__cwmp1__GetAllQueuedTransfersResponse(struct soap*, const char*, struct _cwmp1__GetAllQueuedTransfersResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__GetAllQueuedTransfers +#define SOAP_TYPE__cwmp1__GetAllQueuedTransfers (98) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetAllQueuedTransfers(struct soap*, struct _cwmp1__GetAllQueuedTransfers *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetAllQueuedTransfers(struct soap*, const struct _cwmp1__GetAllQueuedTransfers *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetAllQueuedTransfers(struct soap*, const struct _cwmp1__GetAllQueuedTransfers *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetAllQueuedTransfers(struct soap*, const char*, int, const struct _cwmp1__GetAllQueuedTransfers *, const char*); +SOAP_FMAC3 struct _cwmp1__GetAllQueuedTransfers * SOAP_FMAC4 soap_get__cwmp1__GetAllQueuedTransfers(struct soap*, struct _cwmp1__GetAllQueuedTransfers *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__GetAllQueuedTransfers * SOAP_FMAC4 soap_in__cwmp1__GetAllQueuedTransfers(struct soap*, const char*, struct _cwmp1__GetAllQueuedTransfers *, const char*); + +#ifndef SOAP_TYPE__cwmp1__FactoryResetResponse +#define SOAP_TYPE__cwmp1__FactoryResetResponse (97) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__FactoryResetResponse(struct soap*, struct _cwmp1__FactoryResetResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__FactoryResetResponse(struct soap*, const struct _cwmp1__FactoryResetResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__FactoryResetResponse(struct soap*, const struct _cwmp1__FactoryResetResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__FactoryResetResponse(struct soap*, const char*, int, const struct _cwmp1__FactoryResetResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__FactoryResetResponse * SOAP_FMAC4 soap_get__cwmp1__FactoryResetResponse(struct soap*, struct _cwmp1__FactoryResetResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__FactoryResetResponse * SOAP_FMAC4 soap_in__cwmp1__FactoryResetResponse(struct soap*, const char*, struct _cwmp1__FactoryResetResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__FactoryReset +#define SOAP_TYPE__cwmp1__FactoryReset (96) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__FactoryReset(struct soap*, struct _cwmp1__FactoryReset *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__FactoryReset(struct soap*, const struct _cwmp1__FactoryReset *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__FactoryReset(struct soap*, const struct _cwmp1__FactoryReset *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__FactoryReset(struct soap*, const char*, int, const struct _cwmp1__FactoryReset *, const char*); +SOAP_FMAC3 struct _cwmp1__FactoryReset * SOAP_FMAC4 soap_get__cwmp1__FactoryReset(struct soap*, struct _cwmp1__FactoryReset *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__FactoryReset * SOAP_FMAC4 soap_in__cwmp1__FactoryReset(struct soap*, const char*, struct _cwmp1__FactoryReset *, const char*); + +#ifndef SOAP_TYPE__cwmp1__UploadResponse +#define SOAP_TYPE__cwmp1__UploadResponse (94) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__UploadResponse(struct soap*, struct _cwmp1__UploadResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__UploadResponse(struct soap*, const struct _cwmp1__UploadResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__UploadResponse(struct soap*, const struct _cwmp1__UploadResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__UploadResponse(struct soap*, const char*, int, const struct _cwmp1__UploadResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__UploadResponse * SOAP_FMAC4 soap_get__cwmp1__UploadResponse(struct soap*, struct _cwmp1__UploadResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__UploadResponse * SOAP_FMAC4 soap_in__cwmp1__UploadResponse(struct soap*, const char*, struct _cwmp1__UploadResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__Upload +#define SOAP_TYPE__cwmp1__Upload (93) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__Upload(struct soap*, struct _cwmp1__Upload *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__Upload(struct soap*, const struct _cwmp1__Upload *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__Upload(struct soap*, const struct _cwmp1__Upload *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__Upload(struct soap*, const char*, int, const struct _cwmp1__Upload *, const char*); +SOAP_FMAC3 struct _cwmp1__Upload * SOAP_FMAC4 soap_get__cwmp1__Upload(struct soap*, struct _cwmp1__Upload *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__Upload * SOAP_FMAC4 soap_in__cwmp1__Upload(struct soap*, const char*, struct _cwmp1__Upload *, const char*); + +#ifndef SOAP_TYPE_cwmp1OptionList +#define SOAP_TYPE_cwmp1OptionList (91) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1OptionList(struct soap*, struct cwmp1OptionList *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1OptionList(struct soap*, struct cwmp1OptionList const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1OptionList(struct soap*, const struct cwmp1OptionList *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1OptionList(struct soap*, const char*, int, const struct cwmp1OptionList *, const char*); +SOAP_FMAC3 struct cwmp1OptionList * SOAP_FMAC4 soap_get_cwmp1OptionList(struct soap*, struct cwmp1OptionList *, const char*, const char*); +SOAP_FMAC3 struct cwmp1OptionList * SOAP_FMAC4 soap_in_cwmp1OptionList(struct soap*, const char*, struct cwmp1OptionList *, const char*); + +#ifndef SOAP_TYPE__cwmp1__GetOptionsResponse +#define SOAP_TYPE__cwmp1__GetOptionsResponse (90) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetOptionsResponse(struct soap*, struct _cwmp1__GetOptionsResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetOptionsResponse(struct soap*, const struct _cwmp1__GetOptionsResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetOptionsResponse(struct soap*, const struct _cwmp1__GetOptionsResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetOptionsResponse(struct soap*, const char*, int, const struct _cwmp1__GetOptionsResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__GetOptionsResponse * SOAP_FMAC4 soap_get__cwmp1__GetOptionsResponse(struct soap*, struct _cwmp1__GetOptionsResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__GetOptionsResponse * SOAP_FMAC4 soap_in__cwmp1__GetOptionsResponse(struct soap*, const char*, struct _cwmp1__GetOptionsResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__GetOptions +#define SOAP_TYPE__cwmp1__GetOptions (89) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetOptions(struct soap*, struct _cwmp1__GetOptions *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetOptions(struct soap*, const struct _cwmp1__GetOptions *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetOptions(struct soap*, const struct _cwmp1__GetOptions *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetOptions(struct soap*, const char*, int, const struct _cwmp1__GetOptions *, const char*); +SOAP_FMAC3 struct _cwmp1__GetOptions * SOAP_FMAC4 soap_get__cwmp1__GetOptions(struct soap*, struct _cwmp1__GetOptions *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__GetOptions * SOAP_FMAC4 soap_in__cwmp1__GetOptions(struct soap*, const char*, struct _cwmp1__GetOptions *, const char*); + +#ifndef SOAP_TYPE__cwmp1__SetVouchersResponse +#define SOAP_TYPE__cwmp1__SetVouchersResponse (88) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetVouchersResponse(struct soap*, struct _cwmp1__SetVouchersResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__SetVouchersResponse(struct soap*, const struct _cwmp1__SetVouchersResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetVouchersResponse(struct soap*, const struct _cwmp1__SetVouchersResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetVouchersResponse(struct soap*, const char*, int, const struct _cwmp1__SetVouchersResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__SetVouchersResponse * SOAP_FMAC4 soap_get__cwmp1__SetVouchersResponse(struct soap*, struct _cwmp1__SetVouchersResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__SetVouchersResponse * SOAP_FMAC4 soap_in__cwmp1__SetVouchersResponse(struct soap*, const char*, struct _cwmp1__SetVouchersResponse *, const char*); + +#ifndef SOAP_TYPE_cwmp1VoucherList +#define SOAP_TYPE_cwmp1VoucherList (86) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1VoucherList(struct soap*, struct cwmp1VoucherList *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1VoucherList(struct soap*, struct cwmp1VoucherList const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1VoucherList(struct soap*, const struct cwmp1VoucherList *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1VoucherList(struct soap*, const char*, int, const struct cwmp1VoucherList *, const char*); +SOAP_FMAC3 struct cwmp1VoucherList * SOAP_FMAC4 soap_get_cwmp1VoucherList(struct soap*, struct cwmp1VoucherList *, const char*, const char*); +SOAP_FMAC3 struct cwmp1VoucherList * SOAP_FMAC4 soap_in_cwmp1VoucherList(struct soap*, const char*, struct cwmp1VoucherList *, const char*); + +#ifndef SOAP_TYPE__cwmp1__SetVouchers +#define SOAP_TYPE__cwmp1__SetVouchers (85) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetVouchers(struct soap*, struct _cwmp1__SetVouchers *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__SetVouchers(struct soap*, const struct _cwmp1__SetVouchers *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetVouchers(struct soap*, const struct _cwmp1__SetVouchers *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetVouchers(struct soap*, const char*, int, const struct _cwmp1__SetVouchers *, const char*); +SOAP_FMAC3 struct _cwmp1__SetVouchers * SOAP_FMAC4 soap_get__cwmp1__SetVouchers(struct soap*, struct _cwmp1__SetVouchers *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__SetVouchers * SOAP_FMAC4 soap_in__cwmp1__SetVouchers(struct soap*, const char*, struct _cwmp1__SetVouchers *, const char*); + +#ifndef SOAP_TYPE__cwmp1__ScheduleInformResponse +#define SOAP_TYPE__cwmp1__ScheduleInformResponse (84) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__ScheduleInformResponse(struct soap*, struct _cwmp1__ScheduleInformResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__ScheduleInformResponse(struct soap*, const struct _cwmp1__ScheduleInformResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__ScheduleInformResponse(struct soap*, const struct _cwmp1__ScheduleInformResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__ScheduleInformResponse(struct soap*, const char*, int, const struct _cwmp1__ScheduleInformResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__ScheduleInformResponse * SOAP_FMAC4 soap_get__cwmp1__ScheduleInformResponse(struct soap*, struct _cwmp1__ScheduleInformResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__ScheduleInformResponse * SOAP_FMAC4 soap_in__cwmp1__ScheduleInformResponse(struct soap*, const char*, struct _cwmp1__ScheduleInformResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__ScheduleInform +#define SOAP_TYPE__cwmp1__ScheduleInform (83) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__ScheduleInform(struct soap*, struct _cwmp1__ScheduleInform *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__ScheduleInform(struct soap*, const struct _cwmp1__ScheduleInform *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__ScheduleInform(struct soap*, const struct _cwmp1__ScheduleInform *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__ScheduleInform(struct soap*, const char*, int, const struct _cwmp1__ScheduleInform *, const char*); +SOAP_FMAC3 struct _cwmp1__ScheduleInform * SOAP_FMAC4 soap_get__cwmp1__ScheduleInform(struct soap*, struct _cwmp1__ScheduleInform *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__ScheduleInform * SOAP_FMAC4 soap_in__cwmp1__ScheduleInform(struct soap*, const char*, struct _cwmp1__ScheduleInform *, const char*); + +#ifndef SOAP_TYPE_cwmp1TransferList +#define SOAP_TYPE_cwmp1TransferList (81) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1TransferList(struct soap*, struct cwmp1TransferList *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1TransferList(struct soap*, struct cwmp1TransferList const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1TransferList(struct soap*, const struct cwmp1TransferList *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1TransferList(struct soap*, const char*, int, const struct cwmp1TransferList *, const char*); +SOAP_FMAC3 struct cwmp1TransferList * SOAP_FMAC4 soap_get_cwmp1TransferList(struct soap*, struct cwmp1TransferList *, const char*, const char*); +SOAP_FMAC3 struct cwmp1TransferList * SOAP_FMAC4 soap_in_cwmp1TransferList(struct soap*, const char*, struct cwmp1TransferList *, const char*); + +#ifndef SOAP_TYPE__cwmp1__GetQueuedTransfersResponse +#define SOAP_TYPE__cwmp1__GetQueuedTransfersResponse (80) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetQueuedTransfersResponse(struct soap*, struct _cwmp1__GetQueuedTransfersResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetQueuedTransfersResponse(struct soap*, const struct _cwmp1__GetQueuedTransfersResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetQueuedTransfersResponse(struct soap*, const struct _cwmp1__GetQueuedTransfersResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetQueuedTransfersResponse(struct soap*, const char*, int, const struct _cwmp1__GetQueuedTransfersResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__GetQueuedTransfersResponse * SOAP_FMAC4 soap_get__cwmp1__GetQueuedTransfersResponse(struct soap*, struct _cwmp1__GetQueuedTransfersResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__GetQueuedTransfersResponse * SOAP_FMAC4 soap_in__cwmp1__GetQueuedTransfersResponse(struct soap*, const char*, struct _cwmp1__GetQueuedTransfersResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__GetQueuedTransfers +#define SOAP_TYPE__cwmp1__GetQueuedTransfers (79) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetQueuedTransfers(struct soap*, struct _cwmp1__GetQueuedTransfers *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetQueuedTransfers(struct soap*, const struct _cwmp1__GetQueuedTransfers *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetQueuedTransfers(struct soap*, const struct _cwmp1__GetQueuedTransfers *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetQueuedTransfers(struct soap*, const char*, int, const struct _cwmp1__GetQueuedTransfers *, const char*); +SOAP_FMAC3 struct _cwmp1__GetQueuedTransfers * SOAP_FMAC4 soap_get__cwmp1__GetQueuedTransfers(struct soap*, struct _cwmp1__GetQueuedTransfers *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__GetQueuedTransfers * SOAP_FMAC4 soap_in__cwmp1__GetQueuedTransfers(struct soap*, const char*, struct _cwmp1__GetQueuedTransfers *, const char*); + +#ifndef SOAP_TYPE__cwmp1__RebootResponse +#define SOAP_TYPE__cwmp1__RebootResponse (78) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__RebootResponse(struct soap*, struct _cwmp1__RebootResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__RebootResponse(struct soap*, const struct _cwmp1__RebootResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__RebootResponse(struct soap*, const struct _cwmp1__RebootResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__RebootResponse(struct soap*, const char*, int, const struct _cwmp1__RebootResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__RebootResponse * SOAP_FMAC4 soap_get__cwmp1__RebootResponse(struct soap*, struct _cwmp1__RebootResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__RebootResponse * SOAP_FMAC4 soap_in__cwmp1__RebootResponse(struct soap*, const char*, struct _cwmp1__RebootResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__Reboot +#define SOAP_TYPE__cwmp1__Reboot (77) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__Reboot(struct soap*, struct _cwmp1__Reboot *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__Reboot(struct soap*, const struct _cwmp1__Reboot *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__Reboot(struct soap*, const struct _cwmp1__Reboot *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__Reboot(struct soap*, const char*, int, const struct _cwmp1__Reboot *, const char*); +SOAP_FMAC3 struct _cwmp1__Reboot * SOAP_FMAC4 soap_get__cwmp1__Reboot(struct soap*, struct _cwmp1__Reboot *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__Reboot * SOAP_FMAC4 soap_in__cwmp1__Reboot(struct soap*, const char*, struct _cwmp1__Reboot *, const char*); + +#ifndef SOAP_TYPE__cwmp1__DownloadResponse +#define SOAP_TYPE__cwmp1__DownloadResponse (75) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__DownloadResponse(struct soap*, struct _cwmp1__DownloadResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__DownloadResponse(struct soap*, const struct _cwmp1__DownloadResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__DownloadResponse(struct soap*, const struct _cwmp1__DownloadResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__DownloadResponse(struct soap*, const char*, int, const struct _cwmp1__DownloadResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__DownloadResponse * SOAP_FMAC4 soap_get__cwmp1__DownloadResponse(struct soap*, struct _cwmp1__DownloadResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__DownloadResponse * SOAP_FMAC4 soap_in__cwmp1__DownloadResponse(struct soap*, const char*, struct _cwmp1__DownloadResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__Download +#define SOAP_TYPE__cwmp1__Download (74) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__Download(struct soap*, struct _cwmp1__Download *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__Download(struct soap*, const struct _cwmp1__Download *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__Download(struct soap*, const struct _cwmp1__Download *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__Download(struct soap*, const char*, int, const struct _cwmp1__Download *, const char*); +SOAP_FMAC3 struct _cwmp1__Download * SOAP_FMAC4 soap_get__cwmp1__Download(struct soap*, struct _cwmp1__Download *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__Download * SOAP_FMAC4 soap_in__cwmp1__Download(struct soap*, const char*, struct _cwmp1__Download *, const char*); + +#ifndef SOAP_TYPE__cwmp1__DeleteObjectResponse +#define SOAP_TYPE__cwmp1__DeleteObjectResponse (72) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__DeleteObjectResponse(struct soap*, struct _cwmp1__DeleteObjectResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__DeleteObjectResponse(struct soap*, const struct _cwmp1__DeleteObjectResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__DeleteObjectResponse(struct soap*, const struct _cwmp1__DeleteObjectResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__DeleteObjectResponse(struct soap*, const char*, int, const struct _cwmp1__DeleteObjectResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__DeleteObjectResponse * SOAP_FMAC4 soap_get__cwmp1__DeleteObjectResponse(struct soap*, struct _cwmp1__DeleteObjectResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__DeleteObjectResponse * SOAP_FMAC4 soap_in__cwmp1__DeleteObjectResponse(struct soap*, const char*, struct _cwmp1__DeleteObjectResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__DeleteObject +#define SOAP_TYPE__cwmp1__DeleteObject (71) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__DeleteObject(struct soap*, struct _cwmp1__DeleteObject *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__DeleteObject(struct soap*, const struct _cwmp1__DeleteObject *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__DeleteObject(struct soap*, const struct _cwmp1__DeleteObject *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__DeleteObject(struct soap*, const char*, int, const struct _cwmp1__DeleteObject *, const char*); +SOAP_FMAC3 struct _cwmp1__DeleteObject * SOAP_FMAC4 soap_get__cwmp1__DeleteObject(struct soap*, struct _cwmp1__DeleteObject *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__DeleteObject * SOAP_FMAC4 soap_in__cwmp1__DeleteObject(struct soap*, const char*, struct _cwmp1__DeleteObject *, const char*); + +#ifndef SOAP_TYPE__cwmp1__AddObjectResponse +#define SOAP_TYPE__cwmp1__AddObjectResponse (69) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__AddObjectResponse(struct soap*, struct _cwmp1__AddObjectResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__AddObjectResponse(struct soap*, const struct _cwmp1__AddObjectResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__AddObjectResponse(struct soap*, const struct _cwmp1__AddObjectResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__AddObjectResponse(struct soap*, const char*, int, const struct _cwmp1__AddObjectResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__AddObjectResponse * SOAP_FMAC4 soap_get__cwmp1__AddObjectResponse(struct soap*, struct _cwmp1__AddObjectResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__AddObjectResponse * SOAP_FMAC4 soap_in__cwmp1__AddObjectResponse(struct soap*, const char*, struct _cwmp1__AddObjectResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__AddObject +#define SOAP_TYPE__cwmp1__AddObject (68) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__AddObject(struct soap*, struct _cwmp1__AddObject *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__AddObject(struct soap*, const struct _cwmp1__AddObject *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__AddObject(struct soap*, const struct _cwmp1__AddObject *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__AddObject(struct soap*, const char*, int, const struct _cwmp1__AddObject *, const char*); +SOAP_FMAC3 struct _cwmp1__AddObject * SOAP_FMAC4 soap_get__cwmp1__AddObject(struct soap*, struct _cwmp1__AddObject *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__AddObject * SOAP_FMAC4 soap_in__cwmp1__AddObject(struct soap*, const char*, struct _cwmp1__AddObject *, const char*); + +#ifndef SOAP_TYPE_cwmp1ParameterAttributeList +#define SOAP_TYPE_cwmp1ParameterAttributeList (66) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1ParameterAttributeList(struct soap*, struct cwmp1ParameterAttributeList *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1ParameterAttributeList(struct soap*, struct cwmp1ParameterAttributeList const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1ParameterAttributeList(struct soap*, const struct cwmp1ParameterAttributeList *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1ParameterAttributeList(struct soap*, const char*, int, const struct cwmp1ParameterAttributeList *, const char*); +SOAP_FMAC3 struct cwmp1ParameterAttributeList * SOAP_FMAC4 soap_get_cwmp1ParameterAttributeList(struct soap*, struct cwmp1ParameterAttributeList *, const char*, const char*); +SOAP_FMAC3 struct cwmp1ParameterAttributeList * SOAP_FMAC4 soap_in_cwmp1ParameterAttributeList(struct soap*, const char*, struct cwmp1ParameterAttributeList *, const char*); + +#ifndef SOAP_TYPE__cwmp1__GetParameterAttributesResponse +#define SOAP_TYPE__cwmp1__GetParameterAttributesResponse (65) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetParameterAttributesResponse(struct soap*, struct _cwmp1__GetParameterAttributesResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetParameterAttributesResponse(struct soap*, const struct _cwmp1__GetParameterAttributesResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetParameterAttributesResponse(struct soap*, const struct _cwmp1__GetParameterAttributesResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetParameterAttributesResponse(struct soap*, const char*, int, const struct _cwmp1__GetParameterAttributesResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__GetParameterAttributesResponse * SOAP_FMAC4 soap_get__cwmp1__GetParameterAttributesResponse(struct soap*, struct _cwmp1__GetParameterAttributesResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__GetParameterAttributesResponse * SOAP_FMAC4 soap_in__cwmp1__GetParameterAttributesResponse(struct soap*, const char*, struct _cwmp1__GetParameterAttributesResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__GetParameterAttributes +#define SOAP_TYPE__cwmp1__GetParameterAttributes (64) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetParameterAttributes(struct soap*, struct _cwmp1__GetParameterAttributes *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetParameterAttributes(struct soap*, const struct _cwmp1__GetParameterAttributes *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetParameterAttributes(struct soap*, const struct _cwmp1__GetParameterAttributes *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetParameterAttributes(struct soap*, const char*, int, const struct _cwmp1__GetParameterAttributes *, const char*); +SOAP_FMAC3 struct _cwmp1__GetParameterAttributes * SOAP_FMAC4 soap_get__cwmp1__GetParameterAttributes(struct soap*, struct _cwmp1__GetParameterAttributes *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__GetParameterAttributes * SOAP_FMAC4 soap_in__cwmp1__GetParameterAttributes(struct soap*, const char*, struct _cwmp1__GetParameterAttributes *, const char*); + +#ifndef SOAP_TYPE__cwmp1__SetParameterAttributesResponse +#define SOAP_TYPE__cwmp1__SetParameterAttributesResponse (63) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetParameterAttributesResponse(struct soap*, struct _cwmp1__SetParameterAttributesResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__SetParameterAttributesResponse(struct soap*, const struct _cwmp1__SetParameterAttributesResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetParameterAttributesResponse(struct soap*, const struct _cwmp1__SetParameterAttributesResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetParameterAttributesResponse(struct soap*, const char*, int, const struct _cwmp1__SetParameterAttributesResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__SetParameterAttributesResponse * SOAP_FMAC4 soap_get__cwmp1__SetParameterAttributesResponse(struct soap*, struct _cwmp1__SetParameterAttributesResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__SetParameterAttributesResponse * SOAP_FMAC4 soap_in__cwmp1__SetParameterAttributesResponse(struct soap*, const char*, struct _cwmp1__SetParameterAttributesResponse *, const char*); + +#ifndef SOAP_TYPE_cwmp1SetParameterAttributesList +#define SOAP_TYPE_cwmp1SetParameterAttributesList (61) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1SetParameterAttributesList(struct soap*, struct cwmp1SetParameterAttributesList *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1SetParameterAttributesList(struct soap*, struct cwmp1SetParameterAttributesList const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1SetParameterAttributesList(struct soap*, const struct cwmp1SetParameterAttributesList *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1SetParameterAttributesList(struct soap*, const char*, int, const struct cwmp1SetParameterAttributesList *, const char*); +SOAP_FMAC3 struct cwmp1SetParameterAttributesList * SOAP_FMAC4 soap_get_cwmp1SetParameterAttributesList(struct soap*, struct cwmp1SetParameterAttributesList *, const char*, const char*); +SOAP_FMAC3 struct cwmp1SetParameterAttributesList * SOAP_FMAC4 soap_in_cwmp1SetParameterAttributesList(struct soap*, const char*, struct cwmp1SetParameterAttributesList *, const char*); + +#ifndef SOAP_TYPE__cwmp1__SetParameterAttributes +#define SOAP_TYPE__cwmp1__SetParameterAttributes (60) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetParameterAttributes(struct soap*, struct _cwmp1__SetParameterAttributes *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__SetParameterAttributes(struct soap*, const struct _cwmp1__SetParameterAttributes *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetParameterAttributes(struct soap*, const struct _cwmp1__SetParameterAttributes *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetParameterAttributes(struct soap*, const char*, int, const struct _cwmp1__SetParameterAttributes *, const char*); +SOAP_FMAC3 struct _cwmp1__SetParameterAttributes * SOAP_FMAC4 soap_get__cwmp1__SetParameterAttributes(struct soap*, struct _cwmp1__SetParameterAttributes *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__SetParameterAttributes * SOAP_FMAC4 soap_in__cwmp1__SetParameterAttributes(struct soap*, const char*, struct _cwmp1__SetParameterAttributes *, const char*); + +#ifndef SOAP_TYPE_cwmp1ParameterInfoList +#define SOAP_TYPE_cwmp1ParameterInfoList (58) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1ParameterInfoList(struct soap*, struct cwmp1ParameterInfoList *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1ParameterInfoList(struct soap*, struct cwmp1ParameterInfoList const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1ParameterInfoList(struct soap*, const struct cwmp1ParameterInfoList *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1ParameterInfoList(struct soap*, const char*, int, const struct cwmp1ParameterInfoList *, const char*); +SOAP_FMAC3 struct cwmp1ParameterInfoList * SOAP_FMAC4 soap_get_cwmp1ParameterInfoList(struct soap*, struct cwmp1ParameterInfoList *, const char*, const char*); +SOAP_FMAC3 struct cwmp1ParameterInfoList * SOAP_FMAC4 soap_in_cwmp1ParameterInfoList(struct soap*, const char*, struct cwmp1ParameterInfoList *, const char*); + +#ifndef SOAP_TYPE__cwmp1__GetParameterNamesResponse +#define SOAP_TYPE__cwmp1__GetParameterNamesResponse (57) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetParameterNamesResponse(struct soap*, struct _cwmp1__GetParameterNamesResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetParameterNamesResponse(struct soap*, const struct _cwmp1__GetParameterNamesResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetParameterNamesResponse(struct soap*, const struct _cwmp1__GetParameterNamesResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetParameterNamesResponse(struct soap*, const char*, int, const struct _cwmp1__GetParameterNamesResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__GetParameterNamesResponse * SOAP_FMAC4 soap_get__cwmp1__GetParameterNamesResponse(struct soap*, struct _cwmp1__GetParameterNamesResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__GetParameterNamesResponse * SOAP_FMAC4 soap_in__cwmp1__GetParameterNamesResponse(struct soap*, const char*, struct _cwmp1__GetParameterNamesResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__GetParameterNames +#define SOAP_TYPE__cwmp1__GetParameterNames (56) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetParameterNames(struct soap*, struct _cwmp1__GetParameterNames *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetParameterNames(struct soap*, const struct _cwmp1__GetParameterNames *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetParameterNames(struct soap*, const struct _cwmp1__GetParameterNames *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetParameterNames(struct soap*, const char*, int, const struct _cwmp1__GetParameterNames *, const char*); +SOAP_FMAC3 struct _cwmp1__GetParameterNames * SOAP_FMAC4 soap_get__cwmp1__GetParameterNames(struct soap*, struct _cwmp1__GetParameterNames *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__GetParameterNames * SOAP_FMAC4 soap_in__cwmp1__GetParameterNames(struct soap*, const char*, struct _cwmp1__GetParameterNames *, const char*); + +#ifndef SOAP_TYPE__cwmp1__GetParameterValuesResponse +#define SOAP_TYPE__cwmp1__GetParameterValuesResponse (55) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetParameterValuesResponse(struct soap*, struct _cwmp1__GetParameterValuesResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetParameterValuesResponse(struct soap*, const struct _cwmp1__GetParameterValuesResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetParameterValuesResponse(struct soap*, const struct _cwmp1__GetParameterValuesResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetParameterValuesResponse(struct soap*, const char*, int, const struct _cwmp1__GetParameterValuesResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__GetParameterValuesResponse * SOAP_FMAC4 soap_get__cwmp1__GetParameterValuesResponse(struct soap*, struct _cwmp1__GetParameterValuesResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__GetParameterValuesResponse * SOAP_FMAC4 soap_in__cwmp1__GetParameterValuesResponse(struct soap*, const char*, struct _cwmp1__GetParameterValuesResponse *, const char*); + +#ifndef SOAP_TYPE_cwmp1ParameterNames +#define SOAP_TYPE_cwmp1ParameterNames (53) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1ParameterNames(struct soap*, struct cwmp1ParameterNames *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1ParameterNames(struct soap*, struct cwmp1ParameterNames const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1ParameterNames(struct soap*, const struct cwmp1ParameterNames *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1ParameterNames(struct soap*, const char*, int, const struct cwmp1ParameterNames *, const char*); +SOAP_FMAC3 struct cwmp1ParameterNames * SOAP_FMAC4 soap_get_cwmp1ParameterNames(struct soap*, struct cwmp1ParameterNames *, const char*, const char*); +SOAP_FMAC3 struct cwmp1ParameterNames * SOAP_FMAC4 soap_in_cwmp1ParameterNames(struct soap*, const char*, struct cwmp1ParameterNames *, const char*); + +#ifndef SOAP_TYPE__cwmp1__GetParameterValues +#define SOAP_TYPE__cwmp1__GetParameterValues (52) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetParameterValues(struct soap*, struct _cwmp1__GetParameterValues *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetParameterValues(struct soap*, const struct _cwmp1__GetParameterValues *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetParameterValues(struct soap*, const struct _cwmp1__GetParameterValues *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetParameterValues(struct soap*, const char*, int, const struct _cwmp1__GetParameterValues *, const char*); +SOAP_FMAC3 struct _cwmp1__GetParameterValues * SOAP_FMAC4 soap_get__cwmp1__GetParameterValues(struct soap*, struct _cwmp1__GetParameterValues *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__GetParameterValues * SOAP_FMAC4 soap_in__cwmp1__GetParameterValues(struct soap*, const char*, struct _cwmp1__GetParameterValues *, const char*); + +#ifndef SOAP_TYPE__cwmp1__SetParameterValuesResponse +#define SOAP_TYPE__cwmp1__SetParameterValuesResponse (50) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetParameterValuesResponse(struct soap*, struct _cwmp1__SetParameterValuesResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__SetParameterValuesResponse(struct soap*, const struct _cwmp1__SetParameterValuesResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetParameterValuesResponse(struct soap*, const struct _cwmp1__SetParameterValuesResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetParameterValuesResponse(struct soap*, const char*, int, const struct _cwmp1__SetParameterValuesResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__SetParameterValuesResponse * SOAP_FMAC4 soap_get__cwmp1__SetParameterValuesResponse(struct soap*, struct _cwmp1__SetParameterValuesResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__SetParameterValuesResponse * SOAP_FMAC4 soap_in__cwmp1__SetParameterValuesResponse(struct soap*, const char*, struct _cwmp1__SetParameterValuesResponse *, const char*); + +#ifndef SOAP_TYPE_cwmp1ParameterValueList +#define SOAP_TYPE_cwmp1ParameterValueList (48) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1ParameterValueList(struct soap*, struct cwmp1ParameterValueList *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1ParameterValueList(struct soap*, struct cwmp1ParameterValueList const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1ParameterValueList(struct soap*, const struct cwmp1ParameterValueList *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1ParameterValueList(struct soap*, const char*, int, const struct cwmp1ParameterValueList *, const char*); +SOAP_FMAC3 struct cwmp1ParameterValueList * SOAP_FMAC4 soap_get_cwmp1ParameterValueList(struct soap*, struct cwmp1ParameterValueList *, const char*, const char*); +SOAP_FMAC3 struct cwmp1ParameterValueList * SOAP_FMAC4 soap_in_cwmp1ParameterValueList(struct soap*, const char*, struct cwmp1ParameterValueList *, const char*); + +#ifndef SOAP_TYPE__cwmp1__SetParameterValues +#define SOAP_TYPE__cwmp1__SetParameterValues (47) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetParameterValues(struct soap*, struct _cwmp1__SetParameterValues *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__SetParameterValues(struct soap*, const struct _cwmp1__SetParameterValues *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetParameterValues(struct soap*, const struct _cwmp1__SetParameterValues *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetParameterValues(struct soap*, const char*, int, const struct _cwmp1__SetParameterValues *, const char*); +SOAP_FMAC3 struct _cwmp1__SetParameterValues * SOAP_FMAC4 soap_get__cwmp1__SetParameterValues(struct soap*, struct _cwmp1__SetParameterValues *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__SetParameterValues * SOAP_FMAC4 soap_in__cwmp1__SetParameterValues(struct soap*, const char*, struct _cwmp1__SetParameterValues *, const char*); + +#ifndef SOAP_TYPE_cwmp1MethodList +#define SOAP_TYPE_cwmp1MethodList (45) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1MethodList(struct soap*, struct cwmp1MethodList *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1MethodList(struct soap*, struct cwmp1MethodList const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1MethodList(struct soap*, const struct cwmp1MethodList *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1MethodList(struct soap*, const char*, int, const struct cwmp1MethodList *, const char*); +SOAP_FMAC3 struct cwmp1MethodList * SOAP_FMAC4 soap_get_cwmp1MethodList(struct soap*, struct cwmp1MethodList *, const char*, const char*); +SOAP_FMAC3 struct cwmp1MethodList * SOAP_FMAC4 soap_in_cwmp1MethodList(struct soap*, const char*, struct cwmp1MethodList *, const char*); + +#ifndef SOAP_TYPE__cwmp1__GetRPCMethodsResponse +#define SOAP_TYPE__cwmp1__GetRPCMethodsResponse (44) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetRPCMethodsResponse(struct soap*, struct _cwmp1__GetRPCMethodsResponse *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetRPCMethodsResponse(struct soap*, const struct _cwmp1__GetRPCMethodsResponse *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetRPCMethodsResponse(struct soap*, const struct _cwmp1__GetRPCMethodsResponse *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetRPCMethodsResponse(struct soap*, const char*, int, const struct _cwmp1__GetRPCMethodsResponse *, const char*); +SOAP_FMAC3 struct _cwmp1__GetRPCMethodsResponse * SOAP_FMAC4 soap_get__cwmp1__GetRPCMethodsResponse(struct soap*, struct _cwmp1__GetRPCMethodsResponse *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__GetRPCMethodsResponse * SOAP_FMAC4 soap_in__cwmp1__GetRPCMethodsResponse(struct soap*, const char*, struct _cwmp1__GetRPCMethodsResponse *, const char*); + +#ifndef SOAP_TYPE__cwmp1__GetRPCMethods +#define SOAP_TYPE__cwmp1__GetRPCMethods (43) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetRPCMethods(struct soap*, struct _cwmp1__GetRPCMethods *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetRPCMethods(struct soap*, const struct _cwmp1__GetRPCMethods *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetRPCMethods(struct soap*, const struct _cwmp1__GetRPCMethods *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetRPCMethods(struct soap*, const char*, int, const struct _cwmp1__GetRPCMethods *, const char*); +SOAP_FMAC3 struct _cwmp1__GetRPCMethods * SOAP_FMAC4 soap_get__cwmp1__GetRPCMethods(struct soap*, struct _cwmp1__GetRPCMethods *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__GetRPCMethods * SOAP_FMAC4 soap_in__cwmp1__GetRPCMethods(struct soap*, const char*, struct _cwmp1__GetRPCMethods *, const char*); + +#ifndef SOAP_TYPE__cwmp1__Fault_SetParameterValuesFault +#define SOAP_TYPE__cwmp1__Fault_SetParameterValuesFault (41) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__Fault_SetParameterValuesFault(struct soap*, struct _cwmp1__Fault_SetParameterValuesFault *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__Fault_SetParameterValuesFault(struct soap*, const struct _cwmp1__Fault_SetParameterValuesFault *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__Fault_SetParameterValuesFault(struct soap*, const struct _cwmp1__Fault_SetParameterValuesFault *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__Fault_SetParameterValuesFault(struct soap*, const char*, int, const struct _cwmp1__Fault_SetParameterValuesFault *, const char*); +SOAP_FMAC3 struct _cwmp1__Fault_SetParameterValuesFault * SOAP_FMAC4 soap_get__cwmp1__Fault_SetParameterValuesFault(struct soap*, struct _cwmp1__Fault_SetParameterValuesFault *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__Fault_SetParameterValuesFault * SOAP_FMAC4 soap_in__cwmp1__Fault_SetParameterValuesFault(struct soap*, const char*, struct _cwmp1__Fault_SetParameterValuesFault *, const char*); + +#ifndef SOAP_TYPE__cwmp1__Fault +#define SOAP_TYPE__cwmp1__Fault (40) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__Fault(struct soap*, struct _cwmp1__Fault *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__Fault(struct soap*, const struct _cwmp1__Fault *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__Fault(struct soap*, const struct _cwmp1__Fault *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__Fault(struct soap*, const char*, int, const struct _cwmp1__Fault *, const char*); +SOAP_FMAC3 struct _cwmp1__Fault * SOAP_FMAC4 soap_get__cwmp1__Fault(struct soap*, struct _cwmp1__Fault *, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__Fault * SOAP_FMAC4 soap_in__cwmp1__Fault(struct soap*, const char*, struct _cwmp1__Fault *, const char*); + +#ifndef SOAP_TYPE_cwmp1__OptionStruct +#define SOAP_TYPE_cwmp1__OptionStruct (34) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__OptionStruct(struct soap*, struct cwmp1__OptionStruct *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__OptionStruct(struct soap*, const struct cwmp1__OptionStruct *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__OptionStruct(struct soap*, const struct cwmp1__OptionStruct *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__OptionStruct(struct soap*, const char*, int, const struct cwmp1__OptionStruct *, const char*); +SOAP_FMAC3 struct cwmp1__OptionStruct * SOAP_FMAC4 soap_get_cwmp1__OptionStruct(struct soap*, struct cwmp1__OptionStruct *, const char*, const char*); +SOAP_FMAC3 struct cwmp1__OptionStruct * SOAP_FMAC4 soap_in_cwmp1__OptionStruct(struct soap*, const char*, struct cwmp1__OptionStruct *, const char*); + +#ifndef SOAP_TYPE_cwmp1__ArgStruct +#define SOAP_TYPE_cwmp1__ArgStruct (33) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__ArgStruct(struct soap*, struct cwmp1__ArgStruct *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__ArgStruct(struct soap*, const struct cwmp1__ArgStruct *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__ArgStruct(struct soap*, const struct cwmp1__ArgStruct *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__ArgStruct(struct soap*, const char*, int, const struct cwmp1__ArgStruct *, const char*); +SOAP_FMAC3 struct cwmp1__ArgStruct * SOAP_FMAC4 soap_get_cwmp1__ArgStruct(struct soap*, struct cwmp1__ArgStruct *, const char*, const char*); +SOAP_FMAC3 struct cwmp1__ArgStruct * SOAP_FMAC4 soap_in_cwmp1__ArgStruct(struct soap*, const char*, struct cwmp1__ArgStruct *, const char*); + +#ifndef SOAP_TYPE_cwmp1__AllQueuedTransferStruct +#define SOAP_TYPE_cwmp1__AllQueuedTransferStruct (31) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__AllQueuedTransferStruct(struct soap*, struct cwmp1__AllQueuedTransferStruct *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__AllQueuedTransferStruct(struct soap*, const struct cwmp1__AllQueuedTransferStruct *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__AllQueuedTransferStruct(struct soap*, const struct cwmp1__AllQueuedTransferStruct *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__AllQueuedTransferStruct(struct soap*, const char*, int, const struct cwmp1__AllQueuedTransferStruct *, const char*); +SOAP_FMAC3 struct cwmp1__AllQueuedTransferStruct * SOAP_FMAC4 soap_get_cwmp1__AllQueuedTransferStruct(struct soap*, struct cwmp1__AllQueuedTransferStruct *, const char*, const char*); +SOAP_FMAC3 struct cwmp1__AllQueuedTransferStruct * SOAP_FMAC4 soap_in_cwmp1__AllQueuedTransferStruct(struct soap*, const char*, struct cwmp1__AllQueuedTransferStruct *, const char*); + +#ifndef SOAP_TYPE_cwmp1__QueuedTransferStruct +#define SOAP_TYPE_cwmp1__QueuedTransferStruct (29) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__QueuedTransferStruct(struct soap*, struct cwmp1__QueuedTransferStruct *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__QueuedTransferStruct(struct soap*, const struct cwmp1__QueuedTransferStruct *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__QueuedTransferStruct(struct soap*, const struct cwmp1__QueuedTransferStruct *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__QueuedTransferStruct(struct soap*, const char*, int, const struct cwmp1__QueuedTransferStruct *, const char*); +SOAP_FMAC3 struct cwmp1__QueuedTransferStruct * SOAP_FMAC4 soap_get_cwmp1__QueuedTransferStruct(struct soap*, struct cwmp1__QueuedTransferStruct *, const char*, const char*); +SOAP_FMAC3 struct cwmp1__QueuedTransferStruct * SOAP_FMAC4 soap_in_cwmp1__QueuedTransferStruct(struct soap*, const char*, struct cwmp1__QueuedTransferStruct *, const char*); + +#ifndef SOAP_TYPE_cwmp1__ParameterAttributeStruct +#define SOAP_TYPE_cwmp1__ParameterAttributeStruct (27) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__ParameterAttributeStruct(struct soap*, struct cwmp1__ParameterAttributeStruct *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__ParameterAttributeStruct(struct soap*, const struct cwmp1__ParameterAttributeStruct *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__ParameterAttributeStruct(struct soap*, const struct cwmp1__ParameterAttributeStruct *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__ParameterAttributeStruct(struct soap*, const char*, int, const struct cwmp1__ParameterAttributeStruct *, const char*); +SOAP_FMAC3 struct cwmp1__ParameterAttributeStruct * SOAP_FMAC4 soap_get_cwmp1__ParameterAttributeStruct(struct soap*, struct cwmp1__ParameterAttributeStruct *, const char*, const char*); +SOAP_FMAC3 struct cwmp1__ParameterAttributeStruct * SOAP_FMAC4 soap_in_cwmp1__ParameterAttributeStruct(struct soap*, const char*, struct cwmp1__ParameterAttributeStruct *, const char*); + +#ifndef SOAP_TYPE_cwmp1AccessList +#define SOAP_TYPE_cwmp1AccessList (25) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1AccessList(struct soap*, struct cwmp1AccessList *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1AccessList(struct soap*, struct cwmp1AccessList const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1AccessList(struct soap*, const struct cwmp1AccessList *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1AccessList(struct soap*, const char*, int, const struct cwmp1AccessList *, const char*); +SOAP_FMAC3 struct cwmp1AccessList * SOAP_FMAC4 soap_get_cwmp1AccessList(struct soap*, struct cwmp1AccessList *, const char*, const char*); +SOAP_FMAC3 struct cwmp1AccessList * SOAP_FMAC4 soap_in_cwmp1AccessList(struct soap*, const char*, struct cwmp1AccessList *, const char*); + +#ifndef SOAP_TYPE_cwmp1__SetParameterAttributesStruct +#define SOAP_TYPE_cwmp1__SetParameterAttributesStruct (22) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__SetParameterAttributesStruct(struct soap*, struct cwmp1__SetParameterAttributesStruct *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__SetParameterAttributesStruct(struct soap*, const struct cwmp1__SetParameterAttributesStruct *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__SetParameterAttributesStruct(struct soap*, const struct cwmp1__SetParameterAttributesStruct *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__SetParameterAttributesStruct(struct soap*, const char*, int, const struct cwmp1__SetParameterAttributesStruct *, const char*); +SOAP_FMAC3 struct cwmp1__SetParameterAttributesStruct * SOAP_FMAC4 soap_get_cwmp1__SetParameterAttributesStruct(struct soap*, struct cwmp1__SetParameterAttributesStruct *, const char*, const char*); +SOAP_FMAC3 struct cwmp1__SetParameterAttributesStruct * SOAP_FMAC4 soap_in_cwmp1__SetParameterAttributesStruct(struct soap*, const char*, struct cwmp1__SetParameterAttributesStruct *, const char*); + +#ifndef SOAP_TYPE_cwmp1__ParameterInfoStruct +#define SOAP_TYPE_cwmp1__ParameterInfoStruct (21) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__ParameterInfoStruct(struct soap*, struct cwmp1__ParameterInfoStruct *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__ParameterInfoStruct(struct soap*, const struct cwmp1__ParameterInfoStruct *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__ParameterInfoStruct(struct soap*, const struct cwmp1__ParameterInfoStruct *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__ParameterInfoStruct(struct soap*, const char*, int, const struct cwmp1__ParameterInfoStruct *, const char*); +SOAP_FMAC3 struct cwmp1__ParameterInfoStruct * SOAP_FMAC4 soap_get_cwmp1__ParameterInfoStruct(struct soap*, struct cwmp1__ParameterInfoStruct *, const char*, const char*); +SOAP_FMAC3 struct cwmp1__ParameterInfoStruct * SOAP_FMAC4 soap_in_cwmp1__ParameterInfoStruct(struct soap*, const char*, struct cwmp1__ParameterInfoStruct *, const char*); + +#ifndef SOAP_TYPE_cwmp1__ParameterValueStruct +#define SOAP_TYPE_cwmp1__ParameterValueStruct (20) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__ParameterValueStruct(struct soap*, struct cwmp1__ParameterValueStruct *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__ParameterValueStruct(struct soap*, const struct cwmp1__ParameterValueStruct *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__ParameterValueStruct(struct soap*, const struct cwmp1__ParameterValueStruct *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__ParameterValueStruct(struct soap*, const char*, int, const struct cwmp1__ParameterValueStruct *, const char*); +SOAP_FMAC3 struct cwmp1__ParameterValueStruct * SOAP_FMAC4 soap_get_cwmp1__ParameterValueStruct(struct soap*, struct cwmp1__ParameterValueStruct *, const char*, const char*); +SOAP_FMAC3 struct cwmp1__ParameterValueStruct * SOAP_FMAC4 soap_in_cwmp1__ParameterValueStruct(struct soap*, const char*, struct cwmp1__ParameterValueStruct *, const char*); + +#ifndef SOAP_TYPE_cwmp1__EventStruct +#define SOAP_TYPE_cwmp1__EventStruct (19) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__EventStruct(struct soap*, struct cwmp1__EventStruct *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__EventStruct(struct soap*, const struct cwmp1__EventStruct *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__EventStruct(struct soap*, const struct cwmp1__EventStruct *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__EventStruct(struct soap*, const char*, int, const struct cwmp1__EventStruct *, const char*); +SOAP_FMAC3 struct cwmp1__EventStruct * SOAP_FMAC4 soap_get_cwmp1__EventStruct(struct soap*, struct cwmp1__EventStruct *, const char*, const char*); +SOAP_FMAC3 struct cwmp1__EventStruct * SOAP_FMAC4 soap_in_cwmp1__EventStruct(struct soap*, const char*, struct cwmp1__EventStruct *, const char*); + +#ifndef SOAP_TYPE_cwmp1__DeviceIdStruct +#define SOAP_TYPE_cwmp1__DeviceIdStruct (18) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__DeviceIdStruct(struct soap*, struct cwmp1__DeviceIdStruct *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__DeviceIdStruct(struct soap*, const struct cwmp1__DeviceIdStruct *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__DeviceIdStruct(struct soap*, const struct cwmp1__DeviceIdStruct *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__DeviceIdStruct(struct soap*, const char*, int, const struct cwmp1__DeviceIdStruct *, const char*); +SOAP_FMAC3 struct cwmp1__DeviceIdStruct * SOAP_FMAC4 soap_get_cwmp1__DeviceIdStruct(struct soap*, struct cwmp1__DeviceIdStruct *, const char*, const char*); +SOAP_FMAC3 struct cwmp1__DeviceIdStruct * SOAP_FMAC4 soap_in_cwmp1__DeviceIdStruct(struct soap*, const char*, struct cwmp1__DeviceIdStruct *, const char*); + +#ifndef SOAP_TYPE_cwmp1__FaultStruct +#define SOAP_TYPE_cwmp1__FaultStruct (17) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__FaultStruct(struct soap*, struct cwmp1__FaultStruct *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__FaultStruct(struct soap*, const struct cwmp1__FaultStruct *); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__FaultStruct(struct soap*, const struct cwmp1__FaultStruct *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__FaultStruct(struct soap*, const char*, int, const struct cwmp1__FaultStruct *, const char*); +SOAP_FMAC3 struct cwmp1__FaultStruct * SOAP_FMAC4 soap_get_cwmp1__FaultStruct(struct soap*, struct cwmp1__FaultStruct *, const char*, const char*); +SOAP_FMAC3 struct cwmp1__FaultStruct * SOAP_FMAC4 soap_in_cwmp1__FaultStruct(struct soap*, const char*, struct cwmp1__FaultStruct *, const char*); + +#ifndef SOAP_TYPE_SOAP_ENC__base64 +#define SOAP_TYPE_SOAP_ENC__base64 (7) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENC__base64(struct soap*, struct SOAP_ENC__base64 *); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENC__base64(struct soap*, struct SOAP_ENC__base64 const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENC__base64(struct soap*, const struct SOAP_ENC__base64 *, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENC__base64(struct soap*, const char*, int, const struct SOAP_ENC__base64 *, const char*); +SOAP_FMAC3 struct SOAP_ENC__base64 * SOAP_FMAC4 soap_get_SOAP_ENC__base64(struct soap*, struct SOAP_ENC__base64 *, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENC__base64 * SOAP_FMAC4 soap_in_SOAP_ENC__base64(struct soap*, const char*, struct SOAP_ENC__base64 *, const char*); + +#ifndef WITH_NOGLOBAL + +#ifndef SOAP_TYPE_PointerToSOAP_ENV__Reason +#define SOAP_TYPE_PointerToSOAP_ENV__Reason (153) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Reason(struct soap*, const char *, int, struct SOAP_ENV__Reason *const*, const char *); +SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason **, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason **, const char*); + +#endif + +#ifndef WITH_NOGLOBAL + +#ifndef SOAP_TYPE_PointerToSOAP_ENV__Detail +#define SOAP_TYPE_PointerToSOAP_ENV__Detail (152) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Detail(struct soap*, const char *, int, struct SOAP_ENV__Detail *const*, const char *); +SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail **, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Detail(struct soap*, const char*, struct SOAP_ENV__Detail **, const char*); + +#endif + +#ifndef WITH_NOGLOBAL + +#ifndef SOAP_TYPE_PointerToSOAP_ENV__Code +#define SOAP_TYPE_PointerToSOAP_ENV__Code (146) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Code(struct soap*, const char *, int, struct SOAP_ENV__Code *const*, const char *); +SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code **, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(struct soap*, const char*, struct SOAP_ENV__Code **, const char*); + +#endif + +#ifndef SOAP_TYPE_PointerTounsignedInt +#define SOAP_TYPE_PointerTounsignedInt (140) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTounsignedInt(struct soap*, unsigned int *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTounsignedInt(struct soap*, unsigned int *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTounsignedInt(struct soap*, const char *, int, unsigned int *const*, const char *); +SOAP_FMAC3 unsigned int ** SOAP_FMAC4 soap_get_PointerTounsignedInt(struct soap*, unsigned int **, const char*, const char*); +SOAP_FMAC3 unsigned int ** SOAP_FMAC4 soap_in_PointerTounsignedInt(struct soap*, const char*, unsigned int **, const char*); + +#ifndef SOAP_TYPE_PointerToPointerTocwmp1__ArgStruct +#define SOAP_TYPE_PointerToPointerTocwmp1__ArgStruct (137) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__ArgStruct(struct soap*, struct cwmp1__ArgStruct **const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__ArgStruct(struct soap*, struct cwmp1__ArgStruct **const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__ArgStruct(struct soap*, const char *, int, struct cwmp1__ArgStruct **const*, const char *); +SOAP_FMAC3 struct cwmp1__ArgStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__ArgStruct(struct soap*, struct cwmp1__ArgStruct ***, const char*, const char*); +SOAP_FMAC3 struct cwmp1__ArgStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__ArgStruct(struct soap*, const char*, struct cwmp1__ArgStruct ***, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1__ArgStruct +#define SOAP_TYPE_PointerTocwmp1__ArgStruct (136) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__ArgStruct(struct soap*, struct cwmp1__ArgStruct *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__ArgStruct(struct soap*, struct cwmp1__ArgStruct *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__ArgStruct(struct soap*, const char *, int, struct cwmp1__ArgStruct *const*, const char *); +SOAP_FMAC3 struct cwmp1__ArgStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__ArgStruct(struct soap*, struct cwmp1__ArgStruct **, const char*, const char*); +SOAP_FMAC3 struct cwmp1__ArgStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__ArgStruct(struct soap*, const char*, struct cwmp1__ArgStruct **, const char*); + +#ifndef SOAP_TYPE_PointerToPointerTocwmp1__OptionStruct +#define SOAP_TYPE_PointerToPointerTocwmp1__OptionStruct (135) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__OptionStruct(struct soap*, struct cwmp1__OptionStruct **const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__OptionStruct(struct soap*, struct cwmp1__OptionStruct **const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__OptionStruct(struct soap*, const char *, int, struct cwmp1__OptionStruct **const*, const char *); +SOAP_FMAC3 struct cwmp1__OptionStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__OptionStruct(struct soap*, struct cwmp1__OptionStruct ***, const char*, const char*); +SOAP_FMAC3 struct cwmp1__OptionStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__OptionStruct(struct soap*, const char*, struct cwmp1__OptionStruct ***, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1__OptionStruct +#define SOAP_TYPE_PointerTocwmp1__OptionStruct (134) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__OptionStruct(struct soap*, struct cwmp1__OptionStruct *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__OptionStruct(struct soap*, struct cwmp1__OptionStruct *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__OptionStruct(struct soap*, const char *, int, struct cwmp1__OptionStruct *const*, const char *); +SOAP_FMAC3 struct cwmp1__OptionStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__OptionStruct(struct soap*, struct cwmp1__OptionStruct **, const char*, const char*); +SOAP_FMAC3 struct cwmp1__OptionStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__OptionStruct(struct soap*, const char*, struct cwmp1__OptionStruct **, const char*); + +#ifndef SOAP_TYPE_PointerToPointerToSOAP_ENC__base64 +#define SOAP_TYPE_PointerToPointerToSOAP_ENC__base64 (133) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerToSOAP_ENC__base64(struct soap*, struct SOAP_ENC__base64 **const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerToSOAP_ENC__base64(struct soap*, struct SOAP_ENC__base64 **const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerToSOAP_ENC__base64(struct soap*, const char *, int, struct SOAP_ENC__base64 **const*, const char *); +SOAP_FMAC3 struct SOAP_ENC__base64 *** SOAP_FMAC4 soap_get_PointerToPointerToSOAP_ENC__base64(struct soap*, struct SOAP_ENC__base64 ***, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENC__base64 *** SOAP_FMAC4 soap_in_PointerToPointerToSOAP_ENC__base64(struct soap*, const char*, struct SOAP_ENC__base64 ***, const char*); + +#ifndef SOAP_TYPE_PointerToSOAP_ENC__base64 +#define SOAP_TYPE_PointerToSOAP_ENC__base64 (132) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENC__base64(struct soap*, struct SOAP_ENC__base64 *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENC__base64(struct soap*, struct SOAP_ENC__base64 *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENC__base64(struct soap*, const char *, int, struct SOAP_ENC__base64 *const*, const char *); +SOAP_FMAC3 struct SOAP_ENC__base64 ** SOAP_FMAC4 soap_get_PointerToSOAP_ENC__base64(struct soap*, struct SOAP_ENC__base64 **, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENC__base64 ** SOAP_FMAC4 soap_in_PointerToSOAP_ENC__base64(struct soap*, const char*, struct SOAP_ENC__base64 **, const char*); + +#ifndef SOAP_TYPE_PointerToPointerTocwmp1__AllQueuedTransferStruct +#define SOAP_TYPE_PointerToPointerTocwmp1__AllQueuedTransferStruct (131) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__AllQueuedTransferStruct(struct soap*, struct cwmp1__AllQueuedTransferStruct **const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__AllQueuedTransferStruct(struct soap*, struct cwmp1__AllQueuedTransferStruct **const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__AllQueuedTransferStruct(struct soap*, const char *, int, struct cwmp1__AllQueuedTransferStruct **const*, const char *); +SOAP_FMAC3 struct cwmp1__AllQueuedTransferStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__AllQueuedTransferStruct(struct soap*, struct cwmp1__AllQueuedTransferStruct ***, const char*, const char*); +SOAP_FMAC3 struct cwmp1__AllQueuedTransferStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__AllQueuedTransferStruct(struct soap*, const char*, struct cwmp1__AllQueuedTransferStruct ***, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1__AllQueuedTransferStruct +#define SOAP_TYPE_PointerTocwmp1__AllQueuedTransferStruct (130) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__AllQueuedTransferStruct(struct soap*, struct cwmp1__AllQueuedTransferStruct *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__AllQueuedTransferStruct(struct soap*, struct cwmp1__AllQueuedTransferStruct *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__AllQueuedTransferStruct(struct soap*, const char *, int, struct cwmp1__AllQueuedTransferStruct *const*, const char *); +SOAP_FMAC3 struct cwmp1__AllQueuedTransferStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__AllQueuedTransferStruct(struct soap*, struct cwmp1__AllQueuedTransferStruct **, const char*, const char*); +SOAP_FMAC3 struct cwmp1__AllQueuedTransferStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__AllQueuedTransferStruct(struct soap*, const char*, struct cwmp1__AllQueuedTransferStruct **, const char*); + +#ifndef SOAP_TYPE_PointerToPointerTocwmp1__QueuedTransferStruct +#define SOAP_TYPE_PointerToPointerTocwmp1__QueuedTransferStruct (129) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__QueuedTransferStruct(struct soap*, struct cwmp1__QueuedTransferStruct **const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__QueuedTransferStruct(struct soap*, struct cwmp1__QueuedTransferStruct **const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__QueuedTransferStruct(struct soap*, const char *, int, struct cwmp1__QueuedTransferStruct **const*, const char *); +SOAP_FMAC3 struct cwmp1__QueuedTransferStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__QueuedTransferStruct(struct soap*, struct cwmp1__QueuedTransferStruct ***, const char*, const char*); +SOAP_FMAC3 struct cwmp1__QueuedTransferStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__QueuedTransferStruct(struct soap*, const char*, struct cwmp1__QueuedTransferStruct ***, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1__QueuedTransferStruct +#define SOAP_TYPE_PointerTocwmp1__QueuedTransferStruct (128) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__QueuedTransferStruct(struct soap*, struct cwmp1__QueuedTransferStruct *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__QueuedTransferStruct(struct soap*, struct cwmp1__QueuedTransferStruct *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__QueuedTransferStruct(struct soap*, const char *, int, struct cwmp1__QueuedTransferStruct *const*, const char *); +SOAP_FMAC3 struct cwmp1__QueuedTransferStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__QueuedTransferStruct(struct soap*, struct cwmp1__QueuedTransferStruct **, const char*, const char*); +SOAP_FMAC3 struct cwmp1__QueuedTransferStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__QueuedTransferStruct(struct soap*, const char*, struct cwmp1__QueuedTransferStruct **, const char*); + +#ifndef SOAP_TYPE_PointerToPointerTocwmp1__ParameterAttributeStruct +#define SOAP_TYPE_PointerToPointerTocwmp1__ParameterAttributeStruct (127) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__ParameterAttributeStruct(struct soap*, struct cwmp1__ParameterAttributeStruct **const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__ParameterAttributeStruct(struct soap*, struct cwmp1__ParameterAttributeStruct **const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__ParameterAttributeStruct(struct soap*, const char *, int, struct cwmp1__ParameterAttributeStruct **const*, const char *); +SOAP_FMAC3 struct cwmp1__ParameterAttributeStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__ParameterAttributeStruct(struct soap*, struct cwmp1__ParameterAttributeStruct ***, const char*, const char*); +SOAP_FMAC3 struct cwmp1__ParameterAttributeStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__ParameterAttributeStruct(struct soap*, const char*, struct cwmp1__ParameterAttributeStruct ***, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1__ParameterAttributeStruct +#define SOAP_TYPE_PointerTocwmp1__ParameterAttributeStruct (126) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__ParameterAttributeStruct(struct soap*, struct cwmp1__ParameterAttributeStruct *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__ParameterAttributeStruct(struct soap*, struct cwmp1__ParameterAttributeStruct *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__ParameterAttributeStruct(struct soap*, const char *, int, struct cwmp1__ParameterAttributeStruct *const*, const char *); +SOAP_FMAC3 struct cwmp1__ParameterAttributeStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__ParameterAttributeStruct(struct soap*, struct cwmp1__ParameterAttributeStruct **, const char*, const char*); +SOAP_FMAC3 struct cwmp1__ParameterAttributeStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__ParameterAttributeStruct(struct soap*, const char*, struct cwmp1__ParameterAttributeStruct **, const char*); + +#ifndef SOAP_TYPE_PointerToPointerTocwmp1__SetParameterAttributesStruct +#define SOAP_TYPE_PointerToPointerTocwmp1__SetParameterAttributesStruct (125) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__SetParameterAttributesStruct(struct soap*, struct cwmp1__SetParameterAttributesStruct **const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__SetParameterAttributesStruct(struct soap*, struct cwmp1__SetParameterAttributesStruct **const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__SetParameterAttributesStruct(struct soap*, const char *, int, struct cwmp1__SetParameterAttributesStruct **const*, const char *); +SOAP_FMAC3 struct cwmp1__SetParameterAttributesStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__SetParameterAttributesStruct(struct soap*, struct cwmp1__SetParameterAttributesStruct ***, const char*, const char*); +SOAP_FMAC3 struct cwmp1__SetParameterAttributesStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__SetParameterAttributesStruct(struct soap*, const char*, struct cwmp1__SetParameterAttributesStruct ***, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1__SetParameterAttributesStruct +#define SOAP_TYPE_PointerTocwmp1__SetParameterAttributesStruct (124) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__SetParameterAttributesStruct(struct soap*, struct cwmp1__SetParameterAttributesStruct *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__SetParameterAttributesStruct(struct soap*, struct cwmp1__SetParameterAttributesStruct *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__SetParameterAttributesStruct(struct soap*, const char *, int, struct cwmp1__SetParameterAttributesStruct *const*, const char *); +SOAP_FMAC3 struct cwmp1__SetParameterAttributesStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__SetParameterAttributesStruct(struct soap*, struct cwmp1__SetParameterAttributesStruct **, const char*, const char*); +SOAP_FMAC3 struct cwmp1__SetParameterAttributesStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__SetParameterAttributesStruct(struct soap*, const char*, struct cwmp1__SetParameterAttributesStruct **, const char*); + +#ifndef SOAP_TYPE_PointerToPointerTocwmp1__ParameterInfoStruct +#define SOAP_TYPE_PointerToPointerTocwmp1__ParameterInfoStruct (123) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__ParameterInfoStruct(struct soap*, struct cwmp1__ParameterInfoStruct **const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__ParameterInfoStruct(struct soap*, struct cwmp1__ParameterInfoStruct **const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__ParameterInfoStruct(struct soap*, const char *, int, struct cwmp1__ParameterInfoStruct **const*, const char *); +SOAP_FMAC3 struct cwmp1__ParameterInfoStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__ParameterInfoStruct(struct soap*, struct cwmp1__ParameterInfoStruct ***, const char*, const char*); +SOAP_FMAC3 struct cwmp1__ParameterInfoStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__ParameterInfoStruct(struct soap*, const char*, struct cwmp1__ParameterInfoStruct ***, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1__ParameterInfoStruct +#define SOAP_TYPE_PointerTocwmp1__ParameterInfoStruct (122) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__ParameterInfoStruct(struct soap*, struct cwmp1__ParameterInfoStruct *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__ParameterInfoStruct(struct soap*, struct cwmp1__ParameterInfoStruct *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__ParameterInfoStruct(struct soap*, const char *, int, struct cwmp1__ParameterInfoStruct *const*, const char *); +SOAP_FMAC3 struct cwmp1__ParameterInfoStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__ParameterInfoStruct(struct soap*, struct cwmp1__ParameterInfoStruct **, const char*, const char*); +SOAP_FMAC3 struct cwmp1__ParameterInfoStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__ParameterInfoStruct(struct soap*, const char*, struct cwmp1__ParameterInfoStruct **, const char*); + +#ifndef SOAP_TYPE_PointerToPointerTocwmp1__ParameterValueStruct +#define SOAP_TYPE_PointerToPointerTocwmp1__ParameterValueStruct (121) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__ParameterValueStruct(struct soap*, struct cwmp1__ParameterValueStruct **const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__ParameterValueStruct(struct soap*, struct cwmp1__ParameterValueStruct **const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__ParameterValueStruct(struct soap*, const char *, int, struct cwmp1__ParameterValueStruct **const*, const char *); +SOAP_FMAC3 struct cwmp1__ParameterValueStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__ParameterValueStruct(struct soap*, struct cwmp1__ParameterValueStruct ***, const char*, const char*); +SOAP_FMAC3 struct cwmp1__ParameterValueStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__ParameterValueStruct(struct soap*, const char*, struct cwmp1__ParameterValueStruct ***, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1__ParameterValueStruct +#define SOAP_TYPE_PointerTocwmp1__ParameterValueStruct (120) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__ParameterValueStruct(struct soap*, struct cwmp1__ParameterValueStruct *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__ParameterValueStruct(struct soap*, struct cwmp1__ParameterValueStruct *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__ParameterValueStruct(struct soap*, const char *, int, struct cwmp1__ParameterValueStruct *const*, const char *); +SOAP_FMAC3 struct cwmp1__ParameterValueStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__ParameterValueStruct(struct soap*, struct cwmp1__ParameterValueStruct **, const char*, const char*); +SOAP_FMAC3 struct cwmp1__ParameterValueStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__ParameterValueStruct(struct soap*, const char*, struct cwmp1__ParameterValueStruct **, const char*); + +#ifndef SOAP_TYPE_PointerToPointerTocwmp1__EventStruct +#define SOAP_TYPE_PointerToPointerTocwmp1__EventStruct (119) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__EventStruct(struct soap*, struct cwmp1__EventStruct **const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__EventStruct(struct soap*, struct cwmp1__EventStruct **const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__EventStruct(struct soap*, const char *, int, struct cwmp1__EventStruct **const*, const char *); +SOAP_FMAC3 struct cwmp1__EventStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__EventStruct(struct soap*, struct cwmp1__EventStruct ***, const char*, const char*); +SOAP_FMAC3 struct cwmp1__EventStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__EventStruct(struct soap*, const char*, struct cwmp1__EventStruct ***, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1__EventStruct +#define SOAP_TYPE_PointerTocwmp1__EventStruct (118) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__EventStruct(struct soap*, struct cwmp1__EventStruct *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__EventStruct(struct soap*, struct cwmp1__EventStruct *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__EventStruct(struct soap*, const char *, int, struct cwmp1__EventStruct *const*, const char *); +SOAP_FMAC3 struct cwmp1__EventStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__EventStruct(struct soap*, struct cwmp1__EventStruct **, const char*, const char*); +SOAP_FMAC3 struct cwmp1__EventStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__EventStruct(struct soap*, const char*, struct cwmp1__EventStruct **, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1FileTypeArg +#define SOAP_TYPE_PointerTocwmp1FileTypeArg (116) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1FileTypeArg(struct soap*, struct cwmp1FileTypeArg *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1FileTypeArg(struct soap*, struct cwmp1FileTypeArg *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1FileTypeArg(struct soap*, const char *, int, struct cwmp1FileTypeArg *const*, const char *); +SOAP_FMAC3 struct cwmp1FileTypeArg ** SOAP_FMAC4 soap_get_PointerTocwmp1FileTypeArg(struct soap*, struct cwmp1FileTypeArg **, const char*, const char*); +SOAP_FMAC3 struct cwmp1FileTypeArg ** SOAP_FMAC4 soap_in_PointerTocwmp1FileTypeArg(struct soap*, const char*, struct cwmp1FileTypeArg **, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1__FaultStruct +#define SOAP_TYPE_PointerTocwmp1__FaultStruct (108) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__FaultStruct(struct soap*, struct cwmp1__FaultStruct *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__FaultStruct(struct soap*, struct cwmp1__FaultStruct *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__FaultStruct(struct soap*, const char *, int, struct cwmp1__FaultStruct *const*, const char *); +SOAP_FMAC3 struct cwmp1__FaultStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__FaultStruct(struct soap*, struct cwmp1__FaultStruct **, const char*, const char*); +SOAP_FMAC3 struct cwmp1__FaultStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__FaultStruct(struct soap*, const char*, struct cwmp1__FaultStruct **, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1EventList +#define SOAP_TYPE_PointerTocwmp1EventList (105) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1EventList(struct soap*, struct cwmp1EventList *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1EventList(struct soap*, struct cwmp1EventList *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1EventList(struct soap*, const char *, int, struct cwmp1EventList *const*, const char *); +SOAP_FMAC3 struct cwmp1EventList ** SOAP_FMAC4 soap_get_PointerTocwmp1EventList(struct soap*, struct cwmp1EventList **, const char*, const char*); +SOAP_FMAC3 struct cwmp1EventList ** SOAP_FMAC4 soap_in_PointerTocwmp1EventList(struct soap*, const char*, struct cwmp1EventList **, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1__DeviceIdStruct +#define SOAP_TYPE_PointerTocwmp1__DeviceIdStruct (103) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__DeviceIdStruct(struct soap*, struct cwmp1__DeviceIdStruct *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__DeviceIdStruct(struct soap*, struct cwmp1__DeviceIdStruct *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__DeviceIdStruct(struct soap*, const char *, int, struct cwmp1__DeviceIdStruct *const*, const char *); +SOAP_FMAC3 struct cwmp1__DeviceIdStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__DeviceIdStruct(struct soap*, struct cwmp1__DeviceIdStruct **, const char*, const char*); +SOAP_FMAC3 struct cwmp1__DeviceIdStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__DeviceIdStruct(struct soap*, const char*, struct cwmp1__DeviceIdStruct **, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1AllTransferList +#define SOAP_TYPE_PointerTocwmp1AllTransferList (101) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1AllTransferList(struct soap*, struct cwmp1AllTransferList *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1AllTransferList(struct soap*, struct cwmp1AllTransferList *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1AllTransferList(struct soap*, const char *, int, struct cwmp1AllTransferList *const*, const char *); +SOAP_FMAC3 struct cwmp1AllTransferList ** SOAP_FMAC4 soap_get_PointerTocwmp1AllTransferList(struct soap*, struct cwmp1AllTransferList **, const char*, const char*); +SOAP_FMAC3 struct cwmp1AllTransferList ** SOAP_FMAC4 soap_in_PointerTocwmp1AllTransferList(struct soap*, const char*, struct cwmp1AllTransferList **, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1OptionList +#define SOAP_TYPE_PointerTocwmp1OptionList (92) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1OptionList(struct soap*, struct cwmp1OptionList *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1OptionList(struct soap*, struct cwmp1OptionList *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1OptionList(struct soap*, const char *, int, struct cwmp1OptionList *const*, const char *); +SOAP_FMAC3 struct cwmp1OptionList ** SOAP_FMAC4 soap_get_PointerTocwmp1OptionList(struct soap*, struct cwmp1OptionList **, const char*, const char*); +SOAP_FMAC3 struct cwmp1OptionList ** SOAP_FMAC4 soap_in_PointerTocwmp1OptionList(struct soap*, const char*, struct cwmp1OptionList **, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1VoucherList +#define SOAP_TYPE_PointerTocwmp1VoucherList (87) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1VoucherList(struct soap*, struct cwmp1VoucherList *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1VoucherList(struct soap*, struct cwmp1VoucherList *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1VoucherList(struct soap*, const char *, int, struct cwmp1VoucherList *const*, const char *); +SOAP_FMAC3 struct cwmp1VoucherList ** SOAP_FMAC4 soap_get_PointerTocwmp1VoucherList(struct soap*, struct cwmp1VoucherList **, const char*, const char*); +SOAP_FMAC3 struct cwmp1VoucherList ** SOAP_FMAC4 soap_in_PointerTocwmp1VoucherList(struct soap*, const char*, struct cwmp1VoucherList **, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1TransferList +#define SOAP_TYPE_PointerTocwmp1TransferList (82) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1TransferList(struct soap*, struct cwmp1TransferList *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1TransferList(struct soap*, struct cwmp1TransferList *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1TransferList(struct soap*, const char *, int, struct cwmp1TransferList *const*, const char *); +SOAP_FMAC3 struct cwmp1TransferList ** SOAP_FMAC4 soap_get_PointerTocwmp1TransferList(struct soap*, struct cwmp1TransferList **, const char*, const char*); +SOAP_FMAC3 struct cwmp1TransferList ** SOAP_FMAC4 soap_in_PointerTocwmp1TransferList(struct soap*, const char*, struct cwmp1TransferList **, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1ParameterAttributeList +#define SOAP_TYPE_PointerTocwmp1ParameterAttributeList (67) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1ParameterAttributeList(struct soap*, struct cwmp1ParameterAttributeList *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1ParameterAttributeList(struct soap*, struct cwmp1ParameterAttributeList *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1ParameterAttributeList(struct soap*, const char *, int, struct cwmp1ParameterAttributeList *const*, const char *); +SOAP_FMAC3 struct cwmp1ParameterAttributeList ** SOAP_FMAC4 soap_get_PointerTocwmp1ParameterAttributeList(struct soap*, struct cwmp1ParameterAttributeList **, const char*, const char*); +SOAP_FMAC3 struct cwmp1ParameterAttributeList ** SOAP_FMAC4 soap_in_PointerTocwmp1ParameterAttributeList(struct soap*, const char*, struct cwmp1ParameterAttributeList **, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1SetParameterAttributesList +#define SOAP_TYPE_PointerTocwmp1SetParameterAttributesList (62) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1SetParameterAttributesList(struct soap*, struct cwmp1SetParameterAttributesList *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1SetParameterAttributesList(struct soap*, struct cwmp1SetParameterAttributesList *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1SetParameterAttributesList(struct soap*, const char *, int, struct cwmp1SetParameterAttributesList *const*, const char *); +SOAP_FMAC3 struct cwmp1SetParameterAttributesList ** SOAP_FMAC4 soap_get_PointerTocwmp1SetParameterAttributesList(struct soap*, struct cwmp1SetParameterAttributesList **, const char*, const char*); +SOAP_FMAC3 struct cwmp1SetParameterAttributesList ** SOAP_FMAC4 soap_in_PointerTocwmp1SetParameterAttributesList(struct soap*, const char*, struct cwmp1SetParameterAttributesList **, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1ParameterInfoList +#define SOAP_TYPE_PointerTocwmp1ParameterInfoList (59) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1ParameterInfoList(struct soap*, struct cwmp1ParameterInfoList *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1ParameterInfoList(struct soap*, struct cwmp1ParameterInfoList *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1ParameterInfoList(struct soap*, const char *, int, struct cwmp1ParameterInfoList *const*, const char *); +SOAP_FMAC3 struct cwmp1ParameterInfoList ** SOAP_FMAC4 soap_get_PointerTocwmp1ParameterInfoList(struct soap*, struct cwmp1ParameterInfoList **, const char*, const char*); +SOAP_FMAC3 struct cwmp1ParameterInfoList ** SOAP_FMAC4 soap_in_PointerTocwmp1ParameterInfoList(struct soap*, const char*, struct cwmp1ParameterInfoList **, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1ParameterNames +#define SOAP_TYPE_PointerTocwmp1ParameterNames (54) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1ParameterNames(struct soap*, struct cwmp1ParameterNames *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1ParameterNames(struct soap*, struct cwmp1ParameterNames *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1ParameterNames(struct soap*, const char *, int, struct cwmp1ParameterNames *const*, const char *); +SOAP_FMAC3 struct cwmp1ParameterNames ** SOAP_FMAC4 soap_get_PointerTocwmp1ParameterNames(struct soap*, struct cwmp1ParameterNames **, const char*, const char*); +SOAP_FMAC3 struct cwmp1ParameterNames ** SOAP_FMAC4 soap_in_PointerTocwmp1ParameterNames(struct soap*, const char*, struct cwmp1ParameterNames **, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1ParameterValueList +#define SOAP_TYPE_PointerTocwmp1ParameterValueList (49) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1ParameterValueList(struct soap*, struct cwmp1ParameterValueList *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1ParameterValueList(struct soap*, struct cwmp1ParameterValueList *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1ParameterValueList(struct soap*, const char *, int, struct cwmp1ParameterValueList *const*, const char *); +SOAP_FMAC3 struct cwmp1ParameterValueList ** SOAP_FMAC4 soap_get_PointerTocwmp1ParameterValueList(struct soap*, struct cwmp1ParameterValueList **, const char*, const char*); +SOAP_FMAC3 struct cwmp1ParameterValueList ** SOAP_FMAC4 soap_in_PointerTocwmp1ParameterValueList(struct soap*, const char*, struct cwmp1ParameterValueList **, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1MethodList +#define SOAP_TYPE_PointerTocwmp1MethodList (46) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1MethodList(struct soap*, struct cwmp1MethodList *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1MethodList(struct soap*, struct cwmp1MethodList *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1MethodList(struct soap*, const char *, int, struct cwmp1MethodList *const*, const char *); +SOAP_FMAC3 struct cwmp1MethodList ** SOAP_FMAC4 soap_get_PointerTocwmp1MethodList(struct soap*, struct cwmp1MethodList **, const char*, const char*); +SOAP_FMAC3 struct cwmp1MethodList ** SOAP_FMAC4 soap_in_PointerTocwmp1MethodList(struct soap*, const char*, struct cwmp1MethodList **, const char*); + +#ifndef SOAP_TYPE_PointerTo_cwmp1__Fault_SetParameterValuesFault +#define SOAP_TYPE_PointerTo_cwmp1__Fault_SetParameterValuesFault (42) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTo_cwmp1__Fault_SetParameterValuesFault(struct soap*, struct _cwmp1__Fault_SetParameterValuesFault *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTo_cwmp1__Fault_SetParameterValuesFault(struct soap*, struct _cwmp1__Fault_SetParameterValuesFault *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTo_cwmp1__Fault_SetParameterValuesFault(struct soap*, const char *, int, struct _cwmp1__Fault_SetParameterValuesFault *const*, const char *); +SOAP_FMAC3 struct _cwmp1__Fault_SetParameterValuesFault ** SOAP_FMAC4 soap_get_PointerTo_cwmp1__Fault_SetParameterValuesFault(struct soap*, struct _cwmp1__Fault_SetParameterValuesFault **, const char*, const char*); +SOAP_FMAC3 struct _cwmp1__Fault_SetParameterValuesFault ** SOAP_FMAC4 soap_in_PointerTo_cwmp1__Fault_SetParameterValuesFault(struct soap*, const char*, struct _cwmp1__Fault_SetParameterValuesFault **, const char*); + +#ifndef SOAP_TYPE_PointerTotime +#define SOAP_TYPE_PointerTotime (38) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTotime(struct soap*, time_t *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTotime(struct soap*, time_t *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTotime(struct soap*, const char *, int, time_t *const*, const char *); +SOAP_FMAC3 time_t ** SOAP_FMAC4 soap_get_PointerTotime(struct soap*, time_t **, const char*, const char*); +SOAP_FMAC3 time_t ** SOAP_FMAC4 soap_in_PointerTotime(struct soap*, const char*, time_t **, const char*); + +#ifndef SOAP_TYPE_PointerTocwmp1AccessList +#define SOAP_TYPE_PointerTocwmp1AccessList (26) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1AccessList(struct soap*, struct cwmp1AccessList *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1AccessList(struct soap*, struct cwmp1AccessList *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1AccessList(struct soap*, const char *, int, struct cwmp1AccessList *const*, const char *); +SOAP_FMAC3 struct cwmp1AccessList ** SOAP_FMAC4 soap_get_PointerTocwmp1AccessList(struct soap*, struct cwmp1AccessList **, const char*, const char*); +SOAP_FMAC3 struct cwmp1AccessList ** SOAP_FMAC4 soap_in_PointerTocwmp1AccessList(struct soap*, const char*, struct cwmp1AccessList **, const char*); + +#ifndef SOAP_TYPE_PointerTostring +#define SOAP_TYPE_PointerTostring (23) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTostring(struct soap*, char **const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTostring(struct soap*, char **const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTostring(struct soap*, const char *, int, char **const*, const char *); +SOAP_FMAC3 char *** SOAP_FMAC4 soap_get_PointerTostring(struct soap*, char ***, const char*, const char*); +SOAP_FMAC3 char *** SOAP_FMAC4 soap_in_PointerTostring(struct soap*, const char*, char ***, const char*); + +#ifndef SOAP_TYPE_cwmp1__ObjectNameType +#define SOAP_TYPE_cwmp1__ObjectNameType (16) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__ObjectNameType(struct soap*, char **); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__ObjectNameType(struct soap*, char *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__ObjectNameType(struct soap*, char *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__ObjectNameType(struct soap*, const char*, int, char*const*, const char*); +SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_cwmp1__ObjectNameType(struct soap*, char **, const char*, const char*); +SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_cwmp1__ObjectNameType(struct soap*, const char*, char **, const char*); + +#ifndef SOAP_TYPE_cwmp1__CommandKeyType +#define SOAP_TYPE_cwmp1__CommandKeyType (15) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__CommandKeyType(struct soap*, char **); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__CommandKeyType(struct soap*, char *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__CommandKeyType(struct soap*, char *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__CommandKeyType(struct soap*, const char*, int, char*const*, const char*); +SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_cwmp1__CommandKeyType(struct soap*, char **, const char*, const char*); +SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_cwmp1__CommandKeyType(struct soap*, const char*, char **, const char*); + +#ifndef SOAP_TYPE_cwmp1__ParameterKeyType +#define SOAP_TYPE_cwmp1__ParameterKeyType (14) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__ParameterKeyType(struct soap*, char **); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__ParameterKeyType(struct soap*, char *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__ParameterKeyType(struct soap*, char *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__ParameterKeyType(struct soap*, const char*, int, char*const*, const char*); +SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_cwmp1__ParameterKeyType(struct soap*, char **, const char*, const char*); +SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_cwmp1__ParameterKeyType(struct soap*, const char*, char **, const char*); + +#ifndef SOAP_TYPE_cwmp1__FaultCodeType +#define SOAP_TYPE_cwmp1__FaultCodeType (13) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__FaultCodeType(struct soap*, char **); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__FaultCodeType(struct soap*, char *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__FaultCodeType(struct soap*, char *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__FaultCodeType(struct soap*, const char*, int, char*const*, const char*); +SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_cwmp1__FaultCodeType(struct soap*, char **, const char*, const char*); +SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_cwmp1__FaultCodeType(struct soap*, const char*, char **, const char*); + +#ifndef SOAP_TYPE_xsd__anySimpleType +#define SOAP_TYPE_xsd__anySimpleType (11) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__anySimpleType(struct soap*, char **); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_xsd__anySimpleType(struct soap*, char *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__anySimpleType(struct soap*, char *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__anySimpleType(struct soap*, const char*, int, char*const*, const char*); +SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_xsd__anySimpleType(struct soap*, char **, const char*, const char*); +SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_xsd__anySimpleType(struct soap*, const char*, char **, const char*); + +#ifndef SOAP_TYPE_PointerTounsignedByte +#define SOAP_TYPE_PointerTounsignedByte (10) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTounsignedByte(struct soap*, unsigned char *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTounsignedByte(struct soap*, unsigned char *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTounsignedByte(struct soap*, const char *, int, unsigned char *const*, const char *); +SOAP_FMAC3 unsigned char ** SOAP_FMAC4 soap_get_PointerTounsignedByte(struct soap*, unsigned char **, const char*, const char*); +SOAP_FMAC3 unsigned char ** SOAP_FMAC4 soap_in_PointerTounsignedByte(struct soap*, const char*, unsigned char **, const char*); + +#ifndef SOAP_TYPE__QName +#define SOAP_TYPE__QName (5) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default__QName(struct soap*, char **); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__QName(struct soap*, char *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__QName(struct soap*, char *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__QName(struct soap*, const char*, int, char*const*, const char*); +SOAP_FMAC3 char ** SOAP_FMAC4 soap_get__QName(struct soap*, char **, const char*, const char*); +SOAP_FMAC3 char * * SOAP_FMAC4 soap_in__QName(struct soap*, const char*, char **, const char*); + +#ifndef SOAP_TYPE_string +#define SOAP_TYPE_string (4) +#endif +SOAP_FMAC3 void SOAP_FMAC4 soap_default_string(struct soap*, char **); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_string(struct soap*, char *const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_string(struct soap*, char *const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_string(struct soap*, const char*, int, char*const*, const char*); +SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_string(struct soap*, char **, const char*, const char*); +SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_string(struct soap*, const char*, char **, const char*); + +#ifdef __cplusplus +} +#endif + +#endif + +/* End of soapH.h */ diff --git a/src/inc/soapStub.h b/src/inc/soapStub.h new file mode 100644 index 0000000..34fdf10 --- /dev/null +++ b/src/inc/soapStub.h @@ -0,0 +1,1060 @@ +/* soapStub.h + Generated by gSOAP 2.7.12 from cwmp-1-1.h + Copyright(C) 2000-2008, Robert van Engelen, Genivia Inc. All Rights Reserved. + This part of the software is released under one of the following licenses: + GPL, the gSOAP public license, or Genivia's license for commercial use. +*/ + +#ifndef soapStub_H +#define soapStub_H +#include "stdsoap2.h" +#ifdef __cplusplus +extern "C" { +#endif + +/******************************************************************************\ + * * + * Enumerations * + * * +\******************************************************************************/ + + +#ifndef SOAP_TYPE_xsd__boolean +#define SOAP_TYPE_xsd__boolean (12) +/* xsd:boolean */ +enum xsd__boolean {xsd__boolean__false_ = 0, xsd__boolean__true_ = 1}; +#endif + +#ifndef SOAP_TYPE__cwmp1__SetParameterAttributesStruct_Notification +#define SOAP_TYPE__cwmp1__SetParameterAttributesStruct_Notification (24) +/* cwmp1:SetParameterAttributesStruct-Notification */ +enum _cwmp1__SetParameterAttributesStruct_Notification {_cwmp1__SetParameterAttributesStruct_Notification__0 = 0, _cwmp1__SetParameterAttributesStruct_Notification__1 = 1, _cwmp1__SetParameterAttributesStruct_Notification__2 = 2}; +#endif + +#ifndef SOAP_TYPE__cwmp1__ParameterAttributeStruct_Notification +#define SOAP_TYPE__cwmp1__ParameterAttributeStruct_Notification (28) +/* cwmp1:ParameterAttributeStruct-Notification */ +enum _cwmp1__ParameterAttributeStruct_Notification {_cwmp1__ParameterAttributeStruct_Notification__0 = 0, _cwmp1__ParameterAttributeStruct_Notification__1 = 1, _cwmp1__ParameterAttributeStruct_Notification__2 = 2}; +#endif + +#ifndef SOAP_TYPE__cwmp1__QueuedTransferStruct_State +#define SOAP_TYPE__cwmp1__QueuedTransferStruct_State (30) +/* cwmp1:QueuedTransferStruct-State */ +enum _cwmp1__QueuedTransferStruct_State {_cwmp1__QueuedTransferStruct_State__1 = 1, _cwmp1__QueuedTransferStruct_State__2 = 2, _cwmp1__QueuedTransferStruct_State__3 = 3}; +#endif + +#ifndef SOAP_TYPE__cwmp1__AllQueuedTransferStruct_State +#define SOAP_TYPE__cwmp1__AllQueuedTransferStruct_State (32) +/* cwmp1:AllQueuedTransferStruct-State */ +enum _cwmp1__AllQueuedTransferStruct_State {_cwmp1__AllQueuedTransferStruct_State__1 = 1, _cwmp1__AllQueuedTransferStruct_State__2 = 2, _cwmp1__AllQueuedTransferStruct_State__3 = 3}; +#endif + +#ifndef SOAP_TYPE__cwmp1__OptionStruct_State +#define SOAP_TYPE__cwmp1__OptionStruct_State (35) +/* cwmp1:OptionStruct-State */ +enum _cwmp1__OptionStruct_State {_cwmp1__OptionStruct_State__0 = 0, _cwmp1__OptionStruct_State__1 = 1, _cwmp1__OptionStruct_State__2 = 2, _cwmp1__OptionStruct_State__3 = 3}; +#endif + +#ifndef SOAP_TYPE__cwmp1__OptionStruct_Mode +#define SOAP_TYPE__cwmp1__OptionStruct_Mode (36) +/* cwmp1:OptionStruct-Mode */ +enum _cwmp1__OptionStruct_Mode {_cwmp1__OptionStruct_Mode__0 = 0, _cwmp1__OptionStruct_Mode__1 = 1, _cwmp1__OptionStruct_Mode__2 = 2}; +#endif + +#ifndef SOAP_TYPE__cwmp1__OptionStruct_IsTransferable +#define SOAP_TYPE__cwmp1__OptionStruct_IsTransferable (39) +/* cwmp1:OptionStruct-IsTransferable */ +enum _cwmp1__OptionStruct_IsTransferable {_cwmp1__OptionStruct_IsTransferable__0 = 0, _cwmp1__OptionStruct_IsTransferable__1 = 1}; +#endif + +#ifndef SOAP_TYPE__cwmp1__SetParameterValuesResponse_Status +#define SOAP_TYPE__cwmp1__SetParameterValuesResponse_Status (51) +/* cwmp1:SetParameterValuesResponse-Status */ +enum _cwmp1__SetParameterValuesResponse_Status {_cwmp1__SetParameterValuesResponse_Status__0 = 0, _cwmp1__SetParameterValuesResponse_Status__1 = 1}; +#endif + +#ifndef SOAP_TYPE__cwmp1__AddObjectResponse_Status +#define SOAP_TYPE__cwmp1__AddObjectResponse_Status (70) +/* cwmp1:AddObjectResponse-Status */ +enum _cwmp1__AddObjectResponse_Status {_cwmp1__AddObjectResponse_Status__0 = 0, _cwmp1__AddObjectResponse_Status__1 = 1}; +#endif + +#ifndef SOAP_TYPE__cwmp1__DeleteObjectResponse_Status +#define SOAP_TYPE__cwmp1__DeleteObjectResponse_Status (73) +/* cwmp1:DeleteObjectResponse-Status */ +enum _cwmp1__DeleteObjectResponse_Status {_cwmp1__DeleteObjectResponse_Status__0 = 0, _cwmp1__DeleteObjectResponse_Status__1 = 1}; +#endif + +#ifndef SOAP_TYPE__cwmp1__DownloadResponse_Status +#define SOAP_TYPE__cwmp1__DownloadResponse_Status (76) +/* cwmp1:DownloadResponse-Status */ +enum _cwmp1__DownloadResponse_Status {_cwmp1__DownloadResponse_Status__0 = 0, _cwmp1__DownloadResponse_Status__1 = 1}; +#endif + +#ifndef SOAP_TYPE__cwmp1__UploadResponse_Status +#define SOAP_TYPE__cwmp1__UploadResponse_Status (95) +/* cwmp1:UploadResponse-Status */ +enum _cwmp1__UploadResponse_Status {_cwmp1__UploadResponse_Status__0 = 0, _cwmp1__UploadResponse_Status__1 = 1}; +#endif + +/******************************************************************************\ + * * + * Classes and Structs * + * * +\******************************************************************************/ + + +#if 0 /* volatile type: do not redeclare here */ + +#endif + +#ifndef SOAP_TYPE_SOAP_ENC__base64 +#define SOAP_TYPE_SOAP_ENC__base64 (7) +/* Base64 schema type: */ +struct SOAP_ENC__base64 +{ + unsigned char *__ptr; + int __size; +}; +#endif + +#ifndef SOAP_TYPE_cwmp1__FaultStruct +#define SOAP_TYPE_cwmp1__FaultStruct (17) +/* cwmp1:FaultStruct */ +struct cwmp1__FaultStruct +{ + char *FaultCode; /* required element of type xsd:string */ + char *FaultString; /* required element of type xsd:string */ +}; +#endif + +#ifndef SOAP_TYPE_cwmp1__DeviceIdStruct +#define SOAP_TYPE_cwmp1__DeviceIdStruct (18) +/* cwmp1:DeviceIdStruct */ +struct cwmp1__DeviceIdStruct +{ + char *Manufacturer; /* required element of type xsd:string */ + char *OUI; /* required element of type xsd:string */ + char *ProductClass; /* required element of type xsd:string */ + char *SerialNumber; /* required element of type xsd:string */ +}; +#endif + +#ifndef SOAP_TYPE_cwmp1__EventStruct +#define SOAP_TYPE_cwmp1__EventStruct (19) +/* cwmp1:EventStruct */ +struct cwmp1__EventStruct +{ + char *EventCode; /* required element of type xsd:string */ + char *CommandKey; /* required element of type cwmp1:CommandKeyType */ +}; +#endif + +#ifndef SOAP_TYPE_cwmp1__ParameterValueStruct +#define SOAP_TYPE_cwmp1__ParameterValueStruct (20) +/* cwmp1:ParameterValueStruct */ +struct cwmp1__ParameterValueStruct +{ + char *Name; /* required element of type xsd:string */ + char *Value; /* required element of type xsd:anySimpleType */ + char *Type; /*FIXME AZR: Added for type of value */ +}; +#endif + +#ifndef SOAP_TYPE_cwmp1__ParameterInfoStruct +#define SOAP_TYPE_cwmp1__ParameterInfoStruct (21) +/* cwmp1:ParameterInfoStruct */ +struct cwmp1__ParameterInfoStruct +{ + char *Name; /* required element of type xsd:string */ + enum xsd__boolean Writable; /* required element of type xsd:boolean */ +}; +#endif + +#ifndef SOAP_TYPE_cwmp1__SetParameterAttributesStruct +#define SOAP_TYPE_cwmp1__SetParameterAttributesStruct (22) +/* cwmp1:SetParameterAttributesStruct */ +struct cwmp1__SetParameterAttributesStruct +{ + char **Name; /* optional element of type xsd:string */ + enum xsd__boolean NotificationChange; /* required element of type xsd:boolean */ + enum _cwmp1__SetParameterAttributesStruct_Notification Notification; /* required element of type cwmp1:SetParameterAttributesStruct-Notification */ + enum xsd__boolean AccessListChange; /* required element of type xsd:boolean */ + struct cwmp1AccessList *AccessList; /* required element of type ArrayOfstring */ +}; +#endif + +#ifndef SOAP_TYPE_cwmp1__ParameterAttributeStruct +#define SOAP_TYPE_cwmp1__ParameterAttributeStruct (27) +/* cwmp1:ParameterAttributeStruct */ +struct cwmp1__ParameterAttributeStruct +{ + char *Name; /* required element of type xsd:string */ + enum _cwmp1__ParameterAttributeStruct_Notification Notification; /* required element of type cwmp1:ParameterAttributeStruct-Notification */ + struct cwmp1AccessList *AccessList; /* required element of type ArrayOfstring */ +}; +#endif + +#ifndef SOAP_TYPE_cwmp1__QueuedTransferStruct +#define SOAP_TYPE_cwmp1__QueuedTransferStruct (29) +/* cwmp1:QueuedTransferStruct */ +struct cwmp1__QueuedTransferStruct +{ + char *CommandKey; /* required element of type cwmp1:CommandKeyType */ + enum _cwmp1__QueuedTransferStruct_State State; /* required element of type cwmp1:QueuedTransferStruct-State */ +}; +#endif + +#ifndef SOAP_TYPE_cwmp1__AllQueuedTransferStruct +#define SOAP_TYPE_cwmp1__AllQueuedTransferStruct (31) +/* cwmp1:AllQueuedTransferStruct */ +struct cwmp1__AllQueuedTransferStruct +{ + char *CommandKey; /* required element of type cwmp1:CommandKeyType */ + enum _cwmp1__AllQueuedTransferStruct_State State; /* required element of type cwmp1:AllQueuedTransferStruct-State */ + enum xsd__boolean IsDownload; /* required element of type xsd:boolean */ + char *FileType; /* required element of type xsd:string */ + unsigned int FileSize; /* required element of type xsd:unsignedInt */ + char *TargetFileName; /* required element of type xsd:string */ +}; +#endif + +#ifndef SOAP_TYPE_cwmp1__ArgStruct +#define SOAP_TYPE_cwmp1__ArgStruct (33) +/* cwmp1:ArgStruct */ +struct cwmp1__ArgStruct +{ + char *Name; /* required element of type xsd:string */ + char *Value; /* required element of type xsd:string */ +}; +#endif + +#ifndef SOAP_TYPE_cwmp1__OptionStruct +#define SOAP_TYPE_cwmp1__OptionStruct (34) +/* cwmp1:OptionStruct */ +struct cwmp1__OptionStruct +{ + char *OptionName; /* required element of type xsd:string */ + unsigned int VoucherSN; /* required element of type xsd:unsignedInt */ + enum _cwmp1__OptionStruct_State State; /* required element of type cwmp1:OptionStruct-State */ + enum _cwmp1__OptionStruct_Mode Mode; /* required element of type cwmp1:OptionStruct-Mode */ + time_t StartDate; /* required element of type xsd:dateTime */ + time_t *ExpirationDate; /* optional element of type xsd:dateTime */ + enum _cwmp1__OptionStruct_IsTransferable IsTransferable; /* required element of type cwmp1:OptionStruct-IsTransferable */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__Fault_SetParameterValuesFault +#define SOAP_TYPE__cwmp1__Fault_SetParameterValuesFault (41) +/* cwmp1:Fault-SetParameterValuesFault */ +struct _cwmp1__Fault_SetParameterValuesFault +{ + char *ParameterName; /* required element of type xsd:string */ + char *FaultCode; /* required element of type cwmp1:FaultCodeType */ + char *FaultString; /* optional element of type xsd:string */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__Fault +#define SOAP_TYPE__cwmp1__Fault (40) +/* cwmp1:Fault */ +struct _cwmp1__Fault +{ + char *FaultCode; /* required element of type cwmp1:FaultCodeType */ + char *FaultString; /* optional element of type xsd:string */ + int __sizeSetParameterValuesFault; /* sequence of elements */ + struct _cwmp1__Fault_SetParameterValuesFault *SetParameterValuesFault; /* optional element of type cwmp1:Fault-SetParameterValuesFault */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__GetRPCMethods +#define SOAP_TYPE__cwmp1__GetRPCMethods (43) +/* cwmp1:GetRPCMethods */ +struct _cwmp1__GetRPCMethods +{ +#ifdef WITH_NOEMPTYSTRUCT + char dummy; /* dummy member to enable compilation */ +#endif +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__GetRPCMethodsResponse +#define SOAP_TYPE__cwmp1__GetRPCMethodsResponse (44) +/* cwmp1:GetRPCMethodsResponse */ +struct _cwmp1__GetRPCMethodsResponse +{ + struct cwmp1MethodList *MethodList; /* required element of type ArrayOfstring */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__SetParameterValues +#define SOAP_TYPE__cwmp1__SetParameterValues (47) +/* cwmp1:SetParameterValues */ +struct _cwmp1__SetParameterValues +{ + struct cwmp1ParameterValueList *ParameterList; /* required element of type ArrayOfParameterValueStruct */ + char *ParameterKey; /* required element of type cwmp1:ParameterKeyType */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__SetParameterValuesResponse +#define SOAP_TYPE__cwmp1__SetParameterValuesResponse (50) +/* cwmp1:SetParameterValuesResponse */ +struct _cwmp1__SetParameterValuesResponse +{ + enum _cwmp1__SetParameterValuesResponse_Status Status; /* required element of type cwmp1:SetParameterValuesResponse-Status */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__GetParameterValues +#define SOAP_TYPE__cwmp1__GetParameterValues (52) +/* cwmp1:GetParameterValues */ +struct _cwmp1__GetParameterValues +{ + struct cwmp1ParameterNames *ParameterNames; /* required element of type ArrayOfstring */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__GetParameterValuesResponse +#define SOAP_TYPE__cwmp1__GetParameterValuesResponse (55) +/* cwmp1:GetParameterValuesResponse */ +struct _cwmp1__GetParameterValuesResponse +{ + struct cwmp1ParameterValueList *ParameterList; /* required element of type ArrayOfParameterValueStruct */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__GetParameterNames +#define SOAP_TYPE__cwmp1__GetParameterNames (56) +/* cwmp1:GetParameterNames */ +struct _cwmp1__GetParameterNames +{ + char **ParameterPath; /* optional element of type xsd:string */ + enum xsd__boolean NextLevel; /* required element of type xsd:boolean */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__GetParameterNamesResponse +#define SOAP_TYPE__cwmp1__GetParameterNamesResponse (57) +/* cwmp1:GetParameterNamesResponse */ +struct _cwmp1__GetParameterNamesResponse +{ + struct cwmp1ParameterInfoList *ParameterList; /* required element of type ArrayOfParameterInfoStruct */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__SetParameterAttributes +#define SOAP_TYPE__cwmp1__SetParameterAttributes (60) +/* cwmp1:SetParameterAttributes */ +struct _cwmp1__SetParameterAttributes +{ + struct cwmp1SetParameterAttributesList *ParameterList; /* required element of type ArrayOfSetParameterAttributesStruct */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__SetParameterAttributesResponse +#define SOAP_TYPE__cwmp1__SetParameterAttributesResponse (63) +/* cwmp1:SetParameterAttributesResponse */ +struct _cwmp1__SetParameterAttributesResponse +{ +#ifdef WITH_NOEMPTYSTRUCT + char dummy; /* dummy member to enable compilation */ +#endif +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__GetParameterAttributes +#define SOAP_TYPE__cwmp1__GetParameterAttributes (64) +/* cwmp1:GetParameterAttributes */ +struct _cwmp1__GetParameterAttributes +{ + struct cwmp1ParameterNames *ParameterNames; /* required element of type ArrayOfstring */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__GetParameterAttributesResponse +#define SOAP_TYPE__cwmp1__GetParameterAttributesResponse (65) +/* cwmp1:GetParameterAttributesResponse */ +struct _cwmp1__GetParameterAttributesResponse +{ + struct cwmp1ParameterAttributeList *ParameterList; /* required element of type ArrayOfParameterAttributeStruct */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__AddObject +#define SOAP_TYPE__cwmp1__AddObject (68) +/* cwmp1:AddObject */ +struct _cwmp1__AddObject +{ + char *ObjectName; /* required element of type cwmp1:ObjectNameType */ + char *ParameterKey; /* required element of type cwmp1:ParameterKeyType */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__AddObjectResponse +#define SOAP_TYPE__cwmp1__AddObjectResponse (69) +/* cwmp1:AddObjectResponse */ +struct _cwmp1__AddObjectResponse +{ + unsigned int InstanceNumber; /* required element of type xsd:unsignedInt */ + enum _cwmp1__AddObjectResponse_Status Status; /* required element of type cwmp1:AddObjectResponse-Status */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__DeleteObject +#define SOAP_TYPE__cwmp1__DeleteObject (71) +/* cwmp1:DeleteObject */ +struct _cwmp1__DeleteObject +{ + char *ObjectName; /* required element of type cwmp1:ObjectNameType */ + char *ParameterKey; /* required element of type cwmp1:ParameterKeyType */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__DeleteObjectResponse +#define SOAP_TYPE__cwmp1__DeleteObjectResponse (72) +/* cwmp1:DeleteObjectResponse */ +struct _cwmp1__DeleteObjectResponse +{ + enum _cwmp1__DeleteObjectResponse_Status Status; /* required element of type cwmp1:DeleteObjectResponse-Status */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__Download +#define SOAP_TYPE__cwmp1__Download (74) +/* cwmp1:Download */ +struct _cwmp1__Download +{ + char *CommandKey; /* required element of type cwmp1:CommandKeyType */ + char *FileType; /* required element of type xsd:string */ + char *URL; /* required element of type xsd:string */ + char *Username; /* required element of type xsd:string */ + char *Password; /* required element of type xsd:string */ + unsigned int FileSize; /* required element of type xsd:unsignedInt */ + char *TargetFileName; /* required element of type xsd:string */ + unsigned int DelaySeconds; /* required element of type xsd:unsignedInt */ + char *SuccessURL; /* required element of type xsd:string */ + char *FailureURL; /* required element of type xsd:string */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__DownloadResponse +#define SOAP_TYPE__cwmp1__DownloadResponse (75) +/* cwmp1:DownloadResponse */ +struct _cwmp1__DownloadResponse +{ + enum _cwmp1__DownloadResponse_Status Status; /* required element of type cwmp1:DownloadResponse-Status */ + time_t StartTime; /* required element of type xsd:dateTime */ + time_t CompleteTime; /* required element of type xsd:dateTime */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__Reboot +#define SOAP_TYPE__cwmp1__Reboot (77) +/* cwmp1:Reboot */ +struct _cwmp1__Reboot +{ + char *CommandKey; /* required element of type cwmp1:CommandKeyType */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__RebootResponse +#define SOAP_TYPE__cwmp1__RebootResponse (78) +/* cwmp1:RebootResponse */ +struct _cwmp1__RebootResponse +{ +#ifdef WITH_NOEMPTYSTRUCT + char dummy; /* dummy member to enable compilation */ +#endif +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__GetQueuedTransfers +#define SOAP_TYPE__cwmp1__GetQueuedTransfers (79) +/* cwmp1:GetQueuedTransfers */ +struct _cwmp1__GetQueuedTransfers +{ +#ifdef WITH_NOEMPTYSTRUCT + char dummy; /* dummy member to enable compilation */ +#endif +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__GetQueuedTransfersResponse +#define SOAP_TYPE__cwmp1__GetQueuedTransfersResponse (80) +/* cwmp1:GetQueuedTransfersResponse */ +struct _cwmp1__GetQueuedTransfersResponse +{ + struct cwmp1TransferList *TransferList; /* required element of type ArrayOfQueuedTransferStruct */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__ScheduleInform +#define SOAP_TYPE__cwmp1__ScheduleInform (83) +/* cwmp1:ScheduleInform */ +struct _cwmp1__ScheduleInform +{ + unsigned int DelaySeconds; /* required element of type xsd:unsignedInt */ + char *CommandKey; /* required element of type cwmp1:CommandKeyType */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__ScheduleInformResponse +#define SOAP_TYPE__cwmp1__ScheduleInformResponse (84) +/* cwmp1:ScheduleInformResponse */ +struct _cwmp1__ScheduleInformResponse +{ +#ifdef WITH_NOEMPTYSTRUCT + char dummy; /* dummy member to enable compilation */ +#endif +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__SetVouchers +#define SOAP_TYPE__cwmp1__SetVouchers (85) +/* cwmp1:SetVouchers */ +struct _cwmp1__SetVouchers +{ + struct cwmp1VoucherList *VoucherList; /* required element of type ArrayOfbase64 */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__SetVouchersResponse +#define SOAP_TYPE__cwmp1__SetVouchersResponse (88) +/* cwmp1:SetVouchersResponse */ +struct _cwmp1__SetVouchersResponse +{ +#ifdef WITH_NOEMPTYSTRUCT + char dummy; /* dummy member to enable compilation */ +#endif +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__GetOptions +#define SOAP_TYPE__cwmp1__GetOptions (89) +/* cwmp1:GetOptions */ +struct _cwmp1__GetOptions +{ + char *OptionName; /* required element of type xsd:string */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__GetOptionsResponse +#define SOAP_TYPE__cwmp1__GetOptionsResponse (90) +/* cwmp1:GetOptionsResponse */ +struct _cwmp1__GetOptionsResponse +{ + struct cwmp1OptionList *OptionList; /* required element of type ArrayOfOptionStruct */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__Upload +#define SOAP_TYPE__cwmp1__Upload (93) +/* cwmp1:Upload */ +struct _cwmp1__Upload +{ + char *CommandKey; /* required element of type cwmp1:CommandKeyType */ + char *FileType; /* required element of type xsd:string */ + char *URL; /* required element of type xsd:string */ + char *Username; /* required element of type xsd:string */ + char *Password; /* required element of type xsd:string */ + unsigned int DelaySeconds; /* required element of type xsd:unsignedInt */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__UploadResponse +#define SOAP_TYPE__cwmp1__UploadResponse (94) +/* cwmp1:UploadResponse */ +struct _cwmp1__UploadResponse +{ + enum _cwmp1__UploadResponse_Status Status; /* required element of type cwmp1:UploadResponse-Status */ + time_t StartTime; /* required element of type xsd:dateTime */ + time_t CompleteTime; /* required element of type xsd:dateTime */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__FactoryReset +#define SOAP_TYPE__cwmp1__FactoryReset (96) +/* cwmp1:FactoryReset */ +struct _cwmp1__FactoryReset +{ +#ifdef WITH_NOEMPTYSTRUCT + char dummy; /* dummy member to enable compilation */ +#endif +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__FactoryResetResponse +#define SOAP_TYPE__cwmp1__FactoryResetResponse (97) +/* cwmp1:FactoryResetResponse */ +struct _cwmp1__FactoryResetResponse +{ +#ifdef WITH_NOEMPTYSTRUCT + char dummy; /* dummy member to enable compilation */ +#endif +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__GetAllQueuedTransfers +#define SOAP_TYPE__cwmp1__GetAllQueuedTransfers (98) +/* cwmp1:GetAllQueuedTransfers */ +struct _cwmp1__GetAllQueuedTransfers +{ +#ifdef WITH_NOEMPTYSTRUCT + char dummy; /* dummy member to enable compilation */ +#endif +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__GetAllQueuedTransfersResponse +#define SOAP_TYPE__cwmp1__GetAllQueuedTransfersResponse (99) +/* cwmp1:GetAllQueuedTransfersResponse */ +struct _cwmp1__GetAllQueuedTransfersResponse +{ + struct cwmp1AllTransferList *TransferList; /* required element of type ArrayOfAllQueuedTransferStruct */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__Inform +#define SOAP_TYPE__cwmp1__Inform (102) +/* cwmp1:Inform */ +struct _cwmp1__Inform +{ + struct cwmp1__DeviceIdStruct *DeviceId; /* required element of type cwmp1:DeviceIdStruct */ + struct cwmp1EventList *Event; /* required element of type ArrayOfEventStruct */ + unsigned int MaxEnvelopes; /* required element of type xsd:unsignedInt */ + time_t CurrentTime; /* required element of type xsd:dateTime */ + unsigned int RetryCount; /* required element of type xsd:unsignedInt */ + struct cwmp1ParameterValueList *ParameterList; /* required element of type ArrayOfParameterValueStruct */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__InformResponse +#define SOAP_TYPE__cwmp1__InformResponse (106) +/* cwmp1:InformResponse */ +struct _cwmp1__InformResponse +{ + unsigned int MaxEnvelopes; /* required element of type xsd:unsignedInt */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__TransferComplete +#define SOAP_TYPE__cwmp1__TransferComplete (107) +/* cwmp1:TransferComplete */ +struct _cwmp1__TransferComplete +{ + char *CommandKey; /* required element of type cwmp1:CommandKeyType */ + struct cwmp1__FaultStruct *FaultStruct; /* required element of type cwmp1:FaultStruct */ + time_t StartTime; /* required element of type xsd:dateTime */ + time_t CompleteTime; /* required element of type xsd:dateTime */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__TransferCompleteResponse +#define SOAP_TYPE__cwmp1__TransferCompleteResponse (109) +/* cwmp1:TransferCompleteResponse */ +struct _cwmp1__TransferCompleteResponse +{ +#ifdef WITH_NOEMPTYSTRUCT + char dummy; /* dummy member to enable compilation */ +#endif +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__AutonomousTransferComplete +#define SOAP_TYPE__cwmp1__AutonomousTransferComplete (110) +/* cwmp1:AutonomousTransferComplete */ +struct _cwmp1__AutonomousTransferComplete +{ + char *AnnounceURL; /* required element of type xsd:string */ + char *TransferURL; /* required element of type xsd:string */ + enum xsd__boolean IsDownload; /* required element of type xsd:boolean */ + char *FileType; /* required element of type xsd:string */ + unsigned int FileSize; /* required element of type xsd:unsignedInt */ + char *TargetFileName; /* required element of type xsd:string */ + struct cwmp1__FaultStruct *FaultStruct; /* required element of type cwmp1:FaultStruct */ + time_t StartTime; /* required element of type xsd:dateTime */ + time_t CompleteTime; /* required element of type xsd:dateTime */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__AutonomousTransferCompleteResponse +#define SOAP_TYPE__cwmp1__AutonomousTransferCompleteResponse (111) +/* cwmp1:AutonomousTransferCompleteResponse */ +struct _cwmp1__AutonomousTransferCompleteResponse +{ +#ifdef WITH_NOEMPTYSTRUCT + char dummy; /* dummy member to enable compilation */ +#endif +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__Kicked +#define SOAP_TYPE__cwmp1__Kicked (112) +/* cwmp1:Kicked */ +struct _cwmp1__Kicked +{ + char *Command; /* required element of type xsd:string */ + char *Referer; /* required element of type xsd:string */ + char *Arg; /* required element of type xsd:string */ + char *Next; /* required element of type xsd:string */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__KickedResponse +#define SOAP_TYPE__cwmp1__KickedResponse (113) +/* cwmp1:KickedResponse */ +struct _cwmp1__KickedResponse +{ + char *NextURL; /* required element of type xsd:string */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__RequestDownload +#define SOAP_TYPE__cwmp1__RequestDownload (114) +/* cwmp1:RequestDownload */ +struct _cwmp1__RequestDownload +{ + char *FileType; /* required element of type xsd:string */ + struct cwmp1FileTypeArg *FileTypeArg; /* required element of type ArrayOfArgStruct */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__RequestDownloadResponse +#define SOAP_TYPE__cwmp1__RequestDownloadResponse (117) +/* cwmp1:RequestDownloadResponse */ +struct _cwmp1__RequestDownloadResponse +{ +#ifdef WITH_NOEMPTYSTRUCT + char dummy; /* dummy member to enable compilation */ +#endif +}; +#endif + +#ifndef SOAP_TYPE_cwmp1MethodList +#define SOAP_TYPE_cwmp1MethodList (45) +/* SOAP encoded array of xsd:string schema type: */ +struct cwmp1MethodList +{ + char **__ptrstring; + int __size; +}; +#endif + +#ifndef SOAP_TYPE_cwmp1EventList +#define SOAP_TYPE_cwmp1EventList (104) +/* SOAP encoded array of cwmp1:EventStruct schema type: */ +struct cwmp1EventList +{ + struct cwmp1__EventStruct **__ptrEventStruct; + int __size; +}; +#endif + +#ifndef SOAP_TYPE_cwmp1ParameterValueList +#define SOAP_TYPE_cwmp1ParameterValueList (48) +/* SOAP encoded array of cwmp1:ParameterValueStruct schema type: */ +struct cwmp1ParameterValueList +{ + struct cwmp1__ParameterValueStruct **__ptrParameterValueStruct; + int __size; +}; +#endif + +#ifndef SOAP_TYPE_cwmp1ParameterInfoList +#define SOAP_TYPE_cwmp1ParameterInfoList (58) +/* SOAP encoded array of cwmp1:ParameterInfoStruct schema type: */ +struct cwmp1ParameterInfoList +{ + struct cwmp1__ParameterInfoStruct **__ptrParameterInfoStruct; + int __size; +}; +#endif + +#ifndef SOAP_TYPE_cwmp1ParameterNames +#define SOAP_TYPE_cwmp1ParameterNames (53) +/* SOAP encoded array of xsd:string schema type: */ +struct cwmp1ParameterNames +{ + char **__ptrstring; + int __size; +}; +#endif + +#ifndef SOAP_TYPE_cwmp1AccessList +#define SOAP_TYPE_cwmp1AccessList (25) +/* SOAP encoded array of xsd:string schema type: */ +struct cwmp1AccessList +{ + char **__ptrstring; + int __size; +}; +#endif + +#ifndef SOAP_TYPE_cwmp1SetParameterAttributesList +#define SOAP_TYPE_cwmp1SetParameterAttributesList (61) +/* SOAP encoded array of cwmp1:SetParameterAttributesStruct schema type: */ +struct cwmp1SetParameterAttributesList +{ + struct cwmp1__SetParameterAttributesStruct **__ptrSetParameterAttributesStruct; + int __size; +}; +#endif + +#ifndef SOAP_TYPE_cwmp1ParameterAttributeList +#define SOAP_TYPE_cwmp1ParameterAttributeList (66) +/* SOAP encoded array of cwmp1:ParameterAttributeStruct schema type: */ +struct cwmp1ParameterAttributeList +{ + struct cwmp1__ParameterAttributeStruct **__ptrParameterAttributeStruct; + int __size; +}; +#endif + +#ifndef SOAP_TYPE_cwmp1TransferList +#define SOAP_TYPE_cwmp1TransferList (81) +/* SOAP encoded array of cwmp1:QueuedTransferStruct schema type: */ +struct cwmp1TransferList +{ + struct cwmp1__QueuedTransferStruct **__ptrQueuedTransferStruct; + int __size; +}; +#endif + +#ifndef SOAP_TYPE_cwmp1AllTransferList +#define SOAP_TYPE_cwmp1AllTransferList (100) +/* SOAP encoded array of cwmp1:AllQueuedTransferStruct schema type: */ +struct cwmp1AllTransferList +{ + struct cwmp1__AllQueuedTransferStruct **__ptrAllQueuedTransferStruct; + int __size; +}; +#endif + +#ifndef SOAP_TYPE_cwmp1VoucherList +#define SOAP_TYPE_cwmp1VoucherList (86) +/* SOAP encoded array of SOAP-ENC:base64 schema type: */ +struct cwmp1VoucherList +{ + struct SOAP_ENC__base64 **__ptrbase64; + int __size; +}; +#endif + +#ifndef SOAP_TYPE_cwmp1OptionList +#define SOAP_TYPE_cwmp1OptionList (91) +/* SOAP encoded array of cwmp1:OptionStruct schema type: */ +struct cwmp1OptionList +{ + struct cwmp1__OptionStruct **__ptrOptionStruct; + int __size; +}; +#endif + +#ifndef SOAP_TYPE_cwmp1FileTypeArg +#define SOAP_TYPE_cwmp1FileTypeArg (115) +/* SOAP encoded array of cwmp1:ArgStruct schema type: */ +struct cwmp1FileTypeArg +{ + struct cwmp1__ArgStruct **__ptrArgStruct; + int __size; +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__ID +#define SOAP_TYPE__cwmp1__ID (138) +/* Primitive cwmp1:ID schema type: */ +struct _cwmp1__ID +{ + char *__item; + char *SOAP_ENV__mustUnderstand; /* required attribute of type xsd:string */ +}; +#endif + +#ifndef SOAP_TYPE__cwmp1__HoldRequests +#define SOAP_TYPE__cwmp1__HoldRequests (139) +/* Primitive cwmp1:HoldRequests schema type: */ +struct _cwmp1__HoldRequests +{ + enum xsd__boolean __item; + char *SOAP_ENV__mustUnderstand; /* required attribute of type xsd:string */ +}; +#endif + +#ifndef SOAP_TYPE_cwmp1__InformResponse +#define SOAP_TYPE_cwmp1__InformResponse (142) +/* cwmp1:InformResponse */ +struct cwmp1__InformResponse +{ + unsigned int *MaxEnvelopesO; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type xsd:unsignedInt */ +}; +#endif + +#ifndef SOAP_TYPE_cwmp1__Inform +#define SOAP_TYPE_cwmp1__Inform (143) +/* cwmp1:Inform */ +struct cwmp1__Inform +{ + struct cwmp1__DeviceIdStruct *DeviceId; /* optional element of type cwmp1:DeviceIdStruct */ + struct cwmp1EventList *Event; /* optional element of type ArrayOfEventStruct */ + unsigned int MaxEnvelopesI; /* required element of type xsd:unsignedInt */ + time_t CurrentTime; /* required element of type xsd:dateTime */ + unsigned int RetryCount; /* required element of type xsd:unsignedInt */ + struct cwmp1ParameterValueList *ParameterList; /* optional element of type ArrayOfParameterValueStruct */ +}; +#endif + +#ifndef SOAP_TYPE_SOAP_ENV__Header +#define SOAP_TYPE_SOAP_ENV__Header (144) +/* SOAP Header: */ +struct SOAP_ENV__Header +{ + /* KMD */ + struct _cwmp1__ID ID; + struct _cwmp1__HoldRequests HoldRequests; +}; +#endif + +#ifndef SOAP_TYPE_SOAP_ENV__Code +#define SOAP_TYPE_SOAP_ENV__Code (145) +/* SOAP Fault Code: */ +struct SOAP_ENV__Code +{ + char *SOAP_ENV__Value; /* optional element of type xsd:QName */ + struct SOAP_ENV__Code *SOAP_ENV__Subcode; /* optional element of type SOAP-ENV:Code */ +}; +#endif + +#ifndef SOAP_TYPE_SOAP_ENV__Detail +#define SOAP_TYPE_SOAP_ENV__Detail (147) +/* SOAP-ENV:Detail */ +struct SOAP_ENV__Detail +{ + int __type; /* any type of element (defined below) */ + void *fault; /* transient */ + char *__any; +}; +#endif + +#ifndef SOAP_TYPE_SOAP_ENV__Reason +#define SOAP_TYPE_SOAP_ENV__Reason (150) +/* SOAP-ENV:Reason */ +struct SOAP_ENV__Reason +{ + char *SOAP_ENV__Text; /* optional element of type xsd:string */ +}; +#endif + +#ifndef SOAP_TYPE_SOAP_ENV__Fault +#define SOAP_TYPE_SOAP_ENV__Fault (151) +/* SOAP Fault: */ +struct SOAP_ENV__Fault +{ + char *faultcode; /* optional element of type xsd:QName */ + char *faultstring; /* optional element of type xsd:string */ + char *faultactor; /* optional element of type xsd:string */ + struct SOAP_ENV__Detail *detail; /* optional element of type SOAP-ENV:Detail */ + struct SOAP_ENV__Code *SOAP_ENV__Code; /* optional element of type SOAP-ENV:Code */ + struct SOAP_ENV__Reason *SOAP_ENV__Reason; /* optional element of type SOAP-ENV:Reason */ + char *SOAP_ENV__Node; /* optional element of type xsd:string */ + char *SOAP_ENV__Role; /* optional element of type xsd:string */ + struct SOAP_ENV__Detail *SOAP_ENV__Detail; /* optional element of type SOAP-ENV:Detail */ +}; +#endif + +/******************************************************************************\ + * * + * Types with Custom Serializers * + * * +\******************************************************************************/ + + +/******************************************************************************\ + * * + * Typedefs * + * * +\******************************************************************************/ + +#ifndef SOAP_TYPE__QName +#define SOAP_TYPE__QName (5) +typedef char *_QName; +#endif + +#ifndef SOAP_TYPE__XML +#define SOAP_TYPE__XML (6) +typedef char *_XML; +#endif + +#ifndef SOAP_TYPE_xsd__anySimpleType +#define SOAP_TYPE_xsd__anySimpleType (11) +typedef char *xsd__anySimpleType; +#endif + +#ifndef SOAP_TYPE_cwmp1__FaultCodeType +#define SOAP_TYPE_cwmp1__FaultCodeType (13) +typedef char *cwmp1__FaultCodeType; +#endif + +#ifndef SOAP_TYPE_cwmp1__ParameterKeyType +#define SOAP_TYPE_cwmp1__ParameterKeyType (14) +typedef char *cwmp1__ParameterKeyType; +#endif + +#ifndef SOAP_TYPE_cwmp1__CommandKeyType +#define SOAP_TYPE_cwmp1__CommandKeyType (15) +typedef char *cwmp1__CommandKeyType; +#endif + +#ifndef SOAP_TYPE_cwmp1__ObjectNameType +#define SOAP_TYPE_cwmp1__ObjectNameType (16) +typedef char *cwmp1__ObjectNameType; +#endif + + +/******************************************************************************\ + * * + * Typedef Synonyms * + * * +\******************************************************************************/ + + +/******************************************************************************\ + * * + * Externals * + * * +\******************************************************************************/ + + +/******************************************************************************\ + * * + * Service Operations * + * * +\******************************************************************************/ + + +SOAP_FMAC5 int SOAP_FMAC6 cwmp1__Inform(struct soap*, struct cwmp1__DeviceIdStruct *DeviceId, struct cwmp1EventList *Event, unsigned int MaxEnvelopesI, time_t CurrentTime, unsigned int RetryCount, struct cwmp1ParameterValueList *ParameterList, unsigned int *MaxEnvelopesO); + +/******************************************************************************\ + * * + * Stubs * + * * +\******************************************************************************/ + + +SOAP_FMAC5 int SOAP_FMAC6 soap_call_cwmp1__Inform(struct soap *soap, const char *soap_endpoint, const char *soap_action, struct cwmp1__DeviceIdStruct *DeviceId, struct cwmp1EventList *Event, unsigned int MaxEnvelopesI, time_t CurrentTime, unsigned int RetryCount, struct cwmp1ParameterValueList *ParameterList, unsigned int *MaxEnvelopesO); + +/******************************************************************************\ + * * + * Skeletons * + * * +\******************************************************************************/ + +SOAP_FMAC5 int SOAP_FMAC6 soap_serve_cwmp1__Inform(struct soap*); + +#ifdef __cplusplus +} +#endif + +#endif + +/* End of soapStub.h */ diff --git a/src/inc/stdsoap2.h b/src/inc/stdsoap2.h new file mode 100644 index 0000000..54d9375 --- /dev/null +++ b/src/inc/stdsoap2.h @@ -0,0 +1,2317 @@ +/* + stdsoap2.h 2.7.12 + + gSOAP runtime engine + +gSOAP XML Web services tools +Copyright (C) 2000-2008, Robert van Engelen, Genivia Inc., All Rights Reserved. +This part of the software is released under ONE of the following licenses: +GPL, or the gSOAP public license, or Genivia's license for commercial use. +-------------------------------------------------------------------------------- +Contributors: + +Wind River Systems, Inc., for the following additions + - vxWorks compatible +-------------------------------------------------------------------------------- +gSOAP public license. + +The contents of this file are subject to the gSOAP Public License Version 1.3 +(the "License"); you may not use this file except in compliance with the +License. You may obtain a copy of the License at +http://www.cs.fsu.edu/~engelen/soaplicense.html +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +for the specific language governing rights and limitations under the License. + +The Initial Developer of the Original Code is Robert A. van Engelen. +Copyright (C) 2000-2008, Robert van Engelen, Genivia Inc., All Rights Reserved. +-------------------------------------------------------------------------------- +GPL license. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA + +Author contact information: +engelen@genivia.com / engelen@acm.org + +This program is released under the GPL with the additional exemption that +compiling, linking, and/or using OpenSSL is allowed. +-------------------------------------------------------------------------------- +A commercial use license is available from Genivia, Inc., contact@genivia.com +-------------------------------------------------------------------------------- +*/ + +#ifdef WITH_SOAPDEFS_H +# include "soapdefs.h" /* include user-defined stuff */ +#endif + +#ifndef _THREAD_SAFE +# define _THREAD_SAFE +#endif + +#ifndef OPENSERVER +# ifndef _REENTRANT +# define _REENTRANT +# endif +#endif + +#ifndef SOAP_FMAC1 /* stdsoap2.h declaration macro */ +# define SOAP_FMAC1 +#endif + +#ifndef SOAP_FMAC2 /* stdsoap2.h declaration macro */ +# define SOAP_FMAC2 +#endif + +#ifndef SOAP_FMAC3 /* (de)serializer declaration macro */ +# define SOAP_FMAC3 +#endif + +#ifndef SOAP_FMAC3S /* string converter for (de)serializer declaration macro */ +# define SOAP_FMAC3S SOAP_FMAC3 +#endif + +#ifndef SOAP_FMAC4 /* (de)serializer declaration macro */ +# define SOAP_FMAC4 +#endif + +#ifndef SOAP_FMAC4S /* string converter for (de)serializer declaration macro */ +# define SOAP_FMAC4S SOAP_FMAC4 +#endif + +#ifndef SOAP_FMAC5 /* stub/skeleton declaration macro */ +# define SOAP_FMAC5 +#endif + +#ifndef SOAP_FMAC6 /* stub/skeleton declaration macro */ +# define SOAP_FMAC6 +#endif + +#ifndef SOAP_CMAC /* class declaration macro */ +# define SOAP_CMAC +#endif + +#ifndef SOAP_NMAC /* namespace table declaration macro */ +# define SOAP_NMAC +#endif + +#ifndef SOAP_SOURCE_STAMP +# define SOAP_SOURCE_STAMP(str) +#endif + +/* gSOAP 2.7.4 and higher: fast look-aside buffering is stable */ +#ifndef WITH_FAST +# define WITH_FAST +#endif + +#ifdef WITH_LEANER +# ifndef WITH_LEAN +# define WITH_LEAN +# endif +#endif + +#ifdef WITH_LEAN +# ifdef WITH_COOKIES +# error "Cannot build WITH_LEAN code WITH_COOKIES enabled" +# endif +#endif + +#ifndef STDSOAP_H +#define STDSOAP_H + +#if defined(__vxworks) || defined(__VXWORKS__) +# define VXWORKS +#endif + +#ifdef _WIN32 +# ifndef WIN32 +# define WIN32 +# endif +#endif + +#ifdef _WIN32_WCE +# ifndef UNDER_CE +# define UNDER_CE _WIN32_WCE +# endif +#endif + +#ifdef UNDER_CE +# ifndef WIN32 +# define WIN32 +# endif +#endif + +#ifdef __BORLANDC__ +# ifdef __WIN32__ +# ifndef WIN32 +# define WIN32 +# endif +# endif +#endif + +#ifdef __CYGWIN__ +# ifndef CYGWIN +# define CYGWIN +# endif +#endif + +#ifdef __SYMBIAN32__ +# define SYMBIAN +# undef WIN32 +#endif + +#if defined(__palmos__) || defined(PALM_GCC) || defined(__PALMOS_TRAPS__) +# ifndef PALM +# define PALM +# endif +#endif + +#if defined(__hpux) +# ifndef HP_UX +# define HP_UX +# endif +#endif + +#if defined(__digital__) && defined(__unix__) +# ifndef TRU64 +# define TRU64 +# endif +#endif + +#ifdef __MVS__ +# ifndef OS390 +# define OS390 +# endif +#endif + +#ifdef HAVE_CONFIG_H +# include "config.h" +# if defined(WITH_OPENSSL) +# ifndef HAVE_OPENSSL_SSL_H +# undef WITH_OPENSSL +# endif +# endif +# if defined(WITH_ZLIB) || defined(WITH_GZIP) +# ifndef HAVE_ZLIB_H +# undef WITH_ZLIB +# undef WITH_GZIP +# endif +# endif +#else +# if defined(UNDER_CE) +# define WITH_LEAN +# define HAVE_SSCANF +# elif defined(WIN32) +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_SYS_TIMEB_H +# define HAVE_FTIME +# define HAVE_WCTOMB +# define HAVE_MBTOWC +# define SOAP_LONG_FORMAT "%I64d" +# define SOAP_ULONG_FORMAT "%I64u" +# elif defined(CYGWIN) +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_SYS_TIMEB_H +# define HAVE_FTIME +# define HAVE_RAND_R +# define HAVE_GMTIME_R +# define HAVE_LOCALTIME_R +# define HAVE_WCTOMB +# define HAVE_MBTOWC +# elif defined(__APPLE__) +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOD_L +# define HAVE_SSCANF_L +# define HAVE_SPRINTF_L +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_RAND_R +# define HAVE_GMTIME_R +# define HAVE_LOCALTIME_R +# define HAVE_TIMEGM +# define HAVE_WCTOMB +# define HAVE_MBTOWC +# elif defined(_AIX43) +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_SYS_TIMEB_H +# define HAVE_FTIME +# define HAVE_RAND_R +# define HAVE_GMTIME_R +# define HAVE_LOCALTIME_R +# define HAVE_WCTOMB +# define HAVE_MBTOWC +# elif defined(_AIX41) +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_SYS_TIMEB_H +# define HAVE_WCTOMB +# define HAVE_MBTOWC +# elif defined(HP_UX) +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_SYS_TIMEB_H +# define HAVE_FTIME +# define HAVE_RAND_R +# define HAVE_GMTIME_R +# define HAVE_LOCALTIME_R +# define HAVE_WCTOMB +# define HAVE_MBTOWC +# elif defined(FREEBSD) || defined(__FreeBSD__) +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOD_L +# define HAVE_SSCANF_L +# define HAVE_SPRINTF_L +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_STRTOLL +# define HAVE_STRTOULL +# define HAVE_GETTIMEOFDAY +# define HAVE_RAND_R +# define HAVE_GMTIME_R +# define HAVE_LOCALTIME_R +# define HAVE_WCTOMB +# define HAVE_MBTOWC +# define SOAP_LONG_FORMAT "%qd" +# define SOAP_ULONG_FORMAT "%qu" +# elif defined(__VMS) +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_SYS_TIMEB_H +# define HAVE_FTIME +# define HAVE_RAND_R +# define HAVE_GMTIME_R +# define HAVE_LOCALTIME_R +# define HAVE_WCTOMB +# define HAVE_MBTOWC +# elif defined(__GLIBC__) || defined(__GNU__) +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOD_L +# define HAVE_SSCANF_L +# define HAVE_SPRINTF_L +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_STRTOLL +# define HAVE_STRTOULL +# define HAVE_SYS_TIMEB_H +# define HAVE_FTIME +# define HAVE_RAND_R +# define HAVE_GMTIME_R +# define HAVE_LOCALTIME_R +# define HAVE_TIMEGM +# define HAVE_WCTOMB +# define HAVE_MBTOWC +# define HAVE_ISNAN +# elif defined(TRU64) +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_GETTIMEOFDAY +# define HAVE_SYS_TIMEB_H +# define HAVE_RAND_R +# define HAVE_GMTIME_R +# define HAVE_LOCALTIME_R +# define __USE_STD_IOSTREAM +# define HAVE_WCTOMB +# define HAVE_MBTOWC +# define SOAP_LONG_FORMAT "%ld" +# define SOAP_ULONG_FORMAT "%lu" +# elif defined(MAC_CARBON) +# define WITH_NOIO +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOD_L +# define HAVE_SSCANF_L +# define HAVE_SPRINTF_L +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_FTIME +# define HAVE_RAND_R +# define HAVE_GETHOSTBYNAME_R +# define HAVE_GMTIME_R +# define HAVE_LOCALTIME_R +# define HAVE_WCTOMB +# define HAVE_MBTOWC +# elif defined(PALM) +# define WITH_LEAN +# define HAVE_STRTOD /* strtod() is defined in palmFunctions.h */ +# include /* Needs to be included before unix headers */ +# include +# define IGNORE_STDIO_STUBS +# include +# define O_NONBLOCK FNONBIO +# include +# include "palmFunctions.h" +# elif defined(SYMBIAN) +# define WITH_LEAN +# define WITH_NONAMESPACES +# define HAVE_STRTOD /* use STRTOD since sscanf doesn't seem to work */ +# include +# include +# elif defined(VXWORKS) +# ifdef _WRS_KERNEL +# define _POSIX_THREADS 1 +# endif +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_GMTIME +# define HAVE_LOCALTIME +# define HAVE_MKTIME +# elif defined(OS390) +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_SYS_TIMEB_H +# define HAVE_FTIME +# define HAVE_RAND_R +# define HAVE_GMTIME_R +# define HAVE_LOCALTIME_R +# define HAVE_WCTOMB +# define HAVE_MBTOWC +# elif defined(AS400) +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_SYS_TIMEB_H +# define HAVE_FTIME +# define HAVE_RAND_R +# define HAVE_GMTIME_R +# define HAVE_LOCALTIME_R +# define HAVE_WCTOMB +# define HAVE_MBTOWC +# elif defined(__QNX__) || defined(QNX) +/* QNX does not have a working version of strtof */ +# undef HAVE_STRTOF +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_SYS_TIMEB_H +# define HAVE_FTIME +# define HAVE_RAND_R +# define HAVE_GETHOSTBYNAME_R +# define HAVE_GMTIME_R +# define HAVE_LOCALTIME_R +# define HAVE_WCTOMB +# define HAVE_MBTOWC +# define LONG64 long +# define ULONG64 unsigned LONG64 +# define SOAP_LONG_FORMAT "%ld" +# define SOAP_ULONG_FORMAT "%lu" +# else +/* Default asumptions on supported functions */ +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_SYS_TIMEB_H +# define HAVE_FTIME +# define HAVE_RAND_R +# define HAVE_GETHOSTBYNAME_R +# define HAVE_GMTIME_R +# define HAVE_LOCALTIME_R +# define HAVE_WCTOMB +# define HAVE_MBTOWC +# endif +#endif + +/* native Win and HP-UX compilers don't like empty structs */ +#if defined(WIN32) || defined(HP_UX) +# define WITH_NOEMPTYSTRUCT +#endif + +#ifdef HP_UX +# undef HAVE_STRTOLL +# undef HAVE_STRTOULL +#endif + +#ifdef WITH_C_LOCALE +# include +#else +# undef HAVE_STRTOF_L +# undef HAVE_STRTOD_L +# undef HAVE_SSCANF_L +# undef HAVE_SPRINTF_L +#endif + +#ifndef WITH_NOSTDLIB +# include +# ifndef PALM +# include +# include +# endif +# include +# include +#endif + +#if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT) +# include +# include +#endif + +#ifdef WITH_NOHTTP +# ifndef WITH_NOIO +# define WITH_NOIO +# undef WITH_COOKIES +# endif +#endif + +/* Suggestion when SOAP_FD_EXCEEDED error occurs: + Some systems allow increasing FD_SETSIZE before including sys/types.h: +#define FD_SETSIZE (2048) +*/ + +#ifndef UNDER_CE +# ifndef PALM +# ifndef WITH_NOIO +# include +# include +# endif +# ifndef WITH_LEAN +# ifdef HAVE_SYS_TIMEB_H +# include /* for ftime() */ +# endif +# include +# endif +# endif +#endif + +#ifdef OPENSERVER +# include +# include +# include + extern int h_errno; +#endif + +#ifndef WITH_NOIO +# ifndef WIN32 +# ifndef PALM +# include +# ifdef VXWORKS +# include +# include +# ifndef _WRS_KERNEL +# include +# endif +# else +# ifndef SYMBIAN +# include +# endif +# endif +# ifdef SUN_OS +# include /* SUN */ +# include /* SUN < 2.8 (?) */ +# endif +# ifdef VXWORKS +# ifdef _WRS_KERNEL +# include +# endif +# else +# include +# endif +# include +# ifdef OS390 +# include +# else +# include /* TCP_NODELAY */ +# endif +# include +# endif +# endif +#endif + +#ifdef WIN32 +# define SOAP_WINSOCKINT int +#else +# define SOAP_WINSOCKINT size_t +#endif + +#ifdef WIN32 +# ifndef UNDER_CE +# include +# include +# endif +# ifdef WITH_IPV6 +# include /* Visual Studio 2005 users: you must install the Platform SDK (R2) */ +# include +# include +# define SOAP_GAI_STRERROR gai_strerrorA +# else +# include /* Visual Studio 2005 users: you must install the Platform SDK (R2) */ +/* # include */ /* Alternative: use winsock2 (not available with eVC) */ +# endif +#else +# ifdef VXWORKS +# include +# include +# include +# endif +# ifndef WITH_NOIO +# ifndef PALM +# include +# include +# include +# include +# ifdef _AIX41 +# include +# endif +# endif +# endif +#endif + +#ifdef WITH_FASTCGI +# include +#endif + +#ifdef WITH_OPENSSL +# define OPENSSL_NO_KRB5 +# include +# include +# include +# include +# include +# ifndef ALLOW_OLD_VERSIONS +# if (OPENSSL_VERSION_NUMBER < 0x00905100L) +# error "Must use OpenSSL 0.9.6 or later" +# endif +# endif +#endif + +#ifdef WITH_GZIP +# ifndef WITH_ZLIB +# define WITH_ZLIB +# endif +#endif + +#ifdef WITH_CASEINSENSITIVETAGS +# define SOAP_STRCMP soap_tag_cmp /* case insensitve XML element/attribute names */ +#else +# define SOAP_STRCMP strcmp /* case sensitive XML element/attribute names */ +#endif + +#ifdef WITH_ZLIB +# include +#endif + +#ifndef WITH_NOSTDLIB +# ifndef PALM +# include /* for isnan() */ +# endif +#endif + +/* #define DEBUG */ /* Uncomment to debug sending (in file SENT.log) receiving (in file RECV.log) and messages (in file TEST.log) */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Portability: define SOAP_SOCKLEN_T */ +#if defined(_AIX) +# if defined(_AIX43) +# define SOAP_SOCKLEN_T socklen_t +# else +# define SOAP_SOCKLEN_T int +# endif +#elif defined(SOCKLEN_T) +# define SOAP_SOCKLEN_T SOCKLEN_T +#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) || defined(FREEBSD) || defined(__FreeBSD__) || defined(__QNX__) || defined(QNX) || defined(OS390) +# define SOAP_SOCKLEN_T socklen_t +#elif defined(IRIX) || defined(WIN32) || defined(__APPLE__) || defined(HP_UX) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS) +# define SOAP_SOCKLEN_T int +#else +# define SOAP_SOCKLEN_T size_t +#endif + +#ifndef SOAP_SOCKET +# ifdef WIN32 +# define SOAP_SOCKET SOCKET +# define soap_closesocket(n) closesocket(n) +# else +# define SOAP_SOCKET int +# define soap_closesocket(n) close(n) +# endif +#endif + +#define SOAP_INVALID_SOCKET ((SOAP_SOCKET)-1) +#define soap_valid_socket(n) ((n) != SOAP_INVALID_SOCKET) + +#ifndef SOAP_GAI_STRERROR +# define SOAP_GAI_STRERROR gai_strerror +#endif + +#ifndef FD_SETSIZE +# define FD_SETSIZE (1024) +#endif + +#if defined(SYMBIAN) +# define LONG64 long +# define ULONG64 unsigned LONG64 +#elif !defined(WIN32) || defined(CYGWIN) || defined(__GLIBC__) || defined(__GNU__) +# ifndef LONG64 +# if defined(HAVE_STDINT_H) +# include +# define LONG64 int64_t +# define ULONG64 uint64_t +# elif defined(__GLIBC__) +# include +# if (__WORDSIZE == 64) +# define LONG64 int64_t +# define ULONG64 uint64_t +# ifndef SOAP_LONG_FORMAT +# define SOAP_LONG_FORMAT "%ld" +# endif +# ifndef SOAP_ULONG_FORMAT +# define SOAP_ULONG_FORMAT "%lu" +# endif +# else +# define LONG64 long long +# define ULONG64 unsigned LONG64 +# endif +# else +# define LONG64 long long +# define ULONG64 unsigned LONG64 +# endif +# endif +#elif defined(UNDER_CE) +# define LONG64 __int64 +# define ULONG64 unsigned LONG64 +#elif defined(__BORLANDC__) +# define LONG64 __int64 +# define ULONG64 unsigned LONG64 +#endif + +#ifndef SOAP_LONG_FORMAT +# define SOAP_LONG_FORMAT "%lld" /* printf format for 64 bit ints */ +#endif + +#ifndef SOAP_ULONG_FORMAT +# define SOAP_ULONG_FORMAT "%llu" /* printf format for unsigned 64 bit ints */ +#endif + +#if defined(WIN32) && !defined(CYGWIN) +# define soap_int32 __int32 +#elif defined(SYMBIAN) +# define soap_int32 long +#elif defined(PALM) +# define soap_int32 Int32 +#elif defined(_AIX) +# if defined(_AIX43) +# define soap_int32 int32_t +# else +# define soap_int32 signed int +# endif +#else +# define soap_int32 int32_t +#endif + +#ifdef WIN32 +# define SOAP_ERANGE ERANGE +# define SOAP_EINTR WSAEINTR +# define SOAP_EAGAIN WSAEWOULDBLOCK +# define SOAP_EWOULDBLOCK WSAEWOULDBLOCK +# define SOAP_EINPROGRESS WSAEINPROGRESS +# define SOAP_EADDRINUSE WSAEADDRINUSE +#else +# define SOAP_ERANGE ERANGE +# define SOAP_EINTR EINTR +# define SOAP_EAGAIN EAGAIN +# define SOAP_EADDRINUSE EADDRINUSE +# ifdef SYMBIAN +# define SOAP_EWOULDBLOCK 9898 +# define SOAP_EINPROGRESS 9899 +# else +# define SOAP_EWOULDBLOCK EWOULDBLOCK +# define SOAP_EINPROGRESS EINPROGRESS +# endif +#endif + +#ifdef WIN32 +# ifdef UNDER_CE +# define soap_errno GetLastError() +# define soap_socket_errno(s) GetLastError() +# define soap_reset_errno SetLastError(0) +# else +# define soap_errno GetLastError() +# define soap_socket_errno(s) WSAGetLastError() +# define soap_reset_errno SetLastError(0) +# endif +#else +# ifndef WITH_NOIO +# define soap_errno errno +# define soap_socket_errno(s) errno +# define soap_reset_errno (errno = 0) +# else +# define soap_errno 0 +# define soap_socket_errno(s) 0 +# define soap_reset_errno +# endif +#endif + +#ifndef SOAP_BUFLEN +# ifndef WITH_LEAN +# define SOAP_BUFLEN (65536) /* buffer length for socket packets, also used by gethostbyname_r and UDP messages, so don't make this too small */ +# else +# define SOAP_BUFLEN (2048) +# endif +#endif +#ifndef SOAP_LABLEN +# define SOAP_LABLEN (256) /* initial look-aside buffer length */ +#endif +#ifndef SOAP_PTRBLK +# define SOAP_PTRBLK (32) /* block allocation for pointer hash table chains */ +#endif +#ifndef SOAP_PTRHASH +# ifndef WITH_LEAN +# define SOAP_PTRHASH (1024) /* size of pointer analysis hash table (must be power of 2) */ +# else +# define SOAP_PTRHASH (32) +# endif +#endif +#ifndef SOAP_IDHASH +# ifndef WITH_LEAN +# define SOAP_IDHASH (1999) /* prime size of hash table for parsed id/ref */ +# else +# define SOAP_IDHASH (19) /* 19, 199 */ +# endif +#endif +#ifndef SOAP_BLKLEN +# ifndef WITH_LEAN +# define SOAP_BLKLEN (256) /* size of blocks to collect long strings and XML attributes */ +# else +# define SOAP_BLKLEN (32) +# endif +#endif +#ifndef SOAP_TAGLEN +# ifndef WITH_LEAN +# define SOAP_TAGLEN (1024) /* maximum length of XML element tag/attribute name or host/path name + 1 */ +# else +# define SOAP_TAGLEN (64) +# endif +#endif +#ifndef SOAP_HDRLEN +# ifndef WITH_LEAN +# define SOAP_HDRLEN (8192) /* maximum length of HTTP header line (must be >4096 to read cookies) */ +# else +# define SOAP_HDRLEN (1024) +# endif +#endif +#ifndef SOAP_MAXDIMS +# ifndef WITH_LEAN +# define SOAP_MAXDIMS (16) /* maximum array dimensions (array nestings) must be less than 64 to protect soap->tmpbuf */ +# else +# define SOAP_MAXDIMS (4) +# endif +#endif + +#ifndef SOAP_MAXLOGS +# define SOAP_MAXLOGS (3) /* max number of debug logs per struct soap environment */ +# define SOAP_INDEX_RECV (0) +# define SOAP_INDEX_SENT (1) +# define SOAP_INDEX_TEST (2) +#endif + +/* Max iterations in soap_serve() to keep server connection alive */ +#ifndef SOAP_MAXKEEPALIVE +# define SOAP_MAXKEEPALIVE (100) +#endif + +/* Trusted max size of inbound SOAP array for compound array allocation. + Increase if necessary to allow larger arrays. +*/ +#ifndef SOAP_MAXARRAYSIZE +# define SOAP_MAXARRAYSIZE (1000000) +#endif + +#ifdef VXWORKS +# ifdef __INCmathh +# include +# ifndef HAVE_ISNAN +# define HAVE_ISNAN +# endif +# define soap_isnan(num) isNan(num) +# endif +#endif + +#ifdef WIN32 +# include +# ifndef HAVE_ISNAN +# define HAVE_ISNAN +# endif +# define soap_isnan(num) _isnan(num) +#endif + +#ifdef SUN_OS +# define HAVE_ISNAN +#endif + +#ifdef __APPLE__ +# ifdef __cplusplus +# ifndef isnan +extern "C" int isnan(double); +# endif +# endif +# define HAVE_ISNAN +#endif + +#if !defined(HAVE_ISNAN) && (defined(_MATH_H) || defined(_MATH_INCLUDED)) +# define HAVE_ISNAN +#endif + +extern const struct soap_double_nan { unsigned int n1, n2; } soap_double_nan; + +#ifdef VXWORKS +# ifndef FLT_MAX +# define FLT_MAX _ARCH_FLT_MAX +# endif +# ifndef DBL_MAX +# define DBL_MAX _ARCH_DBL_MAX +# endif +#endif + +#ifndef FLT_NAN +# define FLT_NAN (*(float*)(void*)&soap_double_nan) +#endif + +#ifndef FLT_PINFTY +# if defined(FLT_MAX) +# define FLT_PINFTY FLT_MAX +# elif defined(HUGE_VALF) +# define FLT_PINFTY (float)HUGE_VALF +# elif defined(HUGE_VAL) +# define FLT_PINFTY (float)HUGE_VAL +# elif defined(FLOAT_MAX) +# define FLT_PINFTY FLOAT_MAX +# else +# define FLT_PINFTY (3.40282347e+38F) +# endif +#endif + +#ifndef FLT_NINFTY +# define FLT_NINFTY (-FLT_PINFTY) +#endif + +#ifndef DBL_NAN +# define DBL_NAN (*(double*)(void*)&soap_double_nan) +#endif + +#ifndef DBL_PINFTY +# if defined(DBL_MAX) +# define DBL_PINFTY DBL_MAX +# elif defined(HUGE_VALF) +# define DBL_PINFTY (double)HUGE_VALF +# elif defined(HUGE_VAL) +# define DBL_PINFTY (double)HUGE_VAL +# elif defined(DOUBLE_MAX) +# define DBL_PINFTY DOUBLE_MAX +# else +# define DBL_PINFTY (1.7976931348623157e+308) +# endif +#endif + +#ifndef DBL_NINFTY +# define DBL_NINFTY (-DBL_PINFTY) +#endif + +#ifndef soap_isnan +# ifdef HAVE_ISNAN +# define soap_isnan(n) isnan(n) +# else +# define soap_isnan(n) (0) +# endif +#endif + +#define soap_ispinfd(n) ((n) >= DBL_PINFTY) +#define soap_ispinff(n) ((n) >= FLT_PINFTY) +#define soap_isninfd(n) ((n) <= DBL_NINFTY) +#define soap_isninff(n) ((n) <= FLT_NINFTY) + +/* gSOAP error codes */ + +#define SOAP_EOF EOF +#define SOAP_ERR EOF +#define SOAP_OK 0 +#define SOAP_CLI_FAULT 1 +#define SOAP_SVR_FAULT 2 +#define SOAP_TAG_MISMATCH 3 +#define SOAP_TYPE 4 +#define SOAP_SYNTAX_ERROR 5 +#define SOAP_NO_TAG 6 +#define SOAP_IOB 7 +#define SOAP_MUSTUNDERSTAND 8 +#define SOAP_NAMESPACE 9 +#define SOAP_USER_ERROR 10 +#define SOAP_FATAL_ERROR 11 +#define SOAP_FAULT 12 +#define SOAP_NO_METHOD 13 +#define SOAP_NO_DATA 14 +#define SOAP_GET_METHOD 15 +#define SOAP_PUT_METHOD 16 +#define SOAP_DEL_METHOD 17 +#define SOAP_HEAD_METHOD 18 +#define SOAP_HTTP_METHOD 19 +#define SOAP_EOM 20 +#define SOAP_MOE 21 +#define SOAP_HDR 22 +#define SOAP_NULL 23 +#define SOAP_DUPLICATE_ID 24 +#define SOAP_MISSING_ID 25 +#define SOAP_HREF 26 +#define SOAP_UDP_ERROR 27 +#define SOAP_TCP_ERROR 28 +#define SOAP_HTTP_ERROR 29 +#define SOAP_SSL_ERROR 30 +#define SOAP_ZLIB_ERROR 31 +#define SOAP_DIME_ERROR 32 +#define SOAP_DIME_HREF 33 +#define SOAP_DIME_MISMATCH 34 +#define SOAP_DIME_END 35 +#define SOAP_MIME_ERROR 36 +#define SOAP_MIME_HREF 37 +#define SOAP_MIME_END 38 +#define SOAP_VERSIONMISMATCH 39 +#define SOAP_PLUGIN_ERROR 40 +#define SOAP_DATAENCODINGUNKNOWN 41 +#define SOAP_REQUIRED 42 +#define SOAP_PROHIBITED 43 +#define SOAP_OCCURS 44 +#define SOAP_LENGTH 45 +#define SOAP_FD_EXCEEDED 46 + +#define soap_xml_error_check(e) ((e) == SOAP_TAG_MISMATCH || (e) == SOAP_NO_TAG || (e) == SOAP_SYNTAX_ERROR || (e) == SOAP_NAMESPACE || (e) == SOAP_DUPLICATE_ID || (e) == SOAP_MISSING_ID || (e) == SOAP_REQUIRED || (e) == SOAP_PROHIBITED || (e) == SOAP_OCCURS || (e) == SOAP_LENGTH || (e) == SOAP_NULL || (e) == SOAP_HREF) +#define soap_soap_error_check(e) ((e) == SOAP_CLI_FAULT || (e) == SOAP_SVR_FAULT || (e) == SOAP_VERSIONMISMATCH || (e) == SOAP_MUSTUNDERSTAND || (e) == SOAP_FAULT || (e) == SOAP_NO_METHOD) +#define soap_tcp_error_check(e) ((e) == SOAP_EOF || (e) == SOAP_TCP_ERROR) +#define soap_ssl_error_check(e) ((e) == SOAP_SSL_ERROR) +#define soap_zlib_error_check(e) ((e) == SOAP_ZLIB_ERROR) +#define soap_http_error_check(e) ((e) == SOAP_HTTP_ERROR || ((e) >= SOAP_GET_METHOD && (e) <= SOAP_HTTP_METHOD)|| (e) == SOAP_NO_DATA || ((e) >= 100 && (e) < 600)) + +/* gSOAP HTTP response status codes 100 to 599 are reserved */ + +/* Codes 600 to 999 are user definable */ + +/* Exceptional gSOAP HTTP response status codes >= 1000 */ + +#define SOAP_STOP 1000 /* No HTTP response */ +#define SOAP_FORM 1001 /* Form request/response */ +#define SOAP_HTML 1002 /* Custom HTML response */ +#define SOAP_FILE 1003 /* Custom file-based response */ + +/* gSOAP HTTP method codes */ + +#define SOAP_POST 2000 +#define SOAP_GET 2001 + +/* gSOAP DIME */ + +#define SOAP_DIME_CF 0x01 +#define SOAP_DIME_ME 0x02 +#define SOAP_DIME_MB 0x04 +#define SOAP_DIME_VERSION 0x08 /* DIME version 1 */ +#define SOAP_DIME_MEDIA 0x10 +#define SOAP_DIME_ABSURI 0x20 + +/* gSOAP ZLIB */ + +#define SOAP_ZLIB_NONE 0x00 +#define SOAP_ZLIB_DEFLATE 0x01 +#define SOAP_ZLIB_INFLATE 0x02 +#define SOAP_ZLIB_GZIP 0x02 + +/* gSOAP transport, connection, and content encoding modes */ + +typedef soap_int32 soap_mode; + +#define SOAP_IO 0x00000003 /* IO mask */ +#define SOAP_IO_FLUSH 0x00000000 /* flush output immediately, no buffering */ +#define SOAP_IO_BUFFER 0x00000001 /* buffer output in packets of size SOAP_BUFLEN */ +#define SOAP_IO_STORE 0x00000002 /* store entire output to determine length for transport */ +#define SOAP_IO_CHUNK 0x00000003 /* use HTTP chunked transfer AND buffer packets */ + +#define SOAP_IO_UDP 0x00000004 /* TCP or UDP */ + +#define SOAP_IO_LENGTH 0x00000008 /* calc message length (internal) */ +#define SOAP_IO_KEEPALIVE 0x00000010 /* keep connection alive */ + +#define SOAP_ENC_LATIN 0x00000020 /* accept iso-8859-1 encoding */ +#define SOAP_ENC_XML 0x00000040 /* plain XML encoding, no HTTP header */ +#define SOAP_ENC_DIME 0x00000080 +#define SOAP_ENC_MIME 0x00000100 +#define SOAP_ENC_MTOM 0x00000200 +#define SOAP_ENC_ZLIB 0x00000400 +#define SOAP_ENC_SSL 0x00000800 + +#define SOAP_ENC 0x00000FFF /* IO and ENC mask */ + +#define SOAP_XML_STRICT 0x00001000 /* apply strict validation */ +#define SOAP_XML_INDENT 0x00002000 /* emit indented XML */ +#define SOAP_XML_CANONICAL 0x00004000 /* EXC C14N canonical XML */ +#define SOAP_XML_TREE 0x00008000 /* emit XML tree (no id/ref) */ +#define SOAP_XML_GRAPH 0x00010000 +#define SOAP_XML_NIL 0x00020000 +#define SOAP_XML_DOM 0x00040000 +#define SOAP_XML_SEC 0x00080000 /* reserved for WS security */ + +#define SOAP_C_NOIOB 0x00100000 /* don't fault on array index out of bounds (just ignore) */ +#define SOAP_C_UTFSTRING 0x00200000 /* (de)serialize strings with UTF8 content */ +#define SOAP_C_MBSTRING 0x00400000 /* (de)serialize strings with multi-byte content */ +#define SOAP_C_NILSTRING 0x00800000 /* serialize empty strings as nil (omitted) */ + +#define SOAP_DOM_TREE 0x01000000 +#define SOAP_DOM_NODE 0x02000000 +#define SOAP_DOM_ASIS 0x04000000 + +#define SOAP_MIME_POSTCHECK 0x10000000 /* MIME flag (internal) */ + +#define SOAP_IO_DEFAULT SOAP_IO_FLUSH + +/* SSL client/server authentication settings */ + +#define SOAP_SSL_NO_AUTHENTICATION 0x00 /* for testing purposes */ +#define SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION 0x01 /* client requires server to authenticate */ +#define SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION 0x02 /* server requires client to authenticate */ +#define SOAP_SSL_SKIP_HOST_CHECK 0x04 /* client does not check the common name of the host in certificate */ +#define SOAP_SSL_ALLOW_EXPIRED_CERTIFICATE 0x08 /* client does not check the expiration date of the host certificate */ +#define SOAP_SSL_NO_DEFAULT_CA_PATH 0x10 /* don't use default_verify_paths */ +#define SOAP_SSL_RSA 0x20 /* use RSA */ +#define SOAP_SSLv3 0x40 /* SSL v3 only */ +#define SOAP_TLSv1 0x80 /* TLS v1 only */ +#define SOAP_SSLv3_TLSv1 0x00 /* SSL v3 and TLS v1 support by default */ + +#define SOAP_SSL_DEFAULT (SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION | SOAP_SSLv3_TLSv1) + +/* state */ + +#define SOAP_NONE 0 +#define SOAP_INIT 1 +#define SOAP_COPY 2 + +#define soap_check_state(soap) (!(soap) || ((soap)->state != SOAP_INIT && (soap)->state != SOAP_COPY)) + +/* part */ + +#define SOAP_BEGIN 0 +#define SOAP_IN_ENVELOPE 2 +#define SOAP_IN_HEADER 3 +#define SOAP_END_HEADER 4 +#define SOAP_NO_BODY 5 +#define SOAP_IN_BODY 6 +#define SOAP_END_BODY 7 +#define SOAP_END_ENVELOPE 8 +#define SOAP_END 9 +#define SOAP_BEGIN_SECURITY 10 +#define SOAP_IN_SECURITY 11 +#define SOAP_END_SECURITY 12 + +/* DEBUG macros */ + +#ifndef WITH_LEAN +# ifdef DEBUG +# ifndef SOAP_DEBUG +# define SOAP_DEBUG +# endif +# ifndef SOAP_MEM_DEBUG +# define SOAP_MEM_DEBUG +# endif +# endif +#endif + +#ifdef SOAP_MEM_DEBUG +# ifndef SOAP_MALLOC +# define SOAP_MALLOC(soap, size) soap_track_malloc(soap, __FILE__, __LINE__, size) +# endif +# ifndef SOAP_FREE +# define SOAP_FREE(soap, ptr) soap_track_free(soap, __FILE__, __LINE__, ptr) +# endif +#endif + +#ifndef SOAP_MALLOC /* use libc malloc */ +# define SOAP_MALLOC(soap, size) malloc(size) +#endif + +#ifndef SOAP_FREE /* use libc free */ +# define SOAP_FREE(soap, ptr) free(ptr) +#endif + +#ifdef SOAP_DEBUG +# ifndef SOAP_MESSAGE +# define SOAP_MESSAGE fprintf +# endif +# ifndef DBGLOG +# define DBGLOG(DBGFILE, CMD) \ +{ if (soap)\ + { if (!soap->fdebug[SOAP_INDEX_##DBGFILE])\ + soap_open_logfile((struct soap*)soap, SOAP_INDEX_##DBGFILE);\ + if (soap->fdebug[SOAP_INDEX_##DBGFILE])\ + { FILE *fdebug = soap->fdebug[SOAP_INDEX_##DBGFILE];\ + CMD;\ + fflush(fdebug);\ + }\ + }\ +} +# endif +# ifndef DBGMSG +# define DBGMSG(DBGFILE, MSG, LEN) \ +{ if (soap)\ + { if (!soap->fdebug[SOAP_INDEX_##DBGFILE])\ + soap_open_logfile((struct soap*)soap, SOAP_INDEX_##DBGFILE);\ + if (soap->fdebug[SOAP_INDEX_##DBGFILE])\ + { fwrite((MSG), 1, (LEN), soap->fdebug[SOAP_INDEX_##DBGFILE]);\ + fflush(soap->fdebug[SOAP_INDEX_##DBGFILE]);\ + }\ + }\ +} +# endif +# ifndef DBGFUN +# define DBGFUN(FNAME) DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): %s()\n", __FILE__, __LINE__, FNAME)) +# define DBGFUN1(FNAME, FMT, ARG) DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): %s("FMT")\n", __FILE__, __LINE__, FNAME, (ARG))) +# define DBGFUN2(FNAME, FMT1, ARG1, FMT2, ARG2) DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): %s("FMT1", "FMT2")\n", __FILE__, __LINE__, FNAME, (ARG1), (ARG2))) +# define DBGFUN3(FNAME, FMT1, ARG1, FMT2, ARG2, FMT3, ARG3) DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): %s("FMT1", "FMT2", "FMT3")\n", __FILE__, __LINE__, FNAME, (ARG1), (ARG2), (ARG3))) +# endif +# ifndef DBGHEX +# define DBGHEX(DBGFILE, MSG, LEN) \ +{ if (soap)\ + { if (!soap->fdebug[SOAP_INDEX_##DBGFILE])\ + soap_open_logfile(soap, SOAP_INDEX_##DBGFILE);\ + if (soap->fdebug[SOAP_INDEX_##DBGFILE])\ + { int i; char *s;\ + for (s = (char*)(MSG), i = (LEN); i; i--)\ + fprintf(soap->fdebug[SOAP_INDEX_##DBGFILE], "%2.2X ", (int)*s++&0xFF);\ + fflush(soap->fdebug[SOAP_INDEX_##DBGFILE]);\ + }\ + }\ +} +# endif +#else +# define DBGLOG(DBGFILE, CMD) +# define DBGMSG(DBGFILE, MSG, LEN) +# define DBGFUN(FNAME) +# define DBGFUN1(FNAME, FMT, ARG) +# define DBGFUN2(FNAME, FMT1, ARG1, FMT2, ARG2) +# define DBGFUN3(FNAME, FMT1, ARG1, FMT2, ARG2, FMT3, ARG3) +# define DBGHEX(DBGFILE, MSG, LEN) +#endif + +/* UCS-4 requires 32 bits (0-7FFFFFFF, the sign bit is used by gSOAP to distinguish XML entities) */ +typedef soap_int32 soap_wchar; + +/* namespace table row */ +struct Namespace +{ const char *id; + const char *ns; + const char *in; + char *out; +}; + +/* namespace stack */ +struct soap_nlist +{ struct soap_nlist *next; + unsigned int level; /* nesting depth level */ + short index; /* corresponding entry in ns mapping table */ + char *ns; /* only set when parsed ns URI is not in the ns mapping table */ + char id[1]; /* the actual string value flows into the allocated region below this struct */ +}; + +/* block stack for nested block allocations */ +struct soap_blist +{ struct soap_blist *next; + char *ptr; + size_t size; +}; + +/* array layout */ +struct soap_array +{ void *__ptr; + int __size; +}; + +/* pointer serialization management */ +struct soap_plist +{ struct soap_plist *next; + const void *ptr; + const struct soap_array *array; + int type; + int id; + char mark1; + char mark2; +}; + +/* block allocation for pointer serialization management */ +struct soap_pblk +{ struct soap_pblk *next; + struct soap_plist plist[SOAP_PTRBLK]; +}; + +#ifdef SOAP_MEM_DEBUG +/* malloc/free tracking for debugging */ +struct soap_mlist +{ struct soap_mlist *next; + const void *ptr; + const char *file; + int line; + short live; +}; +#endif + +/* class allocation list */ +struct soap_clist +{ struct soap_clist *next; + void *ptr; + int type; + int size; + int (*fdelete)(struct soap_clist*); +}; + +/* attributes */ +struct soap_attribute +{ struct soap_attribute *next; + char *value; + size_t size; + char *ns; + short visible; + char name[1]; /* the actual name string flows into the allocated region below this struct */ +}; + +#ifndef WITH_LEAN +struct soap_cookie +{ struct soap_cookie *next; + char *name; + char *value; + char *domain; + char *path; + time_t expire; /* client-side: local time to expire */ + long maxage; /* server-side: seconds to expire */ + unsigned int version; + short secure; + short session; /* server-side */ + short env; /* server-side: got cookie from client and should not be (re)send */ + short modified; /* server-side: client cookie was modified and should be send */ +}; +#endif + +#ifdef __cplusplus +SOAP_FMAC1 struct soap_multipart* SOAP_FMAC2 soap_next_multipart(struct soap_multipart*); + +class soap_multipart_iterator +{ public: + struct soap_multipart *content; + bool operator==(const soap_multipart_iterator& iter) const + { return (bool)(content == iter.content); } + bool operator!=(const soap_multipart_iterator& iter) const + { return (bool)(content != iter.content); } + struct soap_multipart &operator*() const + { return *content; } + soap_multipart_iterator &operator++() + { content = soap_next_multipart(content); return *this; } + soap_multipart_iterator() : content(NULL) + { } + soap_multipart_iterator(struct soap_multipart *p) : content(p) + { } +}; +#endif + +#ifndef WITH_LEANER +struct soap_dime +{ size_t count; + size_t size; + size_t chunksize; + size_t buflen; + char flags; + char *ptr; + const char *id; + const char *type; + const char *options; + struct soap_multipart *list; /* list of DIME attachments received */ + struct soap_multipart *first, *last; /* temporary in/out queue */ +#ifdef __cplusplus + soap_multipart_iterator begin() + { soap_multipart_iterator iter(list); return iter; }; + soap_multipart_iterator end() + { soap_multipart_iterator iter(NULL); return iter; }; +#endif +}; +#endif + +#ifndef WITH_LEANER +struct soap_mime +{ char *boundary; /* MIME boundary */ + const char *start; /* MIME start ID */ + struct soap_multipart *list; /* list of MIME attachments received */ + struct soap_multipart *first, *last; /* temporary in/out queue */ +#ifdef __cplusplus + soap_multipart_iterator begin() + { soap_multipart_iterator iter(list); return iter; }; + soap_multipart_iterator end() + { soap_multipart_iterator iter(NULL); return iter; }; +#endif +}; +#endif + +#ifndef WITH_LEANER +/* RFC2045 MIME content transfer encodings */ +enum soap_mime_encoding +{ SOAP_MIME_NONE, + SOAP_MIME_7BIT, + SOAP_MIME_8BIT, + SOAP_MIME_BINARY, + SOAP_MIME_QUOTED_PRINTABLE, + SOAP_MIME_BASE64, + SOAP_MIME_IETF_TOKEN, + SOAP_MIME_X_TOKEN +}; +#endif + +#ifndef WITH_LEANER +/* DIME/MIME multipart list */ +struct soap_multipart +{ struct soap_multipart *next; + char *ptr; /* points to raw data content */ + size_t size; /* size of data content */ + const char *id; /* DIME/MIME content ID or form data name */ + const char *type; /* DIME/MIME type (MIME type format) */ + const char *options; /* DIME options */ + enum soap_mime_encoding encoding; /* MIME Content-Transfer-Encoding */ + const char *location; /* MIME Content-Location (optional) */ + const char *description; /* MIME Content-Description (optional) */ +#ifdef __cplusplus + typedef soap_multipart_iterator iterator; +#endif +}; +#endif + +#ifndef WITH_LEANER +/* attachment DIME and MTOM XOP forwarding */ +struct soap_xlist +{ struct soap_xlist *next; + unsigned char **ptr; + int *size; + char *id; + char **type; + char **options; +}; +#endif + +/******************************************************************************/ + +#ifndef WITH_LEANER +#ifdef __cplusplus +class soap_dom_attribute_iterator +{ public: + struct soap_dom_attribute *att; + const char *nstr; + const char *name; + bool operator==(const soap_dom_attribute_iterator&) const; + bool operator!=(const soap_dom_attribute_iterator&) const; + struct soap_dom_attribute &operator*() const; + soap_dom_attribute_iterator &operator++(); + soap_dom_attribute_iterator(); + soap_dom_attribute_iterator(struct soap_dom_attribute*); + ~soap_dom_attribute_iterator(); +}; +#endif +#endif + +#ifndef WITH_LEANER +struct soap_dom_attribute +{ struct soap_dom_attribute *next; + const char *nstr; + char *name; + char *data; + wchar_t *wide; + struct soap *soap; +#ifdef __cplusplus + typedef soap_dom_attribute_iterator iterator; + struct soap_dom_attribute &set(const char *nstr, const char *name); /* set namespace and name */ + struct soap_dom_attribute &set(const char *data); /* set data */ + soap_dom_attribute_iterator begin(); + soap_dom_attribute_iterator end(); + soap_dom_attribute_iterator find(const char *nstr, const char *name); + void unlink(); + soap_dom_attribute(); + soap_dom_attribute(struct soap *soap); + soap_dom_attribute(struct soap *soap, const char *nstr, const char *name, const char *data); + ~soap_dom_attribute(); +#endif +}; +#endif + +#ifndef WITH_LEANER +#ifdef __cplusplus +class soap_dom_element_iterator +{ public: + struct soap_dom_element *elt; + const char *nstr; + const char *name; + int type; + bool operator==(const soap_dom_element_iterator&) const; + bool operator!=(const soap_dom_element_iterator&) const; + struct soap_dom_element &operator*() const; + soap_dom_element_iterator &operator++(); + soap_dom_element_iterator(); + soap_dom_element_iterator(struct soap_dom_element*); + ~soap_dom_element_iterator(); +}; +#endif +#endif + +#ifndef WITH_LEANER +struct soap_dom_element +{ struct soap_dom_element *next; /* next sibling */ + struct soap_dom_element *prnt; /* parent */ + struct soap_dom_element *elts; /* list of child elements */ + struct soap_dom_attribute *atts; /* list of attributes */ + const char *nstr; /* namespace string */ + char *name; /* element tag name */ + char *data; /* element content data (with SOAP_C_UTFSTRING flag set) */ + wchar_t *wide; /* element content data */ + int type; /* optional: serialized C/C++ data type */ + void *node; /* optional: pointer to serialized C/C++ data */ + char *head; /* leading whitespace to start tag */ + char *tail; /* leading whitespace to end tag */ + struct soap *soap; /* soap context that manages this node */ +#ifdef __cplusplus + typedef soap_dom_element_iterator iterator; + struct soap_dom_element &set(const char *nstr, const char *name); + struct soap_dom_element &set(const char *data); + struct soap_dom_element &set(void *node, int type); + struct soap_dom_element &add(struct soap_dom_element*); + struct soap_dom_element &add(struct soap_dom_element&); + struct soap_dom_element &add(struct soap_dom_attribute*); + struct soap_dom_element &add(struct soap_dom_attribute&); + soap_dom_element_iterator begin(); + soap_dom_element_iterator end(); + soap_dom_element_iterator find(const char *nstr, const char *name); + soap_dom_element_iterator find(int type); + void unlink(); + soap_dom_element(); + soap_dom_element(struct soap *soap); + soap_dom_element(struct soap *soap, const char *nstr, const char *name); + soap_dom_element(struct soap *soap, const char *nstr, const char *name, const char *data); + soap_dom_element(struct soap *soap, const char *nstr, const char *name, void *node, int type); + ~soap_dom_element(); +#endif +}; +SOAP_FMAC1 struct soap_dom_element * SOAP_FMAC2 soap_dom_next_element(struct soap_dom_element *elt); +SOAP_FMAC1 struct soap_dom_attribute * SOAP_FMAC2 soap_dom_next_attribute(struct soap_dom_attribute *att); +#endif + +#if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT) +} +extern std::ostream &operator<<(std::ostream&, const struct soap_dom_element&); +extern std::istream &operator>>(std::istream&, struct soap_dom_element&); +extern "C" { +#endif + +/******************************************************************************/ + +#ifdef WIN32 +# ifdef SOAP_STD_EXPORTS +# define SOAP_STD_API __declspec(dllexport) +# else +# define SOAP_STD_API +# endif +#else +# define SOAP_STD_API +#endif + +struct SOAP_STD_API soap +{ short state; /* 0 = uninitialized, 1 = initialized, 2 = copy of another soap struct */ + short version; /* 1 = SOAP1.1 and 2 = SOAP1.2 (set automatically from namespace URI in nsmap table) */ + soap_mode mode; + soap_mode imode; + soap_mode omode; + const char *float_format; /* user-definable format string for floats (<1024 chars) */ + const char *double_format; /* user-definable format string for doubles (<1024 chars) */ + const char *dime_id_format; /* user-definable format string for integer DIME id ( 0, gives socket recv timeout in seconds, < 0 in usec */ + int send_timeout; /* when > 0, gives socket send timeout in seconds, < 0 in usec */ + int connect_timeout; /* when > 0, gives socket connect() timeout in seconds, < 0 in usec */ + int accept_timeout; /* when > 0, gives socket accept() timeout in seconds, < 0 in usec */ + int socket_flags; /* socket recv() and send() flags, e.g. set to MSG_NOSIGNAL to disable sigpipe */ + int connect_flags; /* connect() SOL_SOCKET sockopt flags, e.g. set to SO_DEBUG to debug socket */ + int bind_flags; /* bind() SOL_SOCKET sockopt flags, e.g. set to SO_REUSEADDR to enable reuse */ + int accept_flags; /* accept() SOL_SOCKET sockopt flags */ + unsigned short linger_time; /* linger time for SO_LINGER option */ + const struct Namespace *namespaces; /* Pointer to global namespace mapping table */ + struct Namespace *local_namespaces; /* Local namespace mapping table */ + struct soap_nlist *nlist; /* namespace stack */ + struct soap_blist *blist; /* block allocation stack */ + struct soap_clist *clist; /* class instance allocation list */ + void *alist; /* memory allocation (malloc) list */ + struct soap_ilist *iht[SOAP_IDHASH]; + struct soap_plist *pht[SOAP_PTRHASH]; + struct soap_pblk *pblk; /* plist block allocation */ + short pidx; /* plist block allocation */ + struct SOAP_ENV__Header *header; + struct SOAP_ENV__Fault *fault; + int idnum; + void *user; /* to pass user-defined data */ + struct soap_plugin *plugins; /* linked list of plug-in data */ + char *userid; /* HTTP Basic authorization userid */ + char *passwd; /* HTTP Basic authorization passwd */ + int (*fpost)(struct soap*, const char*, const char*, int, const char*, const char*, size_t); + int (*fget)(struct soap*); + int (*fput)(struct soap*); + int (*fdel)(struct soap*); + int (*fhead)(struct soap*); + int (*fform)(struct soap*); + int (*fposthdr)(struct soap*, const char*, const char*); + int (*fresponse)(struct soap*, int, size_t); + int (*fparse)(struct soap*); + int (*fparsehdr)(struct soap*, const char*, const char*); + int (*fheader)(struct soap*); + int (*fresolve)(struct soap*, const char*, struct in_addr* inaddr); + int (*fconnect)(struct soap*, const char*, const char*, int); + int (*fdisconnect)(struct soap*); + int (*fclosesocket)(struct soap*, SOAP_SOCKET); + int (*fshutdownsocket)(struct soap*, SOAP_SOCKET, int); + SOAP_SOCKET (*fopen)(struct soap*, const char*, const char*, int); + SOAP_SOCKET (*faccept)(struct soap*, SOAP_SOCKET, struct sockaddr*, int *n); + int (*fclose)(struct soap*); + int (*fsend)(struct soap*, const char*, size_t); + size_t (*frecv)(struct soap*, char*, size_t); + int (*fpoll)(struct soap*); + void (*fseterror)(struct soap*, const char **c, const char **s); + int (*fignore)(struct soap*, const char*); + int (*fserveloop)(struct soap*); + void *(*fplugin)(struct soap*, const char*); + void *(*fmalloc)(struct soap*, size_t); +#ifndef WITH_LEANER + int (*fprepareinit)(struct soap*); + int (*fpreparesend)(struct soap*, const char*, size_t); + int (*fpreparerecv)(struct soap*, const char*, size_t); + int (*fpreparefinal)(struct soap*); + void *(*fdimereadopen)(struct soap*, void*, const char*, const char*, const char*); + void *(*fdimewriteopen)(struct soap*, const char*, const char*, const char*); + void (*fdimereadclose)(struct soap*, void*); + void (*fdimewriteclose)(struct soap*, void*); + size_t (*fdimeread)(struct soap*, void*, char*, size_t); + int (*fdimewrite)(struct soap*, void*, const char*, size_t); + void *(*fmimereadopen)(struct soap*, void*, const char*, const char*, const char*); + void *(*fmimewriteopen)(struct soap*, void*, const char*, const char*, const char*, enum soap_mime_encoding); + void (*fmimereadclose)(struct soap*, void*); + void (*fmimewriteclose)(struct soap*, void*); + size_t (*fmimeread)(struct soap*, void*, char*, size_t); + int (*fmimewrite)(struct soap*, void*, const char*, size_t); +#endif + SOAP_SOCKET master; + SOAP_SOCKET socket; +#if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT) + std::ostream *os; + std::istream *is; +#else + void *os; /* preserve struct size */ + void *is; /* preserve struct size */ +#endif +#ifndef UNDER_CE + int sendfd; + int recvfd; +#else + FILE *sendfd; + FILE *recvfd; +#endif + size_t bufidx; /* index in soap.buf[] */ + size_t buflen; /* length of soap.buf[] content */ + soap_wchar ahead; /* parser lookahead */ + short cdata; /* CDATA parser state */ + short body; /* parsed XML element has a body or not */ + unsigned int level; /* XML nesting level */ + size_t count; /* message length counter */ + size_t length; /* message length as set by HTTP header */ + char *labbuf; /* look-aside buffer */ + size_t lablen; /* look-aside buffer allocated length */ + size_t labidx; /* look-aside buffer index to available part */ + char buf[SOAP_BUFLEN];/* send and receive buffer */ + char msgbuf[1024]; /* in/out buffer for HTTP/MIME headers >=1024 bytes */ + char tmpbuf[1024]; /* in/out buffer for HTTP/MIME headers, simpleType values, element and attribute tag names, and DIME must be >=1024 bytes */ + char tag[SOAP_TAGLEN]; + char id[SOAP_TAGLEN]; + char href[SOAP_TAGLEN]; + char type[SOAP_TAGLEN]; + char arrayType[SOAP_TAGLEN]; + char arraySize[SOAP_TAGLEN]; + char arrayOffset[SOAP_TAGLEN]; + short other; + short position; + int positions[SOAP_MAXDIMS]; + short root; + struct soap_attribute *attributes; /* attribute list */ + short encoding; /* when set, output encodingStyle */ + short mustUnderstand; /* a mustUnderstand element was parsed or is output */ + short null; /* parsed XML is xsi:nil */ + short ns; /* when not set, output full xmlns bindings */ + short part; /* parsing state */ + short alloced; + short peeked; + size_t chunksize; + size_t chunkbuflen; + char endpoint[SOAP_TAGLEN]; + char path[SOAP_TAGLEN]; + char host[SOAP_TAGLEN]; + char *action; + char *authrealm; /* HTTP authentication realm */ + char *prolog; /* XML declaration prolog */ + unsigned long ip; /* IP number */ + int port; /* port number */ + short keep_alive; /* connection should be kept open */ + short tcp_keep_alive; /* enable SO_KEEPALIVE */ + unsigned int tcp_keep_idle; /* set TCP_KEEPIDLE */ + unsigned int tcp_keep_intvl; /* set TCP_KEEPINTVL */ + unsigned int tcp_keep_cnt; /* set TCP_KEEPCNT */ + unsigned int max_keep_alive; /* maximum keep-alive session (default=100) */ + const char *proxy_http_version;/* HTTP version of proxy "1.0" or "1.1" */ + const char *proxy_host; /* Proxy Server host name */ + int proxy_port; /* Proxy Server port (default = 8080) */ + const char *proxy_userid; /* Proxy Authorization user name */ + const char *proxy_passwd; /* Proxy Authorization password */ + const char *proxy_from; /* X-Forwarding-For header returned by proxy */ + int status; /* -1 when request, else error code to be returned by server */ + int error; + int errmode; + int errnum; +#ifndef WITH_LEANER + struct soap_dom_element *dom; + struct soap_dime dime; + struct soap_mime mime; + struct soap_xlist *xlist; +#endif +#if !defined(WITH_LEAN) || defined(SOAP_DEBUG) + const char *logfile[SOAP_MAXLOGS]; + FILE *fdebug[SOAP_MAXLOGS]; + struct soap_mlist *mht[SOAP_PTRHASH]; +#endif +#ifndef WITH_LEAN + const char *c14ninclude; + const char *c14nexclude; + struct soap_cookie *cookies; + const char *cookie_domain; + const char *cookie_path; + int cookie_max; +#endif +#ifndef WITH_NOIO + int ipv6_multicast_if; /* always include this to keep the soap struct size the same in v4 and v6 */ + char* ipv4_multicast_if; /* always include this to keep the soap struct size the same in v4 and v6 */ + int ipv4_multicast_ttl; /* multicast scope */ +#ifdef WITH_IPV6 + struct sockaddr_storage peer; /* IPv6: set by soap_accept and by UDP recv */ +#else + struct sockaddr_in peer; /* IPv4: set by soap_connect/soap_accept and by UDP recv */ +#endif +#endif + size_t peerlen; +#ifdef WITH_OPENSSL + int (*fsslauth)(struct soap*); + int (*fsslverify)(int, X509_STORE_CTX*); + BIO *bio; + SSL *ssl; + SSL_CTX *ctx; + SSL_SESSION *session; +#else + void *fsslauth; /* dummy members, to preserve struct size */ + void *fsslverify; + void *bio; + void *ssl; + void *ctx; + void *session; +#endif + unsigned short ssl_flags; + const char *keyfile; + const char *password; + const char *dhfile; + const char *cafile; + const char *capath; + const char *crlfile; + const char *randfile; + char session_host[SOAP_TAGLEN]; + int session_port; +#ifdef WITH_C_LOCALE + locale_t c_locale; /* set to C locale by default */ +#else + void *c_locale; +#endif +#ifdef WITH_ZLIB + z_stream *d_stream; /* decompression stream */ + uLong z_crc; /* internal gzip crc */ +#else + void *d_stream; /* dummy members, to preserve struct size */ + soap_int32 z_crc; +#endif + short zlib_state; /* SOAP_ZLIB_NONE, SOAP_ZLIB_DEFLATE, or SOAP_ZLIB_INFLATE */ + short zlib_in; /* SOAP_ZLIB_NONE, SOAP_ZLIB_DEFLATE, or SOAP_ZLIB_GZIP */ + short zlib_out; /* SOAP_ZLIB_NONE, SOAP_ZLIB_DEFLATE, or SOAP_ZLIB_GZIP */ + char *z_buf; /* buffer */ + size_t z_buflen; + unsigned short z_level; /* compression level to be used (0=none, 1=fast to 9=best) */ + float z_ratio_in; /* detected compression ratio compressed_length/length of inbound message */ + float z_ratio_out; /* detected compression ratio compressed_length/length of outbound message */ +#ifdef WMW_RPM_IO + void *rpmreqid; +#endif +#ifdef __cplusplus + soap(); + soap(soap_mode); + soap(soap_mode, soap_mode); + soap(struct soap&); + virtual ~soap(); +#else + void (*dummy)(); +#endif +}; + +struct soap_code_map +{ long code; + const char *string; +}; + +/* forwarding list */ +struct soap_flist +{ struct soap_flist *next; + int type; + void *ptr; + unsigned int level; + size_t len; + void (*fcopy)(struct soap*, int, int, void*, size_t, const void*, size_t); +}; + +/* id-ref forwarding list */ +struct soap_ilist +{ struct soap_ilist *next; + int type; + size_t size; + void *link; + void *copy; + struct soap_flist *flist; + void *ptr; + unsigned int level; + char id[1]; /* the actual id string value flows into the allocated region below this struct */ +}; + +struct soap_plugin +{ struct soap_plugin *next; + const char *id; + void *data; + int (*fcopy)(struct soap *soap, struct soap_plugin *dst, struct soap_plugin *src); + void (*fdelete)(struct soap *soap, struct soap_plugin *p); /* should delete fields of plugin only and not free(p) */ +}; + +#ifndef WITH_NONAMESPACES +extern SOAP_NMAC struct Namespace namespaces[]; +#endif + +#ifndef WITH_LEAN +# define soap_get0(soap) (((soap)->bufidx>=(soap)->buflen && soap_recv(soap)) ? EOF : (unsigned char)(soap)->buf[(soap)->bufidx]) +# define soap_get1(soap) (((soap)->bufidx>=(soap)->buflen && soap_recv(soap)) ? EOF : (unsigned char)(soap)->buf[(soap)->bufidx++]) +#else +soap_wchar soap_get0(struct soap*); +soap_wchar soap_get1(struct soap*); +#endif + +#define soap_revget1(soap) ((soap)->bufidx--) +#define soap_unget(soap, c) ((soap)->ahead = c) +#define soap_register_plugin(soap, plugin) soap_register_plugin_arg(soap, plugin, NULL) +#define soap_imode(soap, n) ((soap)->mode = (soap)->imode = (n)) +#define soap_set_imode(soap, n) ((soap)->imode |= (n)) +#define soap_clr_imode(soap, n) ((soap)->imode &= ~(n)) +#define soap_omode(soap, n) ((soap)->mode = (soap)->omode = (n)) +#define soap_set_omode(soap, n) ((soap)->omode |= (n)) +#define soap_clr_omode(soap, n) ((soap)->omode &= ~(n)) +#define soap_set_mode(soap, n) ((soap)->imode |= (n), (soap)->omode |= (n)) +#define soap_clr_mode(soap, n) ((soap)->imode &= ~(n), (soap)->omode &= ~(n)) +#define soap_destroy(soap) soap_delete((soap), NULL) + +#ifdef HAVE_STRRCHR +# define soap_strrchr(s, t) strrchr(s, t) +#else + SOAP_FMAC1 char* SOAP_FMAC2 soap_strrchr(const char *s, int t); +#endif + +#ifdef HAVE_STRTOL +# define soap_strtol(s, t, b) strtol(s, t, b) +#else + SOAP_FMAC1 long SOAP_FMAC2 soap_strtol(const char *s, char **t, int b); +#endif + +#ifdef HAVE_STRTOUL +# define soap_strtoul(s, t, b) strtoul(s, t, b) +#else + SOAP_FMAC1 unsigned long SOAP_FMAC2 soap_strtoul(const char *s, char **t, int b); +#endif + +#if defined(WITH_OPENSSL) +# define soap_random soap_rand() +SOAP_FMAC1 int SOAP_FMAC2 soap_rand(void); +#elif defined(HAVE_RANDOM) +# define soap_random (int)random() +#else +# define soap_random rand() +#endif + +#ifdef WITH_NOIDREF +# define soap_embedded(s, p, t) (0) +# define soap_id_lookup(s, i, p, t, n, k) (p) +# define soap_id_forward(s, h, p, len, st, tt, n, k, fc) (p) +# define soap_reference(s, a, t) (1) +# define soap_array_reference(s, p, a, n, t) (1) +# define soap_embed(s, p, a, n, t, pp) (0) +# define soap_embedded_id(s, i, p, t) (i) +# define soap_is_embedded(s, p) (0) +# define soap_is_single(s, p) (1) +# define soap_lookup_type(s, i) (0) +# define soap_getindependent(s) (0) +# define soap_putindependent(s) (0) +# define soap_getelement(s, n) (n) +# define soap_putelement(s, p, t, i, n) (0) +# define soap_markelement(s, p, n) (0) +#endif + +SOAP_FMAC1 void SOAP_FMAC2 soap_header(struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_fault(struct soap*); +SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultcode(struct soap*); +SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultsubcode(struct soap*); +SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultstring(struct soap*); +SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultdetail(struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_serializeheader(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_putheader(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_getheader(struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_serializefault(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_putfault(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_getfault(struct soap*); + +SOAP_FMAC1 void SOAP_FMAC2 soap_ssl_init(); +SOAP_FMAC1 int SOAP_FMAC2 soap_poll(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_connect_command(struct soap*, int, const char*, const char*); +SOAP_FMAC1 int SOAP_FMAC2 soap_connect(struct soap*, const char*, const char*); +SOAP_FMAC1 SOAP_SOCKET SOAP_FMAC2 soap_bind(struct soap*, const char*, int, int); +SOAP_FMAC1 SOAP_SOCKET SOAP_FMAC2 soap_accept(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_accept(struct soap*); +SOAP_FMAC1 const char * SOAP_FMAC2 soap_ssl_error(struct soap*, int); + +SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_server_context(struct soap*, unsigned short, const char*, const char*, const char*, const char*, const char*, const char*, const char*); +SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_client_context(struct soap*, unsigned short, const char*, const char*, const char*, const char*, const char*); + +SOAP_FMAC1 int SOAP_FMAC2 soap_puthttphdr(struct soap*, int status, size_t count); + +SOAP_FMAC1 const char* SOAP_FMAC2 soap_get_header_attribute(struct soap*, const char*, const char*); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_decode_key(char*, size_t, const char*); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_decode_val(char*, size_t, const char*); + +SOAP_FMAC1 size_t SOAP_FMAC2 soap_hash(const char*); +SOAP_FMAC1 void SOAP_FMAC2 soap_set_endpoint(struct soap*, const char*); +SOAP_FMAC1 int SOAP_FMAC2 soap_flush_raw(struct soap*, const char*, size_t); +SOAP_FMAC1 int SOAP_FMAC2 soap_flush(struct soap*); +SOAP_FMAC1 soap_wchar SOAP_FMAC2 soap_get(struct soap*); +SOAP_FMAC1 soap_wchar SOAP_FMAC2 soap_getchar(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_tag_cmp(const char*, const char*); +SOAP_FMAC1 void SOAP_FMAC2 soap_set_fault(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_sender_fault(struct soap*, const char*, const char*); +SOAP_FMAC1 int SOAP_FMAC2 soap_sender_fault_subcode(struct soap*, const char*, const char*, const char*); +SOAP_FMAC1 int SOAP_FMAC2 soap_receiver_fault(struct soap*, const char*, const char*); +SOAP_FMAC1 int SOAP_FMAC2 soap_receiver_fault_subcode(struct soap*, const char*, const char*, const char*); +SOAP_FMAC1 int SOAP_FMAC2 soap_set_sender_error(struct soap*, const char*, const char*, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_set_receiver_error(struct soap*, const char*, const char*, int); + +SOAP_FMAC1 int SOAP_FMAC2 soap_send_raw(struct soap*, const char*, size_t); +SOAP_FMAC1 int SOAP_FMAC2 soap_recv_raw(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_recv(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_send(struct soap*, const char*); +SOAP_FMAC1 int SOAP_FMAC2 soap_send2(struct soap*, const char*, const char*); +SOAP_FMAC1 int SOAP_FMAC2 soap_send3(struct soap*, const char*, const char*, const char*); + +SOAP_FMAC1 int SOAP_FMAC2 soap_pututf8(struct soap*, unsigned long); +SOAP_FMAC1 soap_wchar SOAP_FMAC2 soap_getutf8(struct soap*); + +SOAP_FMAC1 int SOAP_FMAC2 soap_putbase64(struct soap*, const unsigned char*, int); +SOAP_FMAC1 unsigned char* SOAP_FMAC2 soap_getbase64(struct soap*, int*, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_puthex(struct soap*, const unsigned char*, int); +SOAP_FMAC1 unsigned char* SOAP_FMAC2 soap_gethex(struct soap*, int*); + +#ifndef WITH_LEANER +SOAP_FMAC1 int SOAP_FMAC2 soap_xop_forward(struct soap*, unsigned char**, int*, char**, char**, char**); +SOAP_FMAC1 int SOAP_FMAC2 soap_dime_forward(struct soap*, unsigned char**, int*, char**, char**, char**); +#endif + +#ifndef WITH_NOIDREF +SOAP_FMAC1 int SOAP_FMAC2 soap_pointer_lookup_id(struct soap*, void *p, int t, struct soap_plist**); +SOAP_FMAC1 int SOAP_FMAC2 soap_pointer_lookup(struct soap*, const void *p, int t, struct soap_plist**); +SOAP_FMAC1 int SOAP_FMAC2 soap_pointer_enter(struct soap*, const void *p, const struct soap_array *a, int n, int t, struct soap_plist**); +SOAP_FMAC1 int SOAP_FMAC2 soap_array_pointer_lookup(struct soap*, const void *p, const struct soap_array *a, int n, int t, struct soap_plist**); +SOAP_FMAC1 int SOAP_FMAC2 soap_embed(struct soap *soap, const void *p, const struct soap_array *a, int n, const char *tag, int type); +SOAP_FMAC1 struct soap_ilist* SOAP_FMAC2 soap_lookup(struct soap*, const char*); +SOAP_FMAC1 struct soap_ilist* SOAP_FMAC2 soap_enter(struct soap*, const char*); +SOAP_FMAC1 int SOAP_FMAC2 soap_resolve(struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_embedded(struct soap*, const void *p, int t); +SOAP_FMAC1 int SOAP_FMAC2 soap_reference(struct soap*, const void *p, int t); +SOAP_FMAC1 int SOAP_FMAC2 soap_array_reference(struct soap*, const void *p, const struct soap_array *a, int n, int t); +SOAP_FMAC1 int SOAP_FMAC2 soap_embedded_id(struct soap*, int id, const void *p, int t); +SOAP_FMAC1 int SOAP_FMAC2 soap_is_embedded(struct soap*, struct soap_plist*); +SOAP_FMAC1 int SOAP_FMAC2 soap_is_single(struct soap*, struct soap_plist*); +SOAP_FMAC1 void SOAP_FMAC2 soap_set_embedded(struct soap*, struct soap_plist*); +#endif + +SOAP_FMAC1 int SOAP_FMAC2 soap_begin_count(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_end_count(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_begin_send(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_end_send(struct soap*); + +SOAP_FMAC1 const struct soap_code_map* SOAP_FMAC2 soap_code(const struct soap_code_map*, const char*); +SOAP_FMAC1 long SOAP_FMAC2 soap_code_int(const struct soap_code_map*, const char*, long); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_code_str(const struct soap_code_map*, long); +SOAP_FMAC1 long SOAP_FMAC2 soap_code_bits(const struct soap_code_map*, const char*); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_code_list(struct soap*, const struct soap_code_map*, long); + +SOAP_FMAC1 int SOAP_FMAC2 soap_getline(struct soap*, char*, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_begin_recv(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_end_recv(struct soap*); + +SOAP_FMAC1 void* SOAP_FMAC2 soap_malloc(struct soap*, size_t); +SOAP_FMAC1 void SOAP_FMAC2 soap_dealloc(struct soap*, void*); +SOAP_FMAC1 struct soap_clist * SOAP_FMAC2 soap_link(struct soap*, void*, int, int, int (*fdelete)(struct soap_clist*)); +SOAP_FMAC1 void SOAP_FMAC2 soap_unlink(struct soap*, const void*); +SOAP_FMAC1 void SOAP_FMAC2 soap_free_temp(struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_del(struct soap*); + +SOAP_FMAC1 void* SOAP_FMAC2 soap_track_malloc(struct soap*, const char*, int, size_t); +SOAP_FMAC1 void SOAP_FMAC2 soap_track_free(struct soap*, const char*, int, void*); + +#ifndef WITH_NOIDREF +SOAP_FMAC1 int SOAP_FMAC2 soap_lookup_type(struct soap*, const char *id); +SOAP_FMAC1 void* SOAP_FMAC2 soap_id_lookup(struct soap*, const char *id, void **p, int t, size_t n, unsigned int k); +SOAP_FMAC1 void* SOAP_FMAC2 soap_id_forward(struct soap*, const char *id, void *p, size_t len, int st, int tt, size_t n, unsigned int k, void(*fcopy)(struct soap*, int, int, void*, size_t, const void*, size_t)); +#endif +SOAP_FMAC1 void* SOAP_FMAC2 soap_id_enter(struct soap*, const char *id, void *p, int t, size_t n, unsigned int k, const char *type, const char *arrayType, void *(*finstantiate)(struct soap*, int, const char*, const char*, size_t*)); +SOAP_FMAC1 void SOAP_FMAC2 soap_fcopy(struct soap *soap, int st, int tt, void *p, size_t, const void *q, size_t n); + +SOAP_FMAC1 int SOAP_FMAC2 soap_size(const int *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_getoffsets(const char *, const int *, int *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_getsize(const char *, const char *, int *); +SOAP_FMAC1 int SOAP_FMAC2 soap_getsizes(const char *, int *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_getposition(const char *, int *); + +SOAP_FMAC1 char* SOAP_FMAC2 soap_putsize(struct soap*, const char *, int); +SOAP_FMAC1 char* SOAP_FMAC2 soap_putsizesoffsets(struct soap*, const char *, const int *, const int *, int); +SOAP_FMAC1 char* SOAP_FMAC2 soap_putsizes(struct soap*, const char *, const int *, int); +SOAP_FMAC1 char* SOAP_FMAC2 soap_putoffset(struct soap*, int); +SOAP_FMAC1 char* SOAP_FMAC2 soap_putoffsets(struct soap*, const int *, int); + +SOAP_FMAC1 int SOAP_FMAC2 soap_closesock(struct soap*); + +SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new(void); +SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new1(soap_mode); +SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new2(soap_mode, soap_mode); +SOAP_FMAC1 void SOAP_FMAC2 soap_free(struct soap*); +SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy(const struct soap*); +SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy_context(struct soap*, const struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_copy_stream(struct soap*, struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_init(struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_init1(struct soap*, soap_mode); +SOAP_FMAC1 void SOAP_FMAC2 soap_init2(struct soap*, soap_mode, soap_mode); +SOAP_FMAC1 void SOAP_FMAC2 soap_done(struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_cleanup(struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_begin(struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_end(struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_delete(struct soap*, void*); + +#ifdef SOAP_DEBUG +SOAP_FMAC1 void SOAP_FMAC2 soap_set_recv_logfile(struct soap*, const char*); +SOAP_FMAC1 void SOAP_FMAC2 soap_set_sent_logfile(struct soap*, const char*); +SOAP_FMAC1 void SOAP_FMAC2 soap_set_test_logfile(struct soap*, const char*); +SOAP_FMAC1 void SOAP_FMAC2 soap_close_logfiles(struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_open_logfile(struct soap*, int); +#endif + +SOAP_FMAC1 const char* SOAP_FMAC2 soap_value(struct soap*); + +SOAP_FMAC1 int SOAP_FMAC2 soap_match_tag(struct soap*, const char*, const char *); +SOAP_FMAC1 int SOAP_FMAC2 soap_match_array(struct soap*, const char*); + +SOAP_FMAC1 int SOAP_FMAC2 soap_element(struct soap*, const char*, int, const char*); +SOAP_FMAC1 int SOAP_FMAC2 soap_element_begin_out(struct soap*, const char *tag, int id, const char *type); +SOAP_FMAC1 int SOAP_FMAC2 soap_array_begin_out(struct soap*, const char *tag, int id, const char *type, const char *offset); +SOAP_FMAC1 int SOAP_FMAC2 soap_element_ref(struct soap*, const char *tag, int id, int href); +SOAP_FMAC1 int SOAP_FMAC2 soap_element_href(struct soap*, const char *tag, int id, const char *ref, const char *val); +SOAP_FMAC1 int SOAP_FMAC2 soap_element_null(struct soap*, const char *tag, int id, const char *type); +SOAP_FMAC1 int SOAP_FMAC2 soap_element_id(struct soap*, const char *tag, int id, const void *p, const struct soap_array *a, int d, const char *type, int n); +SOAP_FMAC1 int SOAP_FMAC2 soap_element_result(struct soap*, const char *tag); +SOAP_FMAC1 void SOAP_FMAC2 soap_check_result(struct soap*, const char *tag); +SOAP_FMAC1 int SOAP_FMAC2 soap_element_end_out(struct soap*, const char *tag); +SOAP_FMAC1 int SOAP_FMAC2 soap_element_start_end_out(struct soap*, const char *tag); + +SOAP_FMAC1 int SOAP_FMAC2 soap_attribute(struct soap*, const char*, const char*); + +SOAP_FMAC1 int SOAP_FMAC2 soap_element_begin_in(struct soap*, const char *tag, int nillable, const char *type); + +SOAP_FMAC1 int SOAP_FMAC2 soap_element_end_in(struct soap*, const char *tag); + +SOAP_FMAC1 int SOAP_FMAC2 soap_peek_element(struct soap*); + +SOAP_FMAC1 void SOAP_FMAC2 soap_retry(struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_revert(struct soap*); + +SOAP_FMAC1 char* SOAP_FMAC2 soap_strdup(struct soap*, const char*); +SOAP_FMAC1 wchar_t* SOAP_FMAC2 soap_wstrdup(struct soap*, const wchar_t*); +SOAP_FMAC1 const char * SOAP_FMAC2 soap_strsearch(const char *big, const char *little); + +SOAP_FMAC1 int SOAP_FMAC2 soap_string_out(struct soap*, const char *s, int flag); +SOAP_FMAC1 char* SOAP_FMAC2 soap_string_in(struct soap*, int, long, long); + +#ifndef WITH_LEANER +SOAP_FMAC1 int SOAP_FMAC2 soap_wstring_out(struct soap*, const wchar_t *s, int flag); +SOAP_FMAC1 wchar_t* SOAP_FMAC2 soap_wstring_in(struct soap*, int, long, long); +#endif + +SOAP_FMAC1 int SOAP_FMAC2 soap_match_namespace(struct soap*, const char *, const char*, size_t n1, size_t n2); + +SOAP_FMAC1 int SOAP_FMAC2 soap_set_namespaces(struct soap*, const struct Namespace*); +SOAP_FMAC1 void SOAP_FMAC2 soap_set_local_namespaces(struct soap*); + +SOAP_FMAC1 void SOAP_FMAC2 soap_pop_namespace(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_push_namespace(struct soap*, const char *,const char *); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_current_namespace(struct soap *soap, const char *tag); + +SOAP_FMAC1 struct soap_nlist* SOAP_FMAC2 soap_lookup_ns(struct soap *soap, const char *tag, size_t n); + +SOAP_FMAC1 int SOAP_FMAC2 soap_store_lab(struct soap*, const char*, size_t); +SOAP_FMAC1 int SOAP_FMAC2 soap_append_lab(struct soap*, const char*, size_t); + +SOAP_FMAC1 struct soap_blist* SOAP_FMAC2 soap_new_block(struct soap*); +SOAP_FMAC1 void* SOAP_FMAC2 soap_push_block(struct soap*, struct soap_blist*, size_t); +SOAP_FMAC1 void SOAP_FMAC2 soap_pop_block(struct soap*, struct soap_blist*); +SOAP_FMAC1 size_t SOAP_FMAC2 soap_size_block(struct soap*, struct soap_blist*, size_t); +SOAP_FMAC1 char* SOAP_FMAC2 soap_first_block(struct soap*, struct soap_blist*); +SOAP_FMAC1 char* SOAP_FMAC2 soap_next_block(struct soap*, struct soap_blist*); +SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap*, struct soap_blist*); +SOAP_FMAC1 char* SOAP_FMAC2 soap_save_block(struct soap*, struct soap_blist*, char*, int); +SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap*, struct soap_blist*); + +SOAP_FMAC1 int SOAP_FMAC2 soap_envelope_begin_out(struct soap*); +SOAP_FMAC1 int soap_envelope_end_out(struct soap*); + +SOAP_FMAC1 int SOAP_FMAC2 soap_envelope_begin_in(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_envelope_end_in(struct soap*); + +SOAP_FMAC1 int SOAP_FMAC2 soap_body_begin_out(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_body_end_out(struct soap*); + +SOAP_FMAC1 int SOAP_FMAC2 soap_body_begin_in(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_body_end_in(struct soap*); + +SOAP_FMAC1 int SOAP_FMAC2 soap_recv_header(struct soap*); + +SOAP_FMAC1 int SOAP_FMAC2 soap_response(struct soap*, int); + +SOAP_FMAC1 int SOAP_FMAC2 soap_send_empty_response(struct soap*, int status); +SOAP_FMAC1 int SOAP_FMAC2 soap_recv_empty_response(struct soap*); + +SOAP_FMAC1 int SOAP_FMAC2 soap_send_fault(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_recv_fault(struct soap*); + +#ifndef WITH_NOSTDLIB +SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault(struct soap*, FILE*); +SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault_location(struct soap*, FILE*); +# ifndef WITH_LEAN +# ifdef __cplusplus +SOAP_FMAC1 void SOAP_FMAC2 soap_stream_fault(struct soap*, std::ostream&); +# endif +SOAP_FMAC1 char* SOAP_FMAC2 soap_sprint_fault(struct soap*, char*, size_t); +# endif +#endif + +SOAP_FMAC1 int SOAP_FMAC2 soap_s2byte(struct soap*, const char*, char*); +SOAP_FMAC1 int SOAP_FMAC2 soap_s2short(struct soap*, const char*, short*); +SOAP_FMAC1 int SOAP_FMAC2 soap_s2int(struct soap*, const char*, int*); +SOAP_FMAC1 int SOAP_FMAC2 soap_s2long(struct soap*, const char*, long*); +SOAP_FMAC1 int SOAP_FMAC2 soap_s2LONG64(struct soap*, const char*, LONG64*); +SOAP_FMAC1 int SOAP_FMAC2 soap_s2float(struct soap*, const char*, float*); +SOAP_FMAC1 int SOAP_FMAC2 soap_s2double(struct soap*, const char*, double*); +SOAP_FMAC1 int SOAP_FMAC2 soap_s2unsignedByte(struct soap*, const char*, unsigned char*); +SOAP_FMAC1 int SOAP_FMAC2 soap_s2unsignedShort(struct soap*, const char*, unsigned short*); +SOAP_FMAC1 int SOAP_FMAC2 soap_s2unsignedInt(struct soap*, const char*, unsigned int*); +SOAP_FMAC1 int SOAP_FMAC2 soap_s2unsignedLong(struct soap*, const char*, unsigned long*); +SOAP_FMAC1 int SOAP_FMAC2 soap_s2ULONG64(struct soap*, const char*, ULONG64*); +SOAP_FMAC1 int SOAP_FMAC2 soap_s2string(struct soap*, const char*, char**); +SOAP_FMAC1 int SOAP_FMAC2 soap_s2QName(struct soap*, const char*, char**); + +#ifndef WITH_LEAN +SOAP_FMAC1 int SOAP_FMAC2 soap_s2wchar(struct soap*, const char*, wchar_t**); +SOAP_FMAC1 int SOAP_FMAC2 soap_s2dateTime(struct soap*, const char*, time_t*); +SOAP_FMAC1 char* SOAP_FMAC2 soap_s2base64(struct soap*, const unsigned char*, char*, int); +SOAP_FMAC1 char* SOAP_FMAC2 soap_s2hex(struct soap*, const unsigned char*, char*, int); +#endif + +SOAP_FMAC1 const char* SOAP_FMAC2 soap_byte2s(struct soap*, char); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_short2s(struct soap*, short); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_int2s(struct soap*, int); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_long2s(struct soap*, long); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_LONG642s(struct soap*, LONG64); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_float2s(struct soap*, float); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_double2s(struct soap*, double); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_unsignedByte2s(struct soap*, unsigned char); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_unsignedShort2s(struct soap*, unsigned short); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_unsignedInt2s(struct soap*, unsigned int); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_unsignedLong2s(struct soap*, unsigned long); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_ULONG642s(struct soap*, ULONG64); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_QName2s(struct soap*, const char*); + +#ifndef WITH_LEAN +SOAP_FMAC1 const char* SOAP_FMAC2 soap_wchar2s(struct soap*, const wchar_t*); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_dateTime2s(struct soap*, time_t); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_base642s(struct soap*, const char*, char*, size_t, int*); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_hex2s(struct soap*, const char*, char*, size_t, int*); +#endif + + +SOAP_FMAC1 int* SOAP_FMAC2 soap_inint(struct soap*, const char *tag, int *p, const char *, int); +SOAP_FMAC1 char* SOAP_FMAC2 soap_inbyte(struct soap*, const char *tag, char *p, const char *, int); +SOAP_FMAC1 long* SOAP_FMAC2 soap_inlong(struct soap*, const char *tag, long *p, const char *, int); +SOAP_FMAC1 LONG64* SOAP_FMAC2 soap_inLONG64(struct soap*, const char *tag, LONG64 *p, const char *, int); +SOAP_FMAC1 short* SOAP_FMAC2 soap_inshort(struct soap*, const char *tag, short *p, const char *, int); +SOAP_FMAC1 float* SOAP_FMAC2 soap_infloat(struct soap*, const char *tag, float *p, const char *, int); +SOAP_FMAC1 double* SOAP_FMAC2 soap_indouble(struct soap*, const char *tag, double *p, const char *, int); +SOAP_FMAC1 unsigned char* SOAP_FMAC2 soap_inunsignedByte(struct soap*, const char *tag, unsigned char *p, const char *, int); +SOAP_FMAC1 unsigned short* SOAP_FMAC2 soap_inunsignedShort(struct soap*, const char *tag, unsigned short *p, const char *, int); +SOAP_FMAC1 unsigned int* SOAP_FMAC2 soap_inunsignedInt(struct soap*, const char *tag, unsigned int *p, const char *, int); +SOAP_FMAC1 unsigned long* SOAP_FMAC2 soap_inunsignedLong(struct soap*, const char *tag, unsigned long *p, const char *, int); +SOAP_FMAC1 ULONG64* SOAP_FMAC2 soap_inULONG64(struct soap*, const char *tag, ULONG64 *p, const char *, int); +SOAP_FMAC1 char** SOAP_FMAC2 soap_instring(struct soap*, const char *tag, char **p, const char *, int, int, long, long); +SOAP_FMAC1 char** SOAP_FMAC2 soap_inliteral(struct soap*, const char *tag, char **p); + +#ifndef WITH_LEAN +SOAP_FMAC1 time_t* SOAP_FMAC2 soap_indateTime(struct soap*, const char *tag, time_t *p, const char *, int); +SOAP_FMAC1 time_t SOAP_FMAC2 soap_timegm(struct tm*); +#endif + +#ifndef WITH_LEANER +SOAP_FMAC1 wchar_t** SOAP_FMAC2 soap_inwstring(struct soap*, const char *tag, wchar_t **p, const char *, int, long, long); +SOAP_FMAC1 wchar_t** SOAP_FMAC2 soap_inwliteral(struct soap*, const char *tag, wchar_t **p); +#endif + +SOAP_FMAC1 int SOAP_FMAC2 soap_outbyte(struct soap*, const char *tag, int id, const char *p, const char *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_outshort(struct soap*, const char *tag, int id, const short *p, const char *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_outint(struct soap*, const char *tag, int id, const int *p, const char *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_outlong(struct soap*, const char *tag, int id, const long *p, const char *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_outLONG64(struct soap*, const char *tag, int id, const LONG64 *p, const char *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_outfloat(struct soap*, const char *tag, int id, const float *p, const char *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_outdouble(struct soap*, const char *tag, int id, const double *p, const char *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_outunsignedByte(struct soap*, const char *tag, int id, const unsigned char *p, const char *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_outunsignedShort(struct soap*, const char *tag, int id, const unsigned short *p, const char *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_outunsignedInt(struct soap*, const char *tag, int id, const unsigned int *p, const char *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_outunsignedLong(struct soap*, const char *tag, int id, const unsigned long *p, const char *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_outULONG64(struct soap*, const char *tag, int id, const ULONG64 *p, const char *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_outstring(struct soap*, const char *tag, int id, char *const*p, const char *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_outliteral(struct soap*, const char *tag, char *const*p, const char *type); + +#ifndef WITH_LEAN +SOAP_FMAC1 int SOAP_FMAC2 soap_outdateTime(struct soap*, const char *tag, int id, const time_t *p, const char *, int); +#endif + +#ifndef WITH_LEANER +SOAP_FMAC1 int SOAP_FMAC2 soap_outwstring(struct soap*, const char *tag, int id, wchar_t *const*p, const char *, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_outwliteral(struct soap*, const char *tag, wchar_t *const*p, const char *type); +#endif + +#ifndef WITH_LEANER +SOAP_FMAC1 int SOAP_FMAC2 soap_attachment(struct soap *, const char*, int, const void*, const struct soap_array*, const char*, const char*, const char*, int, const char*, int); +SOAP_FMAC1 int SOAP_FMAC2 soap_move(struct soap*, long); +SOAP_FMAC1 size_t SOAP_FMAC2 soap_tell(struct soap*); +SOAP_FMAC1 char* SOAP_FMAC2 soap_dime_option(struct soap*, unsigned short, const char*); +SOAP_FMAC1 int SOAP_FMAC2 soap_getdimehdr(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_getdime(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_putdimehdr(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_putdime(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_getmimehdr(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_getmime(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_putmimehdr(struct soap*, struct soap_multipart*); +SOAP_FMAC1 int SOAP_FMAC2 soap_putmime(struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_set_dime(struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_set_mime(struct soap*, const char *boundary, const char *start); +SOAP_FMAC1 void SOAP_FMAC2 soap_clr_dime(struct soap*); +SOAP_FMAC1 void SOAP_FMAC2 soap_clr_mime(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_set_dime_attachment(struct soap*, char *ptr, size_t size, const char *type, const char *id, unsigned short optype, const char *option); +SOAP_FMAC1 int SOAP_FMAC2 soap_set_mime_attachment(struct soap*, char *ptr, size_t size, enum soap_mime_encoding encoding, const char *type, const char *id, const char *location, const char *description); +SOAP_FMAC1 void SOAP_FMAC2 soap_post_check_mime_attachments(struct soap *soap); +SOAP_FMAC1 int SOAP_FMAC2 soap_check_mime_attachments(struct soap *soap); +SOAP_FMAC1 struct soap_multipart* SOAP_FMAC2 soap_get_mime_attachment(struct soap *soap, void *handle); +SOAP_FMAC1 struct soap_multipart* SOAP_FMAC2 soap_next_multipart(struct soap_multipart*); +SOAP_FMAC1 int SOAP_FMAC2 soap_match_cid(struct soap*, const char*, const char*); +#endif + +SOAP_FMAC1 int SOAP_FMAC2 soap_register_plugin_arg(struct soap*, int (*fcreate)(struct soap*, struct soap_plugin*, void*), void*); +SOAP_FMAC1 void* SOAP_FMAC2 soap_lookup_plugin(struct soap*, const char*); + +SOAP_FMAC1 const char* SOAP_FMAC2 soap_attr_value(struct soap *soap, const char *name, int flag); +SOAP_FMAC1 int SOAP_FMAC2 soap_set_attr(struct soap *soap, const char *name, const char *value); +SOAP_FMAC1 void SOAP_FMAC2 soap_clr_attr(struct soap *soap); + +#ifdef WITH_COOKIES +SOAP_FMAC1 void SOAP_FMAC2 soap_getcookies(struct soap *soap, const char *val); +SOAP_FMAC1 size_t SOAP_FMAC2 soap_encode_cookie(const char*, char*, size_t); +SOAP_FMAC1 extern struct soap_cookie* SOAP_FMAC2 soap_set_cookie(struct soap*, const char*, const char*, const char*, const char*); +SOAP_FMAC1 extern struct soap_cookie* SOAP_FMAC2 soap_cookie(struct soap*, const char*, const char*, const char*); +SOAP_FMAC1 extern char* SOAP_FMAC2 soap_cookie_value(struct soap*, const char*, const char*, const char*); +SOAP_FMAC1 extern char* SOAP_FMAC2 soap_env_cookie_value(struct soap*, const char*, const char*, const char*); +SOAP_FMAC1 extern time_t SOAP_FMAC2 soap_cookie_expire(struct soap*, const char*, const char*, const char*); +SOAP_FMAC1 extern int SOAP_FMAC2 soap_set_cookie_expire(struct soap*, const char*, long, const char*, const char*); +SOAP_FMAC1 extern int SOAP_FMAC2 soap_set_cookie_session(struct soap*, const char*, const char*, const char*); +SOAP_FMAC1 extern int SOAP_FMAC2 soap_clr_cookie_session(struct soap*, const char*, const char*, const char*); +SOAP_FMAC1 extern void SOAP_FMAC2 soap_clr_cookie(struct soap*, const char*, const char*, const char*); +SOAP_FMAC1 extern int SOAP_FMAC2 soap_getenv_cookies(struct soap*); +SOAP_FMAC1 extern struct soap_cookie* SOAP_FMAC2 soap_copy_cookies(struct soap*, const struct soap*); +SOAP_FMAC1 extern void SOAP_FMAC2 soap_free_cookies(struct soap*); +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/inc/threads.h b/src/inc/threads.h new file mode 100644 index 0000000..75cf067 --- /dev/null +++ b/src/inc/threads.h @@ -0,0 +1,123 @@ +/* + +threads.h + +gSOAP XML Web services tools +Copyright (C) 2000-2005, Robert van Engelen, Genivia Inc., All Rights Reserved. +This part of the software is released under one of the following licenses: +GPL, the gSOAP public license, or Genivia's license for commercial use. +-------------------------------------------------------------------------------- +gSOAP public license. + +The contents of this file are subject to the gSOAP Public License Version 1.3 +(the "License"); you may not use this file except in compliance with the +License. You may obtain a copy of the License at +http://www.cs.fsu.edu/~engelen/soaplicense.html +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +for the specific language governing rights and limitations under the License. + +The Initial Developer of the Original Code is Robert A. van Engelen. +Copyright (C) 2000-2005, Robert van Engelen, Genivia Inc., All Rights Reserved. +-------------------------------------------------------------------------------- +GPL license. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA + +Author contact information: +engelen@genivia.com / engelen@acm.org + +This program is released under the GPL with the additional exemption that +compiling, linking, and/or using OpenSSL is allowed. +-------------------------------------------------------------------------------- +A commercial use license is available from Genivia, Inc., contact@genivia.com +-------------------------------------------------------------------------------- +*/ + +#ifndef THREADS_H +#define THREADS_H + +#ifndef WIN32 +# include /* defines _POSIX_THREADS if pthreads are available */ +#else +# define ssize_t int +# include +# include +# include +# include +#endif + +#if defined(_POSIX_THREADS) || defined(_SC_THREADS) +# include +#endif + +/******************************************************************************\ + * + * Threads + * +\******************************************************************************/ + +#if defined(WIN32) +# define THREAD_TYPE HANDLE +# define THREAD_ID GetCurrentThreadId() +# define THREAD_CREATE(x,y,z) *(x) = (HANDLE)_beginthread((y), 8*4096, (z)) +# define THREAD_DETACH(x) +# define THREAD_JOIN(x) WaitForSingleObject((x), INFINITE) +# define THREAD_EXIT _endthread() +# define MUTEX_TYPE HANDLE +# define MUTEX_SETUP(x) (x) = CreateMutex(NULL, FALSE, NULL) +# define MUTEX_CLEANUP(x) CloseHandle(x) +# define MUTEX_LOCK(x) WaitForSingleObject((x), INFINITE) +# define MUTEX_UNLOCK(x) ReleaseMutex(x) +# define COND_SETUP(x) emulate_pthread_cond_init(&(x)) +# define COND_CLEANUP(x) emulate_pthread_cond_destroy(&(x)) +# define COND_SIGNAL(x) emulate_pthread_cond_signal(&(x)) +# define COND_WAIT(x,y) emulate_pthread_cond_wait(&(x), &(y)) +typedef struct +{ u_int waiters_count_; + CRITICAL_SECTION waiters_count_lock_; + HANDLE signal_event_; +} COND_TYPE; +#ifdef __cplusplus +extern "C" { +#endif +int emulate_pthread_cond_init(COND_TYPE*); +int emulate_pthread_cond_destroy(COND_TYPE*); +int emulate_pthread_cond_signal(COND_TYPE*); +int emulate_pthread_cond_wait(COND_TYPE*, MUTEX_TYPE*); +#ifdef __cplusplus +} +#endif +#elif defined(_POSIX_THREADS) || defined(_SC_THREADS) +# define THREAD_TYPE pthread_t +# define THREAD_ID pthread_self() +# define THREAD_CREATE(x,y,z) pthread_create((x), NULL, (y), (z)) +# define THREAD_DETACH(x) pthread_detach((x)) +# define THREAD_JOIN(x) pthread_join((x), NULL) +# define THREAD_EXIT pthread_exit(NULL) +# define MUTEX_TYPE pthread_mutex_t +# define MUTEX_SETUP(x) pthread_mutex_init(&(x), NULL) +# define MUTEX_CLEANUP(x) pthread_mutex_destroy(&(x)) +# define MUTEX_LOCK(x) pthread_mutex_lock(&(x)) +# define MUTEX_UNLOCK(x) pthread_mutex_unlock(&(x)) +# define COND_TYPE pthread_cond_t +# define COND_SETUP(x) pthread_cond_init(&(x), NULL) +# define COND_CLEANUP(x) pthread_cond_destroy(&(x)) +# define COND_SIGNAL(x) pthread_cond_signal(&(x)) +# define COND_WAIT(x,y) pthread_cond_wait(&(x), &(y)) +#else +# error "No POSIX threads detected: we need thread and mutex operations. See for example OpenSSL /threads/th-lock.c on how to implement mutex on your platform" +#endif + +#endif diff --git a/src/init/cwmpd.init b/src/init/cwmpd.init new file mode 100644 index 0000000..022cd4d --- /dev/null +++ b/src/init/cwmpd.init @@ -0,0 +1,123 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2012 Inteno + +START=99 +STOP=40 + +EXTRA_HELP=" start [GetRPCMethods] Start cwmpd service and send GetRPCMethods" + +wait_connection_acs() { + default_acs="http://192.168.1.1:8080/openacs/acs" + acs_dhcp_discovery=`uci -q get cwmp.acs.dhcp_discovery` + url=`uci -q get cwmp.acs.url` + if [ \( "_$acs_dhcp_discovery" = "_enable" \) -o \( "_$url" = "_" \) ];then + url=`uci -P /var/state -q get provisioning.iup.tr069url` + elif [ "_$url" != "_" ];then + url=`uci -q get cwmp.acs.url` + else + url=$default_acs + fi + + dest=`echo $url|sed 's/http:\/\///g'|cut -f1 -d \/|cut -f1 -d:` + port=`echo $url|sed 's/http:\/\///g'|cut -f1 -d \/|cut -f2 -d:` + + if [ "_$port" = "_" ];then + port=80 + fi + + i=0 + result=1 + until [ \( $result -eq 0 \) -o \( $i -eq 20 \) ];do + echo -e -n "" | nc $dest $port + result=$? + if [ $result -eq 1 ];then + i=`expr $i + 1` + sleep 5 + fi + done +} + +check_dhcp() { + i=0 + dhcp_discovery=`uci -q get cwmp.acs.dhcp_discovery` + url=`uci -q get cwmp.acs.url` + if [ \( "_$acs_dhcp_discovery" = "_enable" \) -o \( "_$url" = "_" \) ] + then + while [ $i -le 10 ] + do + acs_url=`uci -P /var/state -q get provisioning.iup.tr069url` + if [ "$acs_url" != "" ] + then + echo "The acs url discovery from dhcp server is successfully done." + break + else + echo "Waiting for discovery of acs url from dhcp server ..." + sleep 10 + fi + i=`expr $i + 1` + done + fi +} + +start_msg="Starting cwmpd ..." +stop_msg="Stopping cwmpd ..." + +check_iccu() { + echo $start_msg + check_dhcp + wait_connection_acs + iccu_url=`uci get -q -P /etc/cwmpd/.iccu cwmp.cpe.iccu_url` + iccu_change_state=`uci get -q -P /etc/cwmpd/.iccu cwmp.cpe.iccu_change_state` + if [ "_$1" = "_boot" ];then + opt=$opt"-b " + fi + if [ "_$1" = "_GetRPCMethods" ];then + opt=$opt"-g " + fi + if [ "$iccu_change_state" = "yes" ];then + opt=$opt"-c " + fi + [ -f /etc/config/cwmp ] && /usr/bin/cwmpd $opt & + rm -rf /etc/cwmpd/.iccu + uci set -q -P /etc/cwmpd/.iccu cwmp.cpe.iccu_url=$iccu_url + uci set -q -P /etc/cwmpd/.iccu cwmp.cpe.iccu_change_state=no +} + +boot() { + /etc/cwmpd/scripts/iccu_enable && rm /etc/cwmpd/scripts/iccu_enable + run=$(ps aux|grep /usr/bin/cwmpd|grep -v grep|grep -v rc.common) + if [ "$run" = "" ];then + check_iccu "boot" + else + echo "cwmpd is currently running ..." + fi +} + +start() { + run=$(ps aux|grep /usr/bin/cwmpd|grep -v grep|grep -v rc.common) + if [ "$run" = "" ] + then + if [ "$1" = "GetRPCMethods" ];then + check_iccu "GetRPCMethods" + else + check_iccu + fi + else + echo "cwmpd is currently running ..." + fi +} + +stop() { + echo $stop_msg + for pid in `ps aux|grep /usr/bin/cwmpd|sed 's/^ \+//g'|sed 's/ \+/:/g'|grep -v grep|cut -f1 -d:` + do + if [ "_$pid" != "_" ];then + /bin/kill -9 $pid 2> /dev/null + fi + done +} + +restart() { + stop + start +} diff --git a/src/init/iccu.init b/src/init/iccu.init new file mode 100644 index 0000000..7647726 --- /dev/null +++ b/src/init/iccu.init @@ -0,0 +1,124 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2012 Inteno + +START=98 +STOP=40 + +wait_connection_acs() { + i=0 + result=1 + until [ \( $result -eq 0 \) -o \( $i -eq 20 \) ];do + echo -e -n "" | nc $1 $2 + result=$? + if [ $result -eq 1 ];then + i=`expr $i + 1` + sleep 5 + fi + done +} + +check_connection_request_url() { + cpe_port=`uci get cwmp.cpe.port` + if [ "_$cpe_port" = "_" ];then + cpe_port=7547 + fi + default_acs="http://192.168.1.1:8080/openacs/acs" + acs_dhcp_discovery=`uci -q get cwmp.acs.dhcp_discovery` + url=`uci -q get cwmp.acs.url` + if [ \( "_$acs_dhcp_discovery" = "_enable" \) -o \( "_$url" = "_" \) ];then + url=`uci -P /var/state -q get provisioning.iup.tr069url` + elif [ "_$url" != "_" ];then + url=`uci -q get cwmp.acs.url` + else + url=$default_acs + fi + + dest=`echo $url|sed 's/http:\/\///g'|cut -f1 -d \/|cut -f1 -d:` + port=`echo $url|sed 's/http:\/\///g'|cut -f1 -d \/|cut -f2 -d:` + + if [ "_$port" = "_" ];then + port=80 + fi + + isIP=`echo "$dest"|grep -v -e [a-zA-Z]` + if [ "_$isIP" != "_" ];then + list=`netstat -t -n|grep $dest:$port|sed 's/\ \+/-/g'|sed 's/-$//g'` + wait_connection_acs "$dest" "$port" + list2=`netstat -t -n|grep $dest:$port|sed 's/\ \+/-/g'|sed 's/-$//g'` + else + i=0 + result=1 + until [ \( $result -eq 0 \) -o \( $i -eq 20 \) ];do + nslookup $dest > /dev/null + result=$? + if [ $result -eq 1 ];then + i=`expr $i + 1` + sleep 5 + fi + done + if [ $result -eq 1 ];then + exit 1 + fi + number_entries=`nslookup $dest|wc -l` + n=`expr $number_entries - 4` + if [ $n -lt 0 ];then + exit 1 + fi + for addr in `nslookup $dest|tail -$n|grep Address|cut -f2 -d:|sed 's/^ //g'|cut -f1 -d " "`;do + list=$list`netstat -t -n|grep $addr:$port|sed 's/\ \+/-/g'|sed 's/-$//g'` + done + for addr in `nslookup $dest|tail -$n|grep Address|cut -f2 -d:|sed 's/^ //g'|cut -f1 -d " "`;do + wait_connection_acs "$addr" "$port" + list2=$list2`netstat -t -n|grep $addr:$port|sed 's/\ \+/-/g'|sed 's/-$//g'` + done + fi + for line2 in $list2;do + found=0 + for line in $list;do + if [ "_$line" = "_$line2" ];then + found=1 + break + fi + done + if [ $found -eq 1 ];then + continue + fi + ip=`echo $line2|cut -f4 -d -|cut -f1 -d:|uniq` + break + done + if [ "_$ip" = "_" ];then + exit 1 + fi + old_cr_url=`uci get -q -P /etc/cwmpd/.iccu cwmp.cpe.iccu_url` + if [ $? -eq 0 ];then + cr_url="http://$ip:$cpe_port" + if [ "_$cr_url" != "_$old_cr_url" ];then + rm -rf /etc/cwmpd/.iccu + uci set -q -P /etc/cwmpd/.iccu cwmp.cpe.iccu_url=$cr_url + cwmp_value_change "InternetGatewayDevice.ManagementServer.ConnectionRequestURL" + if [ $? -eq 1 ];then + uci set -q -P /etc/cwmpd/.iccu cwmp.cpe.iccu_change_state=yes + else + uci set -q -P /etc/cwmpd/.iccu cwmp.cpe.iccu_change_state=no + fi + uci commit + fi + else + rm -rf /etc/cwmpd/.iccu + uci set -q -P /etc/cwmpd/.iccu cwmp.cpe.iccu_url=http://$ip:$cpe_port + uci set -q -P /etc/cwmpd/.iccu cwmp.cpe.iccu_change_state=no + uci commit + fi +} + +boot() { + check_connection_request_url +} + +start() { + check_connection_request_url +} + +restart() { + start +} \ No newline at end of file diff --git a/src/init/iccu_enable b/src/init/iccu_enable new file mode 100644 index 0000000..f0623e9 --- /dev/null +++ b/src/init/iccu_enable @@ -0,0 +1,22 @@ +#!/bin/sh + +check_network=`uci get -q ucitrack.@network[0].affects|grep iccu` +if [ "_$check_network" = "_" ];then + uci add_list ucitrack.@network[0].affects=iccu +fi +check_cwmp=`uci get -q ucitrack.@cwmp[0]` +if [ "_$check_cwmp" = "_" ];then + uci add ucitrack cwmp + uci set ucitrack.@cwmp[0].init=cwmpd + uci add_list ucitrack.@cwmp[0].affects=iccu + uci add ucitrack iccu + uci set ucitrack.@iccu[0].init=iccu +fi +uci commit + +/etc/init.d/iccu enable +/etc/init.d/iccu boot + +cat /etc/init.d/cwmpd|grep -v "/etc/cwmpd/scripts/iccu_enable && rm /etc/cwmpd/scripts/iccu_enable" > /etc/init.d/cwmpd.new +mv /etc/init.d/cwmpd.new /etc/init.d/cwmpd +chmod +x /etc/init.d/cwmpd \ No newline at end of file diff --git a/src/kcwmp.c b/src/kcwmp.c new file mode 100644 index 0000000..9ee9869 --- /dev/null +++ b/src/kcwmp.c @@ -0,0 +1,197 @@ +/* + kcwmp.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "inc/cwmp_kernel.h" + +typedef struct kernel_cwmp_input { + char **argv; + int argc; + int handler; + struct mutex mutex; + wait_queue_head_t thresholdq; +} KERNEL_CWMP_INPUT; + +static struct sock *nl_sk = NULL; +static struct kernel_cwmp_input kernel_cwmp_input; + +MODULE_LICENSE("INTENO"); + +static void kernel_api_cwmp_value_change_listener(struct sk_buff *skb) +{ + + struct nlmsghdr *nlh; + int pid; + struct sk_buff *skb_out; + int msg_size; + char *msg; + char *recv; + int i,res; + + nlh = (struct nlmsghdr*)skb->data; + recv = (char*)nlmsg_data(nlh); + + if (strcmp(recv,NETLINK_CWMP_ID)!=0) + { + return; + } + pid = nlh->nlmsg_pid; /*pid of sending process */ + + + while (kernel_cwmp_input.argc==0) + { + if ( wait_event_interruptible( kernel_cwmp_input.thresholdq, kernel_cwmp_input.handler)) { + return ; + } + } + kernel_cwmp_input.handler = 0; + + mutex_lock (&(kernel_cwmp_input.mutex)); + + for (i=0;i<=kernel_cwmp_input.argc;i++) + { + if (i0) + { + kernel_cwmp_input.handler = 1; + wake_up_interruptible(&(kernel_cwmp_input.thresholdq)); + return 1; + } + + mutex_lock (&(kernel_cwmp_input.mutex)); + kernel_cwmp_input.argv = kmalloc(count*sizeof(char *),GFP_KERNEL); + + if (kernel_cwmp_input.argv==NULL) + { + goto kernel_api_cwmp_error; + } + + va_start(args, count); + for (i=0;i +#include +#include +#include +#include +#include +#include "cwmp.h" + +#define DEFAULT_LOG_SEVERITY 6 +static char *SEVERITY_NAMES[8] = {"[EMERG] ","[ALERT] ","[CRITIC] ","[ERROR] ","[WARNING]","[NOTICE] ","[INFO] ","[DEBUG] "}; +static int log_severity = DEFAULT_LOG_SEVERITY; +static long int log_max_size = DEFAULT_LOG_FILE_SIZE; +static char log_file_name[256]; +static bool enable_log_file = TRUE; +static bool enable_log_stdout = FALSE; +static pthread_mutex_t mutex_log; + +int log_set_severity_idx (char *value) +{ + int i; + for (i=0;i<8;i++) + { + if (strstr(SEVERITY_NAMES[i],value)!=NULL) + { + log_severity = i; + return 0; + } + } + return 1; +} + +int log_set_log_file_name (char *value) +{ + if(value != NULL) + { + strcpy(log_file_name,value); + } + else + { + strcpy(log_file_name,DEFAULT_LOG_FILE_NAME); + } +} +int log_set_file_max_size(char *value) +{ + if(value != NULL) + { + log_max_size = atol(value); + } +} +int log_set_on_console(char *value) +{ + if(strcmp(value,"enable") == 0) + { + enable_log_stdout = TRUE; + } + if(strcmp(value,"disable") == 0) + { + enable_log_stdout = FALSE; + } +} +int log_set_on_file(char *value) +{ + if(strcmp(value,"enable") == 0) + { + enable_log_file = TRUE; + } + if(strcmp(value,"disable") == 0) + { + enable_log_file = FALSE; + } +} + +void puts_log(int severity, const char *fmt, ...) +{ + va_list args; + int i; + char buf[1024]; + char buf_file[1024]; + time_t t; + struct tm *Tm; + struct timeval tv; + FILE *pLog; + struct stat st; + long int size = 0; + char log_file_name_bak[256]; + + if (severity>log_severity) + { + return; + } + + gettimeofday(&tv, 0); + t = time((time_t*)NULL); + Tm= localtime(&tv.tv_sec); + i = sprintf(buf,"%02d-%02d-%4d, %02d:%02d:%02d.%03d %s ", + Tm->tm_mday, + Tm->tm_mon+1, + Tm->tm_year+1900, + Tm->tm_hour, + Tm->tm_min, + Tm->tm_sec, + (int)tv.tv_usec%1000, + SEVERITY_NAMES[severity]); + + if(strlen(log_file_name) == 0) + { + strcpy(log_file_name,DEFAULT_LOG_FILE_NAME); + } + + if (stat(log_file_name, &st) == 0) + { + size = st.st_size; + } + + if(enable_log_file) + { + pthread_mutex_lock (&mutex_log); + if(size >= log_max_size) + { + sprintf(log_file_name_bak,"%s.1",log_file_name); + rename(log_file_name,log_file_name_bak); + pLog = fopen(log_file_name,"w"); + } + else + { + pLog = fopen(log_file_name,"a+"); + } + } + + va_start(args, fmt); + i += vsprintf(buf+i, fmt, args); + if(enable_log_file) + { + sprintf(buf_file,"%s\n",buf); + fputs (buf_file, pLog); + } + va_end(args); + if(enable_log_file) + { + fclose(pLog); + pthread_mutex_unlock (&mutex_log); + } + if(enable_log_stdout) + { + puts(buf); + } +} diff --git a/src/md5evp.c b/src/md5evp.c new file mode 100644 index 0000000..ad9a885 --- /dev/null +++ b/src/md5evp.c @@ -0,0 +1,102 @@ +/* + +md5evp.c + +gSOAP HTTP Content-MD5 digest EVP handler for httpmd5 plugin + +gSOAP XML Web services tools +Copyright (C) 2000-2005, Robert van Engelen, Genivia Inc., All Rights Reserved. +This part of the software is released under one of the following licenses: +GPL, the gSOAP public license, or Genivia's license for commercial use. +-------------------------------------------------------------------------------- +gSOAP public license. + +The contents of this file are subject to the gSOAP Public License Version 1.3 +(the "License"); you may not use this file except in compliance with the +License. You may obtain a copy of the License at +http://www.cs.fsu.edu/~engelen/soaplicense.html +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +for the specific language governing rights and limitations under the License. + +The Initial Developer of the Original Code is Robert A. van Engelen. +Copyright (C) 2000-2005, Robert van Engelen, Genivia, Inc., All Rights Reserved. +-------------------------------------------------------------------------------- +GPL license. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA + +Author contact information: +engelen@genivia.com / engelen@acm.org + +This program is released under the GPL with the additional exemption that +compiling, linking, and/or using OpenSSL is allowed. +-------------------------------------------------------------------------------- +A commercial use license is available from Genivia, Inc., contact@genivia.com +-------------------------------------------------------------------------------- +*/ + +#include "md5evp.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int md5_handler(struct soap *soap, void **context, enum md5_action action, char *buf, size_t len) +{ + EVP_MD_CTX *ctx; + unsigned char hash[EVP_MAX_MD_SIZE]; + unsigned int size; + switch (action) + { case MD5_INIT: +#ifdef WITH_OPENSSL + OpenSSL_add_all_digests(); +#endif + if (!*context) + { *context = (void*)SOAP_MALLOC(soap, sizeof(EVP_MD_CTX)); + EVP_MD_CTX_init((EVP_MD_CTX*)*context); + } + ctx = (EVP_MD_CTX*)*context; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "-- MD5 Init %p\n", ctx)); + EVP_DigestInit(ctx, EVP_md5()); + break; + case MD5_UPDATE: + ctx = (EVP_MD_CTX*)*context; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "-- MD5 Update %p --\n", ctx)); + DBGMSG(TEST, buf, len); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "\n--")); + EVP_DigestUpdate(ctx, (void*)buf, (unsigned int)len); + break; + case MD5_FINAL: + ctx = (EVP_MD_CTX*)*context; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "-- MD5 Final %p --\n", ctx)); + EVP_DigestFinal(ctx, (unsigned char*)hash, &size); + memcpy(buf, hash, 16); + break; + case MD5_DELETE: + ctx = (EVP_MD_CTX*)*context; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "-- MD5 Delete %p --\n", ctx)); + if (ctx) + { EVP_MD_CTX_cleanup(ctx); + SOAP_FREE(soap, ctx); + } + *context = NULL; + } + return SOAP_OK; +} + +#ifdef __cplusplus +} +#endif + diff --git a/src/soapC.c b/src/soapC.c new file mode 100644 index 0000000..ab54924 --- /dev/null +++ b/src/soapC.c @@ -0,0 +1,12549 @@ +/* soapC.c + Generated by gSOAP 2.7.12 from cwmp-1-1.h + Copyright(C) 2000-2008, Robert van Engelen, Genivia Inc. All Rights Reserved. + This part of the software is released under one of the following licenses: + GPL, the gSOAP public license, or Genivia's license for commercial use. +*/ + +#include "soapH.h" + +#ifdef __cplusplus +extern "C" { +#endif + +SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.12 2011-10-17 13:06:56 GMT") + + +#ifndef WITH_NOGLOBAL + +SOAP_FMAC3 void SOAP_FMAC4 soap_serializeheader(struct soap *soap) +{ + if (soap->header) + soap_serialize_SOAP_ENV__Header(soap, soap->header); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_putheader(struct soap *soap) +{ + if (soap->header) + { soap->part = SOAP_IN_HEADER; + if (soap_out_SOAP_ENV__Header(soap, "SOAP-ENV:Header", 0, soap->header, NULL)) + return soap->error; + soap->part = SOAP_END_HEADER; + } + return SOAP_OK; +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_getheader(struct soap *soap) +{ + soap->part = SOAP_IN_HEADER; + soap->header = soap_in_SOAP_ENV__Header(soap, "SOAP-ENV:Header", NULL, NULL); + soap->part = SOAP_END_HEADER; + return soap->header == NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_header(struct soap *soap) +{ + if (!soap->header) + { soap->header = (struct SOAP_ENV__Header*)soap_malloc(soap, sizeof(struct SOAP_ENV__Header)); + soap_default_SOAP_ENV__Header(soap, soap->header); + } +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_fault(struct soap *soap) +{ + if (!soap->fault) + { soap->fault = (struct SOAP_ENV__Fault*)soap_malloc(soap, sizeof(struct SOAP_ENV__Fault)); + if (!soap->fault) + return; + soap_default_SOAP_ENV__Fault(soap, soap->fault); + } + if (soap->version == 2 && !soap->fault->SOAP_ENV__Code) + { soap->fault->SOAP_ENV__Code = (struct SOAP_ENV__Code*)soap_malloc(soap, sizeof(struct SOAP_ENV__Code)); + soap_default_SOAP_ENV__Code(soap, soap->fault->SOAP_ENV__Code); + } + if (soap->version == 2 && !soap->fault->SOAP_ENV__Reason) + { soap->fault->SOAP_ENV__Reason = (struct SOAP_ENV__Reason*)soap_malloc(soap, sizeof(struct SOAP_ENV__Reason)); + soap_default_SOAP_ENV__Reason(soap, soap->fault->SOAP_ENV__Reason); + } +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serializefault(struct soap *soap) +{ + if (soap->fault) + soap_serialize_SOAP_ENV__Fault(soap, soap->fault); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_putfault(struct soap *soap) +{ + if (soap->fault) + return soap_put_SOAP_ENV__Fault(soap, soap->fault, "SOAP-ENV:Fault", NULL); + return SOAP_OK; +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_getfault(struct soap *soap) +{ + return (soap->fault = soap_get_SOAP_ENV__Fault(soap, NULL, "SOAP-ENV:Fault", NULL)) == NULL; +} + +SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultcode(struct soap *soap) +{ + soap_fault(soap); + if (soap->version == 2) + return (const char**)&soap->fault->SOAP_ENV__Code->SOAP_ENV__Value; + return (const char**)&soap->fault->faultcode; +} + +SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultsubcode(struct soap *soap) +{ + soap_fault(soap); + if (soap->version == 2) + { if (!soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode) + { soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode = (struct SOAP_ENV__Code*)soap_malloc(soap, sizeof(struct SOAP_ENV__Code)); + soap_default_SOAP_ENV__Code(soap, soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode); + } + return (const char**)&soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode->SOAP_ENV__Value; + } + return (const char**)&soap->fault->faultcode; +} + +SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultstring(struct soap *soap) +{ + soap_fault(soap); + if (soap->version == 2) + return (const char**)&soap->fault->SOAP_ENV__Reason->SOAP_ENV__Text; + return (const char**)&soap->fault->faultstring; +} + +SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultdetail(struct soap *soap) +{ + soap_fault(soap); + if (soap->version == 1) + { if (!soap->fault->detail) + { soap->fault->detail = (struct SOAP_ENV__Detail*)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail)); + soap_default_SOAP_ENV__Detail(soap, soap->fault->detail); + } + return (const char**)&soap->fault->detail->__any; + } + if (!soap->fault->SOAP_ENV__Detail) + { soap->fault->SOAP_ENV__Detail = (struct SOAP_ENV__Detail*)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail)); + soap_default_SOAP_ENV__Detail(soap, soap->fault->SOAP_ENV__Detail); + } + return (const char**)&soap->fault->SOAP_ENV__Detail->__any; +} + +#endif + +#ifndef WITH_NOIDREF +SOAP_FMAC3 int SOAP_FMAC4 soap_getindependent(struct soap *soap) +{ + int t; + for (;;) + if (!soap_getelement(soap, &t)) + if (soap->error || soap_ignore_element(soap)) + break; + if (soap->error == SOAP_NO_TAG || soap->error == SOAP_EOF) + soap->error = SOAP_OK; + return soap->error; +} +#endif + +#ifndef WITH_NOIDREF +SOAP_FMAC3 void * SOAP_FMAC4 soap_getelement(struct soap *soap, int *type) +{ + if (soap_peek_element(soap)) + return NULL; + if (!*soap->id || !(*type = soap_lookup_type(soap, soap->id))) + *type = soap_lookup_type(soap, soap->href); + switch (*type) + { + case SOAP_TYPE_byte: + return soap_in_byte(soap, NULL, NULL, "xsd:byte"); + case SOAP_TYPE_int: + return soap_in_int(soap, NULL, NULL, "xsd:int"); + case SOAP_TYPE_unsignedByte: + return soap_in_unsignedByte(soap, NULL, NULL, "xsd:unsignedByte"); + case SOAP_TYPE_unsignedInt: + return soap_in_unsignedInt(soap, NULL, NULL, "xsd:unsignedInt"); + case SOAP_TYPE_time: + return soap_in_time(soap, NULL, NULL, "xsd:dateTime"); + case SOAP_TYPE__cwmp1__UploadResponse_Status: + return soap_in__cwmp1__UploadResponse_Status(soap, NULL, NULL, "cwmp:UploadResponse-Status"); + case SOAP_TYPE__cwmp1__DownloadResponse_Status: + return soap_in__cwmp1__DownloadResponse_Status(soap, NULL, NULL, "cwmp:DownloadResponse-Status"); + case SOAP_TYPE__cwmp1__DeleteObjectResponse_Status: + return soap_in__cwmp1__DeleteObjectResponse_Status(soap, NULL, NULL, "cwmp:DeleteObjectResponse-Status"); + case SOAP_TYPE__cwmp1__AddObjectResponse_Status: + return soap_in__cwmp1__AddObjectResponse_Status(soap, NULL, NULL, "cwmp:AddObjectResponse-Status"); + case SOAP_TYPE__cwmp1__SetParameterValuesResponse_Status: + return soap_in__cwmp1__SetParameterValuesResponse_Status(soap, NULL, NULL, "cwmp:SetParameterValuesResponse-Status"); + case SOAP_TYPE__cwmp1__OptionStruct_IsTransferable: + return soap_in__cwmp1__OptionStruct_IsTransferable(soap, NULL, NULL, "cwmp:OptionStruct-IsTransferable"); + case SOAP_TYPE__cwmp1__OptionStruct_Mode: + return soap_in__cwmp1__OptionStruct_Mode(soap, NULL, NULL, "cwmp:OptionStruct-Mode"); + case SOAP_TYPE__cwmp1__OptionStruct_State: + return soap_in__cwmp1__OptionStruct_State(soap, NULL, NULL, "cwmp:OptionStruct-State"); + case SOAP_TYPE__cwmp1__AllQueuedTransferStruct_State: + return soap_in__cwmp1__AllQueuedTransferStruct_State(soap, NULL, NULL, "cwmp:AllQueuedTransferStruct-State"); + case SOAP_TYPE__cwmp1__QueuedTransferStruct_State: + return soap_in__cwmp1__QueuedTransferStruct_State(soap, NULL, NULL, "cwmp:QueuedTransferStruct-State"); + case SOAP_TYPE__cwmp1__ParameterAttributeStruct_Notification: + return soap_in__cwmp1__ParameterAttributeStruct_Notification(soap, NULL, NULL, "cwmp:ParameterAttributeStruct-Notification"); + case SOAP_TYPE__cwmp1__SetParameterAttributesStruct_Notification: + return soap_in__cwmp1__SetParameterAttributesStruct_Notification(soap, NULL, NULL, "cwmp:SetParameterAttributesStruct-Notification"); + case SOAP_TYPE_xsd__boolean: + return soap_in_xsd__boolean(soap, NULL, NULL, "xsd:boolean"); + case SOAP_TYPE_cwmp1__Inform: + return soap_in_cwmp1__Inform(soap, NULL, NULL, "cwmp:Inform"); + case SOAP_TYPE_cwmp1__InformResponse: + return soap_in_cwmp1__InformResponse(soap, NULL, NULL, "cwmp:InformResponse"); + case SOAP_TYPE_cwmp1FileTypeArg: + return soap_in_cwmp1FileTypeArg(soap, NULL, NULL, "cwmp:ArgStruct"); + case SOAP_TYPE_cwmp1EventList: + return soap_in_cwmp1EventList(soap, NULL, NULL, "cwmp:EventStruct"); + case SOAP_TYPE_cwmp1AllTransferList: + return soap_in_cwmp1AllTransferList(soap, NULL, NULL, "cwmp:AllQueuedTransferStruct"); + case SOAP_TYPE_cwmp1OptionList: + return soap_in_cwmp1OptionList(soap, NULL, NULL, "cwmp:OptionStruct"); + case SOAP_TYPE_cwmp1VoucherList: + return soap_in_cwmp1VoucherList(soap, NULL, NULL, "SOAP-ENC:base64"); + case SOAP_TYPE_cwmp1TransferList: + return soap_in_cwmp1TransferList(soap, NULL, NULL, "cwmp:QueuedTransferStruct"); + case SOAP_TYPE_cwmp1ParameterAttributeList: + return soap_in_cwmp1ParameterAttributeList(soap, NULL, NULL, "cwmp:ParameterAttributeStruct"); + case SOAP_TYPE_cwmp1SetParameterAttributesList: + return soap_in_cwmp1SetParameterAttributesList(soap, NULL, NULL, "cwmp:SetParameterAttributesStruct"); + case SOAP_TYPE_cwmp1ParameterInfoList: + return soap_in_cwmp1ParameterInfoList(soap, NULL, NULL, "cwmp:ParameterInfoStruct"); + case SOAP_TYPE_cwmp1ParameterNames: + return soap_in_cwmp1ParameterNames(soap, NULL, NULL, "xsd:string"); + case SOAP_TYPE_cwmp1ParameterValueList: + return soap_in_cwmp1ParameterValueList(soap, NULL, NULL, "cwmp:ParameterValueStruct"); + case SOAP_TYPE_cwmp1MethodList: + return soap_in_cwmp1MethodList(soap, NULL, NULL, "xsd:string"); + case SOAP_TYPE_cwmp1__OptionStruct: + return soap_in_cwmp1__OptionStruct(soap, NULL, NULL, "cwmp:OptionStruct"); + case SOAP_TYPE_cwmp1__ArgStruct: + return soap_in_cwmp1__ArgStruct(soap, NULL, NULL, "cwmp:ArgStruct"); + case SOAP_TYPE_cwmp1__AllQueuedTransferStruct: + return soap_in_cwmp1__AllQueuedTransferStruct(soap, NULL, NULL, "cwmp:AllQueuedTransferStruct"); + case SOAP_TYPE_cwmp1__QueuedTransferStruct: + return soap_in_cwmp1__QueuedTransferStruct(soap, NULL, NULL, "cwmp:QueuedTransferStruct"); + case SOAP_TYPE_cwmp1__ParameterAttributeStruct: + return soap_in_cwmp1__ParameterAttributeStruct(soap, NULL, NULL, "cwmp:ParameterAttributeStruct"); + case SOAP_TYPE_cwmp1AccessList: + return soap_in_cwmp1AccessList(soap, NULL, NULL, "xsd:string"); + case SOAP_TYPE_cwmp1__SetParameterAttributesStruct: + return soap_in_cwmp1__SetParameterAttributesStruct(soap, NULL, NULL, "cwmp:SetParameterAttributesStruct"); + case SOAP_TYPE_cwmp1__ParameterInfoStruct: + return soap_in_cwmp1__ParameterInfoStruct(soap, NULL, NULL, "cwmp:ParameterInfoStruct"); + case SOAP_TYPE_cwmp1__ParameterValueStruct: + return soap_in_cwmp1__ParameterValueStruct(soap, NULL, NULL, "cwmp:ParameterValueStruct"); + case SOAP_TYPE_cwmp1__EventStruct: + return soap_in_cwmp1__EventStruct(soap, NULL, NULL, "cwmp:EventStruct"); + case SOAP_TYPE_cwmp1__DeviceIdStruct: + return soap_in_cwmp1__DeviceIdStruct(soap, NULL, NULL, "cwmp:DeviceIdStruct"); + case SOAP_TYPE_cwmp1__FaultStruct: + return soap_in_cwmp1__FaultStruct(soap, NULL, NULL, "cwmp:FaultStruct"); + case SOAP_TYPE_SOAP_ENC__base64: + return soap_in_SOAP_ENC__base64(soap, NULL, NULL, "SOAP-ENC:base64"); + case SOAP_TYPE_PointerTounsignedInt: + return soap_in_PointerTounsignedInt(soap, NULL, NULL, "xsd:unsignedInt"); + case SOAP_TYPE_PointerToPointerTocwmp1__ArgStruct: + return soap_in_PointerToPointerTocwmp1__ArgStruct(soap, NULL, NULL, "cwmp:ArgStruct"); + case SOAP_TYPE_PointerTocwmp1__ArgStruct: + return soap_in_PointerTocwmp1__ArgStruct(soap, NULL, NULL, "cwmp:ArgStruct"); + case SOAP_TYPE_PointerToPointerTocwmp1__OptionStruct: + return soap_in_PointerToPointerTocwmp1__OptionStruct(soap, NULL, NULL, "cwmp:OptionStruct"); + case SOAP_TYPE_PointerTocwmp1__OptionStruct: + return soap_in_PointerTocwmp1__OptionStruct(soap, NULL, NULL, "cwmp:OptionStruct"); + case SOAP_TYPE_PointerToPointerToSOAP_ENC__base64: + return soap_in_PointerToPointerToSOAP_ENC__base64(soap, NULL, NULL, "SOAP-ENC:base64"); + case SOAP_TYPE_PointerToSOAP_ENC__base64: + return soap_in_PointerToSOAP_ENC__base64(soap, NULL, NULL, "SOAP-ENC:base64"); + case SOAP_TYPE_PointerToPointerTocwmp1__AllQueuedTransferStruct: + return soap_in_PointerToPointerTocwmp1__AllQueuedTransferStruct(soap, NULL, NULL, "cwmp:AllQueuedTransferStruct"); + case SOAP_TYPE_PointerTocwmp1__AllQueuedTransferStruct: + return soap_in_PointerTocwmp1__AllQueuedTransferStruct(soap, NULL, NULL, "cwmp:AllQueuedTransferStruct"); + case SOAP_TYPE_PointerToPointerTocwmp1__QueuedTransferStruct: + return soap_in_PointerToPointerTocwmp1__QueuedTransferStruct(soap, NULL, NULL, "cwmp:QueuedTransferStruct"); + case SOAP_TYPE_PointerTocwmp1__QueuedTransferStruct: + return soap_in_PointerTocwmp1__QueuedTransferStruct(soap, NULL, NULL, "cwmp:QueuedTransferStruct"); + case SOAP_TYPE_PointerToPointerTocwmp1__ParameterAttributeStruct: + return soap_in_PointerToPointerTocwmp1__ParameterAttributeStruct(soap, NULL, NULL, "cwmp:ParameterAttributeStruct"); + case SOAP_TYPE_PointerTocwmp1__ParameterAttributeStruct: + return soap_in_PointerTocwmp1__ParameterAttributeStruct(soap, NULL, NULL, "cwmp:ParameterAttributeStruct"); + case SOAP_TYPE_PointerToPointerTocwmp1__SetParameterAttributesStruct: + return soap_in_PointerToPointerTocwmp1__SetParameterAttributesStruct(soap, NULL, NULL, "cwmp:SetParameterAttributesStruct"); + case SOAP_TYPE_PointerTocwmp1__SetParameterAttributesStruct: + return soap_in_PointerTocwmp1__SetParameterAttributesStruct(soap, NULL, NULL, "cwmp:SetParameterAttributesStruct"); + case SOAP_TYPE_PointerToPointerTocwmp1__ParameterInfoStruct: + return soap_in_PointerToPointerTocwmp1__ParameterInfoStruct(soap, NULL, NULL, "cwmp:ParameterInfoStruct"); + case SOAP_TYPE_PointerTocwmp1__ParameterInfoStruct: + return soap_in_PointerTocwmp1__ParameterInfoStruct(soap, NULL, NULL, "cwmp:ParameterInfoStruct"); + case SOAP_TYPE_PointerToPointerTocwmp1__ParameterValueStruct: + return soap_in_PointerToPointerTocwmp1__ParameterValueStruct(soap, NULL, NULL, "cwmp:ParameterValueStruct"); + case SOAP_TYPE_PointerTocwmp1__ParameterValueStruct: + return soap_in_PointerTocwmp1__ParameterValueStruct(soap, NULL, NULL, "cwmp:ParameterValueStruct"); + case SOAP_TYPE_PointerToPointerTocwmp1__EventStruct: + return soap_in_PointerToPointerTocwmp1__EventStruct(soap, NULL, NULL, "cwmp:EventStruct"); + case SOAP_TYPE_PointerTocwmp1__EventStruct: + return soap_in_PointerTocwmp1__EventStruct(soap, NULL, NULL, "cwmp:EventStruct"); + case SOAP_TYPE_PointerTocwmp1FileTypeArg: + return soap_in_PointerTocwmp1FileTypeArg(soap, NULL, NULL, "cwmp:ArgStruct"); + case SOAP_TYPE_PointerTocwmp1__FaultStruct: + return soap_in_PointerTocwmp1__FaultStruct(soap, NULL, NULL, "cwmp:FaultStruct"); + case SOAP_TYPE_PointerTocwmp1EventList: + return soap_in_PointerTocwmp1EventList(soap, NULL, NULL, "cwmp:EventStruct"); + case SOAP_TYPE_PointerTocwmp1__DeviceIdStruct: + return soap_in_PointerTocwmp1__DeviceIdStruct(soap, NULL, NULL, "cwmp:DeviceIdStruct"); + case SOAP_TYPE_PointerTocwmp1AllTransferList: + return soap_in_PointerTocwmp1AllTransferList(soap, NULL, NULL, "cwmp:AllQueuedTransferStruct"); + case SOAP_TYPE_PointerTocwmp1OptionList: + return soap_in_PointerTocwmp1OptionList(soap, NULL, NULL, "cwmp:OptionStruct"); + case SOAP_TYPE_PointerTocwmp1VoucherList: + return soap_in_PointerTocwmp1VoucherList(soap, NULL, NULL, "SOAP-ENC:base64"); + case SOAP_TYPE_PointerTocwmp1TransferList: + return soap_in_PointerTocwmp1TransferList(soap, NULL, NULL, "cwmp:QueuedTransferStruct"); + case SOAP_TYPE_PointerTocwmp1ParameterAttributeList: + return soap_in_PointerTocwmp1ParameterAttributeList(soap, NULL, NULL, "cwmp:ParameterAttributeStruct"); + case SOAP_TYPE_PointerTocwmp1SetParameterAttributesList: + return soap_in_PointerTocwmp1SetParameterAttributesList(soap, NULL, NULL, "cwmp:SetParameterAttributesStruct"); + case SOAP_TYPE_PointerTocwmp1ParameterInfoList: + return soap_in_PointerTocwmp1ParameterInfoList(soap, NULL, NULL, "cwmp:ParameterInfoStruct"); + case SOAP_TYPE_PointerTocwmp1ParameterNames: + return soap_in_PointerTocwmp1ParameterNames(soap, NULL, NULL, "xsd:string"); + case SOAP_TYPE_PointerTocwmp1ParameterValueList: + return soap_in_PointerTocwmp1ParameterValueList(soap, NULL, NULL, "cwmp:ParameterValueStruct"); + case SOAP_TYPE_PointerTocwmp1MethodList: + return soap_in_PointerTocwmp1MethodList(soap, NULL, NULL, "xsd:string"); + case SOAP_TYPE_PointerTo_cwmp1__Fault_SetParameterValuesFault: + return soap_in_PointerTo_cwmp1__Fault_SetParameterValuesFault(soap, NULL, NULL, "cwmp:Fault-SetParameterValuesFault"); + case SOAP_TYPE_PointerTotime: + return soap_in_PointerTotime(soap, NULL, NULL, "xsd:dateTime"); + case SOAP_TYPE_PointerTocwmp1AccessList: + return soap_in_PointerTocwmp1AccessList(soap, NULL, NULL, "xsd:string"); + case SOAP_TYPE_PointerTostring: + return soap_in_PointerTostring(soap, NULL, NULL, "xsd:string"); + case SOAP_TYPE_cwmp1__ObjectNameType: + { char **s; + s = soap_in_cwmp1__ObjectNameType(soap, NULL, NULL, "cwmp:ObjectNameType"); + return s ? *s : NULL; + } + case SOAP_TYPE_cwmp1__CommandKeyType: + { char **s; + s = soap_in_cwmp1__CommandKeyType(soap, NULL, NULL, "cwmp:CommandKeyType"); + return s ? *s : NULL; + } + case SOAP_TYPE_cwmp1__ParameterKeyType: + { char **s; + s = soap_in_cwmp1__ParameterKeyType(soap, NULL, NULL, "cwmp:ParameterKeyType"); + return s ? *s : NULL; + } + case SOAP_TYPE_cwmp1__FaultCodeType: + { char **s; + s = soap_in_cwmp1__FaultCodeType(soap, NULL, NULL, "cwmp:FaultCodeType"); + return s ? *s : NULL; + } + case SOAP_TYPE_xsd__anySimpleType: + { char **s; + s = soap_in_xsd__anySimpleType(soap, NULL, NULL, "xsd:anySimpleType"); + return s ? *s : NULL; + } + case SOAP_TYPE_PointerTounsignedByte: + return soap_in_PointerTounsignedByte(soap, NULL, NULL, "xsd:unsignedByte"); + case SOAP_TYPE_string: + { char **s; + s = soap_in_string(soap, NULL, NULL, "xsd:string"); + return s ? *s : NULL; + } + default: + { const char *t = soap->type; + if (!*t) + t = soap->tag; + if (!soap_match_tag(soap, t, "xsd:byte")) + { *type = SOAP_TYPE_byte; + return soap_in_byte(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "xsd:int")) + { *type = SOAP_TYPE_int; + return soap_in_int(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "xsd:unsignedByte")) + { *type = SOAP_TYPE_unsignedByte; + return soap_in_unsignedByte(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "xsd:unsignedInt")) + { *type = SOAP_TYPE_unsignedInt; + return soap_in_unsignedInt(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "xsd:dateTime")) + { *type = SOAP_TYPE_time; + return soap_in_time(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:UploadResponse-Status")) + { *type = SOAP_TYPE__cwmp1__UploadResponse_Status; + return soap_in__cwmp1__UploadResponse_Status(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:DownloadResponse-Status")) + { *type = SOAP_TYPE__cwmp1__DownloadResponse_Status; + return soap_in__cwmp1__DownloadResponse_Status(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:DeleteObjectResponse-Status")) + { *type = SOAP_TYPE__cwmp1__DeleteObjectResponse_Status; + return soap_in__cwmp1__DeleteObjectResponse_Status(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:AddObjectResponse-Status")) + { *type = SOAP_TYPE__cwmp1__AddObjectResponse_Status; + return soap_in__cwmp1__AddObjectResponse_Status(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:SetParameterValuesResponse-Status")) + { *type = SOAP_TYPE__cwmp1__SetParameterValuesResponse_Status; + return soap_in__cwmp1__SetParameterValuesResponse_Status(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:OptionStruct-IsTransferable")) + { *type = SOAP_TYPE__cwmp1__OptionStruct_IsTransferable; + return soap_in__cwmp1__OptionStruct_IsTransferable(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:OptionStruct-Mode")) + { *type = SOAP_TYPE__cwmp1__OptionStruct_Mode; + return soap_in__cwmp1__OptionStruct_Mode(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:OptionStruct-State")) + { *type = SOAP_TYPE__cwmp1__OptionStruct_State; + return soap_in__cwmp1__OptionStruct_State(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:AllQueuedTransferStruct-State")) + { *type = SOAP_TYPE__cwmp1__AllQueuedTransferStruct_State; + return soap_in__cwmp1__AllQueuedTransferStruct_State(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:QueuedTransferStruct-State")) + { *type = SOAP_TYPE__cwmp1__QueuedTransferStruct_State; + return soap_in__cwmp1__QueuedTransferStruct_State(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:ParameterAttributeStruct-Notification")) + { *type = SOAP_TYPE__cwmp1__ParameterAttributeStruct_Notification; + return soap_in__cwmp1__ParameterAttributeStruct_Notification(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:SetParameterAttributesStruct-Notification")) + { *type = SOAP_TYPE__cwmp1__SetParameterAttributesStruct_Notification; + return soap_in__cwmp1__SetParameterAttributesStruct_Notification(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "xsd:boolean")) + { *type = SOAP_TYPE_xsd__boolean; + return soap_in_xsd__boolean(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:Inform")) + { *type = SOAP_TYPE_cwmp1__Inform; + return soap_in_cwmp1__Inform(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:InformResponse")) + { *type = SOAP_TYPE_cwmp1__InformResponse; + return soap_in_cwmp1__InformResponse(soap, NULL, NULL, NULL); + } + if (*soap->arrayType && !soap_match_array(soap, "cwmp:ArgStruct")) + { *type = SOAP_TYPE_cwmp1FileTypeArg; + return soap_in_cwmp1FileTypeArg(soap, NULL, NULL, NULL); + } + if (*soap->arrayType && !soap_match_array(soap, "cwmp:EventStruct")) + { *type = SOAP_TYPE_cwmp1EventList; + return soap_in_cwmp1EventList(soap, NULL, NULL, NULL); + } + if (*soap->arrayType && !soap_match_array(soap, "cwmp:AllQueuedTransferStruct")) + { *type = SOAP_TYPE_cwmp1AllTransferList; + return soap_in_cwmp1AllTransferList(soap, NULL, NULL, NULL); + } + if (*soap->arrayType && !soap_match_array(soap, "cwmp:OptionStruct")) + { *type = SOAP_TYPE_cwmp1OptionList; + return soap_in_cwmp1OptionList(soap, NULL, NULL, NULL); + } + if (*soap->arrayType && !soap_match_array(soap, "SOAP-ENC:base64")) + { *type = SOAP_TYPE_cwmp1VoucherList; + return soap_in_cwmp1VoucherList(soap, NULL, NULL, NULL); + } + if (*soap->arrayType && !soap_match_array(soap, "cwmp:QueuedTransferStruct")) + { *type = SOAP_TYPE_cwmp1TransferList; + return soap_in_cwmp1TransferList(soap, NULL, NULL, NULL); + } + if (*soap->arrayType && !soap_match_array(soap, "cwmp:ParameterAttributeStruct")) + { *type = SOAP_TYPE_cwmp1ParameterAttributeList; + return soap_in_cwmp1ParameterAttributeList(soap, NULL, NULL, NULL); + } + if (*soap->arrayType && !soap_match_array(soap, "cwmp:SetParameterAttributesStruct")) + { *type = SOAP_TYPE_cwmp1SetParameterAttributesList; + return soap_in_cwmp1SetParameterAttributesList(soap, NULL, NULL, NULL); + } + if (*soap->arrayType && !soap_match_array(soap, "cwmp:ParameterInfoStruct")) + { *type = SOAP_TYPE_cwmp1ParameterInfoList; + return soap_in_cwmp1ParameterInfoList(soap, NULL, NULL, NULL); + } + if (*soap->arrayType && !soap_match_array(soap, "xsd:string")) + { *type = SOAP_TYPE_cwmp1ParameterNames; + return soap_in_cwmp1ParameterNames(soap, NULL, NULL, NULL); + } + if (*soap->arrayType && !soap_match_array(soap, "cwmp:ParameterValueStruct")) + { *type = SOAP_TYPE_cwmp1ParameterValueList; + return soap_in_cwmp1ParameterValueList(soap, NULL, NULL, NULL); + } + if (*soap->arrayType && !soap_match_array(soap, "xsd:string")) + { *type = SOAP_TYPE_cwmp1MethodList; + return soap_in_cwmp1MethodList(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:OptionStruct")) + { *type = SOAP_TYPE_cwmp1__OptionStruct; + return soap_in_cwmp1__OptionStruct(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:ArgStruct")) + { *type = SOAP_TYPE_cwmp1__ArgStruct; + return soap_in_cwmp1__ArgStruct(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:AllQueuedTransferStruct")) + { *type = SOAP_TYPE_cwmp1__AllQueuedTransferStruct; + return soap_in_cwmp1__AllQueuedTransferStruct(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:QueuedTransferStruct")) + { *type = SOAP_TYPE_cwmp1__QueuedTransferStruct; + return soap_in_cwmp1__QueuedTransferStruct(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:ParameterAttributeStruct")) + { *type = SOAP_TYPE_cwmp1__ParameterAttributeStruct; + return soap_in_cwmp1__ParameterAttributeStruct(soap, NULL, NULL, NULL); + } + if (*soap->arrayType && !soap_match_array(soap, "xsd:string")) + { *type = SOAP_TYPE_cwmp1AccessList; + return soap_in_cwmp1AccessList(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:SetParameterAttributesStruct")) + { *type = SOAP_TYPE_cwmp1__SetParameterAttributesStruct; + return soap_in_cwmp1__SetParameterAttributesStruct(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:ParameterInfoStruct")) + { *type = SOAP_TYPE_cwmp1__ParameterInfoStruct; + return soap_in_cwmp1__ParameterInfoStruct(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:ParameterValueStruct")) + { *type = SOAP_TYPE_cwmp1__ParameterValueStruct; + return soap_in_cwmp1__ParameterValueStruct(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:EventStruct")) + { *type = SOAP_TYPE_cwmp1__EventStruct; + return soap_in_cwmp1__EventStruct(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:DeviceIdStruct")) + { *type = SOAP_TYPE_cwmp1__DeviceIdStruct; + return soap_in_cwmp1__DeviceIdStruct(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:FaultStruct")) + { *type = SOAP_TYPE_cwmp1__FaultStruct; + return soap_in_cwmp1__FaultStruct(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "SOAP-ENC:base64")) + { *type = SOAP_TYPE_SOAP_ENC__base64; + return soap_in_SOAP_ENC__base64(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:ObjectNameType")) + { char **s; + *type = SOAP_TYPE_cwmp1__ObjectNameType; + s = soap_in_cwmp1__ObjectNameType(soap, NULL, NULL, NULL); + return s ? *s : NULL; + } + if (!soap_match_tag(soap, t, "cwmp:CommandKeyType")) + { char **s; + *type = SOAP_TYPE_cwmp1__CommandKeyType; + s = soap_in_cwmp1__CommandKeyType(soap, NULL, NULL, NULL); + return s ? *s : NULL; + } + if (!soap_match_tag(soap, t, "cwmp:ParameterKeyType")) + { char **s; + *type = SOAP_TYPE_cwmp1__ParameterKeyType; + s = soap_in_cwmp1__ParameterKeyType(soap, NULL, NULL, NULL); + return s ? *s : NULL; + } + if (!soap_match_tag(soap, t, "cwmp:FaultCodeType")) + { char **s; + *type = SOAP_TYPE_cwmp1__FaultCodeType; + s = soap_in_cwmp1__FaultCodeType(soap, NULL, NULL, NULL); + return s ? *s : NULL; + } + if (!soap_match_tag(soap, t, "xsd:anySimpleType")) + { char **s; + *type = SOAP_TYPE_xsd__anySimpleType; + s = soap_in_xsd__anySimpleType(soap, NULL, NULL, NULL); + return s ? *s : NULL; + } + if (!soap_match_tag(soap, t, "xsd:string")) + { char **s; + *type = SOAP_TYPE_string; + s = soap_in_string(soap, NULL, NULL, NULL); + return s ? *s : NULL; + } + t = soap->tag; +/* KMD */ +#if 0 + if (!soap_match_tag(soap, t, "cwmp:HoldRequests")) + { *type = SOAP_TYPE__cwmp1__HoldRequests; + return soap_in__cwmp1__HoldRequests(soap, NULL, NULL, NULL); + } +#endif + if (!soap_match_tag(soap, t, "cwmp:ID")) + { *type = SOAP_TYPE__cwmp1__ID; + return soap_in__cwmp1__ID(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:RequestDownloadResponse")) + { *type = SOAP_TYPE__cwmp1__RequestDownloadResponse; + return soap_in__cwmp1__RequestDownloadResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:RequestDownload")) + { *type = SOAP_TYPE__cwmp1__RequestDownload; + return soap_in__cwmp1__RequestDownload(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:KickedResponse")) + { *type = SOAP_TYPE__cwmp1__KickedResponse; + return soap_in__cwmp1__KickedResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:Kicked")) + { *type = SOAP_TYPE__cwmp1__Kicked; + return soap_in__cwmp1__Kicked(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:AutonomousTransferCompleteResponse")) + { *type = SOAP_TYPE__cwmp1__AutonomousTransferCompleteResponse; + return soap_in__cwmp1__AutonomousTransferCompleteResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:AutonomousTransferComplete")) + { *type = SOAP_TYPE__cwmp1__AutonomousTransferComplete; + return soap_in__cwmp1__AutonomousTransferComplete(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:TransferCompleteResponse")) + { *type = SOAP_TYPE__cwmp1__TransferCompleteResponse; + return soap_in__cwmp1__TransferCompleteResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:TransferComplete")) + { *type = SOAP_TYPE__cwmp1__TransferComplete; + return soap_in__cwmp1__TransferComplete(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:InformResponse")) + { *type = SOAP_TYPE__cwmp1__InformResponse; + return soap_in__cwmp1__InformResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:Inform")) + { *type = SOAP_TYPE__cwmp1__Inform; + return soap_in__cwmp1__Inform(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:GetAllQueuedTransfersResponse")) + { *type = SOAP_TYPE__cwmp1__GetAllQueuedTransfersResponse; + return soap_in__cwmp1__GetAllQueuedTransfersResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:GetAllQueuedTransfers")) + { *type = SOAP_TYPE__cwmp1__GetAllQueuedTransfers; + return soap_in__cwmp1__GetAllQueuedTransfers(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:FactoryResetResponse")) + { *type = SOAP_TYPE__cwmp1__FactoryResetResponse; + return soap_in__cwmp1__FactoryResetResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:FactoryReset")) + { *type = SOAP_TYPE__cwmp1__FactoryReset; + return soap_in__cwmp1__FactoryReset(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:UploadResponse")) + { *type = SOAP_TYPE__cwmp1__UploadResponse; + return soap_in__cwmp1__UploadResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:Upload")) + { *type = SOAP_TYPE__cwmp1__Upload; + return soap_in__cwmp1__Upload(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:GetOptionsResponse")) + { *type = SOAP_TYPE__cwmp1__GetOptionsResponse; + return soap_in__cwmp1__GetOptionsResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:GetOptions")) + { *type = SOAP_TYPE__cwmp1__GetOptions; + return soap_in__cwmp1__GetOptions(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:SetVouchersResponse")) + { *type = SOAP_TYPE__cwmp1__SetVouchersResponse; + return soap_in__cwmp1__SetVouchersResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:SetVouchers")) + { *type = SOAP_TYPE__cwmp1__SetVouchers; + return soap_in__cwmp1__SetVouchers(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:ScheduleInformResponse")) + { *type = SOAP_TYPE__cwmp1__ScheduleInformResponse; + return soap_in__cwmp1__ScheduleInformResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:ScheduleInform")) + { *type = SOAP_TYPE__cwmp1__ScheduleInform; + return soap_in__cwmp1__ScheduleInform(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:GetQueuedTransfersResponse")) + { *type = SOAP_TYPE__cwmp1__GetQueuedTransfersResponse; + return soap_in__cwmp1__GetQueuedTransfersResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:GetQueuedTransfers")) + { *type = SOAP_TYPE__cwmp1__GetQueuedTransfers; + return soap_in__cwmp1__GetQueuedTransfers(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:RebootResponse")) + { *type = SOAP_TYPE__cwmp1__RebootResponse; + return soap_in__cwmp1__RebootResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:Reboot")) + { *type = SOAP_TYPE__cwmp1__Reboot; + return soap_in__cwmp1__Reboot(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:DownloadResponse")) + { *type = SOAP_TYPE__cwmp1__DownloadResponse; + return soap_in__cwmp1__DownloadResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:Download")) + { *type = SOAP_TYPE__cwmp1__Download; + return soap_in__cwmp1__Download(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:DeleteObjectResponse")) + { *type = SOAP_TYPE__cwmp1__DeleteObjectResponse; + return soap_in__cwmp1__DeleteObjectResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:DeleteObject")) + { *type = SOAP_TYPE__cwmp1__DeleteObject; + return soap_in__cwmp1__DeleteObject(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:AddObjectResponse")) + { *type = SOAP_TYPE__cwmp1__AddObjectResponse; + return soap_in__cwmp1__AddObjectResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:AddObject")) + { *type = SOAP_TYPE__cwmp1__AddObject; + return soap_in__cwmp1__AddObject(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:GetParameterAttributesResponse")) + { *type = SOAP_TYPE__cwmp1__GetParameterAttributesResponse; + return soap_in__cwmp1__GetParameterAttributesResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:GetParameterAttributes")) + { *type = SOAP_TYPE__cwmp1__GetParameterAttributes; + return soap_in__cwmp1__GetParameterAttributes(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:SetParameterAttributesResponse")) + { *type = SOAP_TYPE__cwmp1__SetParameterAttributesResponse; + return soap_in__cwmp1__SetParameterAttributesResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:SetParameterAttributes")) + { *type = SOAP_TYPE__cwmp1__SetParameterAttributes; + return soap_in__cwmp1__SetParameterAttributes(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:GetParameterNamesResponse")) + { *type = SOAP_TYPE__cwmp1__GetParameterNamesResponse; + return soap_in__cwmp1__GetParameterNamesResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:GetParameterNames")) + { *type = SOAP_TYPE__cwmp1__GetParameterNames; + return soap_in__cwmp1__GetParameterNames(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:GetParameterValuesResponse")) + { *type = SOAP_TYPE__cwmp1__GetParameterValuesResponse; + return soap_in__cwmp1__GetParameterValuesResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:GetParameterValues")) + { *type = SOAP_TYPE__cwmp1__GetParameterValues; + return soap_in__cwmp1__GetParameterValues(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:SetParameterValuesResponse")) + { *type = SOAP_TYPE__cwmp1__SetParameterValuesResponse; + return soap_in__cwmp1__SetParameterValuesResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:SetParameterValues")) + { *type = SOAP_TYPE__cwmp1__SetParameterValues; + return soap_in__cwmp1__SetParameterValues(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:GetRPCMethodsResponse")) + { *type = SOAP_TYPE__cwmp1__GetRPCMethodsResponse; + return soap_in__cwmp1__GetRPCMethodsResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:GetRPCMethods")) + { *type = SOAP_TYPE__cwmp1__GetRPCMethods; + return soap_in__cwmp1__GetRPCMethods(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:Fault-SetParameterValuesFault")) + { *type = SOAP_TYPE__cwmp1__Fault_SetParameterValuesFault; + return soap_in__cwmp1__Fault_SetParameterValuesFault(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "cwmp:Fault")) + { *type = SOAP_TYPE__cwmp1__Fault; + return soap_in__cwmp1__Fault(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "xsd:QName")) + { char **s; + *type = SOAP_TYPE__QName; + s = soap_in__QName(soap, NULL, NULL, NULL); + return s ? *s : NULL; + } + } + } + soap->error = SOAP_TAG_MISMATCH; + return NULL; +} +#endif + +SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap *soap) +{ + if (!soap_peek_element(soap)) + { int t; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unexpected element '%s' in input (level=%u, %d)\n", soap->tag, soap->level, soap->body)); +#if 0 + if (soap->mustUnderstand && !soap->other) + return soap->error = SOAP_MUSTUNDERSTAND; /* KMD IN */ +#endif + if (((soap->mode & SOAP_XML_STRICT) && soap->part != SOAP_IN_HEADER) || !soap_match_tag(soap, soap->tag, "SOAP-ENV:")) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "REJECTING element '%s'\n", soap->tag)); + return soap->error = SOAP_TAG_MISMATCH; + } + if (!*soap->id || !soap_getelement(soap, &t)) + { soap->peeked = 0; + if (soap->fignore) + soap->error = soap->fignore(soap, soap->tag); + else + soap->error = SOAP_OK; + DBGLOG(TEST, if (!soap->error) SOAP_MESSAGE(fdebug, "IGNORING element '%s'\n", soap->tag)); + if (!soap->error && soap->body) + { soap->level++; + while (!soap_ignore_element(soap)) + ; + if (soap->error == SOAP_NO_TAG) + soap->error = soap_element_end_in(soap, NULL); + } + } + } + return soap->error; +} + +#ifndef WITH_NOIDREF +SOAP_FMAC3 int SOAP_FMAC4 soap_putindependent(struct soap *soap) +{ + int i; + struct soap_plist *pp; + if (soap->version == 1 && soap->encodingStyle && !(soap->mode & (SOAP_XML_TREE | SOAP_XML_GRAPH))) + for (i = 0; i < SOAP_PTRHASH; i++) + for (pp = soap->pht[i]; pp; pp = pp->next) + if (pp->mark1 == 2 || pp->mark2 == 2) + if (soap_putelement(soap, pp->ptr, "id", pp->id, pp->type)) + return soap->error; + return SOAP_OK; +} +#endif + +#ifndef WITH_NOIDREF +SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap *soap, const void *ptr, const char *tag, int id, int type) +{ + switch (type) + { + case SOAP_TYPE_byte: + return soap_out_byte(soap, tag, id, (const char *)ptr, "xsd:byte"); + case SOAP_TYPE_int: + return soap_out_int(soap, tag, id, (const int *)ptr, "xsd:int"); + case SOAP_TYPE_unsignedByte: + return soap_out_unsignedByte(soap, tag, id, (const unsigned char *)ptr, "xsd:unsignedByte"); + case SOAP_TYPE_unsignedInt: + return soap_out_unsignedInt(soap, tag, id, (const unsigned int *)ptr, "xsd:unsignedInt"); + case SOAP_TYPE_time: + return soap_out_time(soap, tag, id, (const time_t *)ptr, "xsd:dateTime"); + case SOAP_TYPE__cwmp1__UploadResponse_Status: + return soap_out__cwmp1__UploadResponse_Status(soap, tag, id, (const enum _cwmp1__UploadResponse_Status *)ptr, "cwmp:UploadResponse-Status"); + case SOAP_TYPE__cwmp1__DownloadResponse_Status: + return soap_out__cwmp1__DownloadResponse_Status(soap, tag, id, (const enum _cwmp1__DownloadResponse_Status *)ptr, "cwmp:DownloadResponse-Status"); + case SOAP_TYPE__cwmp1__DeleteObjectResponse_Status: + return soap_out__cwmp1__DeleteObjectResponse_Status(soap, tag, id, (const enum _cwmp1__DeleteObjectResponse_Status *)ptr, "cwmp:DeleteObjectResponse-Status"); + case SOAP_TYPE__cwmp1__AddObjectResponse_Status: + return soap_out__cwmp1__AddObjectResponse_Status(soap, tag, id, (const enum _cwmp1__AddObjectResponse_Status *)ptr, "cwmp:AddObjectResponse-Status"); + case SOAP_TYPE__cwmp1__SetParameterValuesResponse_Status: + return soap_out__cwmp1__SetParameterValuesResponse_Status(soap, tag, id, (const enum _cwmp1__SetParameterValuesResponse_Status *)ptr, "cwmp:SetParameterValuesResponse-Status"); + case SOAP_TYPE__cwmp1__OptionStruct_IsTransferable: + return soap_out__cwmp1__OptionStruct_IsTransferable(soap, tag, id, (const enum _cwmp1__OptionStruct_IsTransferable *)ptr, "cwmp:OptionStruct-IsTransferable"); + case SOAP_TYPE__cwmp1__OptionStruct_Mode: + return soap_out__cwmp1__OptionStruct_Mode(soap, tag, id, (const enum _cwmp1__OptionStruct_Mode *)ptr, "cwmp:OptionStruct-Mode"); + case SOAP_TYPE__cwmp1__OptionStruct_State: + return soap_out__cwmp1__OptionStruct_State(soap, tag, id, (const enum _cwmp1__OptionStruct_State *)ptr, "cwmp:OptionStruct-State"); + case SOAP_TYPE__cwmp1__AllQueuedTransferStruct_State: + return soap_out__cwmp1__AllQueuedTransferStruct_State(soap, tag, id, (const enum _cwmp1__AllQueuedTransferStruct_State *)ptr, "cwmp:AllQueuedTransferStruct-State"); + case SOAP_TYPE__cwmp1__QueuedTransferStruct_State: + return soap_out__cwmp1__QueuedTransferStruct_State(soap, tag, id, (const enum _cwmp1__QueuedTransferStruct_State *)ptr, "cwmp:QueuedTransferStruct-State"); + case SOAP_TYPE__cwmp1__ParameterAttributeStruct_Notification: + return soap_out__cwmp1__ParameterAttributeStruct_Notification(soap, tag, id, (const enum _cwmp1__ParameterAttributeStruct_Notification *)ptr, "cwmp:ParameterAttributeStruct-Notification"); + case SOAP_TYPE__cwmp1__SetParameterAttributesStruct_Notification: + return soap_out__cwmp1__SetParameterAttributesStruct_Notification(soap, tag, id, (const enum _cwmp1__SetParameterAttributesStruct_Notification *)ptr, "cwmp:SetParameterAttributesStruct-Notification"); + case SOAP_TYPE_xsd__boolean: + return soap_out_xsd__boolean(soap, tag, id, (const enum xsd__boolean *)ptr, "xsd:boolean"); + case SOAP_TYPE_cwmp1__Inform: + return soap_out_cwmp1__Inform(soap, tag, id, (const struct cwmp1__Inform *)ptr, "cwmp:Inform"); + case SOAP_TYPE_cwmp1__InformResponse: + return soap_out_cwmp1__InformResponse(soap, tag, id, (const struct cwmp1__InformResponse *)ptr, "cwmp:InformResponse"); + case SOAP_TYPE__cwmp1__HoldRequests: + return soap_out__cwmp1__HoldRequests(soap, "cwmp:HoldRequests", id, (const struct _cwmp1__HoldRequests *)ptr, NULL); + case SOAP_TYPE__cwmp1__ID: + return soap_out__cwmp1__ID(soap, "cwmp:ID", id, (const struct _cwmp1__ID *)ptr, NULL); + case SOAP_TYPE__cwmp1__RequestDownloadResponse: + return soap_out__cwmp1__RequestDownloadResponse(soap, "cwmp:RequestDownloadResponse", id, (const struct _cwmp1__RequestDownloadResponse *)ptr, NULL); + case SOAP_TYPE_cwmp1FileTypeArg: + return soap_out_cwmp1FileTypeArg(soap, tag, id, (const struct cwmp1FileTypeArg *)ptr, "cwmp:ArgStruct"); + case SOAP_TYPE__cwmp1__RequestDownload: + return soap_out__cwmp1__RequestDownload(soap, "cwmp:RequestDownload", id, (const struct _cwmp1__RequestDownload *)ptr, NULL); + case SOAP_TYPE__cwmp1__KickedResponse: + return soap_out__cwmp1__KickedResponse(soap, "cwmp:KickedResponse", id, (const struct _cwmp1__KickedResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__Kicked: + return soap_out__cwmp1__Kicked(soap, "cwmp:Kicked", id, (const struct _cwmp1__Kicked *)ptr, NULL); + case SOAP_TYPE__cwmp1__AutonomousTransferCompleteResponse: + return soap_out__cwmp1__AutonomousTransferCompleteResponse(soap, "cwmp:AutonomousTransferCompleteResponse", id, (const struct _cwmp1__AutonomousTransferCompleteResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__AutonomousTransferComplete: + return soap_out__cwmp1__AutonomousTransferComplete(soap, "cwmp:AutonomousTransferComplete", id, (const struct _cwmp1__AutonomousTransferComplete *)ptr, NULL); + case SOAP_TYPE__cwmp1__TransferCompleteResponse: + return soap_out__cwmp1__TransferCompleteResponse(soap, "cwmp:TransferCompleteResponse", id, (const struct _cwmp1__TransferCompleteResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__TransferComplete: + return soap_out__cwmp1__TransferComplete(soap, "cwmp:TransferComplete", id, (const struct _cwmp1__TransferComplete *)ptr, NULL); + case SOAP_TYPE__cwmp1__InformResponse: + return soap_out__cwmp1__InformResponse(soap, "cwmp:InformResponse", id, (const struct _cwmp1__InformResponse *)ptr, NULL); + case SOAP_TYPE_cwmp1EventList: + return soap_out_cwmp1EventList(soap, tag, id, (const struct cwmp1EventList *)ptr, "cwmp:EventStruct"); + case SOAP_TYPE__cwmp1__Inform: + return soap_out__cwmp1__Inform(soap, "cwmp:Inform", id, (const struct _cwmp1__Inform *)ptr, NULL); + case SOAP_TYPE_cwmp1AllTransferList: + return soap_out_cwmp1AllTransferList(soap, tag, id, (const struct cwmp1AllTransferList *)ptr, "cwmp:AllQueuedTransferStruct"); + case SOAP_TYPE__cwmp1__GetAllQueuedTransfersResponse: + return soap_out__cwmp1__GetAllQueuedTransfersResponse(soap, "cwmp:GetAllQueuedTransfersResponse", id, (const struct _cwmp1__GetAllQueuedTransfersResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__GetAllQueuedTransfers: + return soap_out__cwmp1__GetAllQueuedTransfers(soap, "cwmp:GetAllQueuedTransfers", id, (const struct _cwmp1__GetAllQueuedTransfers *)ptr, NULL); + case SOAP_TYPE__cwmp1__FactoryResetResponse: + return soap_out__cwmp1__FactoryResetResponse(soap, "cwmp:FactoryResetResponse", id, (const struct _cwmp1__FactoryResetResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__FactoryReset: + return soap_out__cwmp1__FactoryReset(soap, "cwmp:FactoryReset", id, (const struct _cwmp1__FactoryReset *)ptr, NULL); + case SOAP_TYPE__cwmp1__UploadResponse: + return soap_out__cwmp1__UploadResponse(soap, "cwmp:UploadResponse", id, (const struct _cwmp1__UploadResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__Upload: + return soap_out__cwmp1__Upload(soap, "cwmp:Upload", id, (const struct _cwmp1__Upload *)ptr, NULL); + case SOAP_TYPE_cwmp1OptionList: + return soap_out_cwmp1OptionList(soap, tag, id, (const struct cwmp1OptionList *)ptr, "cwmp:OptionStruct"); + case SOAP_TYPE__cwmp1__GetOptionsResponse: + return soap_out__cwmp1__GetOptionsResponse(soap, "cwmp:GetOptionsResponse", id, (const struct _cwmp1__GetOptionsResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__GetOptions: + return soap_out__cwmp1__GetOptions(soap, "cwmp:GetOptions", id, (const struct _cwmp1__GetOptions *)ptr, NULL); + case SOAP_TYPE__cwmp1__SetVouchersResponse: + return soap_out__cwmp1__SetVouchersResponse(soap, "cwmp:SetVouchersResponse", id, (const struct _cwmp1__SetVouchersResponse *)ptr, NULL); + case SOAP_TYPE_cwmp1VoucherList: + return soap_out_cwmp1VoucherList(soap, tag, id, (const struct cwmp1VoucherList *)ptr, "SOAP-ENC:base64"); + case SOAP_TYPE__cwmp1__SetVouchers: + return soap_out__cwmp1__SetVouchers(soap, "cwmp:SetVouchers", id, (const struct _cwmp1__SetVouchers *)ptr, NULL); + case SOAP_TYPE__cwmp1__ScheduleInformResponse: + return soap_out__cwmp1__ScheduleInformResponse(soap, "cwmp:ScheduleInformResponse", id, (const struct _cwmp1__ScheduleInformResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__ScheduleInform: + return soap_out__cwmp1__ScheduleInform(soap, "cwmp:ScheduleInform", id, (const struct _cwmp1__ScheduleInform *)ptr, NULL); + case SOAP_TYPE_cwmp1TransferList: + return soap_out_cwmp1TransferList(soap, tag, id, (const struct cwmp1TransferList *)ptr, "cwmp:QueuedTransferStruct"); + case SOAP_TYPE__cwmp1__GetQueuedTransfersResponse: + return soap_out__cwmp1__GetQueuedTransfersResponse(soap, "cwmp:GetQueuedTransfersResponse", id, (const struct _cwmp1__GetQueuedTransfersResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__GetQueuedTransfers: + return soap_out__cwmp1__GetQueuedTransfers(soap, "cwmp:GetQueuedTransfers", id, (const struct _cwmp1__GetQueuedTransfers *)ptr, NULL); + case SOAP_TYPE__cwmp1__RebootResponse: + return soap_out__cwmp1__RebootResponse(soap, "cwmp:RebootResponse", id, (const struct _cwmp1__RebootResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__Reboot: + return soap_out__cwmp1__Reboot(soap, "cwmp:Reboot", id, (const struct _cwmp1__Reboot *)ptr, NULL); + case SOAP_TYPE__cwmp1__DownloadResponse: + return soap_out__cwmp1__DownloadResponse(soap, "cwmp:DownloadResponse", id, (const struct _cwmp1__DownloadResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__Download: + return soap_out__cwmp1__Download(soap, "cwmp:Download", id, (const struct _cwmp1__Download *)ptr, NULL); + case SOAP_TYPE__cwmp1__DeleteObjectResponse: + return soap_out__cwmp1__DeleteObjectResponse(soap, "cwmp:DeleteObjectResponse", id, (const struct _cwmp1__DeleteObjectResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__DeleteObject: + return soap_out__cwmp1__DeleteObject(soap, "cwmp:DeleteObject", id, (const struct _cwmp1__DeleteObject *)ptr, NULL); + case SOAP_TYPE__cwmp1__AddObjectResponse: + return soap_out__cwmp1__AddObjectResponse(soap, "cwmp:AddObjectResponse", id, (const struct _cwmp1__AddObjectResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__AddObject: + return soap_out__cwmp1__AddObject(soap, "cwmp:AddObject", id, (const struct _cwmp1__AddObject *)ptr, NULL); + case SOAP_TYPE_cwmp1ParameterAttributeList: + return soap_out_cwmp1ParameterAttributeList(soap, tag, id, (const struct cwmp1ParameterAttributeList *)ptr, "cwmp:ParameterAttributeStruct"); + case SOAP_TYPE__cwmp1__GetParameterAttributesResponse: + return soap_out__cwmp1__GetParameterAttributesResponse(soap, "cwmp:GetParameterAttributesResponse", id, (const struct _cwmp1__GetParameterAttributesResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__GetParameterAttributes: + return soap_out__cwmp1__GetParameterAttributes(soap, "cwmp:GetParameterAttributes", id, (const struct _cwmp1__GetParameterAttributes *)ptr, NULL); + case SOAP_TYPE__cwmp1__SetParameterAttributesResponse: + return soap_out__cwmp1__SetParameterAttributesResponse(soap, "cwmp:SetParameterAttributesResponse", id, (const struct _cwmp1__SetParameterAttributesResponse *)ptr, NULL); + case SOAP_TYPE_cwmp1SetParameterAttributesList: + return soap_out_cwmp1SetParameterAttributesList(soap, tag, id, (const struct cwmp1SetParameterAttributesList *)ptr, "cwmp:SetParameterAttributesStruct"); + case SOAP_TYPE__cwmp1__SetParameterAttributes: + return soap_out__cwmp1__SetParameterAttributes(soap, "cwmp:SetParameterAttributes", id, (const struct _cwmp1__SetParameterAttributes *)ptr, NULL); + case SOAP_TYPE_cwmp1ParameterInfoList: + return soap_out_cwmp1ParameterInfoList(soap, tag, id, (const struct cwmp1ParameterInfoList *)ptr, "cwmp:ParameterInfoStruct"); + case SOAP_TYPE__cwmp1__GetParameterNamesResponse: + return soap_out__cwmp1__GetParameterNamesResponse(soap, "cwmp:GetParameterNamesResponse", id, (const struct _cwmp1__GetParameterNamesResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__GetParameterNames: + return soap_out__cwmp1__GetParameterNames(soap, "cwmp:GetParameterNames", id, (const struct _cwmp1__GetParameterNames *)ptr, NULL); + case SOAP_TYPE__cwmp1__GetParameterValuesResponse: + return soap_out__cwmp1__GetParameterValuesResponse(soap, "cwmp:GetParameterValuesResponse", id, (const struct _cwmp1__GetParameterValuesResponse *)ptr, NULL); + case SOAP_TYPE_cwmp1ParameterNames: + return soap_out_cwmp1ParameterNames(soap, tag, id, (const struct cwmp1ParameterNames *)ptr, "xsd:string"); + case SOAP_TYPE__cwmp1__GetParameterValues: + return soap_out__cwmp1__GetParameterValues(soap, "cwmp:GetParameterValues", id, (const struct _cwmp1__GetParameterValues *)ptr, NULL); + case SOAP_TYPE__cwmp1__SetParameterValuesResponse: + return soap_out__cwmp1__SetParameterValuesResponse(soap, "cwmp:SetParameterValuesResponse", id, (const struct _cwmp1__SetParameterValuesResponse *)ptr, NULL); + case SOAP_TYPE_cwmp1ParameterValueList: + return soap_out_cwmp1ParameterValueList(soap, tag, id, (const struct cwmp1ParameterValueList *)ptr, "cwmp:ParameterValueStruct"); + case SOAP_TYPE__cwmp1__SetParameterValues: + return soap_out__cwmp1__SetParameterValues(soap, "cwmp:SetParameterValues", id, (const struct _cwmp1__SetParameterValues *)ptr, NULL); + case SOAP_TYPE_cwmp1MethodList: + return soap_out_cwmp1MethodList(soap, tag, id, (const struct cwmp1MethodList *)ptr, "xsd:string"); + case SOAP_TYPE__cwmp1__GetRPCMethodsResponse: + return soap_out__cwmp1__GetRPCMethodsResponse(soap, "cwmp:GetRPCMethodsResponse", id, (const struct _cwmp1__GetRPCMethodsResponse *)ptr, NULL); + case SOAP_TYPE__cwmp1__GetRPCMethods: + return soap_out__cwmp1__GetRPCMethods(soap, "cwmp:GetRPCMethods", id, (const struct _cwmp1__GetRPCMethods *)ptr, NULL); + case SOAP_TYPE__cwmp1__Fault_SetParameterValuesFault: + return soap_out__cwmp1__Fault_SetParameterValuesFault(soap, "cwmp:Fault-SetParameterValuesFault", id, (const struct _cwmp1__Fault_SetParameterValuesFault *)ptr, NULL); + case SOAP_TYPE__cwmp1__Fault: + return soap_out__cwmp1__Fault(soap, "cwmp:Fault", id, (const struct _cwmp1__Fault *)ptr, NULL); + case SOAP_TYPE_cwmp1__OptionStruct: + return soap_out_cwmp1__OptionStruct(soap, tag, id, (const struct cwmp1__OptionStruct *)ptr, "cwmp:OptionStruct"); + case SOAP_TYPE_cwmp1__ArgStruct: + return soap_out_cwmp1__ArgStruct(soap, tag, id, (const struct cwmp1__ArgStruct *)ptr, "cwmp:ArgStruct"); + case SOAP_TYPE_cwmp1__AllQueuedTransferStruct: + return soap_out_cwmp1__AllQueuedTransferStruct(soap, tag, id, (const struct cwmp1__AllQueuedTransferStruct *)ptr, "cwmp:AllQueuedTransferStruct"); + case SOAP_TYPE_cwmp1__QueuedTransferStruct: + return soap_out_cwmp1__QueuedTransferStruct(soap, tag, id, (const struct cwmp1__QueuedTransferStruct *)ptr, "cwmp:QueuedTransferStruct"); + case SOAP_TYPE_cwmp1__ParameterAttributeStruct: + return soap_out_cwmp1__ParameterAttributeStruct(soap, tag, id, (const struct cwmp1__ParameterAttributeStruct *)ptr, "cwmp:ParameterAttributeStruct"); + case SOAP_TYPE_cwmp1AccessList: + return soap_out_cwmp1AccessList(soap, tag, id, (const struct cwmp1AccessList *)ptr, "xsd:string"); + case SOAP_TYPE_cwmp1__SetParameterAttributesStruct: + return soap_out_cwmp1__SetParameterAttributesStruct(soap, tag, id, (const struct cwmp1__SetParameterAttributesStruct *)ptr, "cwmp:SetParameterAttributesStruct"); + case SOAP_TYPE_cwmp1__ParameterInfoStruct: + return soap_out_cwmp1__ParameterInfoStruct(soap, tag, id, (const struct cwmp1__ParameterInfoStruct *)ptr, "cwmp:ParameterInfoStruct"); + case SOAP_TYPE_cwmp1__ParameterValueStruct: + return soap_out_cwmp1__ParameterValueStruct(soap, tag, id, (const struct cwmp1__ParameterValueStruct *)ptr, "cwmp:ParameterValueStruct"); + case SOAP_TYPE_cwmp1__EventStruct: + return soap_out_cwmp1__EventStruct(soap, tag, id, (const struct cwmp1__EventStruct *)ptr, "cwmp:EventStruct"); + case SOAP_TYPE_cwmp1__DeviceIdStruct: + return soap_out_cwmp1__DeviceIdStruct(soap, tag, id, (const struct cwmp1__DeviceIdStruct *)ptr, "cwmp:DeviceIdStruct"); + case SOAP_TYPE_cwmp1__FaultStruct: + return soap_out_cwmp1__FaultStruct(soap, tag, id, (const struct cwmp1__FaultStruct *)ptr, "cwmp:FaultStruct"); + case SOAP_TYPE_SOAP_ENC__base64: + return soap_out_SOAP_ENC__base64(soap, tag, id, (const struct SOAP_ENC__base64 *)ptr, "SOAP-ENC:base64"); + case SOAP_TYPE_PointerTounsignedInt: + return soap_out_PointerTounsignedInt(soap, tag, id, (unsigned int *const*)ptr, "xsd:unsignedInt"); + case SOAP_TYPE_PointerToPointerTocwmp1__ArgStruct: + return soap_out_PointerToPointerTocwmp1__ArgStruct(soap, tag, id, (struct cwmp1__ArgStruct **const*)ptr, "cwmp:ArgStruct"); + case SOAP_TYPE_PointerTocwmp1__ArgStruct: + return soap_out_PointerTocwmp1__ArgStruct(soap, tag, id, (struct cwmp1__ArgStruct *const*)ptr, "cwmp:ArgStruct"); + case SOAP_TYPE_PointerToPointerTocwmp1__OptionStruct: + return soap_out_PointerToPointerTocwmp1__OptionStruct(soap, tag, id, (struct cwmp1__OptionStruct **const*)ptr, "cwmp:OptionStruct"); + case SOAP_TYPE_PointerTocwmp1__OptionStruct: + return soap_out_PointerTocwmp1__OptionStruct(soap, tag, id, (struct cwmp1__OptionStruct *const*)ptr, "cwmp:OptionStruct"); + case SOAP_TYPE_PointerToPointerToSOAP_ENC__base64: + return soap_out_PointerToPointerToSOAP_ENC__base64(soap, tag, id, (struct SOAP_ENC__base64 **const*)ptr, "SOAP-ENC:base64"); + case SOAP_TYPE_PointerToSOAP_ENC__base64: + return soap_out_PointerToSOAP_ENC__base64(soap, tag, id, (struct SOAP_ENC__base64 *const*)ptr, "SOAP-ENC:base64"); + case SOAP_TYPE_PointerToPointerTocwmp1__AllQueuedTransferStruct: + return soap_out_PointerToPointerTocwmp1__AllQueuedTransferStruct(soap, tag, id, (struct cwmp1__AllQueuedTransferStruct **const*)ptr, "cwmp:AllQueuedTransferStruct"); + case SOAP_TYPE_PointerTocwmp1__AllQueuedTransferStruct: + return soap_out_PointerTocwmp1__AllQueuedTransferStruct(soap, tag, id, (struct cwmp1__AllQueuedTransferStruct *const*)ptr, "cwmp:AllQueuedTransferStruct"); + case SOAP_TYPE_PointerToPointerTocwmp1__QueuedTransferStruct: + return soap_out_PointerToPointerTocwmp1__QueuedTransferStruct(soap, tag, id, (struct cwmp1__QueuedTransferStruct **const*)ptr, "cwmp:QueuedTransferStruct"); + case SOAP_TYPE_PointerTocwmp1__QueuedTransferStruct: + return soap_out_PointerTocwmp1__QueuedTransferStruct(soap, tag, id, (struct cwmp1__QueuedTransferStruct *const*)ptr, "cwmp:QueuedTransferStruct"); + case SOAP_TYPE_PointerToPointerTocwmp1__ParameterAttributeStruct: + return soap_out_PointerToPointerTocwmp1__ParameterAttributeStruct(soap, tag, id, (struct cwmp1__ParameterAttributeStruct **const*)ptr, "cwmp:ParameterAttributeStruct"); + case SOAP_TYPE_PointerTocwmp1__ParameterAttributeStruct: + return soap_out_PointerTocwmp1__ParameterAttributeStruct(soap, tag, id, (struct cwmp1__ParameterAttributeStruct *const*)ptr, "cwmp:ParameterAttributeStruct"); + case SOAP_TYPE_PointerToPointerTocwmp1__SetParameterAttributesStruct: + return soap_out_PointerToPointerTocwmp1__SetParameterAttributesStruct(soap, tag, id, (struct cwmp1__SetParameterAttributesStruct **const*)ptr, "cwmp:SetParameterAttributesStruct"); + case SOAP_TYPE_PointerTocwmp1__SetParameterAttributesStruct: + return soap_out_PointerTocwmp1__SetParameterAttributesStruct(soap, tag, id, (struct cwmp1__SetParameterAttributesStruct *const*)ptr, "cwmp:SetParameterAttributesStruct"); + case SOAP_TYPE_PointerToPointerTocwmp1__ParameterInfoStruct: + return soap_out_PointerToPointerTocwmp1__ParameterInfoStruct(soap, tag, id, (struct cwmp1__ParameterInfoStruct **const*)ptr, "cwmp:ParameterInfoStruct"); + case SOAP_TYPE_PointerTocwmp1__ParameterInfoStruct: + return soap_out_PointerTocwmp1__ParameterInfoStruct(soap, tag, id, (struct cwmp1__ParameterInfoStruct *const*)ptr, "cwmp:ParameterInfoStruct"); + case SOAP_TYPE_PointerToPointerTocwmp1__ParameterValueStruct: + return soap_out_PointerToPointerTocwmp1__ParameterValueStruct(soap, tag, id, (struct cwmp1__ParameterValueStruct **const*)ptr, "cwmp:ParameterValueStruct"); + case SOAP_TYPE_PointerTocwmp1__ParameterValueStruct: + return soap_out_PointerTocwmp1__ParameterValueStruct(soap, tag, id, (struct cwmp1__ParameterValueStruct *const*)ptr, "cwmp:ParameterValueStruct"); + case SOAP_TYPE_PointerToPointerTocwmp1__EventStruct: + return soap_out_PointerToPointerTocwmp1__EventStruct(soap, tag, id, (struct cwmp1__EventStruct **const*)ptr, "cwmp:EventStruct"); + case SOAP_TYPE_PointerTocwmp1__EventStruct: + return soap_out_PointerTocwmp1__EventStruct(soap, tag, id, (struct cwmp1__EventStruct *const*)ptr, "cwmp:EventStruct"); + case SOAP_TYPE_PointerTocwmp1FileTypeArg: + return soap_out_PointerTocwmp1FileTypeArg(soap, tag, id, (struct cwmp1FileTypeArg *const*)ptr, "cwmp:ArgStruct"); + case SOAP_TYPE_PointerTocwmp1__FaultStruct: + return soap_out_PointerTocwmp1__FaultStruct(soap, tag, id, (struct cwmp1__FaultStruct *const*)ptr, "cwmp:FaultStruct"); + case SOAP_TYPE_PointerTocwmp1EventList: + return soap_out_PointerTocwmp1EventList(soap, tag, id, (struct cwmp1EventList *const*)ptr, "cwmp:EventStruct"); + case SOAP_TYPE_PointerTocwmp1__DeviceIdStruct: + return soap_out_PointerTocwmp1__DeviceIdStruct(soap, tag, id, (struct cwmp1__DeviceIdStruct *const*)ptr, "cwmp:DeviceIdStruct"); + case SOAP_TYPE_PointerTocwmp1AllTransferList: + return soap_out_PointerTocwmp1AllTransferList(soap, tag, id, (struct cwmp1AllTransferList *const*)ptr, "cwmp:AllQueuedTransferStruct"); + case SOAP_TYPE_PointerTocwmp1OptionList: + return soap_out_PointerTocwmp1OptionList(soap, tag, id, (struct cwmp1OptionList *const*)ptr, "cwmp:OptionStruct"); + case SOAP_TYPE_PointerTocwmp1VoucherList: + return soap_out_PointerTocwmp1VoucherList(soap, tag, id, (struct cwmp1VoucherList *const*)ptr, "SOAP-ENC:base64"); + case SOAP_TYPE_PointerTocwmp1TransferList: + return soap_out_PointerTocwmp1TransferList(soap, tag, id, (struct cwmp1TransferList *const*)ptr, "cwmp:QueuedTransferStruct"); + case SOAP_TYPE_PointerTocwmp1ParameterAttributeList: + return soap_out_PointerTocwmp1ParameterAttributeList(soap, tag, id, (struct cwmp1ParameterAttributeList *const*)ptr, "cwmp:ParameterAttributeStruct"); + case SOAP_TYPE_PointerTocwmp1SetParameterAttributesList: + return soap_out_PointerTocwmp1SetParameterAttributesList(soap, tag, id, (struct cwmp1SetParameterAttributesList *const*)ptr, "cwmp:SetParameterAttributesStruct"); + case SOAP_TYPE_PointerTocwmp1ParameterInfoList: + return soap_out_PointerTocwmp1ParameterInfoList(soap, tag, id, (struct cwmp1ParameterInfoList *const*)ptr, "cwmp:ParameterInfoStruct"); + case SOAP_TYPE_PointerTocwmp1ParameterNames: + return soap_out_PointerTocwmp1ParameterNames(soap, tag, id, (struct cwmp1ParameterNames *const*)ptr, "xsd:string"); + case SOAP_TYPE_PointerTocwmp1ParameterValueList: + return soap_out_PointerTocwmp1ParameterValueList(soap, tag, id, (struct cwmp1ParameterValueList *const*)ptr, "cwmp:ParameterValueStruct"); + case SOAP_TYPE_PointerTocwmp1MethodList: + return soap_out_PointerTocwmp1MethodList(soap, tag, id, (struct cwmp1MethodList *const*)ptr, "xsd:string"); + case SOAP_TYPE_PointerTo_cwmp1__Fault_SetParameterValuesFault: + return soap_out_PointerTo_cwmp1__Fault_SetParameterValuesFault(soap, tag, id, (struct _cwmp1__Fault_SetParameterValuesFault *const*)ptr, "cwmp:Fault-SetParameterValuesFault"); + case SOAP_TYPE_PointerTotime: + return soap_out_PointerTotime(soap, tag, id, (time_t *const*)ptr, "xsd:dateTime"); + case SOAP_TYPE_PointerTocwmp1AccessList: + return soap_out_PointerTocwmp1AccessList(soap, tag, id, (struct cwmp1AccessList *const*)ptr, "xsd:string"); + case SOAP_TYPE_PointerTostring: + return soap_out_PointerTostring(soap, tag, id, (char **const*)ptr, "xsd:string"); + case SOAP_TYPE_cwmp1__ObjectNameType: + return soap_out_string(soap, tag, id, (char*const*)&ptr, "cwmp:ObjectNameType"); + case SOAP_TYPE_cwmp1__CommandKeyType: + return soap_out_string(soap, tag, id, (char*const*)&ptr, "cwmp:CommandKeyType"); + case SOAP_TYPE_cwmp1__ParameterKeyType: + return soap_out_string(soap, tag, id, (char*const*)&ptr, "cwmp:ParameterKeyType"); + case SOAP_TYPE_cwmp1__FaultCodeType: + return soap_out_string(soap, tag, id, (char*const*)&ptr, "cwmp:FaultCodeType"); + case SOAP_TYPE_xsd__anySimpleType: + return soap_out_string(soap, tag, id, (char*const*)&ptr, "xsd:anySimpleType"); + case SOAP_TYPE_PointerTounsignedByte: + return soap_out_PointerTounsignedByte(soap, tag, id, (unsigned char *const*)ptr, "xsd:unsignedByte"); + case SOAP_TYPE__QName: + return soap_out_string(soap, "xsd:QName", id, (char*const*)&ptr, NULL); + case SOAP_TYPE_string: + return soap_out_string(soap, tag, id, (char*const*)&ptr, "xsd:string"); + } + return SOAP_OK; +} +#endif + +#ifndef WITH_NOIDREF +SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap *soap, const void *ptr, int type) +{ + (void)soap; (void)ptr; (void)type; /* appease -Wall -Werror */ + switch (type) + { + case SOAP_TYPE_cwmp1__Inform: + soap_serialize_cwmp1__Inform(soap, (const struct cwmp1__Inform *)ptr); + break; + case SOAP_TYPE_cwmp1__InformResponse: + soap_serialize_cwmp1__InformResponse(soap, (const struct cwmp1__InformResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__HoldRequests: + soap_serialize__cwmp1__HoldRequests(soap, (const struct _cwmp1__HoldRequests *)ptr); + break; + case SOAP_TYPE__cwmp1__ID: + soap_serialize__cwmp1__ID(soap, (const struct _cwmp1__ID *)ptr); + break; + case SOAP_TYPE__cwmp1__RequestDownloadResponse: + soap_serialize__cwmp1__RequestDownloadResponse(soap, (const struct _cwmp1__RequestDownloadResponse *)ptr); + break; + case SOAP_TYPE_cwmp1FileTypeArg: + soap_serialize_cwmp1FileTypeArg(soap, (const struct cwmp1FileTypeArg *)ptr); + break; + case SOAP_TYPE__cwmp1__RequestDownload: + soap_serialize__cwmp1__RequestDownload(soap, (const struct _cwmp1__RequestDownload *)ptr); + break; + case SOAP_TYPE__cwmp1__KickedResponse: + soap_serialize__cwmp1__KickedResponse(soap, (const struct _cwmp1__KickedResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__Kicked: + soap_serialize__cwmp1__Kicked(soap, (const struct _cwmp1__Kicked *)ptr); + break; + case SOAP_TYPE__cwmp1__AutonomousTransferCompleteResponse: + soap_serialize__cwmp1__AutonomousTransferCompleteResponse(soap, (const struct _cwmp1__AutonomousTransferCompleteResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__AutonomousTransferComplete: + soap_serialize__cwmp1__AutonomousTransferComplete(soap, (const struct _cwmp1__AutonomousTransferComplete *)ptr); + break; + case SOAP_TYPE__cwmp1__TransferCompleteResponse: + soap_serialize__cwmp1__TransferCompleteResponse(soap, (const struct _cwmp1__TransferCompleteResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__TransferComplete: + soap_serialize__cwmp1__TransferComplete(soap, (const struct _cwmp1__TransferComplete *)ptr); + break; + case SOAP_TYPE__cwmp1__InformResponse: + soap_serialize__cwmp1__InformResponse(soap, (const struct _cwmp1__InformResponse *)ptr); + break; + case SOAP_TYPE_cwmp1EventList: + soap_serialize_cwmp1EventList(soap, (const struct cwmp1EventList *)ptr); + break; + case SOAP_TYPE__cwmp1__Inform: + soap_serialize__cwmp1__Inform(soap, (const struct _cwmp1__Inform *)ptr); + break; + case SOAP_TYPE_cwmp1AllTransferList: + soap_serialize_cwmp1AllTransferList(soap, (const struct cwmp1AllTransferList *)ptr); + break; + case SOAP_TYPE__cwmp1__GetAllQueuedTransfersResponse: + soap_serialize__cwmp1__GetAllQueuedTransfersResponse(soap, (const struct _cwmp1__GetAllQueuedTransfersResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__GetAllQueuedTransfers: + soap_serialize__cwmp1__GetAllQueuedTransfers(soap, (const struct _cwmp1__GetAllQueuedTransfers *)ptr); + break; + case SOAP_TYPE__cwmp1__FactoryResetResponse: + soap_serialize__cwmp1__FactoryResetResponse(soap, (const struct _cwmp1__FactoryResetResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__FactoryReset: + soap_serialize__cwmp1__FactoryReset(soap, (const struct _cwmp1__FactoryReset *)ptr); + break; + case SOAP_TYPE__cwmp1__UploadResponse: + soap_serialize__cwmp1__UploadResponse(soap, (const struct _cwmp1__UploadResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__Upload: + soap_serialize__cwmp1__Upload(soap, (const struct _cwmp1__Upload *)ptr); + break; + case SOAP_TYPE_cwmp1OptionList: + soap_serialize_cwmp1OptionList(soap, (const struct cwmp1OptionList *)ptr); + break; + case SOAP_TYPE__cwmp1__GetOptionsResponse: + soap_serialize__cwmp1__GetOptionsResponse(soap, (const struct _cwmp1__GetOptionsResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__GetOptions: + soap_serialize__cwmp1__GetOptions(soap, (const struct _cwmp1__GetOptions *)ptr); + break; + case SOAP_TYPE__cwmp1__SetVouchersResponse: + soap_serialize__cwmp1__SetVouchersResponse(soap, (const struct _cwmp1__SetVouchersResponse *)ptr); + break; + case SOAP_TYPE_cwmp1VoucherList: + soap_serialize_cwmp1VoucherList(soap, (const struct cwmp1VoucherList *)ptr); + break; + case SOAP_TYPE__cwmp1__SetVouchers: + soap_serialize__cwmp1__SetVouchers(soap, (const struct _cwmp1__SetVouchers *)ptr); + break; + case SOAP_TYPE__cwmp1__ScheduleInformResponse: + soap_serialize__cwmp1__ScheduleInformResponse(soap, (const struct _cwmp1__ScheduleInformResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__ScheduleInform: + soap_serialize__cwmp1__ScheduleInform(soap, (const struct _cwmp1__ScheduleInform *)ptr); + break; + case SOAP_TYPE_cwmp1TransferList: + soap_serialize_cwmp1TransferList(soap, (const struct cwmp1TransferList *)ptr); + break; + case SOAP_TYPE__cwmp1__GetQueuedTransfersResponse: + soap_serialize__cwmp1__GetQueuedTransfersResponse(soap, (const struct _cwmp1__GetQueuedTransfersResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__GetQueuedTransfers: + soap_serialize__cwmp1__GetQueuedTransfers(soap, (const struct _cwmp1__GetQueuedTransfers *)ptr); + break; + case SOAP_TYPE__cwmp1__RebootResponse: + soap_serialize__cwmp1__RebootResponse(soap, (const struct _cwmp1__RebootResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__Reboot: + soap_serialize__cwmp1__Reboot(soap, (const struct _cwmp1__Reboot *)ptr); + break; + case SOAP_TYPE__cwmp1__DownloadResponse: + soap_serialize__cwmp1__DownloadResponse(soap, (const struct _cwmp1__DownloadResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__Download: + soap_serialize__cwmp1__Download(soap, (const struct _cwmp1__Download *)ptr); + break; + case SOAP_TYPE__cwmp1__DeleteObjectResponse: + soap_serialize__cwmp1__DeleteObjectResponse(soap, (const struct _cwmp1__DeleteObjectResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__DeleteObject: + soap_serialize__cwmp1__DeleteObject(soap, (const struct _cwmp1__DeleteObject *)ptr); + break; + case SOAP_TYPE__cwmp1__AddObjectResponse: + soap_serialize__cwmp1__AddObjectResponse(soap, (const struct _cwmp1__AddObjectResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__AddObject: + soap_serialize__cwmp1__AddObject(soap, (const struct _cwmp1__AddObject *)ptr); + break; + case SOAP_TYPE_cwmp1ParameterAttributeList: + soap_serialize_cwmp1ParameterAttributeList(soap, (const struct cwmp1ParameterAttributeList *)ptr); + break; + case SOAP_TYPE__cwmp1__GetParameterAttributesResponse: + soap_serialize__cwmp1__GetParameterAttributesResponse(soap, (const struct _cwmp1__GetParameterAttributesResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__GetParameterAttributes: + soap_serialize__cwmp1__GetParameterAttributes(soap, (const struct _cwmp1__GetParameterAttributes *)ptr); + break; + case SOAP_TYPE__cwmp1__SetParameterAttributesResponse: + soap_serialize__cwmp1__SetParameterAttributesResponse(soap, (const struct _cwmp1__SetParameterAttributesResponse *)ptr); + break; + case SOAP_TYPE_cwmp1SetParameterAttributesList: + soap_serialize_cwmp1SetParameterAttributesList(soap, (const struct cwmp1SetParameterAttributesList *)ptr); + break; + case SOAP_TYPE__cwmp1__SetParameterAttributes: + soap_serialize__cwmp1__SetParameterAttributes(soap, (const struct _cwmp1__SetParameterAttributes *)ptr); + break; + case SOAP_TYPE_cwmp1ParameterInfoList: + soap_serialize_cwmp1ParameterInfoList(soap, (const struct cwmp1ParameterInfoList *)ptr); + break; + case SOAP_TYPE__cwmp1__GetParameterNamesResponse: + soap_serialize__cwmp1__GetParameterNamesResponse(soap, (const struct _cwmp1__GetParameterNamesResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__GetParameterNames: + soap_serialize__cwmp1__GetParameterNames(soap, (const struct _cwmp1__GetParameterNames *)ptr); + break; + case SOAP_TYPE__cwmp1__GetParameterValuesResponse: + soap_serialize__cwmp1__GetParameterValuesResponse(soap, (const struct _cwmp1__GetParameterValuesResponse *)ptr); + break; + case SOAP_TYPE_cwmp1ParameterNames: + soap_serialize_cwmp1ParameterNames(soap, (const struct cwmp1ParameterNames *)ptr); + break; + case SOAP_TYPE__cwmp1__GetParameterValues: + soap_serialize__cwmp1__GetParameterValues(soap, (const struct _cwmp1__GetParameterValues *)ptr); + break; + case SOAP_TYPE__cwmp1__SetParameterValuesResponse: + soap_serialize__cwmp1__SetParameterValuesResponse(soap, (const struct _cwmp1__SetParameterValuesResponse *)ptr); + break; + case SOAP_TYPE_cwmp1ParameterValueList: + soap_serialize_cwmp1ParameterValueList(soap, (const struct cwmp1ParameterValueList *)ptr); + break; + case SOAP_TYPE__cwmp1__SetParameterValues: + soap_serialize__cwmp1__SetParameterValues(soap, (const struct _cwmp1__SetParameterValues *)ptr); + break; + case SOAP_TYPE_cwmp1MethodList: + soap_serialize_cwmp1MethodList(soap, (const struct cwmp1MethodList *)ptr); + break; + case SOAP_TYPE__cwmp1__GetRPCMethodsResponse: + soap_serialize__cwmp1__GetRPCMethodsResponse(soap, (const struct _cwmp1__GetRPCMethodsResponse *)ptr); + break; + case SOAP_TYPE__cwmp1__GetRPCMethods: + soap_serialize__cwmp1__GetRPCMethods(soap, (const struct _cwmp1__GetRPCMethods *)ptr); + break; + case SOAP_TYPE__cwmp1__Fault_SetParameterValuesFault: + soap_serialize__cwmp1__Fault_SetParameterValuesFault(soap, (const struct _cwmp1__Fault_SetParameterValuesFault *)ptr); + break; + case SOAP_TYPE__cwmp1__Fault: + soap_serialize__cwmp1__Fault(soap, (const struct _cwmp1__Fault *)ptr); + break; + case SOAP_TYPE_cwmp1__OptionStruct: + soap_serialize_cwmp1__OptionStruct(soap, (const struct cwmp1__OptionStruct *)ptr); + break; + case SOAP_TYPE_cwmp1__ArgStruct: + soap_serialize_cwmp1__ArgStruct(soap, (const struct cwmp1__ArgStruct *)ptr); + break; + case SOAP_TYPE_cwmp1__AllQueuedTransferStruct: + soap_serialize_cwmp1__AllQueuedTransferStruct(soap, (const struct cwmp1__AllQueuedTransferStruct *)ptr); + break; + case SOAP_TYPE_cwmp1__QueuedTransferStruct: + soap_serialize_cwmp1__QueuedTransferStruct(soap, (const struct cwmp1__QueuedTransferStruct *)ptr); + break; + case SOAP_TYPE_cwmp1__ParameterAttributeStruct: + soap_serialize_cwmp1__ParameterAttributeStruct(soap, (const struct cwmp1__ParameterAttributeStruct *)ptr); + break; + case SOAP_TYPE_cwmp1AccessList: + soap_serialize_cwmp1AccessList(soap, (const struct cwmp1AccessList *)ptr); + break; + case SOAP_TYPE_cwmp1__SetParameterAttributesStruct: + soap_serialize_cwmp1__SetParameterAttributesStruct(soap, (const struct cwmp1__SetParameterAttributesStruct *)ptr); + break; + case SOAP_TYPE_cwmp1__ParameterInfoStruct: + soap_serialize_cwmp1__ParameterInfoStruct(soap, (const struct cwmp1__ParameterInfoStruct *)ptr); + break; + case SOAP_TYPE_cwmp1__ParameterValueStruct: + soap_serialize_cwmp1__ParameterValueStruct(soap, (const struct cwmp1__ParameterValueStruct *)ptr); + break; + case SOAP_TYPE_cwmp1__EventStruct: + soap_serialize_cwmp1__EventStruct(soap, (const struct cwmp1__EventStruct *)ptr); + break; + case SOAP_TYPE_cwmp1__DeviceIdStruct: + soap_serialize_cwmp1__DeviceIdStruct(soap, (const struct cwmp1__DeviceIdStruct *)ptr); + break; + case SOAP_TYPE_cwmp1__FaultStruct: + soap_serialize_cwmp1__FaultStruct(soap, (const struct cwmp1__FaultStruct *)ptr); + break; + case SOAP_TYPE_SOAP_ENC__base64: + soap_serialize_SOAP_ENC__base64(soap, (const struct SOAP_ENC__base64 *)ptr); + break; + case SOAP_TYPE_PointerTounsignedInt: + soap_serialize_PointerTounsignedInt(soap, (unsigned int *const*)ptr); + break; + case SOAP_TYPE_PointerToPointerTocwmp1__ArgStruct: + soap_serialize_PointerToPointerTocwmp1__ArgStruct(soap, (struct cwmp1__ArgStruct **const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1__ArgStruct: + soap_serialize_PointerTocwmp1__ArgStruct(soap, (struct cwmp1__ArgStruct *const*)ptr); + break; + case SOAP_TYPE_PointerToPointerTocwmp1__OptionStruct: + soap_serialize_PointerToPointerTocwmp1__OptionStruct(soap, (struct cwmp1__OptionStruct **const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1__OptionStruct: + soap_serialize_PointerTocwmp1__OptionStruct(soap, (struct cwmp1__OptionStruct *const*)ptr); + break; + case SOAP_TYPE_PointerToPointerToSOAP_ENC__base64: + soap_serialize_PointerToPointerToSOAP_ENC__base64(soap, (struct SOAP_ENC__base64 **const*)ptr); + break; + case SOAP_TYPE_PointerToSOAP_ENC__base64: + soap_serialize_PointerToSOAP_ENC__base64(soap, (struct SOAP_ENC__base64 *const*)ptr); + break; + case SOAP_TYPE_PointerToPointerTocwmp1__AllQueuedTransferStruct: + soap_serialize_PointerToPointerTocwmp1__AllQueuedTransferStruct(soap, (struct cwmp1__AllQueuedTransferStruct **const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1__AllQueuedTransferStruct: + soap_serialize_PointerTocwmp1__AllQueuedTransferStruct(soap, (struct cwmp1__AllQueuedTransferStruct *const*)ptr); + break; + case SOAP_TYPE_PointerToPointerTocwmp1__QueuedTransferStruct: + soap_serialize_PointerToPointerTocwmp1__QueuedTransferStruct(soap, (struct cwmp1__QueuedTransferStruct **const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1__QueuedTransferStruct: + soap_serialize_PointerTocwmp1__QueuedTransferStruct(soap, (struct cwmp1__QueuedTransferStruct *const*)ptr); + break; + case SOAP_TYPE_PointerToPointerTocwmp1__ParameterAttributeStruct: + soap_serialize_PointerToPointerTocwmp1__ParameterAttributeStruct(soap, (struct cwmp1__ParameterAttributeStruct **const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1__ParameterAttributeStruct: + soap_serialize_PointerTocwmp1__ParameterAttributeStruct(soap, (struct cwmp1__ParameterAttributeStruct *const*)ptr); + break; + case SOAP_TYPE_PointerToPointerTocwmp1__SetParameterAttributesStruct: + soap_serialize_PointerToPointerTocwmp1__SetParameterAttributesStruct(soap, (struct cwmp1__SetParameterAttributesStruct **const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1__SetParameterAttributesStruct: + soap_serialize_PointerTocwmp1__SetParameterAttributesStruct(soap, (struct cwmp1__SetParameterAttributesStruct *const*)ptr); + break; + case SOAP_TYPE_PointerToPointerTocwmp1__ParameterInfoStruct: + soap_serialize_PointerToPointerTocwmp1__ParameterInfoStruct(soap, (struct cwmp1__ParameterInfoStruct **const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1__ParameterInfoStruct: + soap_serialize_PointerTocwmp1__ParameterInfoStruct(soap, (struct cwmp1__ParameterInfoStruct *const*)ptr); + break; + case SOAP_TYPE_PointerToPointerTocwmp1__ParameterValueStruct: + soap_serialize_PointerToPointerTocwmp1__ParameterValueStruct(soap, (struct cwmp1__ParameterValueStruct **const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1__ParameterValueStruct: + soap_serialize_PointerTocwmp1__ParameterValueStruct(soap, (struct cwmp1__ParameterValueStruct *const*)ptr); + break; + case SOAP_TYPE_PointerToPointerTocwmp1__EventStruct: + soap_serialize_PointerToPointerTocwmp1__EventStruct(soap, (struct cwmp1__EventStruct **const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1__EventStruct: + soap_serialize_PointerTocwmp1__EventStruct(soap, (struct cwmp1__EventStruct *const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1FileTypeArg: + soap_serialize_PointerTocwmp1FileTypeArg(soap, (struct cwmp1FileTypeArg *const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1__FaultStruct: + soap_serialize_PointerTocwmp1__FaultStruct(soap, (struct cwmp1__FaultStruct *const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1EventList: + soap_serialize_PointerTocwmp1EventList(soap, (struct cwmp1EventList *const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1__DeviceIdStruct: + soap_serialize_PointerTocwmp1__DeviceIdStruct(soap, (struct cwmp1__DeviceIdStruct *const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1AllTransferList: + soap_serialize_PointerTocwmp1AllTransferList(soap, (struct cwmp1AllTransferList *const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1OptionList: + soap_serialize_PointerTocwmp1OptionList(soap, (struct cwmp1OptionList *const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1VoucherList: + soap_serialize_PointerTocwmp1VoucherList(soap, (struct cwmp1VoucherList *const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1TransferList: + soap_serialize_PointerTocwmp1TransferList(soap, (struct cwmp1TransferList *const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1ParameterAttributeList: + soap_serialize_PointerTocwmp1ParameterAttributeList(soap, (struct cwmp1ParameterAttributeList *const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1SetParameterAttributesList: + soap_serialize_PointerTocwmp1SetParameterAttributesList(soap, (struct cwmp1SetParameterAttributesList *const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1ParameterInfoList: + soap_serialize_PointerTocwmp1ParameterInfoList(soap, (struct cwmp1ParameterInfoList *const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1ParameterNames: + soap_serialize_PointerTocwmp1ParameterNames(soap, (struct cwmp1ParameterNames *const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1ParameterValueList: + soap_serialize_PointerTocwmp1ParameterValueList(soap, (struct cwmp1ParameterValueList *const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1MethodList: + soap_serialize_PointerTocwmp1MethodList(soap, (struct cwmp1MethodList *const*)ptr); + break; + case SOAP_TYPE_PointerTo_cwmp1__Fault_SetParameterValuesFault: + soap_serialize_PointerTo_cwmp1__Fault_SetParameterValuesFault(soap, (struct _cwmp1__Fault_SetParameterValuesFault *const*)ptr); + break; + case SOAP_TYPE_PointerTotime: + soap_serialize_PointerTotime(soap, (time_t *const*)ptr); + break; + case SOAP_TYPE_PointerTocwmp1AccessList: + soap_serialize_PointerTocwmp1AccessList(soap, (struct cwmp1AccessList *const*)ptr); + break; + case SOAP_TYPE_PointerTostring: + soap_serialize_PointerTostring(soap, (char **const*)ptr); + break; + case SOAP_TYPE_cwmp1__ObjectNameType: + soap_serialize_string(soap, (char*const*)&ptr); + break; + case SOAP_TYPE_cwmp1__CommandKeyType: + soap_serialize_string(soap, (char*const*)&ptr); + break; + case SOAP_TYPE_cwmp1__ParameterKeyType: + soap_serialize_string(soap, (char*const*)&ptr); + break; + case SOAP_TYPE_cwmp1__FaultCodeType: + soap_serialize_string(soap, (char*const*)&ptr); + break; + case SOAP_TYPE_xsd__anySimpleType: + soap_serialize_string(soap, (char*const*)&ptr); + break; + case SOAP_TYPE_PointerTounsignedByte: + soap_serialize_PointerTounsignedByte(soap, (unsigned char *const*)ptr); + break; + case SOAP_TYPE__QName: + soap_serialize_string(soap, (char*const*)&ptr); + break; + case SOAP_TYPE_string: + soap_serialize_string(soap, (char*const*)&ptr); + break; + } +} +#endif + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap *soap, char *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT_byte + *a = SOAP_DEFAULT_byte; +#else + *a = (char)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_byte(struct soap *soap, const char *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_byte); + if (soap_out_byte(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_byte(struct soap *soap, const char *tag, int id, const char *a, const char *type) +{ + return soap_outbyte(soap, tag, id, a, type, SOAP_TYPE_byte); +} + +SOAP_FMAC3 char * SOAP_FMAC4 soap_get_byte(struct soap *soap, char *p, const char *tag, const char *type) +{ + if ((p = soap_in_byte(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 char * SOAP_FMAC4 soap_in_byte(struct soap *soap, const char *tag, char *a, const char *type) +{ char *p; + p = soap_inbyte(soap, tag, a, type, SOAP_TYPE_byte); + return p; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap *soap, int *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT_int + *a = SOAP_DEFAULT_int; +#else + *a = (int)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_int(struct soap *soap, const int *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_int); + if (soap_out_int(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_int(struct soap *soap, const char *tag, int id, const int *a, const char *type) +{ + return soap_outint(soap, tag, id, a, type, SOAP_TYPE_int); +} + +SOAP_FMAC3 int * SOAP_FMAC4 soap_get_int(struct soap *soap, int *p, const char *tag, const char *type) +{ + if ((p = soap_in_int(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 int * SOAP_FMAC4 soap_in_int(struct soap *soap, const char *tag, int *a, const char *type) +{ int *p; + p = soap_inint(soap, tag, a, type, SOAP_TYPE_int); + return p; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_unsignedByte(struct soap *soap, unsigned char *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT_unsignedByte + *a = SOAP_DEFAULT_unsignedByte; +#else + *a = (unsigned char)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_unsignedByte(struct soap *soap, const unsigned char *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_unsignedByte); + if (soap_out_unsignedByte(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_unsignedByte(struct soap *soap, const char *tag, int id, const unsigned char *a, const char *type) +{ + return soap_outunsignedByte(soap, tag, id, a, type, SOAP_TYPE_unsignedByte); +} + +SOAP_FMAC3 unsigned char * SOAP_FMAC4 soap_get_unsignedByte(struct soap *soap, unsigned char *p, const char *tag, const char *type) +{ + if ((p = soap_in_unsignedByte(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 unsigned char * SOAP_FMAC4 soap_in_unsignedByte(struct soap *soap, const char *tag, unsigned char *a, const char *type) +{ unsigned char *p; + p = soap_inunsignedByte(soap, tag, a, type, SOAP_TYPE_unsignedByte); + return p; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_unsignedInt(struct soap *soap, unsigned int *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT_unsignedInt + *a = SOAP_DEFAULT_unsignedInt; +#else + *a = (unsigned int)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_unsignedInt(struct soap *soap, const unsigned int *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_unsignedInt); + if (soap_out_unsignedInt(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_unsignedInt(struct soap *soap, const char *tag, int id, const unsigned int *a, const char *type) +{ + return soap_outunsignedInt(soap, tag, id, a, type, SOAP_TYPE_unsignedInt); +} + +SOAP_FMAC3 unsigned int * SOAP_FMAC4 soap_get_unsignedInt(struct soap *soap, unsigned int *p, const char *tag, const char *type) +{ + if ((p = soap_in_unsignedInt(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 unsigned int * SOAP_FMAC4 soap_in_unsignedInt(struct soap *soap, const char *tag, unsigned int *a, const char *type) +{ unsigned int *p; + p = soap_inunsignedInt(soap, tag, a, type, SOAP_TYPE_unsignedInt); + return p; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_time(struct soap *soap, time_t *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT_time + *a = SOAP_DEFAULT_time; +#else + *a = (time_t)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_time(struct soap *soap, const time_t *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_time); + if (soap_out_time(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_time(struct soap *soap, const char *tag, int id, const time_t *a, const char *type) +{ + return soap_outdateTime(soap, tag, id, a, type, SOAP_TYPE_time); +} + +SOAP_FMAC3 time_t * SOAP_FMAC4 soap_get_time(struct soap *soap, time_t *p, const char *tag, const char *type) +{ + if ((p = soap_in_time(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 time_t * SOAP_FMAC4 soap_in_time(struct soap *soap, const char *tag, time_t *a, const char *type) +{ time_t *p; + p = soap_indateTime(soap, tag, a, type, SOAP_TYPE_time); + return p; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__UploadResponse_Status(struct soap *soap, enum _cwmp1__UploadResponse_Status *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT__cwmp1__UploadResponse_Status + *a = SOAP_DEFAULT__cwmp1__UploadResponse_Status; +#else + *a = (enum _cwmp1__UploadResponse_Status)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__UploadResponse_Status(struct soap *soap, const enum _cwmp1__UploadResponse_Status *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__UploadResponse_Status); + if (soap_out__cwmp1__UploadResponse_Status(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +static const struct soap_code_map soap_codes__cwmp1__UploadResponse_Status[] = +{ { (long)_cwmp1__UploadResponse_Status__0, "0" }, + { (long)_cwmp1__UploadResponse_Status__1, "1" }, + { 0, NULL } +}; + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__UploadResponse_Status2s(struct soap *soap, enum _cwmp1__UploadResponse_Status n) +{ const char *s = soap_code_str(soap_codes__cwmp1__UploadResponse_Status, (long)n); + if (s) + return s; + return soap_long2s(soap, (long)n); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__UploadResponse_Status(struct soap *soap, const char *tag, int id, const enum _cwmp1__UploadResponse_Status *a, const char *type) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__UploadResponse_Status), type) || soap_send(soap, soap__cwmp1__UploadResponse_Status2s(soap, *a))) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 enum _cwmp1__UploadResponse_Status * SOAP_FMAC4 soap_get__cwmp1__UploadResponse_Status(struct soap *soap, enum _cwmp1__UploadResponse_Status *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__UploadResponse_Status(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__UploadResponse_Status(struct soap *soap, const char *s, enum _cwmp1__UploadResponse_Status *a) +{ + const struct soap_code_map *map; + if (!s) + return SOAP_OK; + map = soap_code(soap_codes__cwmp1__UploadResponse_Status, s); + if (map) + *a = (enum _cwmp1__UploadResponse_Status)map->code; + else + { long n; + if (soap_s2long(soap, s, &n) || ((soap->mode & SOAP_XML_STRICT) && (n < 0 || n > 1))) + return soap->error = SOAP_TYPE; + *a = (enum _cwmp1__UploadResponse_Status)n; + } + return SOAP_OK; +} + +SOAP_FMAC3 enum _cwmp1__UploadResponse_Status * SOAP_FMAC4 soap_in__cwmp1__UploadResponse_Status(struct soap *soap, const char *tag, enum _cwmp1__UploadResponse_Status *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (enum _cwmp1__UploadResponse_Status *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__UploadResponse_Status, sizeof(enum _cwmp1__UploadResponse_Status), 0, NULL, NULL, NULL); + if (!a) + return NULL; + if (soap->body && !*soap->href) + { if (!a || soap_s2_cwmp1__UploadResponse_Status(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (enum _cwmp1__UploadResponse_Status *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__UploadResponse_Status, 0, sizeof(enum _cwmp1__UploadResponse_Status), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__DownloadResponse_Status(struct soap *soap, enum _cwmp1__DownloadResponse_Status *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT__cwmp1__DownloadResponse_Status + *a = SOAP_DEFAULT__cwmp1__DownloadResponse_Status; +#else + *a = (enum _cwmp1__DownloadResponse_Status)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__DownloadResponse_Status(struct soap *soap, const enum _cwmp1__DownloadResponse_Status *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__DownloadResponse_Status); + if (soap_out__cwmp1__DownloadResponse_Status(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +static const struct soap_code_map soap_codes__cwmp1__DownloadResponse_Status[] = +{ { (long)_cwmp1__DownloadResponse_Status__0, "0" }, + { (long)_cwmp1__DownloadResponse_Status__1, "1" }, + { 0, NULL } +}; + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__DownloadResponse_Status2s(struct soap *soap, enum _cwmp1__DownloadResponse_Status n) +{ const char *s = soap_code_str(soap_codes__cwmp1__DownloadResponse_Status, (long)n); + if (s) + return s; + return soap_long2s(soap, (long)n); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__DownloadResponse_Status(struct soap *soap, const char *tag, int id, const enum _cwmp1__DownloadResponse_Status *a, const char *type) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__DownloadResponse_Status), type) || soap_send(soap, soap__cwmp1__DownloadResponse_Status2s(soap, *a))) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 enum _cwmp1__DownloadResponse_Status * SOAP_FMAC4 soap_get__cwmp1__DownloadResponse_Status(struct soap *soap, enum _cwmp1__DownloadResponse_Status *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__DownloadResponse_Status(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__DownloadResponse_Status(struct soap *soap, const char *s, enum _cwmp1__DownloadResponse_Status *a) +{ + const struct soap_code_map *map; + if (!s) + return SOAP_OK; + map = soap_code(soap_codes__cwmp1__DownloadResponse_Status, s); + if (map) + *a = (enum _cwmp1__DownloadResponse_Status)map->code; + else + { long n; + if (soap_s2long(soap, s, &n) || ((soap->mode & SOAP_XML_STRICT) && (n < 0 || n > 1))) + return soap->error = SOAP_TYPE; + *a = (enum _cwmp1__DownloadResponse_Status)n; + } + return SOAP_OK; +} + +SOAP_FMAC3 enum _cwmp1__DownloadResponse_Status * SOAP_FMAC4 soap_in__cwmp1__DownloadResponse_Status(struct soap *soap, const char *tag, enum _cwmp1__DownloadResponse_Status *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (enum _cwmp1__DownloadResponse_Status *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__DownloadResponse_Status, sizeof(enum _cwmp1__DownloadResponse_Status), 0, NULL, NULL, NULL); + if (!a) + return NULL; + if (soap->body && !*soap->href) + { if (!a || soap_s2_cwmp1__DownloadResponse_Status(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (enum _cwmp1__DownloadResponse_Status *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__DownloadResponse_Status, 0, sizeof(enum _cwmp1__DownloadResponse_Status), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__DeleteObjectResponse_Status(struct soap *soap, enum _cwmp1__DeleteObjectResponse_Status *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT__cwmp1__DeleteObjectResponse_Status + *a = SOAP_DEFAULT__cwmp1__DeleteObjectResponse_Status; +#else + *a = (enum _cwmp1__DeleteObjectResponse_Status)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__DeleteObjectResponse_Status(struct soap *soap, const enum _cwmp1__DeleteObjectResponse_Status *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__DeleteObjectResponse_Status); + if (soap_out__cwmp1__DeleteObjectResponse_Status(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +static const struct soap_code_map soap_codes__cwmp1__DeleteObjectResponse_Status[] = +{ { (long)_cwmp1__DeleteObjectResponse_Status__0, "0" }, + { (long)_cwmp1__DeleteObjectResponse_Status__1, "1" }, + { 0, NULL } +}; + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__DeleteObjectResponse_Status2s(struct soap *soap, enum _cwmp1__DeleteObjectResponse_Status n) +{ const char *s = soap_code_str(soap_codes__cwmp1__DeleteObjectResponse_Status, (long)n); + if (s) + return s; + return soap_long2s(soap, (long)n); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__DeleteObjectResponse_Status(struct soap *soap, const char *tag, int id, const enum _cwmp1__DeleteObjectResponse_Status *a, const char *type) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__DeleteObjectResponse_Status), type) || soap_send(soap, soap__cwmp1__DeleteObjectResponse_Status2s(soap, *a))) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 enum _cwmp1__DeleteObjectResponse_Status * SOAP_FMAC4 soap_get__cwmp1__DeleteObjectResponse_Status(struct soap *soap, enum _cwmp1__DeleteObjectResponse_Status *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__DeleteObjectResponse_Status(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__DeleteObjectResponse_Status(struct soap *soap, const char *s, enum _cwmp1__DeleteObjectResponse_Status *a) +{ + const struct soap_code_map *map; + if (!s) + return SOAP_OK; + map = soap_code(soap_codes__cwmp1__DeleteObjectResponse_Status, s); + if (map) + *a = (enum _cwmp1__DeleteObjectResponse_Status)map->code; + else + { long n; + if (soap_s2long(soap, s, &n) || ((soap->mode & SOAP_XML_STRICT) && (n < 0 || n > 1))) + return soap->error = SOAP_TYPE; + *a = (enum _cwmp1__DeleteObjectResponse_Status)n; + } + return SOAP_OK; +} + +SOAP_FMAC3 enum _cwmp1__DeleteObjectResponse_Status * SOAP_FMAC4 soap_in__cwmp1__DeleteObjectResponse_Status(struct soap *soap, const char *tag, enum _cwmp1__DeleteObjectResponse_Status *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (enum _cwmp1__DeleteObjectResponse_Status *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__DeleteObjectResponse_Status, sizeof(enum _cwmp1__DeleteObjectResponse_Status), 0, NULL, NULL, NULL); + if (!a) + return NULL; + if (soap->body && !*soap->href) + { if (!a || soap_s2_cwmp1__DeleteObjectResponse_Status(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (enum _cwmp1__DeleteObjectResponse_Status *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__DeleteObjectResponse_Status, 0, sizeof(enum _cwmp1__DeleteObjectResponse_Status), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__AddObjectResponse_Status(struct soap *soap, enum _cwmp1__AddObjectResponse_Status *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT__cwmp1__AddObjectResponse_Status + *a = SOAP_DEFAULT__cwmp1__AddObjectResponse_Status; +#else + *a = (enum _cwmp1__AddObjectResponse_Status)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__AddObjectResponse_Status(struct soap *soap, const enum _cwmp1__AddObjectResponse_Status *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__AddObjectResponse_Status); + if (soap_out__cwmp1__AddObjectResponse_Status(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +static const struct soap_code_map soap_codes__cwmp1__AddObjectResponse_Status[] = +{ { (long)_cwmp1__AddObjectResponse_Status__0, "0" }, + { (long)_cwmp1__AddObjectResponse_Status__1, "1" }, + { 0, NULL } +}; + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__AddObjectResponse_Status2s(struct soap *soap, enum _cwmp1__AddObjectResponse_Status n) +{ const char *s = soap_code_str(soap_codes__cwmp1__AddObjectResponse_Status, (long)n); + if (s) + return s; + return soap_long2s(soap, (long)n); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__AddObjectResponse_Status(struct soap *soap, const char *tag, int id, const enum _cwmp1__AddObjectResponse_Status *a, const char *type) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__AddObjectResponse_Status), type) || soap_send(soap, soap__cwmp1__AddObjectResponse_Status2s(soap, *a))) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 enum _cwmp1__AddObjectResponse_Status * SOAP_FMAC4 soap_get__cwmp1__AddObjectResponse_Status(struct soap *soap, enum _cwmp1__AddObjectResponse_Status *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__AddObjectResponse_Status(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__AddObjectResponse_Status(struct soap *soap, const char *s, enum _cwmp1__AddObjectResponse_Status *a) +{ + const struct soap_code_map *map; + if (!s) + return SOAP_OK; + map = soap_code(soap_codes__cwmp1__AddObjectResponse_Status, s); + if (map) + *a = (enum _cwmp1__AddObjectResponse_Status)map->code; + else + { long n; + if (soap_s2long(soap, s, &n) || ((soap->mode & SOAP_XML_STRICT) && (n < 0 || n > 1))) + return soap->error = SOAP_TYPE; + *a = (enum _cwmp1__AddObjectResponse_Status)n; + } + return SOAP_OK; +} + +SOAP_FMAC3 enum _cwmp1__AddObjectResponse_Status * SOAP_FMAC4 soap_in__cwmp1__AddObjectResponse_Status(struct soap *soap, const char *tag, enum _cwmp1__AddObjectResponse_Status *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (enum _cwmp1__AddObjectResponse_Status *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__AddObjectResponse_Status, sizeof(enum _cwmp1__AddObjectResponse_Status), 0, NULL, NULL, NULL); + if (!a) + return NULL; + if (soap->body && !*soap->href) + { if (!a || soap_s2_cwmp1__AddObjectResponse_Status(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (enum _cwmp1__AddObjectResponse_Status *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__AddObjectResponse_Status, 0, sizeof(enum _cwmp1__AddObjectResponse_Status), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetParameterValuesResponse_Status(struct soap *soap, enum _cwmp1__SetParameterValuesResponse_Status *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT__cwmp1__SetParameterValuesResponse_Status + *a = SOAP_DEFAULT__cwmp1__SetParameterValuesResponse_Status; +#else + *a = (enum _cwmp1__SetParameterValuesResponse_Status)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetParameterValuesResponse_Status(struct soap *soap, const enum _cwmp1__SetParameterValuesResponse_Status *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__SetParameterValuesResponse_Status); + if (soap_out__cwmp1__SetParameterValuesResponse_Status(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +static const struct soap_code_map soap_codes__cwmp1__SetParameterValuesResponse_Status[] = +{ { (long)_cwmp1__SetParameterValuesResponse_Status__0, "0" }, + { (long)_cwmp1__SetParameterValuesResponse_Status__1, "1" }, + { 0, NULL } +}; + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__SetParameterValuesResponse_Status2s(struct soap *soap, enum _cwmp1__SetParameterValuesResponse_Status n) +{ const char *s = soap_code_str(soap_codes__cwmp1__SetParameterValuesResponse_Status, (long)n); + if (s) + return s; + return soap_long2s(soap, (long)n); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetParameterValuesResponse_Status(struct soap *soap, const char *tag, int id, const enum _cwmp1__SetParameterValuesResponse_Status *a, const char *type) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__SetParameterValuesResponse_Status), type) || soap_send(soap, soap__cwmp1__SetParameterValuesResponse_Status2s(soap, *a))) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 enum _cwmp1__SetParameterValuesResponse_Status * SOAP_FMAC4 soap_get__cwmp1__SetParameterValuesResponse_Status(struct soap *soap, enum _cwmp1__SetParameterValuesResponse_Status *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__SetParameterValuesResponse_Status(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__SetParameterValuesResponse_Status(struct soap *soap, const char *s, enum _cwmp1__SetParameterValuesResponse_Status *a) +{ + const struct soap_code_map *map; + if (!s) + return SOAP_OK; + map = soap_code(soap_codes__cwmp1__SetParameterValuesResponse_Status, s); + if (map) + *a = (enum _cwmp1__SetParameterValuesResponse_Status)map->code; + else + { long n; + if (soap_s2long(soap, s, &n) || ((soap->mode & SOAP_XML_STRICT) && (n < 0 || n > 1))) + return soap->error = SOAP_TYPE; + *a = (enum _cwmp1__SetParameterValuesResponse_Status)n; + } + return SOAP_OK; +} + +SOAP_FMAC3 enum _cwmp1__SetParameterValuesResponse_Status * SOAP_FMAC4 soap_in__cwmp1__SetParameterValuesResponse_Status(struct soap *soap, const char *tag, enum _cwmp1__SetParameterValuesResponse_Status *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (enum _cwmp1__SetParameterValuesResponse_Status *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__SetParameterValuesResponse_Status, sizeof(enum _cwmp1__SetParameterValuesResponse_Status), 0, NULL, NULL, NULL); + if (!a) + return NULL; + if (soap->body && !*soap->href) + { if (!a || soap_s2_cwmp1__SetParameterValuesResponse_Status(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (enum _cwmp1__SetParameterValuesResponse_Status *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__SetParameterValuesResponse_Status, 0, sizeof(enum _cwmp1__SetParameterValuesResponse_Status), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__OptionStruct_IsTransferable(struct soap *soap, enum _cwmp1__OptionStruct_IsTransferable *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT__cwmp1__OptionStruct_IsTransferable + *a = SOAP_DEFAULT__cwmp1__OptionStruct_IsTransferable; +#else + *a = (enum _cwmp1__OptionStruct_IsTransferable)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__OptionStruct_IsTransferable(struct soap *soap, const enum _cwmp1__OptionStruct_IsTransferable *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__OptionStruct_IsTransferable); + if (soap_out__cwmp1__OptionStruct_IsTransferable(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +static const struct soap_code_map soap_codes__cwmp1__OptionStruct_IsTransferable[] = +{ { (long)_cwmp1__OptionStruct_IsTransferable__0, "0" }, + { (long)_cwmp1__OptionStruct_IsTransferable__1, "1" }, + { 0, NULL } +}; + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__OptionStruct_IsTransferable2s(struct soap *soap, enum _cwmp1__OptionStruct_IsTransferable n) +{ const char *s = soap_code_str(soap_codes__cwmp1__OptionStruct_IsTransferable, (long)n); + if (s) + return s; + return soap_long2s(soap, (long)n); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__OptionStruct_IsTransferable(struct soap *soap, const char *tag, int id, const enum _cwmp1__OptionStruct_IsTransferable *a, const char *type) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__OptionStruct_IsTransferable), type) || soap_send(soap, soap__cwmp1__OptionStruct_IsTransferable2s(soap, *a))) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 enum _cwmp1__OptionStruct_IsTransferable * SOAP_FMAC4 soap_get__cwmp1__OptionStruct_IsTransferable(struct soap *soap, enum _cwmp1__OptionStruct_IsTransferable *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__OptionStruct_IsTransferable(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__OptionStruct_IsTransferable(struct soap *soap, const char *s, enum _cwmp1__OptionStruct_IsTransferable *a) +{ + const struct soap_code_map *map; + if (!s) + return SOAP_OK; + map = soap_code(soap_codes__cwmp1__OptionStruct_IsTransferable, s); + if (map) + *a = (enum _cwmp1__OptionStruct_IsTransferable)map->code; + else + { long n; + if (soap_s2long(soap, s, &n) || ((soap->mode & SOAP_XML_STRICT) && (n < 0 || n > 1))) + return soap->error = SOAP_TYPE; + *a = (enum _cwmp1__OptionStruct_IsTransferable)n; + } + return SOAP_OK; +} + +SOAP_FMAC3 enum _cwmp1__OptionStruct_IsTransferable * SOAP_FMAC4 soap_in__cwmp1__OptionStruct_IsTransferable(struct soap *soap, const char *tag, enum _cwmp1__OptionStruct_IsTransferable *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (enum _cwmp1__OptionStruct_IsTransferable *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__OptionStruct_IsTransferable, sizeof(enum _cwmp1__OptionStruct_IsTransferable), 0, NULL, NULL, NULL); + if (!a) + return NULL; + if (soap->body && !*soap->href) + { if (!a || soap_s2_cwmp1__OptionStruct_IsTransferable(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (enum _cwmp1__OptionStruct_IsTransferable *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__OptionStruct_IsTransferable, 0, sizeof(enum _cwmp1__OptionStruct_IsTransferable), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__OptionStruct_Mode(struct soap *soap, enum _cwmp1__OptionStruct_Mode *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT__cwmp1__OptionStruct_Mode + *a = SOAP_DEFAULT__cwmp1__OptionStruct_Mode; +#else + *a = (enum _cwmp1__OptionStruct_Mode)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__OptionStruct_Mode(struct soap *soap, const enum _cwmp1__OptionStruct_Mode *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__OptionStruct_Mode); + if (soap_out__cwmp1__OptionStruct_Mode(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +static const struct soap_code_map soap_codes__cwmp1__OptionStruct_Mode[] = +{ { (long)_cwmp1__OptionStruct_Mode__0, "0" }, + { (long)_cwmp1__OptionStruct_Mode__1, "1" }, + { (long)_cwmp1__OptionStruct_Mode__2, "2" }, + { 0, NULL } +}; + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__OptionStruct_Mode2s(struct soap *soap, enum _cwmp1__OptionStruct_Mode n) +{ const char *s = soap_code_str(soap_codes__cwmp1__OptionStruct_Mode, (long)n); + if (s) + return s; + return soap_long2s(soap, (long)n); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__OptionStruct_Mode(struct soap *soap, const char *tag, int id, const enum _cwmp1__OptionStruct_Mode *a, const char *type) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__OptionStruct_Mode), type) || soap_send(soap, soap__cwmp1__OptionStruct_Mode2s(soap, *a))) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 enum _cwmp1__OptionStruct_Mode * SOAP_FMAC4 soap_get__cwmp1__OptionStruct_Mode(struct soap *soap, enum _cwmp1__OptionStruct_Mode *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__OptionStruct_Mode(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__OptionStruct_Mode(struct soap *soap, const char *s, enum _cwmp1__OptionStruct_Mode *a) +{ + const struct soap_code_map *map; + if (!s) + return SOAP_OK; + map = soap_code(soap_codes__cwmp1__OptionStruct_Mode, s); + if (map) + *a = (enum _cwmp1__OptionStruct_Mode)map->code; + else + { long n; + if (soap_s2long(soap, s, &n) || ((soap->mode & SOAP_XML_STRICT) && (n < 0 || n > 2))) + return soap->error = SOAP_TYPE; + *a = (enum _cwmp1__OptionStruct_Mode)n; + } + return SOAP_OK; +} + +SOAP_FMAC3 enum _cwmp1__OptionStruct_Mode * SOAP_FMAC4 soap_in__cwmp1__OptionStruct_Mode(struct soap *soap, const char *tag, enum _cwmp1__OptionStruct_Mode *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (enum _cwmp1__OptionStruct_Mode *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__OptionStruct_Mode, sizeof(enum _cwmp1__OptionStruct_Mode), 0, NULL, NULL, NULL); + if (!a) + return NULL; + if (soap->body && !*soap->href) + { if (!a || soap_s2_cwmp1__OptionStruct_Mode(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (enum _cwmp1__OptionStruct_Mode *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__OptionStruct_Mode, 0, sizeof(enum _cwmp1__OptionStruct_Mode), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__OptionStruct_State(struct soap *soap, enum _cwmp1__OptionStruct_State *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT__cwmp1__OptionStruct_State + *a = SOAP_DEFAULT__cwmp1__OptionStruct_State; +#else + *a = (enum _cwmp1__OptionStruct_State)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__OptionStruct_State(struct soap *soap, const enum _cwmp1__OptionStruct_State *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__OptionStruct_State); + if (soap_out__cwmp1__OptionStruct_State(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +static const struct soap_code_map soap_codes__cwmp1__OptionStruct_State[] = +{ { (long)_cwmp1__OptionStruct_State__0, "0" }, + { (long)_cwmp1__OptionStruct_State__1, "1" }, + { (long)_cwmp1__OptionStruct_State__2, "2" }, + { (long)_cwmp1__OptionStruct_State__3, "3" }, + { 0, NULL } +}; + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__OptionStruct_State2s(struct soap *soap, enum _cwmp1__OptionStruct_State n) +{ const char *s = soap_code_str(soap_codes__cwmp1__OptionStruct_State, (long)n); + if (s) + return s; + return soap_long2s(soap, (long)n); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__OptionStruct_State(struct soap *soap, const char *tag, int id, const enum _cwmp1__OptionStruct_State *a, const char *type) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__OptionStruct_State), type) || soap_send(soap, soap__cwmp1__OptionStruct_State2s(soap, *a))) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 enum _cwmp1__OptionStruct_State * SOAP_FMAC4 soap_get__cwmp1__OptionStruct_State(struct soap *soap, enum _cwmp1__OptionStruct_State *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__OptionStruct_State(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__OptionStruct_State(struct soap *soap, const char *s, enum _cwmp1__OptionStruct_State *a) +{ + const struct soap_code_map *map; + if (!s) + return SOAP_OK; + map = soap_code(soap_codes__cwmp1__OptionStruct_State, s); + if (map) + *a = (enum _cwmp1__OptionStruct_State)map->code; + else + { long n; + if (soap_s2long(soap, s, &n) || ((soap->mode & SOAP_XML_STRICT) && (n < 0 || n > 3))) + return soap->error = SOAP_TYPE; + *a = (enum _cwmp1__OptionStruct_State)n; + } + return SOAP_OK; +} + +SOAP_FMAC3 enum _cwmp1__OptionStruct_State * SOAP_FMAC4 soap_in__cwmp1__OptionStruct_State(struct soap *soap, const char *tag, enum _cwmp1__OptionStruct_State *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (enum _cwmp1__OptionStruct_State *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__OptionStruct_State, sizeof(enum _cwmp1__OptionStruct_State), 0, NULL, NULL, NULL); + if (!a) + return NULL; + if (soap->body && !*soap->href) + { if (!a || soap_s2_cwmp1__OptionStruct_State(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (enum _cwmp1__OptionStruct_State *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__OptionStruct_State, 0, sizeof(enum _cwmp1__OptionStruct_State), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__AllQueuedTransferStruct_State(struct soap *soap, enum _cwmp1__AllQueuedTransferStruct_State *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT__cwmp1__AllQueuedTransferStruct_State + *a = SOAP_DEFAULT__cwmp1__AllQueuedTransferStruct_State; +#else + *a = (enum _cwmp1__AllQueuedTransferStruct_State)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__AllQueuedTransferStruct_State(struct soap *soap, const enum _cwmp1__AllQueuedTransferStruct_State *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__AllQueuedTransferStruct_State); + if (soap_out__cwmp1__AllQueuedTransferStruct_State(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +static const struct soap_code_map soap_codes__cwmp1__AllQueuedTransferStruct_State[] = +{ { (long)_cwmp1__AllQueuedTransferStruct_State__1, "1" }, + { (long)_cwmp1__AllQueuedTransferStruct_State__2, "2" }, + { (long)_cwmp1__AllQueuedTransferStruct_State__3, "3" }, + { 0, NULL } +}; + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__AllQueuedTransferStruct_State2s(struct soap *soap, enum _cwmp1__AllQueuedTransferStruct_State n) +{ const char *s = soap_code_str(soap_codes__cwmp1__AllQueuedTransferStruct_State, (long)n); + if (s) + return s; + return soap_long2s(soap, (long)n); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__AllQueuedTransferStruct_State(struct soap *soap, const char *tag, int id, const enum _cwmp1__AllQueuedTransferStruct_State *a, const char *type) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__AllQueuedTransferStruct_State), type) || soap_send(soap, soap__cwmp1__AllQueuedTransferStruct_State2s(soap, *a))) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 enum _cwmp1__AllQueuedTransferStruct_State * SOAP_FMAC4 soap_get__cwmp1__AllQueuedTransferStruct_State(struct soap *soap, enum _cwmp1__AllQueuedTransferStruct_State *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__AllQueuedTransferStruct_State(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__AllQueuedTransferStruct_State(struct soap *soap, const char *s, enum _cwmp1__AllQueuedTransferStruct_State *a) +{ + const struct soap_code_map *map; + if (!s) + return SOAP_OK; + map = soap_code(soap_codes__cwmp1__AllQueuedTransferStruct_State, s); + if (map) + *a = (enum _cwmp1__AllQueuedTransferStruct_State)map->code; + else + { long n; + if (soap_s2long(soap, s, &n) || ((soap->mode & SOAP_XML_STRICT) && (n < 0 || n > 3))) + return soap->error = SOAP_TYPE; + *a = (enum _cwmp1__AllQueuedTransferStruct_State)n; + } + return SOAP_OK; +} + +SOAP_FMAC3 enum _cwmp1__AllQueuedTransferStruct_State * SOAP_FMAC4 soap_in__cwmp1__AllQueuedTransferStruct_State(struct soap *soap, const char *tag, enum _cwmp1__AllQueuedTransferStruct_State *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (enum _cwmp1__AllQueuedTransferStruct_State *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__AllQueuedTransferStruct_State, sizeof(enum _cwmp1__AllQueuedTransferStruct_State), 0, NULL, NULL, NULL); + if (!a) + return NULL; + if (soap->body && !*soap->href) + { if (!a || soap_s2_cwmp1__AllQueuedTransferStruct_State(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (enum _cwmp1__AllQueuedTransferStruct_State *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__AllQueuedTransferStruct_State, 0, sizeof(enum _cwmp1__AllQueuedTransferStruct_State), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__QueuedTransferStruct_State(struct soap *soap, enum _cwmp1__QueuedTransferStruct_State *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT__cwmp1__QueuedTransferStruct_State + *a = SOAP_DEFAULT__cwmp1__QueuedTransferStruct_State; +#else + *a = (enum _cwmp1__QueuedTransferStruct_State)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__QueuedTransferStruct_State(struct soap *soap, const enum _cwmp1__QueuedTransferStruct_State *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__QueuedTransferStruct_State); + if (soap_out__cwmp1__QueuedTransferStruct_State(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +static const struct soap_code_map soap_codes__cwmp1__QueuedTransferStruct_State[] = +{ { (long)_cwmp1__QueuedTransferStruct_State__1, "1" }, + { (long)_cwmp1__QueuedTransferStruct_State__2, "2" }, + { (long)_cwmp1__QueuedTransferStruct_State__3, "3" }, + { 0, NULL } +}; + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__QueuedTransferStruct_State2s(struct soap *soap, enum _cwmp1__QueuedTransferStruct_State n) +{ const char *s = soap_code_str(soap_codes__cwmp1__QueuedTransferStruct_State, (long)n); + if (s) + return s; + return soap_long2s(soap, (long)n); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__QueuedTransferStruct_State(struct soap *soap, const char *tag, int id, const enum _cwmp1__QueuedTransferStruct_State *a, const char *type) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__QueuedTransferStruct_State), type) || soap_send(soap, soap__cwmp1__QueuedTransferStruct_State2s(soap, *a))) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 enum _cwmp1__QueuedTransferStruct_State * SOAP_FMAC4 soap_get__cwmp1__QueuedTransferStruct_State(struct soap *soap, enum _cwmp1__QueuedTransferStruct_State *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__QueuedTransferStruct_State(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__QueuedTransferStruct_State(struct soap *soap, const char *s, enum _cwmp1__QueuedTransferStruct_State *a) +{ + const struct soap_code_map *map; + if (!s) + return SOAP_OK; + map = soap_code(soap_codes__cwmp1__QueuedTransferStruct_State, s); + if (map) + *a = (enum _cwmp1__QueuedTransferStruct_State)map->code; + else + { long n; + if (soap_s2long(soap, s, &n) || ((soap->mode & SOAP_XML_STRICT) && (n < 0 || n > 3))) + return soap->error = SOAP_TYPE; + *a = (enum _cwmp1__QueuedTransferStruct_State)n; + } + return SOAP_OK; +} + +SOAP_FMAC3 enum _cwmp1__QueuedTransferStruct_State * SOAP_FMAC4 soap_in__cwmp1__QueuedTransferStruct_State(struct soap *soap, const char *tag, enum _cwmp1__QueuedTransferStruct_State *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (enum _cwmp1__QueuedTransferStruct_State *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__QueuedTransferStruct_State, sizeof(enum _cwmp1__QueuedTransferStruct_State), 0, NULL, NULL, NULL); + if (!a) + return NULL; + if (soap->body && !*soap->href) + { if (!a || soap_s2_cwmp1__QueuedTransferStruct_State(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (enum _cwmp1__QueuedTransferStruct_State *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__QueuedTransferStruct_State, 0, sizeof(enum _cwmp1__QueuedTransferStruct_State), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__ParameterAttributeStruct_Notification(struct soap *soap, enum _cwmp1__ParameterAttributeStruct_Notification *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT__cwmp1__ParameterAttributeStruct_Notification + *a = SOAP_DEFAULT__cwmp1__ParameterAttributeStruct_Notification; +#else + *a = (enum _cwmp1__ParameterAttributeStruct_Notification)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__ParameterAttributeStruct_Notification(struct soap *soap, const enum _cwmp1__ParameterAttributeStruct_Notification *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__ParameterAttributeStruct_Notification); + if (soap_out__cwmp1__ParameterAttributeStruct_Notification(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +static const struct soap_code_map soap_codes__cwmp1__ParameterAttributeStruct_Notification[] = +{ { (long)_cwmp1__ParameterAttributeStruct_Notification__0, "0" }, + { (long)_cwmp1__ParameterAttributeStruct_Notification__1, "1" }, + { (long)_cwmp1__ParameterAttributeStruct_Notification__2, "2" }, + { 0, NULL } +}; + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__ParameterAttributeStruct_Notification2s(struct soap *soap, enum _cwmp1__ParameterAttributeStruct_Notification n) +{ const char *s = soap_code_str(soap_codes__cwmp1__ParameterAttributeStruct_Notification, (long)n); + if (s) + return s; + return soap_long2s(soap, (long)n); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__ParameterAttributeStruct_Notification(struct soap *soap, const char *tag, int id, const enum _cwmp1__ParameterAttributeStruct_Notification *a, const char *type) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__ParameterAttributeStruct_Notification), type) || soap_send(soap, soap__cwmp1__ParameterAttributeStruct_Notification2s(soap, *a))) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 enum _cwmp1__ParameterAttributeStruct_Notification * SOAP_FMAC4 soap_get__cwmp1__ParameterAttributeStruct_Notification(struct soap *soap, enum _cwmp1__ParameterAttributeStruct_Notification *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__ParameterAttributeStruct_Notification(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__ParameterAttributeStruct_Notification(struct soap *soap, const char *s, enum _cwmp1__ParameterAttributeStruct_Notification *a) +{ + const struct soap_code_map *map; + if (!s) + return SOAP_OK; + map = soap_code(soap_codes__cwmp1__ParameterAttributeStruct_Notification, s); + if (map) + *a = (enum _cwmp1__ParameterAttributeStruct_Notification)map->code; + else + { long n; + if (soap_s2long(soap, s, &n) || ((soap->mode & SOAP_XML_STRICT) && (n < 0 || n > 2))) + return soap->error = SOAP_TYPE; + *a = (enum _cwmp1__ParameterAttributeStruct_Notification)n; + } + return SOAP_OK; +} + +SOAP_FMAC3 enum _cwmp1__ParameterAttributeStruct_Notification * SOAP_FMAC4 soap_in__cwmp1__ParameterAttributeStruct_Notification(struct soap *soap, const char *tag, enum _cwmp1__ParameterAttributeStruct_Notification *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (enum _cwmp1__ParameterAttributeStruct_Notification *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__ParameterAttributeStruct_Notification, sizeof(enum _cwmp1__ParameterAttributeStruct_Notification), 0, NULL, NULL, NULL); + if (!a) + return NULL; + if (soap->body && !*soap->href) + { if (!a || soap_s2_cwmp1__ParameterAttributeStruct_Notification(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (enum _cwmp1__ParameterAttributeStruct_Notification *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__ParameterAttributeStruct_Notification, 0, sizeof(enum _cwmp1__ParameterAttributeStruct_Notification), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetParameterAttributesStruct_Notification(struct soap *soap, enum _cwmp1__SetParameterAttributesStruct_Notification *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT__cwmp1__SetParameterAttributesStruct_Notification + *a = SOAP_DEFAULT__cwmp1__SetParameterAttributesStruct_Notification; +#else + *a = (enum _cwmp1__SetParameterAttributesStruct_Notification)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetParameterAttributesStruct_Notification(struct soap *soap, const enum _cwmp1__SetParameterAttributesStruct_Notification *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__SetParameterAttributesStruct_Notification); + if (soap_out__cwmp1__SetParameterAttributesStruct_Notification(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +static const struct soap_code_map soap_codes__cwmp1__SetParameterAttributesStruct_Notification[] = +{ { (long)_cwmp1__SetParameterAttributesStruct_Notification__0, "0" }, + { (long)_cwmp1__SetParameterAttributesStruct_Notification__1, "1" }, + { (long)_cwmp1__SetParameterAttributesStruct_Notification__2, "2" }, + { 0, NULL } +}; + +SOAP_FMAC3S const char* SOAP_FMAC4S soap__cwmp1__SetParameterAttributesStruct_Notification2s(struct soap *soap, enum _cwmp1__SetParameterAttributesStruct_Notification n) +{ const char *s = soap_code_str(soap_codes__cwmp1__SetParameterAttributesStruct_Notification, (long)n); + if (s) + return s; + return soap_long2s(soap, (long)n); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetParameterAttributesStruct_Notification(struct soap *soap, const char *tag, int id, const enum _cwmp1__SetParameterAttributesStruct_Notification *a, const char *type) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__SetParameterAttributesStruct_Notification), type) || soap_send(soap, soap__cwmp1__SetParameterAttributesStruct_Notification2s(soap, *a))) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 enum _cwmp1__SetParameterAttributesStruct_Notification * SOAP_FMAC4 soap_get__cwmp1__SetParameterAttributesStruct_Notification(struct soap *soap, enum _cwmp1__SetParameterAttributesStruct_Notification *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__SetParameterAttributesStruct_Notification(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2_cwmp1__SetParameterAttributesStruct_Notification(struct soap *soap, const char *s, enum _cwmp1__SetParameterAttributesStruct_Notification *a) +{ + const struct soap_code_map *map; + if (!s) + return SOAP_OK; + map = soap_code(soap_codes__cwmp1__SetParameterAttributesStruct_Notification, s); + if (map) + *a = (enum _cwmp1__SetParameterAttributesStruct_Notification)map->code; + else + { long n; + if (soap_s2long(soap, s, &n) || ((soap->mode & SOAP_XML_STRICT) && (n < 0 || n > 2))) + return soap->error = SOAP_TYPE; + *a = (enum _cwmp1__SetParameterAttributesStruct_Notification)n; + } + return SOAP_OK; +} + +SOAP_FMAC3 enum _cwmp1__SetParameterAttributesStruct_Notification * SOAP_FMAC4 soap_in__cwmp1__SetParameterAttributesStruct_Notification(struct soap *soap, const char *tag, enum _cwmp1__SetParameterAttributesStruct_Notification *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (enum _cwmp1__SetParameterAttributesStruct_Notification *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__SetParameterAttributesStruct_Notification, sizeof(enum _cwmp1__SetParameterAttributesStruct_Notification), 0, NULL, NULL, NULL); + if (!a) + return NULL; + if (soap->body && !*soap->href) + { if (!a || soap_s2_cwmp1__SetParameterAttributesStruct_Notification(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (enum _cwmp1__SetParameterAttributesStruct_Notification *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__SetParameterAttributesStruct_Notification, 0, sizeof(enum _cwmp1__SetParameterAttributesStruct_Notification), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__boolean(struct soap *soap, enum xsd__boolean *a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT_xsd__boolean + *a = SOAP_DEFAULT_xsd__boolean; +#else + *a = (enum xsd__boolean)0; +#endif +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__boolean(struct soap *soap, const enum xsd__boolean *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_xsd__boolean); + if (soap_out_xsd__boolean(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +static const struct soap_code_map soap_codes_xsd__boolean[] = +{ { (long)xsd__boolean__false_, "false" }, + { (long)xsd__boolean__true_, "true" }, + { 0, NULL } +}; + +SOAP_FMAC3S const char* SOAP_FMAC4S soap_xsd__boolean2s(struct soap *soap, enum xsd__boolean n) +{ return soap_code_str(soap_codes_xsd__boolean, n!=0); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__boolean(struct soap *soap, const char *tag, int id, const enum xsd__boolean *a, const char *type) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_xsd__boolean), type) || soap_send(soap, soap_xsd__boolean2s(soap, *a))) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 enum xsd__boolean * SOAP_FMAC4 soap_get_xsd__boolean(struct soap *soap, enum xsd__boolean *p, const char *tag, const char *type) +{ + if ((p = soap_in_xsd__boolean(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3S int SOAP_FMAC4S soap_s2xsd__boolean(struct soap *soap, const char *s, enum xsd__boolean *a) +{ + const struct soap_code_map *map; + if (!s) + return SOAP_OK; + map = soap_code(soap_codes_xsd__boolean, s); + if (map) + *a = (enum xsd__boolean)(map->code != 0); + else + { long n; + if (soap_s2long(soap, s, &n) || n < 0 || n > 1) + return soap->error = SOAP_TYPE; + *a = (enum xsd__boolean)(n != 0); + } + return SOAP_OK; +} + +SOAP_FMAC3 enum xsd__boolean * SOAP_FMAC4 soap_in_xsd__boolean(struct soap *soap, const char *tag, enum xsd__boolean *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, NULL)) + return NULL; + if (*soap->type && soap_match_tag(soap, soap->type, type) && soap_match_tag(soap, soap->type, ":boolean")) + { soap->error = SOAP_TYPE; + return NULL; + } + a = (enum xsd__boolean *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_xsd__boolean, sizeof(enum xsd__boolean), 0, NULL, NULL, NULL); + if (!a) + return NULL; + if (soap->body && !*soap->href) + { if (!a || soap_s2xsd__boolean(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (enum xsd__boolean *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_xsd__boolean, 0, sizeof(enum xsd__boolean), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +#ifndef WITH_NOGLOBAL + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap *soap, struct SOAP_ENV__Fault *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default__QName(soap, &a->faultcode); + soap_default_string(soap, &a->faultstring); + soap_default_string(soap, &a->faultactor); + a->detail = NULL; + a->SOAP_ENV__Code = NULL; + a->SOAP_ENV__Reason = NULL; + soap_default_string(soap, &a->SOAP_ENV__Node); + soap_default_string(soap, &a->SOAP_ENV__Role); + a->SOAP_ENV__Detail = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap *soap, const struct SOAP_ENV__Fault *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize__QName(soap, &a->faultcode); + soap_serialize_string(soap, &a->faultstring); + soap_serialize_string(soap, &a->faultactor); + soap_serialize_PointerToSOAP_ENV__Detail(soap, &a->detail); + soap_serialize_PointerToSOAP_ENV__Code(soap, &a->SOAP_ENV__Code); + soap_serialize_PointerToSOAP_ENV__Reason(soap, &a->SOAP_ENV__Reason); + soap_serialize_string(soap, &a->SOAP_ENV__Node); + soap_serialize_string(soap, &a->SOAP_ENV__Role); + soap_serialize_PointerToSOAP_ENV__Detail(soap, &a->SOAP_ENV__Detail); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap *soap, const struct SOAP_ENV__Fault *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Fault); + if (soap_out_SOAP_ENV__Fault(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Fault(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Fault *a, const char *type) +{ + const char *soap_tmp_faultcode = soap_QName2s(soap, a->faultcode); + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Fault), type)) + return soap->error; + if (soap_out__QName(soap, "faultcode", -1, (char*const*)&soap_tmp_faultcode, "")) + return soap->error; + if (soap_out_string(soap, "faultstring", -1, &a->faultstring, "")) + return soap->error; + if (soap_out_string(soap, "faultactor", -1, &a->faultactor, "")) + return soap->error; + if (soap_out_PointerToSOAP_ENV__Detail(soap, "detail", -1, &a->detail, "")) + return soap->error; + if (soap_out_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Code", -1, &a->SOAP_ENV__Code, "")) + return soap->error; + if (soap_out_PointerToSOAP_ENV__Reason(soap, "SOAP-ENV:Reason", -1, &a->SOAP_ENV__Reason, "")) + return soap->error; + if (soap_out_string(soap, "SOAP-ENV:Node", -1, &a->SOAP_ENV__Node, "")) + return soap->error; + if (soap_out_string(soap, "SOAP-ENV:Role", -1, &a->SOAP_ENV__Role, "")) + return soap->error; + if (soap_out_PointerToSOAP_ENV__Detail(soap, "SOAP-ENV:Detail", -1, &a->SOAP_ENV__Detail, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_get_SOAP_ENV__Fault(struct soap *soap, struct SOAP_ENV__Fault *p, const char *tag, const char *type) +{ + if ((p = soap_in_SOAP_ENV__Fault(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_in_SOAP_ENV__Fault(struct soap *soap, const char *tag, struct SOAP_ENV__Fault *a, const char *type) +{ + size_t soap_flag_faultcode = 1; + size_t soap_flag_faultstring = 1; + size_t soap_flag_faultactor = 1; + size_t soap_flag_detail = 1; + size_t soap_flag_SOAP_ENV__Code = 1; + size_t soap_flag_SOAP_ENV__Reason = 1; + size_t soap_flag_SOAP_ENV__Node = 1; + size_t soap_flag_SOAP_ENV__Role = 1; + size_t soap_flag_SOAP_ENV__Detail = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct SOAP_ENV__Fault *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Fault, sizeof(struct SOAP_ENV__Fault), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_SOAP_ENV__Fault(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_faultcode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in__QName(soap, "faultcode", &a->faultcode, "")) + { soap_flag_faultcode--; + continue; + } + if (soap_flag_faultstring && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "faultstring", &a->faultstring, "xsd:string")) + { soap_flag_faultstring--; + continue; + } + if (soap_flag_faultactor && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "faultactor", &a->faultactor, "xsd:string")) + { soap_flag_faultactor--; + continue; + } + if (soap_flag_detail && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerToSOAP_ENV__Detail(soap, "detail", &a->detail, "")) + { soap_flag_detail--; + continue; + } + if (soap_flag_SOAP_ENV__Code && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Code", &a->SOAP_ENV__Code, "")) + { soap_flag_SOAP_ENV__Code--; + continue; + } + if (soap_flag_SOAP_ENV__Reason && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerToSOAP_ENV__Reason(soap, "SOAP-ENV:Reason", &a->SOAP_ENV__Reason, "")) + { soap_flag_SOAP_ENV__Reason--; + continue; + } + if (soap_flag_SOAP_ENV__Node && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "SOAP-ENV:Node", &a->SOAP_ENV__Node, "xsd:string")) + { soap_flag_SOAP_ENV__Node--; + continue; + } + if (soap_flag_SOAP_ENV__Role && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "SOAP-ENV:Role", &a->SOAP_ENV__Role, "xsd:string")) + { soap_flag_SOAP_ENV__Role--; + continue; + } + if (soap_flag_SOAP_ENV__Detail && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerToSOAP_ENV__Detail(soap, "SOAP-ENV:Detail", &a->SOAP_ENV__Detail, "")) + { soap_flag_SOAP_ENV__Detail--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct SOAP_ENV__Fault *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Fault, 0, sizeof(struct SOAP_ENV__Fault), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +#endif + +#ifndef WITH_NOGLOBAL + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->SOAP_ENV__Text); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap *soap, const struct SOAP_ENV__Reason *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->SOAP_ENV__Text); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Reason(struct soap *soap, const struct SOAP_ENV__Reason *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Reason); + if (soap_out_SOAP_ENV__Reason(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Reason *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Reason), type)) + return soap->error; + if (soap->lang) + soap_set_attr(soap, "xml:lang", soap->lang); + if (soap_out_string(soap, "SOAP-ENV:Text", -1, &a->SOAP_ENV__Text, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_get_SOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *p, const char *tag, const char *type) +{ + if ((p = soap_in_SOAP_ENV__Reason(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct soap *soap, const char *tag, struct SOAP_ENV__Reason *a, const char *type) +{ + size_t soap_flag_SOAP_ENV__Text = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct SOAP_ENV__Reason *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Reason, sizeof(struct SOAP_ENV__Reason), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_SOAP_ENV__Reason(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_SOAP_ENV__Text && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "SOAP-ENV:Text", &a->SOAP_ENV__Text, "xsd:string")) + { soap_flag_SOAP_ENV__Text--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct SOAP_ENV__Reason *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Reason, 0, sizeof(struct SOAP_ENV__Reason), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +#endif + +#ifndef WITH_NOGLOBAL + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->__type = 0; + a->fault = NULL; + a->__any = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap *soap, const struct SOAP_ENV__Detail *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_markelement(soap, a->fault, a->__type); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap *soap, const struct SOAP_ENV__Detail *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Detail); + if (soap_out_SOAP_ENV__Detail(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Detail *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Detail), type)) + return soap->error; + if (soap_putelement(soap, a->fault, "fault", -1, a->__type)) + return soap->error; + soap_outliteral(soap, "-any", &a->__any, NULL); + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_get_SOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *p, const char *tag, const char *type) +{ + if ((p = soap_in_SOAP_ENV__Detail(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct soap *soap, const char *tag, struct SOAP_ENV__Detail *a, const char *type) +{ + size_t soap_flag_fault = 1; + size_t soap_flag___any = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct SOAP_ENV__Detail *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Detail, sizeof(struct SOAP_ENV__Detail), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_SOAP_ENV__Detail(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_fault && soap->error == SOAP_TAG_MISMATCH) + if ((a->fault = soap_getelement(soap, &a->__type))) + { soap_flag_fault = 0; + continue; + } + if (soap_flag___any && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_inliteral(soap, "-any", &a->__any)) + { soap_flag___any--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct SOAP_ENV__Detail *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Detail, 0, sizeof(struct SOAP_ENV__Detail), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +#endif + +#ifndef WITH_NOGLOBAL + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default__QName(soap, &a->SOAP_ENV__Value); + a->SOAP_ENV__Subcode = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap *soap, const struct SOAP_ENV__Code *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize__QName(soap, &a->SOAP_ENV__Value); + soap_serialize_PointerToSOAP_ENV__Code(soap, &a->SOAP_ENV__Subcode); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap *soap, const struct SOAP_ENV__Code *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Code); + if (soap_out_SOAP_ENV__Code(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Code *a, const char *type) +{ + const char *soap_tmp_SOAP_ENV__Value = soap_QName2s(soap, a->SOAP_ENV__Value); + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Code), type)) + return soap->error; + if (soap_out__QName(soap, "SOAP-ENV:Value", -1, (char*const*)&soap_tmp_SOAP_ENV__Value, "")) + return soap->error; + if (soap_out_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Subcode", -1, &a->SOAP_ENV__Subcode, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_get_SOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *p, const char *tag, const char *type) +{ + if ((p = soap_in_SOAP_ENV__Code(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap *soap, const char *tag, struct SOAP_ENV__Code *a, const char *type) +{ + size_t soap_flag_SOAP_ENV__Value = 1; + size_t soap_flag_SOAP_ENV__Subcode = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct SOAP_ENV__Code *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Code, sizeof(struct SOAP_ENV__Code), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_SOAP_ENV__Code(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_SOAP_ENV__Value && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in__QName(soap, "SOAP-ENV:Value", &a->SOAP_ENV__Value, "")) + { soap_flag_SOAP_ENV__Value--; + continue; + } + if (soap_flag_SOAP_ENV__Subcode && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Subcode", &a->SOAP_ENV__Subcode, "")) + { soap_flag_SOAP_ENV__Subcode--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct SOAP_ENV__Code *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Code, 0, sizeof(struct SOAP_ENV__Code), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +#endif + +#ifndef WITH_NOGLOBAL + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap *soap, struct SOAP_ENV__Header *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap *soap, const struct SOAP_ENV__Header *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap *soap, const struct SOAP_ENV__Header *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Header); + if (soap_out_SOAP_ENV__Header(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Header *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Header), type)) + return soap->error; + /* KMD */ + if (soap_put__cwmp1__ID(soap, &(a->ID), "cwmp:ID", "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_get_SOAP_ENV__Header(struct soap *soap, struct SOAP_ENV__Header *p, const char *tag, const char *type) +{ + if ((p = soap_in_SOAP_ENV__Header(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct soap *soap, const char *tag, struct SOAP_ENV__Header *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct SOAP_ENV__Header *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Header, sizeof(struct SOAP_ENV__Header), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_SOAP_ENV__Header(soap, a); + memset(a, 0, sizeof(struct SOAP_ENV__Header)); + soap_get__cwmp1__ID(soap, &(a->ID), "cwmp:ID",""); + soap_get__cwmp1__HoldRequests(soap, &(a->HoldRequests), "cwmp:HoldRequests",""); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct SOAP_ENV__Header *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Header, 0, sizeof(struct SOAP_ENV__Header), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +#endif + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__Inform(struct soap *soap, struct cwmp1__Inform *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->DeviceId = NULL; + a->Event = NULL; + soap_default_unsignedInt(soap, &a->MaxEnvelopesI); + soap_default_time(soap, &a->CurrentTime); + soap_default_unsignedInt(soap, &a->RetryCount); + a->ParameterList = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__Inform(struct soap *soap, const struct cwmp1__Inform *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTocwmp1__DeviceIdStruct(soap, &a->DeviceId); + soap_serialize_PointerTocwmp1EventList(soap, &a->Event); + soap_embedded(soap, &a->MaxEnvelopesI, SOAP_TYPE_unsignedInt); + soap_embedded(soap, &a->CurrentTime, SOAP_TYPE_time); + soap_embedded(soap, &a->RetryCount, SOAP_TYPE_unsignedInt); + soap_serialize_PointerTocwmp1ParameterValueList(soap, &a->ParameterList); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__Inform(struct soap *soap, const struct cwmp1__Inform *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__Inform); + if (soap_out_cwmp1__Inform(soap, tag, id, a, type)) + return soap->error; + /* KMD */ + return SOAP_OK; + /*return soap_putindependent(soap);*/ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__Inform(struct soap *soap, const char *tag, int id, const struct cwmp1__Inform *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_cwmp1__Inform), type)) + return soap->error; + if (soap_out_PointerTocwmp1__DeviceIdStruct(soap, "DeviceId", -1, &a->DeviceId, "")) + return soap->error; + if (soap_out_PointerTocwmp1EventList(soap, "Event", -1, &a->Event, "")) + return soap->error; + if (soap_out_unsignedInt(soap, "MaxEnvelopes", -1, &a->MaxEnvelopesI, "")) + return soap->error; + if (soap_out_time(soap, "CurrentTime", -1, &a->CurrentTime, "")) + return soap->error; + if (soap_out_unsignedInt(soap, "RetryCount", -1, &a->RetryCount, "")) + return soap->error; + if (soap_out_PointerTocwmp1ParameterValueList(soap, "ParameterList", -1, &a->ParameterList, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1__Inform * SOAP_FMAC4 soap_get_cwmp1__Inform(struct soap *soap, struct cwmp1__Inform *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__Inform(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__Inform * SOAP_FMAC4 soap_in_cwmp1__Inform(struct soap *soap, const char *tag, struct cwmp1__Inform *a, const char *type) +{ + size_t soap_flag_DeviceId = 1; + size_t soap_flag_Event = 1; + size_t soap_flag_MaxEnvelopesI = 1; + size_t soap_flag_CurrentTime = 1; + size_t soap_flag_RetryCount = 1; + size_t soap_flag_ParameterList = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct cwmp1__Inform *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1__Inform, sizeof(struct cwmp1__Inform), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1__Inform(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_DeviceId && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1__DeviceIdStruct(soap, "DeviceId", &a->DeviceId, "cwmp:DeviceIdStruct")) + { soap_flag_DeviceId--; + continue; + } + if (soap_flag_Event && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1EventList(soap, "Event", &a->Event, "cwmp:EventStruct")) + { soap_flag_Event--; + continue; + } + if (soap_flag_MaxEnvelopesI && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_unsignedInt(soap, "MaxEnvelopesI", &a->MaxEnvelopesI, "xsd:unsignedInt")) + { soap_flag_MaxEnvelopesI--; + continue; + } + if (soap_flag_CurrentTime && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_time(soap, "CurrentTime", &a->CurrentTime, "xsd:dateTime")) + { soap_flag_CurrentTime--; + continue; + } + if (soap_flag_RetryCount && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_unsignedInt(soap, "RetryCount", &a->RetryCount, "xsd:unsignedInt")) + { soap_flag_RetryCount--; + continue; + } + if (soap_flag_ParameterList && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1ParameterValueList(soap, "ParameterList", &a->ParameterList, "cwmp:ParameterValueStruct")) + { soap_flag_ParameterList--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1__Inform *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1__Inform, 0, sizeof(struct cwmp1__Inform), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_MaxEnvelopesI > 0 || soap_flag_CurrentTime > 0 || soap_flag_RetryCount > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__InformResponse(struct soap *soap, struct cwmp1__InformResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->MaxEnvelopesO = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__InformResponse(struct soap *soap, const struct cwmp1__InformResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTounsignedInt(soap, &a->MaxEnvelopesO); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__InformResponse(struct soap *soap, const struct cwmp1__InformResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__InformResponse); + if (soap_out_cwmp1__InformResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__InformResponse(struct soap *soap, const char *tag, int id, const struct cwmp1__InformResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_cwmp1__InformResponse), type)) + return soap->error; + if (soap_out_PointerTounsignedInt(soap, "MaxEnvelopesO", -1, &a->MaxEnvelopesO, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1__InformResponse * SOAP_FMAC4 soap_get_cwmp1__InformResponse(struct soap *soap, struct cwmp1__InformResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__InformResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__InformResponse * SOAP_FMAC4 soap_in_cwmp1__InformResponse(struct soap *soap, const char *tag, struct cwmp1__InformResponse *a, const char *type) +{ + size_t soap_flag_MaxEnvelopesO = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct cwmp1__InformResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1__InformResponse, sizeof(struct cwmp1__InformResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1__InformResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_MaxEnvelopesO && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTounsignedInt(soap, "MaxEnvelopes", &a->MaxEnvelopesO, "xsd:unsignedInt")) + { soap_flag_MaxEnvelopesO--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1__InformResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1__InformResponse, 0, sizeof(struct cwmp1__InformResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__HoldRequests(struct soap *soap, struct _cwmp1__HoldRequests *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_xsd__boolean(soap, &a->__item); + soap_default_string(soap, &a->SOAP_ENV__mustUnderstand); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__HoldRequests(struct soap *soap, const struct _cwmp1__HoldRequests *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__HoldRequests(struct soap *soap, const struct _cwmp1__HoldRequests *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__HoldRequests); + if (soap_out__cwmp1__HoldRequests(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__HoldRequests(struct soap *soap, const char *tag, int id, const struct _cwmp1__HoldRequests *a, const char *type) +{ + if (a->SOAP_ENV__mustUnderstand) + soap_set_attr(soap, "SOAP-ENV:mustUnderstand", a->SOAP_ENV__mustUnderstand); + return soap_out_xsd__boolean(soap, tag, id, &a->__item, ""); +} + +SOAP_FMAC3 struct _cwmp1__HoldRequests * SOAP_FMAC4 soap_get__cwmp1__HoldRequests(struct soap *soap, struct _cwmp1__HoldRequests *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__HoldRequests(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__HoldRequests * SOAP_FMAC4 soap_in__cwmp1__HoldRequests(struct soap *soap, const char *tag, struct _cwmp1__HoldRequests *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!(a = (struct _cwmp1__HoldRequests *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__HoldRequests, sizeof(struct _cwmp1__HoldRequests), 0, NULL, NULL, NULL))) + return NULL; + soap_revert(soap); + *soap->id = '\0'; + soap_default__cwmp1__HoldRequests(soap, a); + if (soap_s2string(soap, soap_attr_value(soap, "SOAP-ENV:mustUnderstand", 1), &a->SOAP_ENV__mustUnderstand)) + return NULL; + if (!soap_in_xsd__boolean(soap, tag, &a->__item, "")) + return NULL; + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__ID(struct soap *soap, struct _cwmp1__ID *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->__item); + soap_default_string(soap, &a->SOAP_ENV__mustUnderstand); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__ID(struct soap *soap, const struct _cwmp1__ID *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->__item); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__ID(struct soap *soap, const struct _cwmp1__ID *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__ID); + if (soap_out__cwmp1__ID(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__ID(struct soap *soap, const char *tag, int id, const struct _cwmp1__ID *a, const char *type) +{ + if (a->SOAP_ENV__mustUnderstand) + soap_set_attr(soap, "SOAP-ENV:mustUnderstand", a->SOAP_ENV__mustUnderstand); + return soap_out_string(soap, tag, id, &a->__item, ""); +} + +SOAP_FMAC3 struct _cwmp1__ID * SOAP_FMAC4 soap_get__cwmp1__ID(struct soap *soap, struct _cwmp1__ID *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__ID(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__ID * SOAP_FMAC4 soap_in__cwmp1__ID(struct soap *soap, const char *tag, struct _cwmp1__ID *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!(a = (struct _cwmp1__ID *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__ID, sizeof(struct _cwmp1__ID), 0, NULL, NULL, NULL))) + return NULL; + soap_revert(soap); + *soap->id = '\0'; + soap_default__cwmp1__ID(soap, a); + if (soap_s2string(soap, soap_attr_value(soap, "SOAP-ENV:mustUnderstand", 1), &a->SOAP_ENV__mustUnderstand)) + return NULL; + if (!soap_in_string(soap, tag, &a->__item, "")) + return NULL; + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__RequestDownloadResponse(struct soap *soap, struct _cwmp1__RequestDownloadResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__RequestDownloadResponse(struct soap *soap, const struct _cwmp1__RequestDownloadResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__RequestDownloadResponse(struct soap *soap, const struct _cwmp1__RequestDownloadResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__RequestDownloadResponse); + if (soap_out__cwmp1__RequestDownloadResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__RequestDownloadResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__RequestDownloadResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__RequestDownloadResponse), type)) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__RequestDownloadResponse * SOAP_FMAC4 soap_get__cwmp1__RequestDownloadResponse(struct soap *soap, struct _cwmp1__RequestDownloadResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__RequestDownloadResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__RequestDownloadResponse * SOAP_FMAC4 soap_in__cwmp1__RequestDownloadResponse(struct soap *soap, const char *tag, struct _cwmp1__RequestDownloadResponse *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__RequestDownloadResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__RequestDownloadResponse, sizeof(struct _cwmp1__RequestDownloadResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__RequestDownloadResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__RequestDownloadResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__RequestDownloadResponse, 0, sizeof(struct _cwmp1__RequestDownloadResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1FileTypeArg(struct soap *soap, struct cwmp1FileTypeArg *a) +{ + a->__size = 0; + a->__ptrArgStruct = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1FileTypeArg(struct soap *soap, struct cwmp1FileTypeArg const*a) +{ + int i; + if (a->__ptrArgStruct && !soap_array_reference(soap, a, (struct soap_array*)&a->__ptrArgStruct, 1, SOAP_TYPE_cwmp1FileTypeArg)) + for (i = 0; i < a->__size; i++) + { + soap_serialize_PointerTocwmp1__ArgStruct(soap, a->__ptrArgStruct + i); + } +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1FileTypeArg(struct soap *soap, const struct cwmp1FileTypeArg *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, (struct soap_array*)&a->__ptrArgStruct, 1, tag, SOAP_TYPE_cwmp1FileTypeArg); + if (soap_out_cwmp1FileTypeArg(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1FileTypeArg(struct soap *soap, const char *tag, int id, const struct cwmp1FileTypeArg *a, const char *type) +{ + int i, n = a->__size; + char *t = a->__ptrArgStruct ? soap_putsize(soap, "cwmp:ArgStruct", a->__size) : NULL; + id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptrArgStruct, 1, type, SOAP_TYPE_cwmp1FileTypeArg); + if (id < 0) + return soap->error; + if (soap_array_begin_out(soap, tag, id, t, NULL)) + return soap->error; + for (i = 0; i < n; i++) + { + soap->position = 1; + soap->positions[0] = i; + soap_out_PointerTocwmp1__ArgStruct(soap, "ArgStruct", -1, &a->__ptrArgStruct[i], ""); + } + soap->position = 0; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1FileTypeArg * SOAP_FMAC4 soap_get_cwmp1FileTypeArg(struct soap *soap, struct cwmp1FileTypeArg *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1FileTypeArg(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1FileTypeArg * SOAP_FMAC4 soap_in_cwmp1FileTypeArg(struct soap *soap, const char *tag, struct cwmp1FileTypeArg *a, const char *type) +{ int i, j; + struct cwmp1__ArgStruct **p; + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (soap_match_array(soap, type)) + { soap->error = SOAP_TYPE; + return NULL; + } + a = (struct cwmp1FileTypeArg *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1FileTypeArg, sizeof(struct cwmp1FileTypeArg), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1FileTypeArg(soap, a); + if (soap->body && !*soap->href) + { + a->__size = soap_getsize(soap->arraySize, soap->arrayOffset, &j); + if (a->__size >= 0) + { a->__ptrArgStruct = (struct cwmp1__ArgStruct **)soap_malloc(soap, sizeof(struct cwmp1__ArgStruct *) * a->__size); + for (i = 0; i < a->__size; i++) + a->__ptrArgStruct[i] = NULL; + for (i = 0; i < a->__size; i++) + { soap_peek_element(soap); + if (soap->position) + { i = soap->positions[0]-j; + if (i < 0 || i >= a->__size) + { soap->error = SOAP_IOB; + return NULL; + } + } + if (!soap_in_PointerTocwmp1__ArgStruct(soap, NULL, a->__ptrArgStruct + i, "cwmp:ArgStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + } + else + { if (soap_new_block(soap) == NULL) + return NULL; + for (a->__size = 0; ; a->__size++) + { p = (struct cwmp1__ArgStruct **)soap_push_block(soap, NULL, sizeof(struct cwmp1__ArgStruct *)); + if (!p) + return NULL; + *p = NULL; + if (!soap_in_PointerTocwmp1__ArgStruct(soap, NULL, p, "cwmp:ArgStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + soap_pop_block(soap, NULL); + a->__ptrArgStruct = (struct cwmp1__ArgStruct **)soap_malloc(soap, soap->blist->size); + soap_save_block(soap, NULL, (char*)a->__ptrArgStruct, 1); + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1FileTypeArg *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1FileTypeArg, 0, sizeof(struct cwmp1FileTypeArg), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__RequestDownload(struct soap *soap, struct _cwmp1__RequestDownload *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->FileType); + a->FileTypeArg = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__RequestDownload(struct soap *soap, const struct _cwmp1__RequestDownload *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->FileType); + soap_serialize_PointerTocwmp1FileTypeArg(soap, &a->FileTypeArg); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__RequestDownload(struct soap *soap, const struct _cwmp1__RequestDownload *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__RequestDownload); + if (soap_out__cwmp1__RequestDownload(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__RequestDownload(struct soap *soap, const char *tag, int id, const struct _cwmp1__RequestDownload *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__RequestDownload), type)) + return soap->error; + if (soap_out_string(soap, "FileType", -1, &a->FileType, "")) + return soap->error; + if (soap_out_PointerTocwmp1FileTypeArg(soap, "FileTypeArg", -1, &a->FileTypeArg, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__RequestDownload * SOAP_FMAC4 soap_get__cwmp1__RequestDownload(struct soap *soap, struct _cwmp1__RequestDownload *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__RequestDownload(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__RequestDownload * SOAP_FMAC4 soap_in__cwmp1__RequestDownload(struct soap *soap, const char *tag, struct _cwmp1__RequestDownload *a, const char *type) +{ + size_t soap_flag_FileType = 1; + size_t soap_flag_FileTypeArg = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__RequestDownload *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__RequestDownload, sizeof(struct _cwmp1__RequestDownload), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__RequestDownload(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_FileType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "FileType", &a->FileType, "xsd:string")) + { soap_flag_FileType--; + continue; + } + if (soap_flag_FileTypeArg && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1FileTypeArg(soap, "FileTypeArg", &a->FileTypeArg, "cwmp:ArgStruct")) + { soap_flag_FileTypeArg--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__RequestDownload *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__RequestDownload, 0, sizeof(struct _cwmp1__RequestDownload), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_FileType > 0 || soap_flag_FileTypeArg > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__KickedResponse(struct soap *soap, struct _cwmp1__KickedResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->NextURL); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__KickedResponse(struct soap *soap, const struct _cwmp1__KickedResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->NextURL); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__KickedResponse(struct soap *soap, const struct _cwmp1__KickedResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__KickedResponse); + if (soap_out__cwmp1__KickedResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__KickedResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__KickedResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__KickedResponse), type)) + return soap->error; + if (soap_out_string(soap, "NextURL", -1, &a->NextURL, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__KickedResponse * SOAP_FMAC4 soap_get__cwmp1__KickedResponse(struct soap *soap, struct _cwmp1__KickedResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__KickedResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__KickedResponse * SOAP_FMAC4 soap_in__cwmp1__KickedResponse(struct soap *soap, const char *tag, struct _cwmp1__KickedResponse *a, const char *type) +{ + size_t soap_flag_NextURL = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__KickedResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__KickedResponse, sizeof(struct _cwmp1__KickedResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__KickedResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_NextURL && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "NextURL", &a->NextURL, "xsd:string")) + { soap_flag_NextURL--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__KickedResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__KickedResponse, 0, sizeof(struct _cwmp1__KickedResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_NextURL > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__Kicked(struct soap *soap, struct _cwmp1__Kicked *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->Command); + soap_default_string(soap, &a->Referer); + soap_default_string(soap, &a->Arg); + soap_default_string(soap, &a->Next); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__Kicked(struct soap *soap, const struct _cwmp1__Kicked *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->Command); + soap_serialize_string(soap, &a->Referer); + soap_serialize_string(soap, &a->Arg); + soap_serialize_string(soap, &a->Next); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__Kicked(struct soap *soap, const struct _cwmp1__Kicked *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__Kicked); + if (soap_out__cwmp1__Kicked(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__Kicked(struct soap *soap, const char *tag, int id, const struct _cwmp1__Kicked *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__Kicked), type)) + return soap->error; + if (soap_out_string(soap, "Command", -1, &a->Command, "")) + return soap->error; + if (soap_out_string(soap, "Referer", -1, &a->Referer, "")) + return soap->error; + if (soap_out_string(soap, "Arg", -1, &a->Arg, "")) + return soap->error; + if (soap_out_string(soap, "Next", -1, &a->Next, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__Kicked * SOAP_FMAC4 soap_get__cwmp1__Kicked(struct soap *soap, struct _cwmp1__Kicked *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__Kicked(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__Kicked * SOAP_FMAC4 soap_in__cwmp1__Kicked(struct soap *soap, const char *tag, struct _cwmp1__Kicked *a, const char *type) +{ + size_t soap_flag_Command = 1; + size_t soap_flag_Referer = 1; + size_t soap_flag_Arg = 1; + size_t soap_flag_Next = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__Kicked *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__Kicked, sizeof(struct _cwmp1__Kicked), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__Kicked(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_Command && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "Command", &a->Command, "xsd:string")) + { soap_flag_Command--; + continue; + } + if (soap_flag_Referer && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "Referer", &a->Referer, "xsd:string")) + { soap_flag_Referer--; + continue; + } + if (soap_flag_Arg && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "Arg", &a->Arg, "xsd:string")) + { soap_flag_Arg--; + continue; + } + if (soap_flag_Next && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "Next", &a->Next, "xsd:string")) + { soap_flag_Next--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__Kicked *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__Kicked, 0, sizeof(struct _cwmp1__Kicked), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Command > 0 || soap_flag_Referer > 0 || soap_flag_Arg > 0 || soap_flag_Next > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__AutonomousTransferCompleteResponse(struct soap *soap, struct _cwmp1__AutonomousTransferCompleteResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__AutonomousTransferCompleteResponse(struct soap *soap, const struct _cwmp1__AutonomousTransferCompleteResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__AutonomousTransferCompleteResponse(struct soap *soap, const struct _cwmp1__AutonomousTransferCompleteResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__AutonomousTransferCompleteResponse); + if (soap_out__cwmp1__AutonomousTransferCompleteResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__AutonomousTransferCompleteResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__AutonomousTransferCompleteResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__AutonomousTransferCompleteResponse), type)) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__AutonomousTransferCompleteResponse * SOAP_FMAC4 soap_get__cwmp1__AutonomousTransferCompleteResponse(struct soap *soap, struct _cwmp1__AutonomousTransferCompleteResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__AutonomousTransferCompleteResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__AutonomousTransferCompleteResponse * SOAP_FMAC4 soap_in__cwmp1__AutonomousTransferCompleteResponse(struct soap *soap, const char *tag, struct _cwmp1__AutonomousTransferCompleteResponse *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__AutonomousTransferCompleteResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__AutonomousTransferCompleteResponse, sizeof(struct _cwmp1__AutonomousTransferCompleteResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__AutonomousTransferCompleteResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__AutonomousTransferCompleteResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__AutonomousTransferCompleteResponse, 0, sizeof(struct _cwmp1__AutonomousTransferCompleteResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__AutonomousTransferComplete(struct soap *soap, struct _cwmp1__AutonomousTransferComplete *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->AnnounceURL); + soap_default_string(soap, &a->TransferURL); + soap_default_xsd__boolean(soap, &a->IsDownload); + soap_default_string(soap, &a->FileType); + soap_default_unsignedInt(soap, &a->FileSize); + soap_default_string(soap, &a->TargetFileName); + a->FaultStruct = NULL; + soap_default_time(soap, &a->StartTime); + soap_default_time(soap, &a->CompleteTime); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__AutonomousTransferComplete(struct soap *soap, const struct _cwmp1__AutonomousTransferComplete *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->AnnounceURL); + soap_serialize_string(soap, &a->TransferURL); + soap_serialize_string(soap, &a->FileType); + soap_embedded(soap, &a->FileSize, SOAP_TYPE_unsignedInt); + soap_serialize_string(soap, &a->TargetFileName); + soap_serialize_PointerTocwmp1__FaultStruct(soap, &a->FaultStruct); + soap_embedded(soap, &a->StartTime, SOAP_TYPE_time); + soap_embedded(soap, &a->CompleteTime, SOAP_TYPE_time); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__AutonomousTransferComplete(struct soap *soap, const struct _cwmp1__AutonomousTransferComplete *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__AutonomousTransferComplete); + if (soap_out__cwmp1__AutonomousTransferComplete(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__AutonomousTransferComplete(struct soap *soap, const char *tag, int id, const struct _cwmp1__AutonomousTransferComplete *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__AutonomousTransferComplete), type)) + return soap->error; + if (soap_out_string(soap, "AnnounceURL", -1, &a->AnnounceURL, "")) + return soap->error; + if (soap_out_string(soap, "TransferURL", -1, &a->TransferURL, "")) + return soap->error; + if (soap_out_xsd__boolean(soap, "IsDownload", -1, &a->IsDownload, "")) + return soap->error; + if (soap_out_string(soap, "FileType", -1, &a->FileType, "")) + return soap->error; + if (soap_out_unsignedInt(soap, "FileSize", -1, &a->FileSize, "")) + return soap->error; + if (soap_out_string(soap, "TargetFileName", -1, &a->TargetFileName, "")) + return soap->error; + if (soap_out_PointerTocwmp1__FaultStruct(soap, "FaultStruct", -1, &a->FaultStruct, "")) + return soap->error; + if (soap_out_time(soap, "StartTime", -1, &a->StartTime, "")) + return soap->error; + if (soap_out_time(soap, "CompleteTime", -1, &a->CompleteTime, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__AutonomousTransferComplete * SOAP_FMAC4 soap_get__cwmp1__AutonomousTransferComplete(struct soap *soap, struct _cwmp1__AutonomousTransferComplete *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__AutonomousTransferComplete(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__AutonomousTransferComplete * SOAP_FMAC4 soap_in__cwmp1__AutonomousTransferComplete(struct soap *soap, const char *tag, struct _cwmp1__AutonomousTransferComplete *a, const char *type) +{ + size_t soap_flag_AnnounceURL = 1; + size_t soap_flag_TransferURL = 1; + size_t soap_flag_IsDownload = 1; + size_t soap_flag_FileType = 1; + size_t soap_flag_FileSize = 1; + size_t soap_flag_TargetFileName = 1; + size_t soap_flag_FaultStruct = 1; + size_t soap_flag_StartTime = 1; + size_t soap_flag_CompleteTime = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__AutonomousTransferComplete *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__AutonomousTransferComplete, sizeof(struct _cwmp1__AutonomousTransferComplete), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__AutonomousTransferComplete(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_AnnounceURL && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "AnnounceURL", &a->AnnounceURL, "xsd:string")) + { soap_flag_AnnounceURL--; + continue; + } + if (soap_flag_TransferURL && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "TransferURL", &a->TransferURL, "xsd:string")) + { soap_flag_TransferURL--; + continue; + } + if (soap_flag_IsDownload && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_xsd__boolean(soap, "IsDownload", &a->IsDownload, "xsd:boolean")) + { soap_flag_IsDownload--; + continue; + } + if (soap_flag_FileType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "FileType", &a->FileType, "xsd:string")) + { soap_flag_FileType--; + continue; + } + if (soap_flag_FileSize && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_unsignedInt(soap, "FileSize", &a->FileSize, "xsd:unsignedInt")) + { soap_flag_FileSize--; + continue; + } + if (soap_flag_TargetFileName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "TargetFileName", &a->TargetFileName, "xsd:string")) + { soap_flag_TargetFileName--; + continue; + } + if (soap_flag_FaultStruct && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1__FaultStruct(soap, "FaultStruct", &a->FaultStruct, "cwmp:FaultStruct")) + { soap_flag_FaultStruct--; + continue; + } + if (soap_flag_StartTime && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_time(soap, "StartTime", &a->StartTime, "xsd:dateTime")) + { soap_flag_StartTime--; + continue; + } + if (soap_flag_CompleteTime && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_time(soap, "CompleteTime", &a->CompleteTime, "xsd:dateTime")) + { soap_flag_CompleteTime--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__AutonomousTransferComplete *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__AutonomousTransferComplete, 0, sizeof(struct _cwmp1__AutonomousTransferComplete), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_AnnounceURL > 0 || soap_flag_TransferURL > 0 || soap_flag_IsDownload > 0 || soap_flag_FileType > 0 || soap_flag_FileSize > 0 || soap_flag_TargetFileName > 0 || soap_flag_FaultStruct > 0 || soap_flag_StartTime > 0 || soap_flag_CompleteTime > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__TransferCompleteResponse(struct soap *soap, struct _cwmp1__TransferCompleteResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__TransferCompleteResponse(struct soap *soap, const struct _cwmp1__TransferCompleteResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__TransferCompleteResponse(struct soap *soap, const struct _cwmp1__TransferCompleteResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__TransferCompleteResponse); + if (soap_out__cwmp1__TransferCompleteResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__TransferCompleteResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__TransferCompleteResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__TransferCompleteResponse), type)) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__TransferCompleteResponse * SOAP_FMAC4 soap_get__cwmp1__TransferCompleteResponse(struct soap *soap, struct _cwmp1__TransferCompleteResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__TransferCompleteResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__TransferCompleteResponse * SOAP_FMAC4 soap_in__cwmp1__TransferCompleteResponse(struct soap *soap, const char *tag, struct _cwmp1__TransferCompleteResponse *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__TransferCompleteResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__TransferCompleteResponse, sizeof(struct _cwmp1__TransferCompleteResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__TransferCompleteResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__TransferCompleteResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__TransferCompleteResponse, 0, sizeof(struct _cwmp1__TransferCompleteResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__TransferComplete(struct soap *soap, struct _cwmp1__TransferComplete *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_cwmp1__CommandKeyType(soap, &a->CommandKey); + a->FaultStruct = NULL; + soap_default_time(soap, &a->StartTime); + soap_default_time(soap, &a->CompleteTime); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__TransferComplete(struct soap *soap, const struct _cwmp1__TransferComplete *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_cwmp1__CommandKeyType(soap, &a->CommandKey); + soap_serialize_PointerTocwmp1__FaultStruct(soap, &a->FaultStruct); + soap_embedded(soap, &a->StartTime, SOAP_TYPE_time); + soap_embedded(soap, &a->CompleteTime, SOAP_TYPE_time); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__TransferComplete(struct soap *soap, const struct _cwmp1__TransferComplete *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__TransferComplete); + if (soap_out__cwmp1__TransferComplete(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__TransferComplete(struct soap *soap, const char *tag, int id, const struct _cwmp1__TransferComplete *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__TransferComplete), type)) + return soap->error; + if (soap_out_cwmp1__CommandKeyType(soap, "CommandKey", -1, &a->CommandKey, "")) + return soap->error; + if (soap_out_PointerTocwmp1__FaultStruct(soap, "FaultStruct", -1, &a->FaultStruct, "")) + return soap->error; + if (soap_out_time(soap, "StartTime", -1, &a->StartTime, "")) + return soap->error; + if (soap_out_time(soap, "CompleteTime", -1, &a->CompleteTime, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__TransferComplete * SOAP_FMAC4 soap_get__cwmp1__TransferComplete(struct soap *soap, struct _cwmp1__TransferComplete *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__TransferComplete(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__TransferComplete * SOAP_FMAC4 soap_in__cwmp1__TransferComplete(struct soap *soap, const char *tag, struct _cwmp1__TransferComplete *a, const char *type) +{ + size_t soap_flag_CommandKey = 1; + size_t soap_flag_FaultStruct = 1; + size_t soap_flag_StartTime = 1; + size_t soap_flag_CompleteTime = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__TransferComplete *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__TransferComplete, sizeof(struct _cwmp1__TransferComplete), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__TransferComplete(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_CommandKey && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_cwmp1__CommandKeyType(soap, "CommandKey", &a->CommandKey, "cwmp:CommandKeyType")) + { soap_flag_CommandKey--; + continue; + } + if (soap_flag_FaultStruct && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1__FaultStruct(soap, "FaultStruct", &a->FaultStruct, "cwmp:FaultStruct")) + { soap_flag_FaultStruct--; + continue; + } + if (soap_flag_StartTime && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_time(soap, "StartTime", &a->StartTime, "xsd:dateTime")) + { soap_flag_StartTime--; + continue; + } + if (soap_flag_CompleteTime && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_time(soap, "CompleteTime", &a->CompleteTime, "xsd:dateTime")) + { soap_flag_CompleteTime--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__TransferComplete *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__TransferComplete, 0, sizeof(struct _cwmp1__TransferComplete), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_CommandKey > 0 || soap_flag_FaultStruct > 0 || soap_flag_StartTime > 0 || soap_flag_CompleteTime > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__InformResponse(struct soap *soap, struct _cwmp1__InformResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_unsignedInt(soap, &a->MaxEnvelopes); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__InformResponse(struct soap *soap, const struct _cwmp1__InformResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_embedded(soap, &a->MaxEnvelopes, SOAP_TYPE_unsignedInt); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__InformResponse(struct soap *soap, const struct _cwmp1__InformResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__InformResponse); + if (soap_out__cwmp1__InformResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__InformResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__InformResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__InformResponse), type)) + return soap->error; + if (soap_out_unsignedInt(soap, "MaxEnvelopes", -1, &a->MaxEnvelopes, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__InformResponse * SOAP_FMAC4 soap_get__cwmp1__InformResponse(struct soap *soap, struct _cwmp1__InformResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__InformResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__InformResponse * SOAP_FMAC4 soap_in__cwmp1__InformResponse(struct soap *soap, const char *tag, struct _cwmp1__InformResponse *a, const char *type) +{ + size_t soap_flag_MaxEnvelopes = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__InformResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__InformResponse, sizeof(struct _cwmp1__InformResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__InformResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_MaxEnvelopes && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_unsignedInt(soap, "MaxEnvelopes", &a->MaxEnvelopes, "xsd:unsignedInt")) + { soap_flag_MaxEnvelopes--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__InformResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__InformResponse, 0, sizeof(struct _cwmp1__InformResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_MaxEnvelopes > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1EventList(struct soap *soap, struct cwmp1EventList *a) +{ + a->__size = 0; + a->__ptrEventStruct = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1EventList(struct soap *soap, struct cwmp1EventList const*a) +{ + int i; + if (a->__ptrEventStruct && !soap_array_reference(soap, a, (struct soap_array*)&a->__ptrEventStruct, 1, SOAP_TYPE_cwmp1EventList)) + for (i = 0; i < a->__size; i++) + { + soap_serialize_PointerTocwmp1__EventStruct(soap, a->__ptrEventStruct + i); + } +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1EventList(struct soap *soap, const struct cwmp1EventList *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, (struct soap_array*)&a->__ptrEventStruct, 1, tag, SOAP_TYPE_cwmp1EventList); + if (soap_out_cwmp1EventList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1EventList(struct soap *soap, const char *tag, int id, const struct cwmp1EventList *a, const char *type) +{ + int i, n = a->__size; + char *t = a->__ptrEventStruct ? soap_putsize(soap, "cwmp:EventStruct", a->__size) : NULL; + id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptrEventStruct, 1, type, SOAP_TYPE_cwmp1EventList); + if (id < 0) + return soap->error; + if (soap_array_begin_out(soap, tag, id, t, NULL)) + return soap->error; + for (i = 0; i < n; i++) + { + soap->position = 1; + soap->positions[0] = i; + soap_out_PointerTocwmp1__EventStruct(soap, "EventStruct", -1, &a->__ptrEventStruct[i], ""); + } + soap->position = 0; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1EventList * SOAP_FMAC4 soap_get_cwmp1EventList(struct soap *soap, struct cwmp1EventList *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1EventList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1EventList * SOAP_FMAC4 soap_in_cwmp1EventList(struct soap *soap, const char *tag, struct cwmp1EventList *a, const char *type) +{ int i, j; + struct cwmp1__EventStruct **p; + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (soap_match_array(soap, type)) + { soap->error = SOAP_TYPE; + return NULL; + } + a = (struct cwmp1EventList *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1EventList, sizeof(struct cwmp1EventList), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1EventList(soap, a); + if (soap->body && !*soap->href) + { + a->__size = soap_getsize(soap->arraySize, soap->arrayOffset, &j); + if (a->__size >= 0) + { a->__ptrEventStruct = (struct cwmp1__EventStruct **)soap_malloc(soap, sizeof(struct cwmp1__EventStruct *) * a->__size); + for (i = 0; i < a->__size; i++) + a->__ptrEventStruct[i] = NULL; + for (i = 0; i < a->__size; i++) + { soap_peek_element(soap); + if (soap->position) + { i = soap->positions[0]-j; + if (i < 0 || i >= a->__size) + { soap->error = SOAP_IOB; + return NULL; + } + } + if (!soap_in_PointerTocwmp1__EventStruct(soap, NULL, a->__ptrEventStruct + i, "cwmp:EventStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + } + else + { if (soap_new_block(soap) == NULL) + return NULL; + for (a->__size = 0; ; a->__size++) + { p = (struct cwmp1__EventStruct **)soap_push_block(soap, NULL, sizeof(struct cwmp1__EventStruct *)); + if (!p) + return NULL; + *p = NULL; + if (!soap_in_PointerTocwmp1__EventStruct(soap, NULL, p, "cwmp:EventStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + soap_pop_block(soap, NULL); + a->__ptrEventStruct = (struct cwmp1__EventStruct **)soap_malloc(soap, soap->blist->size); + soap_save_block(soap, NULL, (char*)a->__ptrEventStruct, 1); + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1EventList *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1EventList, 0, sizeof(struct cwmp1EventList), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__Inform(struct soap *soap, struct _cwmp1__Inform *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->DeviceId = NULL; + a->Event = NULL; + soap_default_unsignedInt(soap, &a->MaxEnvelopes); + soap_default_time(soap, &a->CurrentTime); + soap_default_unsignedInt(soap, &a->RetryCount); + a->ParameterList = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__Inform(struct soap *soap, const struct _cwmp1__Inform *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTocwmp1__DeviceIdStruct(soap, &a->DeviceId); + soap_serialize_PointerTocwmp1EventList(soap, &a->Event); + soap_embedded(soap, &a->MaxEnvelopes, SOAP_TYPE_unsignedInt); + soap_embedded(soap, &a->CurrentTime, SOAP_TYPE_time); + soap_embedded(soap, &a->RetryCount, SOAP_TYPE_unsignedInt); + soap_serialize_PointerTocwmp1ParameterValueList(soap, &a->ParameterList); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__Inform(struct soap *soap, const struct _cwmp1__Inform *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__Inform); + if (soap_out__cwmp1__Inform(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__Inform(struct soap *soap, const char *tag, int id, const struct _cwmp1__Inform *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__Inform), type)) + return soap->error; + if (soap_out_PointerTocwmp1__DeviceIdStruct(soap, "DeviceId", -1, &a->DeviceId, "")) + return soap->error; + if (soap_out_PointerTocwmp1EventList(soap, "Event", -1, &a->Event, "")) + return soap->error; + if (soap_out_unsignedInt(soap, "MaxEnvelopes", -1, &a->MaxEnvelopes, "")) + return soap->error; + if (soap_out_time(soap, "CurrentTime", -1, &a->CurrentTime, "")) + return soap->error; + if (soap_out_unsignedInt(soap, "RetryCount", -1, &a->RetryCount, "")) + return soap->error; + if (soap_out_PointerTocwmp1ParameterValueList(soap, "ParameterList", -1, &a->ParameterList, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__Inform * SOAP_FMAC4 soap_get__cwmp1__Inform(struct soap *soap, struct _cwmp1__Inform *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__Inform(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__Inform * SOAP_FMAC4 soap_in__cwmp1__Inform(struct soap *soap, const char *tag, struct _cwmp1__Inform *a, const char *type) +{ + size_t soap_flag_DeviceId = 1; + size_t soap_flag_Event = 1; + size_t soap_flag_MaxEnvelopes = 1; + size_t soap_flag_CurrentTime = 1; + size_t soap_flag_RetryCount = 1; + size_t soap_flag_ParameterList = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__Inform *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__Inform, sizeof(struct _cwmp1__Inform), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__Inform(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_DeviceId && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1__DeviceIdStruct(soap, "DeviceId", &a->DeviceId, "cwmp:DeviceIdStruct")) + { soap_flag_DeviceId--; + continue; + } + if (soap_flag_Event && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1EventList(soap, "Event", &a->Event, "cwmp:EventStruct")) + { soap_flag_Event--; + continue; + } + if (soap_flag_MaxEnvelopes && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_unsignedInt(soap, "MaxEnvelopes", &a->MaxEnvelopes, "xsd:unsignedInt")) + { soap_flag_MaxEnvelopes--; + continue; + } + if (soap_flag_CurrentTime && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_time(soap, "CurrentTime", &a->CurrentTime, "xsd:dateTime")) + { soap_flag_CurrentTime--; + continue; + } + if (soap_flag_RetryCount && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_unsignedInt(soap, "RetryCount", &a->RetryCount, "xsd:unsignedInt")) + { soap_flag_RetryCount--; + continue; + } + if (soap_flag_ParameterList && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1ParameterValueList(soap, "ParameterList", &a->ParameterList, "cwmp:ParameterValueStruct")) + { soap_flag_ParameterList--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__Inform *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__Inform, 0, sizeof(struct _cwmp1__Inform), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_DeviceId > 0 || soap_flag_Event > 0 || soap_flag_MaxEnvelopes > 0 || soap_flag_CurrentTime > 0 || soap_flag_RetryCount > 0 || soap_flag_ParameterList > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1AllTransferList(struct soap *soap, struct cwmp1AllTransferList *a) +{ + a->__size = 0; + a->__ptrAllQueuedTransferStruct = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1AllTransferList(struct soap *soap, struct cwmp1AllTransferList const*a) +{ + int i; + if (a->__ptrAllQueuedTransferStruct && !soap_array_reference(soap, a, (struct soap_array*)&a->__ptrAllQueuedTransferStruct, 1, SOAP_TYPE_cwmp1AllTransferList)) + for (i = 0; i < a->__size; i++) + { + soap_serialize_PointerTocwmp1__AllQueuedTransferStruct(soap, a->__ptrAllQueuedTransferStruct + i); + } +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1AllTransferList(struct soap *soap, const struct cwmp1AllTransferList *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, (struct soap_array*)&a->__ptrAllQueuedTransferStruct, 1, tag, SOAP_TYPE_cwmp1AllTransferList); + if (soap_out_cwmp1AllTransferList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1AllTransferList(struct soap *soap, const char *tag, int id, const struct cwmp1AllTransferList *a, const char *type) +{ + int i, n = a->__size; + char *t = a->__ptrAllQueuedTransferStruct ? soap_putsize(soap, "cwmp:AllQueuedTransferStruct", a->__size) : NULL; + id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptrAllQueuedTransferStruct, 1, type, SOAP_TYPE_cwmp1AllTransferList); + if (id < 0) + return soap->error; + if (soap_array_begin_out(soap, tag, id, t, NULL)) + return soap->error; + for (i = 0; i < n; i++) + { + soap->position = 1; + soap->positions[0] = i; + soap_out_PointerTocwmp1__AllQueuedTransferStruct(soap, "AllQueuedTransferStruct", -1, &a->__ptrAllQueuedTransferStruct[i], ""); + } + soap->position = 0; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1AllTransferList * SOAP_FMAC4 soap_get_cwmp1AllTransferList(struct soap *soap, struct cwmp1AllTransferList *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1AllTransferList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1AllTransferList * SOAP_FMAC4 soap_in_cwmp1AllTransferList(struct soap *soap, const char *tag, struct cwmp1AllTransferList *a, const char *type) +{ int i, j; + struct cwmp1__AllQueuedTransferStruct **p; + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (soap_match_array(soap, type)) + { soap->error = SOAP_TYPE; + return NULL; + } + a = (struct cwmp1AllTransferList *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1AllTransferList, sizeof(struct cwmp1AllTransferList), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1AllTransferList(soap, a); + if (soap->body && !*soap->href) + { + a->__size = soap_getsize(soap->arraySize, soap->arrayOffset, &j); + if (a->__size >= 0) + { a->__ptrAllQueuedTransferStruct = (struct cwmp1__AllQueuedTransferStruct **)soap_malloc(soap, sizeof(struct cwmp1__AllQueuedTransferStruct *) * a->__size); + for (i = 0; i < a->__size; i++) + a->__ptrAllQueuedTransferStruct[i] = NULL; + for (i = 0; i < a->__size; i++) + { soap_peek_element(soap); + if (soap->position) + { i = soap->positions[0]-j; + if (i < 0 || i >= a->__size) + { soap->error = SOAP_IOB; + return NULL; + } + } + if (!soap_in_PointerTocwmp1__AllQueuedTransferStruct(soap, NULL, a->__ptrAllQueuedTransferStruct + i, "cwmp:AllQueuedTransferStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + } + else + { if (soap_new_block(soap) == NULL) + return NULL; + for (a->__size = 0; ; a->__size++) + { p = (struct cwmp1__AllQueuedTransferStruct **)soap_push_block(soap, NULL, sizeof(struct cwmp1__AllQueuedTransferStruct *)); + if (!p) + return NULL; + *p = NULL; + if (!soap_in_PointerTocwmp1__AllQueuedTransferStruct(soap, NULL, p, "cwmp:AllQueuedTransferStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + soap_pop_block(soap, NULL); + a->__ptrAllQueuedTransferStruct = (struct cwmp1__AllQueuedTransferStruct **)soap_malloc(soap, soap->blist->size); + soap_save_block(soap, NULL, (char*)a->__ptrAllQueuedTransferStruct, 1); + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1AllTransferList *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1AllTransferList, 0, sizeof(struct cwmp1AllTransferList), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetAllQueuedTransfersResponse(struct soap *soap, struct _cwmp1__GetAllQueuedTransfersResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->TransferList = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetAllQueuedTransfersResponse(struct soap *soap, const struct _cwmp1__GetAllQueuedTransfersResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTocwmp1AllTransferList(soap, &a->TransferList); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetAllQueuedTransfersResponse(struct soap *soap, const struct _cwmp1__GetAllQueuedTransfersResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__GetAllQueuedTransfersResponse); + if (soap_out__cwmp1__GetAllQueuedTransfersResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetAllQueuedTransfersResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__GetAllQueuedTransfersResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__GetAllQueuedTransfersResponse), type)) + return soap->error; + if (soap_out_PointerTocwmp1AllTransferList(soap, "TransferList", -1, &a->TransferList, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__GetAllQueuedTransfersResponse * SOAP_FMAC4 soap_get__cwmp1__GetAllQueuedTransfersResponse(struct soap *soap, struct _cwmp1__GetAllQueuedTransfersResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__GetAllQueuedTransfersResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__GetAllQueuedTransfersResponse * SOAP_FMAC4 soap_in__cwmp1__GetAllQueuedTransfersResponse(struct soap *soap, const char *tag, struct _cwmp1__GetAllQueuedTransfersResponse *a, const char *type) +{ + size_t soap_flag_TransferList = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__GetAllQueuedTransfersResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__GetAllQueuedTransfersResponse, sizeof(struct _cwmp1__GetAllQueuedTransfersResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__GetAllQueuedTransfersResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_TransferList && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1AllTransferList(soap, "TransferList", &a->TransferList, "cwmp:AllQueuedTransferStruct")) + { soap_flag_TransferList--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__GetAllQueuedTransfersResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__GetAllQueuedTransfersResponse, 0, sizeof(struct _cwmp1__GetAllQueuedTransfersResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_TransferList > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetAllQueuedTransfers(struct soap *soap, struct _cwmp1__GetAllQueuedTransfers *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetAllQueuedTransfers(struct soap *soap, const struct _cwmp1__GetAllQueuedTransfers *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetAllQueuedTransfers(struct soap *soap, const struct _cwmp1__GetAllQueuedTransfers *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__GetAllQueuedTransfers); + if (soap_out__cwmp1__GetAllQueuedTransfers(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetAllQueuedTransfers(struct soap *soap, const char *tag, int id, const struct _cwmp1__GetAllQueuedTransfers *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__GetAllQueuedTransfers), type)) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__GetAllQueuedTransfers * SOAP_FMAC4 soap_get__cwmp1__GetAllQueuedTransfers(struct soap *soap, struct _cwmp1__GetAllQueuedTransfers *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__GetAllQueuedTransfers(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__GetAllQueuedTransfers * SOAP_FMAC4 soap_in__cwmp1__GetAllQueuedTransfers(struct soap *soap, const char *tag, struct _cwmp1__GetAllQueuedTransfers *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__GetAllQueuedTransfers *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__GetAllQueuedTransfers, sizeof(struct _cwmp1__GetAllQueuedTransfers), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__GetAllQueuedTransfers(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__GetAllQueuedTransfers *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__GetAllQueuedTransfers, 0, sizeof(struct _cwmp1__GetAllQueuedTransfers), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__FactoryResetResponse(struct soap *soap, struct _cwmp1__FactoryResetResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__FactoryResetResponse(struct soap *soap, const struct _cwmp1__FactoryResetResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__FactoryResetResponse(struct soap *soap, const struct _cwmp1__FactoryResetResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__FactoryResetResponse); + if (soap_out__cwmp1__FactoryResetResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__FactoryResetResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__FactoryResetResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__FactoryResetResponse), type)) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__FactoryResetResponse * SOAP_FMAC4 soap_get__cwmp1__FactoryResetResponse(struct soap *soap, struct _cwmp1__FactoryResetResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__FactoryResetResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__FactoryResetResponse * SOAP_FMAC4 soap_in__cwmp1__FactoryResetResponse(struct soap *soap, const char *tag, struct _cwmp1__FactoryResetResponse *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__FactoryResetResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__FactoryResetResponse, sizeof(struct _cwmp1__FactoryResetResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__FactoryResetResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__FactoryResetResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__FactoryResetResponse, 0, sizeof(struct _cwmp1__FactoryResetResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__FactoryReset(struct soap *soap, struct _cwmp1__FactoryReset *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__FactoryReset(struct soap *soap, const struct _cwmp1__FactoryReset *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__FactoryReset(struct soap *soap, const struct _cwmp1__FactoryReset *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__FactoryReset); + if (soap_out__cwmp1__FactoryReset(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__FactoryReset(struct soap *soap, const char *tag, int id, const struct _cwmp1__FactoryReset *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__FactoryReset), type)) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__FactoryReset * SOAP_FMAC4 soap_get__cwmp1__FactoryReset(struct soap *soap, struct _cwmp1__FactoryReset *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__FactoryReset(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__FactoryReset * SOAP_FMAC4 soap_in__cwmp1__FactoryReset(struct soap *soap, const char *tag, struct _cwmp1__FactoryReset *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__FactoryReset *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__FactoryReset, sizeof(struct _cwmp1__FactoryReset), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__FactoryReset(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__FactoryReset *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__FactoryReset, 0, sizeof(struct _cwmp1__FactoryReset), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__UploadResponse(struct soap *soap, struct _cwmp1__UploadResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default__cwmp1__UploadResponse_Status(soap, &a->Status); + soap_default_time(soap, &a->StartTime); + soap_default_time(soap, &a->CompleteTime); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__UploadResponse(struct soap *soap, const struct _cwmp1__UploadResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_embedded(soap, &a->StartTime, SOAP_TYPE_time); + soap_embedded(soap, &a->CompleteTime, SOAP_TYPE_time); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__UploadResponse(struct soap *soap, const struct _cwmp1__UploadResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__UploadResponse); + if (soap_out__cwmp1__UploadResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__UploadResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__UploadResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__UploadResponse), type)) + return soap->error; + if (soap_out__cwmp1__UploadResponse_Status(soap, "Status", -1, &a->Status, "")) + return soap->error; + if (soap_out_time(soap, "StartTime", -1, &a->StartTime, "")) + return soap->error; + if (soap_out_time(soap, "CompleteTime", -1, &a->CompleteTime, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__UploadResponse * SOAP_FMAC4 soap_get__cwmp1__UploadResponse(struct soap *soap, struct _cwmp1__UploadResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__UploadResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__UploadResponse * SOAP_FMAC4 soap_in__cwmp1__UploadResponse(struct soap *soap, const char *tag, struct _cwmp1__UploadResponse *a, const char *type) +{ + size_t soap_flag_Status = 1; + size_t soap_flag_StartTime = 1; + size_t soap_flag_CompleteTime = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__UploadResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__UploadResponse, sizeof(struct _cwmp1__UploadResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__UploadResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_Status && soap->error == SOAP_TAG_MISMATCH) + if (soap_in__cwmp1__UploadResponse_Status(soap, "Status", &a->Status, "cwmp:UploadResponse-Status")) + { soap_flag_Status--; + continue; + } + if (soap_flag_StartTime && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_time(soap, "StartTime", &a->StartTime, "xsd:dateTime")) + { soap_flag_StartTime--; + continue; + } + if (soap_flag_CompleteTime && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_time(soap, "CompleteTime", &a->CompleteTime, "xsd:dateTime")) + { soap_flag_CompleteTime--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__UploadResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__UploadResponse, 0, sizeof(struct _cwmp1__UploadResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Status > 0 || soap_flag_StartTime > 0 || soap_flag_CompleteTime > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__Upload(struct soap *soap, struct _cwmp1__Upload *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_cwmp1__CommandKeyType(soap, &a->CommandKey); + soap_default_string(soap, &a->FileType); + soap_default_string(soap, &a->URL); + soap_default_string(soap, &a->Username); + soap_default_string(soap, &a->Password); + soap_default_unsignedInt(soap, &a->DelaySeconds); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__Upload(struct soap *soap, const struct _cwmp1__Upload *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_cwmp1__CommandKeyType(soap, &a->CommandKey); + soap_serialize_string(soap, &a->FileType); + soap_serialize_string(soap, &a->URL); + soap_serialize_string(soap, &a->Username); + soap_serialize_string(soap, &a->Password); + soap_embedded(soap, &a->DelaySeconds, SOAP_TYPE_unsignedInt); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__Upload(struct soap *soap, const struct _cwmp1__Upload *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__Upload); + if (soap_out__cwmp1__Upload(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__Upload(struct soap *soap, const char *tag, int id, const struct _cwmp1__Upload *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__Upload), type)) + return soap->error; + if (soap_out_cwmp1__CommandKeyType(soap, "CommandKey", -1, &a->CommandKey, "")) + return soap->error; + if (soap_out_string(soap, "FileType", -1, &a->FileType, "")) + return soap->error; + if (soap_out_string(soap, "URL", -1, &a->URL, "")) + return soap->error; + if (soap_out_string(soap, "Username", -1, &a->Username, "")) + return soap->error; + if (soap_out_string(soap, "Password", -1, &a->Password, "")) + return soap->error; + if (soap_out_unsignedInt(soap, "DelaySeconds", -1, &a->DelaySeconds, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__Upload * SOAP_FMAC4 soap_get__cwmp1__Upload(struct soap *soap, struct _cwmp1__Upload *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__Upload(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__Upload * SOAP_FMAC4 soap_in__cwmp1__Upload(struct soap *soap, const char *tag, struct _cwmp1__Upload *a, const char *type) +{ + size_t soap_flag_CommandKey = 1; + size_t soap_flag_FileType = 1; + size_t soap_flag_URL = 1; + size_t soap_flag_Username = 1; + size_t soap_flag_Password = 1; + size_t soap_flag_DelaySeconds = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__Upload *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__Upload, sizeof(struct _cwmp1__Upload), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__Upload(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_CommandKey && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_cwmp1__CommandKeyType(soap, "CommandKey", &a->CommandKey, "cwmp:CommandKeyType")) + { soap_flag_CommandKey--; + continue; + } + if (soap_flag_FileType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "FileType", &a->FileType, "xsd:string")) + { soap_flag_FileType--; + continue; + } + if (soap_flag_URL && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "URL", &a->URL, "xsd:string")) + { soap_flag_URL--; + continue; + } + if (soap_flag_Username && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "Username", &a->Username, "xsd:string")) + { soap_flag_Username--; + continue; + } + if (soap_flag_Password && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "Password", &a->Password, "xsd:string")) + { soap_flag_Password--; + continue; + } + if (soap_flag_DelaySeconds && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_unsignedInt(soap, "DelaySeconds", &a->DelaySeconds, "xsd:unsignedInt")) + { soap_flag_DelaySeconds--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__Upload *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__Upload, 0, sizeof(struct _cwmp1__Upload), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_CommandKey > 0 || soap_flag_FileType > 0 || soap_flag_URL > 0 || soap_flag_Username > 0 || soap_flag_Password > 0 || soap_flag_DelaySeconds > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1OptionList(struct soap *soap, struct cwmp1OptionList *a) +{ + a->__size = 0; + a->__ptrOptionStruct = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1OptionList(struct soap *soap, struct cwmp1OptionList const*a) +{ + int i; + if (a->__ptrOptionStruct && !soap_array_reference(soap, a, (struct soap_array*)&a->__ptrOptionStruct, 1, SOAP_TYPE_cwmp1OptionList)) + for (i = 0; i < a->__size; i++) + { + soap_serialize_PointerTocwmp1__OptionStruct(soap, a->__ptrOptionStruct + i); + } +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1OptionList(struct soap *soap, const struct cwmp1OptionList *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, (struct soap_array*)&a->__ptrOptionStruct, 1, tag, SOAP_TYPE_cwmp1OptionList); + if (soap_out_cwmp1OptionList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1OptionList(struct soap *soap, const char *tag, int id, const struct cwmp1OptionList *a, const char *type) +{ + int i, n = a->__size; + char *t = a->__ptrOptionStruct ? soap_putsize(soap, "cwmp:OptionStruct", a->__size) : NULL; + id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptrOptionStruct, 1, type, SOAP_TYPE_cwmp1OptionList); + if (id < 0) + return soap->error; + if (soap_array_begin_out(soap, tag, id, t, NULL)) + return soap->error; + for (i = 0; i < n; i++) + { + soap->position = 1; + soap->positions[0] = i; + soap_out_PointerTocwmp1__OptionStruct(soap, "OptionStruct", -1, &a->__ptrOptionStruct[i], ""); + } + soap->position = 0; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1OptionList * SOAP_FMAC4 soap_get_cwmp1OptionList(struct soap *soap, struct cwmp1OptionList *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1OptionList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1OptionList * SOAP_FMAC4 soap_in_cwmp1OptionList(struct soap *soap, const char *tag, struct cwmp1OptionList *a, const char *type) +{ int i, j; + struct cwmp1__OptionStruct **p; + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (soap_match_array(soap, type)) + { soap->error = SOAP_TYPE; + return NULL; + } + a = (struct cwmp1OptionList *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1OptionList, sizeof(struct cwmp1OptionList), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1OptionList(soap, a); + if (soap->body && !*soap->href) + { + a->__size = soap_getsize(soap->arraySize, soap->arrayOffset, &j); + if (a->__size >= 0) + { a->__ptrOptionStruct = (struct cwmp1__OptionStruct **)soap_malloc(soap, sizeof(struct cwmp1__OptionStruct *) * a->__size); + for (i = 0; i < a->__size; i++) + a->__ptrOptionStruct[i] = NULL; + for (i = 0; i < a->__size; i++) + { soap_peek_element(soap); + if (soap->position) + { i = soap->positions[0]-j; + if (i < 0 || i >= a->__size) + { soap->error = SOAP_IOB; + return NULL; + } + } + if (!soap_in_PointerTocwmp1__OptionStruct(soap, NULL, a->__ptrOptionStruct + i, "cwmp:OptionStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + } + else + { if (soap_new_block(soap) == NULL) + return NULL; + for (a->__size = 0; ; a->__size++) + { p = (struct cwmp1__OptionStruct **)soap_push_block(soap, NULL, sizeof(struct cwmp1__OptionStruct *)); + if (!p) + return NULL; + *p = NULL; + if (!soap_in_PointerTocwmp1__OptionStruct(soap, NULL, p, "cwmp:OptionStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + soap_pop_block(soap, NULL); + a->__ptrOptionStruct = (struct cwmp1__OptionStruct **)soap_malloc(soap, soap->blist->size); + soap_save_block(soap, NULL, (char*)a->__ptrOptionStruct, 1); + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1OptionList *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1OptionList, 0, sizeof(struct cwmp1OptionList), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetOptionsResponse(struct soap *soap, struct _cwmp1__GetOptionsResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->OptionList = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetOptionsResponse(struct soap *soap, const struct _cwmp1__GetOptionsResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTocwmp1OptionList(soap, &a->OptionList); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetOptionsResponse(struct soap *soap, const struct _cwmp1__GetOptionsResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__GetOptionsResponse); + if (soap_out__cwmp1__GetOptionsResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetOptionsResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__GetOptionsResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__GetOptionsResponse), type)) + return soap->error; + if (soap_out_PointerTocwmp1OptionList(soap, "OptionList", -1, &a->OptionList, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__GetOptionsResponse * SOAP_FMAC4 soap_get__cwmp1__GetOptionsResponse(struct soap *soap, struct _cwmp1__GetOptionsResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__GetOptionsResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__GetOptionsResponse * SOAP_FMAC4 soap_in__cwmp1__GetOptionsResponse(struct soap *soap, const char *tag, struct _cwmp1__GetOptionsResponse *a, const char *type) +{ + size_t soap_flag_OptionList = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__GetOptionsResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__GetOptionsResponse, sizeof(struct _cwmp1__GetOptionsResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__GetOptionsResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_OptionList && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1OptionList(soap, "OptionList", &a->OptionList, "cwmp:OptionStruct")) + { soap_flag_OptionList--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__GetOptionsResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__GetOptionsResponse, 0, sizeof(struct _cwmp1__GetOptionsResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_OptionList > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetOptions(struct soap *soap, struct _cwmp1__GetOptions *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->OptionName); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetOptions(struct soap *soap, const struct _cwmp1__GetOptions *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->OptionName); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetOptions(struct soap *soap, const struct _cwmp1__GetOptions *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__GetOptions); + if (soap_out__cwmp1__GetOptions(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetOptions(struct soap *soap, const char *tag, int id, const struct _cwmp1__GetOptions *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__GetOptions), type)) + return soap->error; + if (soap_out_string(soap, "OptionName", -1, &a->OptionName, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__GetOptions * SOAP_FMAC4 soap_get__cwmp1__GetOptions(struct soap *soap, struct _cwmp1__GetOptions *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__GetOptions(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__GetOptions * SOAP_FMAC4 soap_in__cwmp1__GetOptions(struct soap *soap, const char *tag, struct _cwmp1__GetOptions *a, const char *type) +{ + size_t soap_flag_OptionName = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__GetOptions *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__GetOptions, sizeof(struct _cwmp1__GetOptions), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__GetOptions(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_OptionName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "OptionName", &a->OptionName, "xsd:string")) + { soap_flag_OptionName--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__GetOptions *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__GetOptions, 0, sizeof(struct _cwmp1__GetOptions), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_OptionName > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetVouchersResponse(struct soap *soap, struct _cwmp1__SetVouchersResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__SetVouchersResponse(struct soap *soap, const struct _cwmp1__SetVouchersResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetVouchersResponse(struct soap *soap, const struct _cwmp1__SetVouchersResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__SetVouchersResponse); + if (soap_out__cwmp1__SetVouchersResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetVouchersResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__SetVouchersResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__SetVouchersResponse), type)) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__SetVouchersResponse * SOAP_FMAC4 soap_get__cwmp1__SetVouchersResponse(struct soap *soap, struct _cwmp1__SetVouchersResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__SetVouchersResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__SetVouchersResponse * SOAP_FMAC4 soap_in__cwmp1__SetVouchersResponse(struct soap *soap, const char *tag, struct _cwmp1__SetVouchersResponse *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__SetVouchersResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__SetVouchersResponse, sizeof(struct _cwmp1__SetVouchersResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__SetVouchersResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__SetVouchersResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__SetVouchersResponse, 0, sizeof(struct _cwmp1__SetVouchersResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1VoucherList(struct soap *soap, struct cwmp1VoucherList *a) +{ + a->__size = 0; + a->__ptrbase64 = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1VoucherList(struct soap *soap, struct cwmp1VoucherList const*a) +{ + int i; + if (a->__ptrbase64 && !soap_array_reference(soap, a, (struct soap_array*)&a->__ptrbase64, 1, SOAP_TYPE_cwmp1VoucherList)) + for (i = 0; i < a->__size; i++) + { + soap_serialize_PointerToSOAP_ENC__base64(soap, a->__ptrbase64 + i); + } +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1VoucherList(struct soap *soap, const struct cwmp1VoucherList *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, (struct soap_array*)&a->__ptrbase64, 1, tag, SOAP_TYPE_cwmp1VoucherList); + if (soap_out_cwmp1VoucherList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1VoucherList(struct soap *soap, const char *tag, int id, const struct cwmp1VoucherList *a, const char *type) +{ + int i, n = a->__size; + char *t = a->__ptrbase64 ? soap_putsize(soap, "SOAP-ENC:base64", a->__size) : NULL; + id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptrbase64, 1, type, SOAP_TYPE_cwmp1VoucherList); + if (id < 0) + return soap->error; + if (soap_array_begin_out(soap, tag, id, t, NULL)) + return soap->error; + for (i = 0; i < n; i++) + { + soap->position = 1; + soap->positions[0] = i; + soap_out_PointerToSOAP_ENC__base64(soap, "base64", -1, &a->__ptrbase64[i], ""); + } + soap->position = 0; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1VoucherList * SOAP_FMAC4 soap_get_cwmp1VoucherList(struct soap *soap, struct cwmp1VoucherList *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1VoucherList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1VoucherList * SOAP_FMAC4 soap_in_cwmp1VoucherList(struct soap *soap, const char *tag, struct cwmp1VoucherList *a, const char *type) +{ int i, j; + struct SOAP_ENC__base64 **p; + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (soap_match_array(soap, type)) + { soap->error = SOAP_TYPE; + return NULL; + } + a = (struct cwmp1VoucherList *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1VoucherList, sizeof(struct cwmp1VoucherList), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1VoucherList(soap, a); + if (soap->body && !*soap->href) + { + a->__size = soap_getsize(soap->arraySize, soap->arrayOffset, &j); + if (a->__size >= 0) + { a->__ptrbase64 = (struct SOAP_ENC__base64 **)soap_malloc(soap, sizeof(struct SOAP_ENC__base64 *) * a->__size); + for (i = 0; i < a->__size; i++) + a->__ptrbase64[i] = NULL; + for (i = 0; i < a->__size; i++) + { soap_peek_element(soap); + if (soap->position) + { i = soap->positions[0]-j; + if (i < 0 || i >= a->__size) + { soap->error = SOAP_IOB; + return NULL; + } + } + if (!soap_in_PointerToSOAP_ENC__base64(soap, NULL, a->__ptrbase64 + i, "SOAP-ENC:base64")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + } + else + { if (soap_new_block(soap) == NULL) + return NULL; + for (a->__size = 0; ; a->__size++) + { p = (struct SOAP_ENC__base64 **)soap_push_block(soap, NULL, sizeof(struct SOAP_ENC__base64 *)); + if (!p) + return NULL; + *p = NULL; + if (!soap_in_PointerToSOAP_ENC__base64(soap, NULL, p, "SOAP-ENC:base64")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + soap_pop_block(soap, NULL); + a->__ptrbase64 = (struct SOAP_ENC__base64 **)soap_malloc(soap, soap->blist->size); + soap_save_block(soap, NULL, (char*)a->__ptrbase64, 1); + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1VoucherList *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1VoucherList, 0, sizeof(struct cwmp1VoucherList), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetVouchers(struct soap *soap, struct _cwmp1__SetVouchers *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->VoucherList = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__SetVouchers(struct soap *soap, const struct _cwmp1__SetVouchers *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTocwmp1VoucherList(soap, &a->VoucherList); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetVouchers(struct soap *soap, const struct _cwmp1__SetVouchers *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__SetVouchers); + if (soap_out__cwmp1__SetVouchers(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetVouchers(struct soap *soap, const char *tag, int id, const struct _cwmp1__SetVouchers *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__SetVouchers), type)) + return soap->error; + if (soap_out_PointerTocwmp1VoucherList(soap, "VoucherList", -1, &a->VoucherList, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__SetVouchers * SOAP_FMAC4 soap_get__cwmp1__SetVouchers(struct soap *soap, struct _cwmp1__SetVouchers *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__SetVouchers(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__SetVouchers * SOAP_FMAC4 soap_in__cwmp1__SetVouchers(struct soap *soap, const char *tag, struct _cwmp1__SetVouchers *a, const char *type) +{ + size_t soap_flag_VoucherList = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__SetVouchers *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__SetVouchers, sizeof(struct _cwmp1__SetVouchers), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__SetVouchers(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_VoucherList && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1VoucherList(soap, "VoucherList", &a->VoucherList, "SOAP-ENC:base64")) + { soap_flag_VoucherList--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__SetVouchers *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__SetVouchers, 0, sizeof(struct _cwmp1__SetVouchers), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_VoucherList > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__ScheduleInformResponse(struct soap *soap, struct _cwmp1__ScheduleInformResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__ScheduleInformResponse(struct soap *soap, const struct _cwmp1__ScheduleInformResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__ScheduleInformResponse(struct soap *soap, const struct _cwmp1__ScheduleInformResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__ScheduleInformResponse); + if (soap_out__cwmp1__ScheduleInformResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__ScheduleInformResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__ScheduleInformResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__ScheduleInformResponse), type)) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__ScheduleInformResponse * SOAP_FMAC4 soap_get__cwmp1__ScheduleInformResponse(struct soap *soap, struct _cwmp1__ScheduleInformResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__ScheduleInformResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__ScheduleInformResponse * SOAP_FMAC4 soap_in__cwmp1__ScheduleInformResponse(struct soap *soap, const char *tag, struct _cwmp1__ScheduleInformResponse *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__ScheduleInformResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__ScheduleInformResponse, sizeof(struct _cwmp1__ScheduleInformResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__ScheduleInformResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__ScheduleInformResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__ScheduleInformResponse, 0, sizeof(struct _cwmp1__ScheduleInformResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__ScheduleInform(struct soap *soap, struct _cwmp1__ScheduleInform *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_unsignedInt(soap, &a->DelaySeconds); + soap_default_cwmp1__CommandKeyType(soap, &a->CommandKey); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__ScheduleInform(struct soap *soap, const struct _cwmp1__ScheduleInform *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_embedded(soap, &a->DelaySeconds, SOAP_TYPE_unsignedInt); + soap_serialize_cwmp1__CommandKeyType(soap, &a->CommandKey); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__ScheduleInform(struct soap *soap, const struct _cwmp1__ScheduleInform *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__ScheduleInform); + if (soap_out__cwmp1__ScheduleInform(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__ScheduleInform(struct soap *soap, const char *tag, int id, const struct _cwmp1__ScheduleInform *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__ScheduleInform), type)) + return soap->error; + if (soap_out_unsignedInt(soap, "DelaySeconds", -1, &a->DelaySeconds, "")) + return soap->error; + if (soap_out_cwmp1__CommandKeyType(soap, "CommandKey", -1, &a->CommandKey, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__ScheduleInform * SOAP_FMAC4 soap_get__cwmp1__ScheduleInform(struct soap *soap, struct _cwmp1__ScheduleInform *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__ScheduleInform(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__ScheduleInform * SOAP_FMAC4 soap_in__cwmp1__ScheduleInform(struct soap *soap, const char *tag, struct _cwmp1__ScheduleInform *a, const char *type) +{ + size_t soap_flag_DelaySeconds = 1; + size_t soap_flag_CommandKey = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__ScheduleInform *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__ScheduleInform, sizeof(struct _cwmp1__ScheduleInform), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__ScheduleInform(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_DelaySeconds && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_unsignedInt(soap, "DelaySeconds", &a->DelaySeconds, "xsd:unsignedInt")) + { soap_flag_DelaySeconds--; + continue; + } + if (soap_flag_CommandKey && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_cwmp1__CommandKeyType(soap, "CommandKey", &a->CommandKey, "cwmp:CommandKeyType")) + { soap_flag_CommandKey--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__ScheduleInform *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__ScheduleInform, 0, sizeof(struct _cwmp1__ScheduleInform), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_DelaySeconds > 0 || soap_flag_CommandKey > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1TransferList(struct soap *soap, struct cwmp1TransferList *a) +{ + a->__size = 0; + a->__ptrQueuedTransferStruct = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1TransferList(struct soap *soap, struct cwmp1TransferList const*a) +{ + int i; + if (a->__ptrQueuedTransferStruct && !soap_array_reference(soap, a, (struct soap_array*)&a->__ptrQueuedTransferStruct, 1, SOAP_TYPE_cwmp1TransferList)) + for (i = 0; i < a->__size; i++) + { + soap_serialize_PointerTocwmp1__QueuedTransferStruct(soap, a->__ptrQueuedTransferStruct + i); + } +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1TransferList(struct soap *soap, const struct cwmp1TransferList *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, (struct soap_array*)&a->__ptrQueuedTransferStruct, 1, tag, SOAP_TYPE_cwmp1TransferList); + if (soap_out_cwmp1TransferList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1TransferList(struct soap *soap, const char *tag, int id, const struct cwmp1TransferList *a, const char *type) +{ + int i, n = a->__size; + char *t = a->__ptrQueuedTransferStruct ? soap_putsize(soap, "cwmp:QueuedTransferStruct", a->__size) : NULL; + id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptrQueuedTransferStruct, 1, type, SOAP_TYPE_cwmp1TransferList); + if (id < 0) + return soap->error; + if (soap_array_begin_out(soap, tag, id, t, NULL)) + return soap->error; + for (i = 0; i < n; i++) + { + soap->position = 1; + soap->positions[0] = i; + soap_out_PointerTocwmp1__QueuedTransferStruct(soap, "QueuedTransferStruct", -1, &a->__ptrQueuedTransferStruct[i], ""); + } + soap->position = 0; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1TransferList * SOAP_FMAC4 soap_get_cwmp1TransferList(struct soap *soap, struct cwmp1TransferList *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1TransferList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1TransferList * SOAP_FMAC4 soap_in_cwmp1TransferList(struct soap *soap, const char *tag, struct cwmp1TransferList *a, const char *type) +{ int i, j; + struct cwmp1__QueuedTransferStruct **p; + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (soap_match_array(soap, type)) + { soap->error = SOAP_TYPE; + return NULL; + } + a = (struct cwmp1TransferList *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1TransferList, sizeof(struct cwmp1TransferList), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1TransferList(soap, a); + if (soap->body && !*soap->href) + { + a->__size = soap_getsize(soap->arraySize, soap->arrayOffset, &j); + if (a->__size >= 0) + { a->__ptrQueuedTransferStruct = (struct cwmp1__QueuedTransferStruct **)soap_malloc(soap, sizeof(struct cwmp1__QueuedTransferStruct *) * a->__size); + for (i = 0; i < a->__size; i++) + a->__ptrQueuedTransferStruct[i] = NULL; + for (i = 0; i < a->__size; i++) + { soap_peek_element(soap); + if (soap->position) + { i = soap->positions[0]-j; + if (i < 0 || i >= a->__size) + { soap->error = SOAP_IOB; + return NULL; + } + } + if (!soap_in_PointerTocwmp1__QueuedTransferStruct(soap, NULL, a->__ptrQueuedTransferStruct + i, "cwmp:QueuedTransferStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + } + else + { if (soap_new_block(soap) == NULL) + return NULL; + for (a->__size = 0; ; a->__size++) + { p = (struct cwmp1__QueuedTransferStruct **)soap_push_block(soap, NULL, sizeof(struct cwmp1__QueuedTransferStruct *)); + if (!p) + return NULL; + *p = NULL; + if (!soap_in_PointerTocwmp1__QueuedTransferStruct(soap, NULL, p, "cwmp:QueuedTransferStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + soap_pop_block(soap, NULL); + a->__ptrQueuedTransferStruct = (struct cwmp1__QueuedTransferStruct **)soap_malloc(soap, soap->blist->size); + soap_save_block(soap, NULL, (char*)a->__ptrQueuedTransferStruct, 1); + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1TransferList *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1TransferList, 0, sizeof(struct cwmp1TransferList), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetQueuedTransfersResponse(struct soap *soap, struct _cwmp1__GetQueuedTransfersResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->TransferList = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetQueuedTransfersResponse(struct soap *soap, const struct _cwmp1__GetQueuedTransfersResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTocwmp1TransferList(soap, &a->TransferList); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetQueuedTransfersResponse(struct soap *soap, const struct _cwmp1__GetQueuedTransfersResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__GetQueuedTransfersResponse); + if (soap_out__cwmp1__GetQueuedTransfersResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetQueuedTransfersResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__GetQueuedTransfersResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__GetQueuedTransfersResponse), type)) + return soap->error; + if (soap_out_PointerTocwmp1TransferList(soap, "TransferList", -1, &a->TransferList, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__GetQueuedTransfersResponse * SOAP_FMAC4 soap_get__cwmp1__GetQueuedTransfersResponse(struct soap *soap, struct _cwmp1__GetQueuedTransfersResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__GetQueuedTransfersResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__GetQueuedTransfersResponse * SOAP_FMAC4 soap_in__cwmp1__GetQueuedTransfersResponse(struct soap *soap, const char *tag, struct _cwmp1__GetQueuedTransfersResponse *a, const char *type) +{ + size_t soap_flag_TransferList = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__GetQueuedTransfersResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__GetQueuedTransfersResponse, sizeof(struct _cwmp1__GetQueuedTransfersResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__GetQueuedTransfersResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_TransferList && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1TransferList(soap, "TransferList", &a->TransferList, "cwmp:QueuedTransferStruct")) + { soap_flag_TransferList--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__GetQueuedTransfersResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__GetQueuedTransfersResponse, 0, sizeof(struct _cwmp1__GetQueuedTransfersResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_TransferList > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetQueuedTransfers(struct soap *soap, struct _cwmp1__GetQueuedTransfers *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetQueuedTransfers(struct soap *soap, const struct _cwmp1__GetQueuedTransfers *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetQueuedTransfers(struct soap *soap, const struct _cwmp1__GetQueuedTransfers *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__GetQueuedTransfers); + if (soap_out__cwmp1__GetQueuedTransfers(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetQueuedTransfers(struct soap *soap, const char *tag, int id, const struct _cwmp1__GetQueuedTransfers *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__GetQueuedTransfers), type)) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__GetQueuedTransfers * SOAP_FMAC4 soap_get__cwmp1__GetQueuedTransfers(struct soap *soap, struct _cwmp1__GetQueuedTransfers *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__GetQueuedTransfers(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__GetQueuedTransfers * SOAP_FMAC4 soap_in__cwmp1__GetQueuedTransfers(struct soap *soap, const char *tag, struct _cwmp1__GetQueuedTransfers *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__GetQueuedTransfers *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__GetQueuedTransfers, sizeof(struct _cwmp1__GetQueuedTransfers), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__GetQueuedTransfers(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__GetQueuedTransfers *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__GetQueuedTransfers, 0, sizeof(struct _cwmp1__GetQueuedTransfers), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__RebootResponse(struct soap *soap, struct _cwmp1__RebootResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__RebootResponse(struct soap *soap, const struct _cwmp1__RebootResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__RebootResponse(struct soap *soap, const struct _cwmp1__RebootResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__RebootResponse); + if (soap_out__cwmp1__RebootResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__RebootResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__RebootResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__RebootResponse), type)) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__RebootResponse * SOAP_FMAC4 soap_get__cwmp1__RebootResponse(struct soap *soap, struct _cwmp1__RebootResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__RebootResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__RebootResponse * SOAP_FMAC4 soap_in__cwmp1__RebootResponse(struct soap *soap, const char *tag, struct _cwmp1__RebootResponse *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__RebootResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__RebootResponse, sizeof(struct _cwmp1__RebootResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__RebootResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__RebootResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__RebootResponse, 0, sizeof(struct _cwmp1__RebootResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__Reboot(struct soap *soap, struct _cwmp1__Reboot *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_cwmp1__CommandKeyType(soap, &a->CommandKey); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__Reboot(struct soap *soap, const struct _cwmp1__Reboot *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_cwmp1__CommandKeyType(soap, &a->CommandKey); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__Reboot(struct soap *soap, const struct _cwmp1__Reboot *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__Reboot); + if (soap_out__cwmp1__Reboot(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__Reboot(struct soap *soap, const char *tag, int id, const struct _cwmp1__Reboot *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__Reboot), type)) + return soap->error; + if (soap_out_cwmp1__CommandKeyType(soap, "CommandKey", -1, &a->CommandKey, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__Reboot * SOAP_FMAC4 soap_get__cwmp1__Reboot(struct soap *soap, struct _cwmp1__Reboot *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__Reboot(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__Reboot * SOAP_FMAC4 soap_in__cwmp1__Reboot(struct soap *soap, const char *tag, struct _cwmp1__Reboot *a, const char *type) +{ + size_t soap_flag_CommandKey = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__Reboot *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__Reboot, sizeof(struct _cwmp1__Reboot), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__Reboot(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_CommandKey && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_cwmp1__CommandKeyType(soap, "CommandKey", &a->CommandKey, "cwmp:CommandKeyType")) + { soap_flag_CommandKey--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__Reboot *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__Reboot, 0, sizeof(struct _cwmp1__Reboot), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_CommandKey > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__DownloadResponse(struct soap *soap, struct _cwmp1__DownloadResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default__cwmp1__DownloadResponse_Status(soap, &a->Status); + soap_default_time(soap, &a->StartTime); + soap_default_time(soap, &a->CompleteTime); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__DownloadResponse(struct soap *soap, const struct _cwmp1__DownloadResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_embedded(soap, &a->StartTime, SOAP_TYPE_time); + soap_embedded(soap, &a->CompleteTime, SOAP_TYPE_time); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__DownloadResponse(struct soap *soap, const struct _cwmp1__DownloadResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__DownloadResponse); + if (soap_out__cwmp1__DownloadResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__DownloadResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__DownloadResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__DownloadResponse), type)) + return soap->error; + if (soap_out__cwmp1__DownloadResponse_Status(soap, "Status", -1, &a->Status, "")) + return soap->error; + if (soap_out_time(soap, "StartTime", -1, &a->StartTime, "")) + return soap->error; + if (soap_out_time(soap, "CompleteTime", -1, &a->CompleteTime, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__DownloadResponse * SOAP_FMAC4 soap_get__cwmp1__DownloadResponse(struct soap *soap, struct _cwmp1__DownloadResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__DownloadResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__DownloadResponse * SOAP_FMAC4 soap_in__cwmp1__DownloadResponse(struct soap *soap, const char *tag, struct _cwmp1__DownloadResponse *a, const char *type) +{ + size_t soap_flag_Status = 1; + size_t soap_flag_StartTime = 1; + size_t soap_flag_CompleteTime = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__DownloadResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__DownloadResponse, sizeof(struct _cwmp1__DownloadResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__DownloadResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_Status && soap->error == SOAP_TAG_MISMATCH) + if (soap_in__cwmp1__DownloadResponse_Status(soap, "Status", &a->Status, "cwmp:DownloadResponse-Status")) + { soap_flag_Status--; + continue; + } + if (soap_flag_StartTime && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_time(soap, "StartTime", &a->StartTime, "xsd:dateTime")) + { soap_flag_StartTime--; + continue; + } + if (soap_flag_CompleteTime && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_time(soap, "CompleteTime", &a->CompleteTime, "xsd:dateTime")) + { soap_flag_CompleteTime--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__DownloadResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__DownloadResponse, 0, sizeof(struct _cwmp1__DownloadResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Status > 0 || soap_flag_StartTime > 0 || soap_flag_CompleteTime > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__Download(struct soap *soap, struct _cwmp1__Download *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_cwmp1__CommandKeyType(soap, &a->CommandKey); + soap_default_string(soap, &a->FileType); + soap_default_string(soap, &a->URL); + soap_default_string(soap, &a->Username); + soap_default_string(soap, &a->Password); + soap_default_unsignedInt(soap, &a->FileSize); + soap_default_string(soap, &a->TargetFileName); + soap_default_unsignedInt(soap, &a->DelaySeconds); + soap_default_string(soap, &a->SuccessURL); + soap_default_string(soap, &a->FailureURL); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__Download(struct soap *soap, const struct _cwmp1__Download *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_cwmp1__CommandKeyType(soap, &a->CommandKey); + soap_serialize_string(soap, &a->FileType); + soap_serialize_string(soap, &a->URL); + soap_serialize_string(soap, &a->Username); + soap_serialize_string(soap, &a->Password); + soap_embedded(soap, &a->FileSize, SOAP_TYPE_unsignedInt); + soap_serialize_string(soap, &a->TargetFileName); + soap_embedded(soap, &a->DelaySeconds, SOAP_TYPE_unsignedInt); + soap_serialize_string(soap, &a->SuccessURL); + soap_serialize_string(soap, &a->FailureURL); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__Download(struct soap *soap, const struct _cwmp1__Download *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__Download); + if (soap_out__cwmp1__Download(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__Download(struct soap *soap, const char *tag, int id, const struct _cwmp1__Download *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__Download), type)) + return soap->error; + if (soap_out_cwmp1__CommandKeyType(soap, "CommandKey", -1, &a->CommandKey, "")) + return soap->error; + if (soap_out_string(soap, "FileType", -1, &a->FileType, "")) + return soap->error; + if (soap_out_string(soap, "URL", -1, &a->URL, "")) + return soap->error; + if (soap_out_string(soap, "Username", -1, &a->Username, "")) + return soap->error; + if (soap_out_string(soap, "Password", -1, &a->Password, "")) + return soap->error; + if (soap_out_unsignedInt(soap, "FileSize", -1, &a->FileSize, "")) + return soap->error; + if (soap_out_string(soap, "TargetFileName", -1, &a->TargetFileName, "")) + return soap->error; + if (soap_out_unsignedInt(soap, "DelaySeconds", -1, &a->DelaySeconds, "")) + return soap->error; + if (soap_out_string(soap, "SuccessURL", -1, &a->SuccessURL, "")) + return soap->error; + if (soap_out_string(soap, "FailureURL", -1, &a->FailureURL, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__Download * SOAP_FMAC4 soap_get__cwmp1__Download(struct soap *soap, struct _cwmp1__Download *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__Download(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__Download * SOAP_FMAC4 soap_in__cwmp1__Download(struct soap *soap, const char *tag, struct _cwmp1__Download *a, const char *type) +{ + size_t soap_flag_CommandKey = 1; + size_t soap_flag_FileType = 1; + size_t soap_flag_URL = 1; + size_t soap_flag_Username = 1; + size_t soap_flag_Password = 1; + size_t soap_flag_FileSize = 1; + size_t soap_flag_TargetFileName = 1; + size_t soap_flag_DelaySeconds = 1; + size_t soap_flag_SuccessURL = 1; + size_t soap_flag_FailureURL = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__Download *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__Download, sizeof(struct _cwmp1__Download), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__Download(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_CommandKey && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_cwmp1__CommandKeyType(soap, "CommandKey", &a->CommandKey, "cwmp:CommandKeyType")) + { soap_flag_CommandKey--; + continue; + } + if (soap_flag_FileType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "FileType", &a->FileType, "xsd:string")) + { soap_flag_FileType--; + continue; + } + if (soap_flag_URL && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "URL", &a->URL, "xsd:string")) + { soap_flag_URL--; + continue; + } + if (soap_flag_Username && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "Username", &a->Username, "xsd:string")) + { soap_flag_Username--; + continue; + } + if (soap_flag_Password && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "Password", &a->Password, "xsd:string")) + { soap_flag_Password--; + continue; + } + if (soap_flag_FileSize && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_unsignedInt(soap, "FileSize", &a->FileSize, "xsd:unsignedInt")) + { soap_flag_FileSize--; + continue; + } + if (soap_flag_TargetFileName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "TargetFileName", &a->TargetFileName, "xsd:string")) + { soap_flag_TargetFileName--; + continue; + } + if (soap_flag_DelaySeconds && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_unsignedInt(soap, "DelaySeconds", &a->DelaySeconds, "xsd:unsignedInt")) + { soap_flag_DelaySeconds--; + continue; + } + if (soap_flag_SuccessURL && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "SuccessURL", &a->SuccessURL, "xsd:string")) + { soap_flag_SuccessURL--; + continue; + } + if (soap_flag_FailureURL && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "FailureURL", &a->FailureURL, "xsd:string")) + { soap_flag_FailureURL--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__Download *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__Download, 0, sizeof(struct _cwmp1__Download), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_CommandKey > 0 || soap_flag_FileType > 0 || soap_flag_URL > 0 || soap_flag_Username > 0 || soap_flag_Password > 0 || soap_flag_FileSize > 0 || soap_flag_TargetFileName > 0 || soap_flag_DelaySeconds > 0 || soap_flag_SuccessURL > 0 || soap_flag_FailureURL > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__DeleteObjectResponse(struct soap *soap, struct _cwmp1__DeleteObjectResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default__cwmp1__DeleteObjectResponse_Status(soap, &a->Status); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__DeleteObjectResponse(struct soap *soap, const struct _cwmp1__DeleteObjectResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__DeleteObjectResponse(struct soap *soap, const struct _cwmp1__DeleteObjectResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__DeleteObjectResponse); + if (soap_out__cwmp1__DeleteObjectResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__DeleteObjectResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__DeleteObjectResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__DeleteObjectResponse), type)) + return soap->error; + if (soap_out__cwmp1__DeleteObjectResponse_Status(soap, "Status", -1, &a->Status, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__DeleteObjectResponse * SOAP_FMAC4 soap_get__cwmp1__DeleteObjectResponse(struct soap *soap, struct _cwmp1__DeleteObjectResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__DeleteObjectResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__DeleteObjectResponse * SOAP_FMAC4 soap_in__cwmp1__DeleteObjectResponse(struct soap *soap, const char *tag, struct _cwmp1__DeleteObjectResponse *a, const char *type) +{ + size_t soap_flag_Status = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__DeleteObjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__DeleteObjectResponse, sizeof(struct _cwmp1__DeleteObjectResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__DeleteObjectResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_Status && soap->error == SOAP_TAG_MISMATCH) + if (soap_in__cwmp1__DeleteObjectResponse_Status(soap, "Status", &a->Status, "cwmp:DeleteObjectResponse-Status")) + { soap_flag_Status--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__DeleteObjectResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__DeleteObjectResponse, 0, sizeof(struct _cwmp1__DeleteObjectResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Status > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__DeleteObject(struct soap *soap, struct _cwmp1__DeleteObject *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_cwmp1__ObjectNameType(soap, &a->ObjectName); + soap_default_cwmp1__ParameterKeyType(soap, &a->ParameterKey); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__DeleteObject(struct soap *soap, const struct _cwmp1__DeleteObject *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_cwmp1__ObjectNameType(soap, &a->ObjectName); + soap_serialize_cwmp1__ParameterKeyType(soap, &a->ParameterKey); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__DeleteObject(struct soap *soap, const struct _cwmp1__DeleteObject *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__DeleteObject); + if (soap_out__cwmp1__DeleteObject(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__DeleteObject(struct soap *soap, const char *tag, int id, const struct _cwmp1__DeleteObject *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__DeleteObject), type)) + return soap->error; + if (soap_out_cwmp1__ObjectNameType(soap, "ObjectName", -1, &a->ObjectName, "")) + return soap->error; + if (soap_out_cwmp1__ParameterKeyType(soap, "ParameterKey", -1, &a->ParameterKey, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__DeleteObject * SOAP_FMAC4 soap_get__cwmp1__DeleteObject(struct soap *soap, struct _cwmp1__DeleteObject *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__DeleteObject(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__DeleteObject * SOAP_FMAC4 soap_in__cwmp1__DeleteObject(struct soap *soap, const char *tag, struct _cwmp1__DeleteObject *a, const char *type) +{ + size_t soap_flag_ObjectName = 1; + size_t soap_flag_ParameterKey = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__DeleteObject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__DeleteObject, sizeof(struct _cwmp1__DeleteObject), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__DeleteObject(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_ObjectName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_cwmp1__ObjectNameType(soap, "ObjectName", &a->ObjectName, "cwmp:ObjectNameType")) + { soap_flag_ObjectName--; + continue; + } + if (soap_flag_ParameterKey && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_cwmp1__ParameterKeyType(soap, "ParameterKey", &a->ParameterKey, "cwmp:ParameterKeyType")) + { soap_flag_ParameterKey--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__DeleteObject *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__DeleteObject, 0, sizeof(struct _cwmp1__DeleteObject), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_ObjectName > 0 || soap_flag_ParameterKey > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__AddObjectResponse(struct soap *soap, struct _cwmp1__AddObjectResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_unsignedInt(soap, &a->InstanceNumber); + soap_default__cwmp1__AddObjectResponse_Status(soap, &a->Status); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__AddObjectResponse(struct soap *soap, const struct _cwmp1__AddObjectResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_embedded(soap, &a->InstanceNumber, SOAP_TYPE_unsignedInt); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__AddObjectResponse(struct soap *soap, const struct _cwmp1__AddObjectResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__AddObjectResponse); + if (soap_out__cwmp1__AddObjectResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__AddObjectResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__AddObjectResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__AddObjectResponse), type)) + return soap->error; + if (soap_out_unsignedInt(soap, "InstanceNumber", -1, &a->InstanceNumber, "")) + return soap->error; + if (soap_out__cwmp1__AddObjectResponse_Status(soap, "Status", -1, &a->Status, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__AddObjectResponse * SOAP_FMAC4 soap_get__cwmp1__AddObjectResponse(struct soap *soap, struct _cwmp1__AddObjectResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__AddObjectResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__AddObjectResponse * SOAP_FMAC4 soap_in__cwmp1__AddObjectResponse(struct soap *soap, const char *tag, struct _cwmp1__AddObjectResponse *a, const char *type) +{ + size_t soap_flag_InstanceNumber = 1; + size_t soap_flag_Status = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__AddObjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__AddObjectResponse, sizeof(struct _cwmp1__AddObjectResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__AddObjectResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_InstanceNumber && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_unsignedInt(soap, "InstanceNumber", &a->InstanceNumber, "xsd:unsignedInt")) + { soap_flag_InstanceNumber--; + continue; + } + if (soap_flag_Status && soap->error == SOAP_TAG_MISMATCH) + if (soap_in__cwmp1__AddObjectResponse_Status(soap, "Status", &a->Status, "cwmp:AddObjectResponse-Status")) + { soap_flag_Status--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__AddObjectResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__AddObjectResponse, 0, sizeof(struct _cwmp1__AddObjectResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_InstanceNumber > 0 || soap_flag_Status > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__AddObject(struct soap *soap, struct _cwmp1__AddObject *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_cwmp1__ObjectNameType(soap, &a->ObjectName); + soap_default_cwmp1__ParameterKeyType(soap, &a->ParameterKey); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__AddObject(struct soap *soap, const struct _cwmp1__AddObject *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_cwmp1__ObjectNameType(soap, &a->ObjectName); + soap_serialize_cwmp1__ParameterKeyType(soap, &a->ParameterKey); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__AddObject(struct soap *soap, const struct _cwmp1__AddObject *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__AddObject); + if (soap_out__cwmp1__AddObject(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__AddObject(struct soap *soap, const char *tag, int id, const struct _cwmp1__AddObject *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__AddObject), type)) + return soap->error; + if (soap_out_cwmp1__ObjectNameType(soap, "ObjectName", -1, &a->ObjectName, "")) + return soap->error; + if (soap_out_cwmp1__ParameterKeyType(soap, "ParameterKey", -1, &a->ParameterKey, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__AddObject * SOAP_FMAC4 soap_get__cwmp1__AddObject(struct soap *soap, struct _cwmp1__AddObject *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__AddObject(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__AddObject * SOAP_FMAC4 soap_in__cwmp1__AddObject(struct soap *soap, const char *tag, struct _cwmp1__AddObject *a, const char *type) +{ + size_t soap_flag_ObjectName = 1; + size_t soap_flag_ParameterKey = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__AddObject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__AddObject, sizeof(struct _cwmp1__AddObject), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__AddObject(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_ObjectName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_cwmp1__ObjectNameType(soap, "ObjectName", &a->ObjectName, "cwmp:ObjectNameType")) + { soap_flag_ObjectName--; + continue; + } + if (soap_flag_ParameterKey && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_cwmp1__ParameterKeyType(soap, "ParameterKey", &a->ParameterKey, "cwmp:ParameterKeyType")) + { soap_flag_ParameterKey--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__AddObject *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__AddObject, 0, sizeof(struct _cwmp1__AddObject), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_ObjectName > 0 || soap_flag_ParameterKey > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1ParameterAttributeList(struct soap *soap, struct cwmp1ParameterAttributeList *a) +{ + a->__size = 0; + a->__ptrParameterAttributeStruct = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1ParameterAttributeList(struct soap *soap, struct cwmp1ParameterAttributeList const*a) +{ + int i; + if (a->__ptrParameterAttributeStruct && !soap_array_reference(soap, a, (struct soap_array*)&a->__ptrParameterAttributeStruct, 1, SOAP_TYPE_cwmp1ParameterAttributeList)) + for (i = 0; i < a->__size; i++) + { + soap_serialize_PointerTocwmp1__ParameterAttributeStruct(soap, a->__ptrParameterAttributeStruct + i); + } +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1ParameterAttributeList(struct soap *soap, const struct cwmp1ParameterAttributeList *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, (struct soap_array*)&a->__ptrParameterAttributeStruct, 1, tag, SOAP_TYPE_cwmp1ParameterAttributeList); + if (soap_out_cwmp1ParameterAttributeList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1ParameterAttributeList(struct soap *soap, const char *tag, int id, const struct cwmp1ParameterAttributeList *a, const char *type) +{ + int i, n = a->__size; + char *t = a->__ptrParameterAttributeStruct ? soap_putsize(soap, "cwmp:ParameterAttributeStruct", a->__size) : NULL; + id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptrParameterAttributeStruct, 1, type, SOAP_TYPE_cwmp1ParameterAttributeList); + if (id < 0) + return soap->error; + if (soap_array_begin_out(soap, tag, id, t, NULL)) + return soap->error; + for (i = 0; i < n; i++) + { + soap->position = 1; + soap->positions[0] = i; + soap_out_PointerTocwmp1__ParameterAttributeStruct(soap, "ParameterAttributeStruct", -1, &a->__ptrParameterAttributeStruct[i], ""); + } + soap->position = 0; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1ParameterAttributeList * SOAP_FMAC4 soap_get_cwmp1ParameterAttributeList(struct soap *soap, struct cwmp1ParameterAttributeList *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1ParameterAttributeList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1ParameterAttributeList * SOAP_FMAC4 soap_in_cwmp1ParameterAttributeList(struct soap *soap, const char *tag, struct cwmp1ParameterAttributeList *a, const char *type) +{ int i, j; + struct cwmp1__ParameterAttributeStruct **p; + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (soap_match_array(soap, type)) + { soap->error = SOAP_TYPE; + return NULL; + } + a = (struct cwmp1ParameterAttributeList *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1ParameterAttributeList, sizeof(struct cwmp1ParameterAttributeList), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1ParameterAttributeList(soap, a); + if (soap->body && !*soap->href) + { + a->__size = soap_getsize(soap->arraySize, soap->arrayOffset, &j); + if (a->__size >= 0) + { a->__ptrParameterAttributeStruct = (struct cwmp1__ParameterAttributeStruct **)soap_malloc(soap, sizeof(struct cwmp1__ParameterAttributeStruct *) * a->__size); + for (i = 0; i < a->__size; i++) + a->__ptrParameterAttributeStruct[i] = NULL; + for (i = 0; i < a->__size; i++) + { soap_peek_element(soap); + if (soap->position) + { i = soap->positions[0]-j; + if (i < 0 || i >= a->__size) + { soap->error = SOAP_IOB; + return NULL; + } + } + if (!soap_in_PointerTocwmp1__ParameterAttributeStruct(soap, NULL, a->__ptrParameterAttributeStruct + i, "cwmp:ParameterAttributeStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + } + else + { if (soap_new_block(soap) == NULL) + return NULL; + for (a->__size = 0; ; a->__size++) + { p = (struct cwmp1__ParameterAttributeStruct **)soap_push_block(soap, NULL, sizeof(struct cwmp1__ParameterAttributeStruct *)); + if (!p) + return NULL; + *p = NULL; + if (!soap_in_PointerTocwmp1__ParameterAttributeStruct(soap, NULL, p, "cwmp:ParameterAttributeStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + soap_pop_block(soap, NULL); + a->__ptrParameterAttributeStruct = (struct cwmp1__ParameterAttributeStruct **)soap_malloc(soap, soap->blist->size); + soap_save_block(soap, NULL, (char*)a->__ptrParameterAttributeStruct, 1); + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1ParameterAttributeList *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1ParameterAttributeList, 0, sizeof(struct cwmp1ParameterAttributeList), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetParameterAttributesResponse(struct soap *soap, struct _cwmp1__GetParameterAttributesResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->ParameterList = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetParameterAttributesResponse(struct soap *soap, const struct _cwmp1__GetParameterAttributesResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTocwmp1ParameterAttributeList(soap, &a->ParameterList); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetParameterAttributesResponse(struct soap *soap, const struct _cwmp1__GetParameterAttributesResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__GetParameterAttributesResponse); + if (soap_out__cwmp1__GetParameterAttributesResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetParameterAttributesResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__GetParameterAttributesResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__GetParameterAttributesResponse), type)) + return soap->error; + if (soap_out_PointerTocwmp1ParameterAttributeList(soap, "ParameterList", -1, &a->ParameterList, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__GetParameterAttributesResponse * SOAP_FMAC4 soap_get__cwmp1__GetParameterAttributesResponse(struct soap *soap, struct _cwmp1__GetParameterAttributesResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__GetParameterAttributesResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__GetParameterAttributesResponse * SOAP_FMAC4 soap_in__cwmp1__GetParameterAttributesResponse(struct soap *soap, const char *tag, struct _cwmp1__GetParameterAttributesResponse *a, const char *type) +{ + size_t soap_flag_ParameterList = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__GetParameterAttributesResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__GetParameterAttributesResponse, sizeof(struct _cwmp1__GetParameterAttributesResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__GetParameterAttributesResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_ParameterList && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1ParameterAttributeList(soap, "ParameterList", &a->ParameterList, "cwmp:ParameterAttributeStruct")) + { soap_flag_ParameterList--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__GetParameterAttributesResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__GetParameterAttributesResponse, 0, sizeof(struct _cwmp1__GetParameterAttributesResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_ParameterList > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetParameterAttributes(struct soap *soap, struct _cwmp1__GetParameterAttributes *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->ParameterNames = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetParameterAttributes(struct soap *soap, const struct _cwmp1__GetParameterAttributes *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTocwmp1ParameterNames(soap, &a->ParameterNames); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetParameterAttributes(struct soap *soap, const struct _cwmp1__GetParameterAttributes *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__GetParameterAttributes); + if (soap_out__cwmp1__GetParameterAttributes(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetParameterAttributes(struct soap *soap, const char *tag, int id, const struct _cwmp1__GetParameterAttributes *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__GetParameterAttributes), type)) + return soap->error; + if (soap_out_PointerTocwmp1ParameterNames(soap, "ParameterNames", -1, &a->ParameterNames, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__GetParameterAttributes * SOAP_FMAC4 soap_get__cwmp1__GetParameterAttributes(struct soap *soap, struct _cwmp1__GetParameterAttributes *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__GetParameterAttributes(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__GetParameterAttributes * SOAP_FMAC4 soap_in__cwmp1__GetParameterAttributes(struct soap *soap, const char *tag, struct _cwmp1__GetParameterAttributes *a, const char *type) +{ + size_t soap_flag_ParameterNames = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__GetParameterAttributes *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__GetParameterAttributes, sizeof(struct _cwmp1__GetParameterAttributes), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__GetParameterAttributes(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_ParameterNames && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1ParameterNames(soap, "ParameterNames", &a->ParameterNames, "xsd:string")) + { soap_flag_ParameterNames--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__GetParameterAttributes *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__GetParameterAttributes, 0, sizeof(struct _cwmp1__GetParameterAttributes), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_ParameterNames > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetParameterAttributesResponse(struct soap *soap, struct _cwmp1__SetParameterAttributesResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__SetParameterAttributesResponse(struct soap *soap, const struct _cwmp1__SetParameterAttributesResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetParameterAttributesResponse(struct soap *soap, const struct _cwmp1__SetParameterAttributesResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__SetParameterAttributesResponse); + if (soap_out__cwmp1__SetParameterAttributesResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetParameterAttributesResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__SetParameterAttributesResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__SetParameterAttributesResponse), type)) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__SetParameterAttributesResponse * SOAP_FMAC4 soap_get__cwmp1__SetParameterAttributesResponse(struct soap *soap, struct _cwmp1__SetParameterAttributesResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__SetParameterAttributesResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__SetParameterAttributesResponse * SOAP_FMAC4 soap_in__cwmp1__SetParameterAttributesResponse(struct soap *soap, const char *tag, struct _cwmp1__SetParameterAttributesResponse *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__SetParameterAttributesResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__SetParameterAttributesResponse, sizeof(struct _cwmp1__SetParameterAttributesResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__SetParameterAttributesResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__SetParameterAttributesResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__SetParameterAttributesResponse, 0, sizeof(struct _cwmp1__SetParameterAttributesResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1SetParameterAttributesList(struct soap *soap, struct cwmp1SetParameterAttributesList *a) +{ + a->__size = 0; + a->__ptrSetParameterAttributesStruct = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1SetParameterAttributesList(struct soap *soap, struct cwmp1SetParameterAttributesList const*a) +{ + int i; + if (a->__ptrSetParameterAttributesStruct && !soap_array_reference(soap, a, (struct soap_array*)&a->__ptrSetParameterAttributesStruct, 1, SOAP_TYPE_cwmp1SetParameterAttributesList)) + for (i = 0; i < a->__size; i++) + { + soap_serialize_PointerTocwmp1__SetParameterAttributesStruct(soap, a->__ptrSetParameterAttributesStruct + i); + } +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1SetParameterAttributesList(struct soap *soap, const struct cwmp1SetParameterAttributesList *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, (struct soap_array*)&a->__ptrSetParameterAttributesStruct, 1, tag, SOAP_TYPE_cwmp1SetParameterAttributesList); + if (soap_out_cwmp1SetParameterAttributesList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1SetParameterAttributesList(struct soap *soap, const char *tag, int id, const struct cwmp1SetParameterAttributesList *a, const char *type) +{ + int i, n = a->__size; + char *t = a->__ptrSetParameterAttributesStruct ? soap_putsize(soap, "cwmp:SetParameterAttributesStruct", a->__size) : NULL; + id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptrSetParameterAttributesStruct, 1, type, SOAP_TYPE_cwmp1SetParameterAttributesList); + if (id < 0) + return soap->error; + if (soap_array_begin_out(soap, tag, id, t, NULL)) + return soap->error; + for (i = 0; i < n; i++) + { + soap->position = 1; + soap->positions[0] = i; + soap_out_PointerTocwmp1__SetParameterAttributesStruct(soap, "SetParameterAttributesStruct", -1, &a->__ptrSetParameterAttributesStruct[i], ""); + } + soap->position = 0; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1SetParameterAttributesList * SOAP_FMAC4 soap_get_cwmp1SetParameterAttributesList(struct soap *soap, struct cwmp1SetParameterAttributesList *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1SetParameterAttributesList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1SetParameterAttributesList * SOAP_FMAC4 soap_in_cwmp1SetParameterAttributesList(struct soap *soap, const char *tag, struct cwmp1SetParameterAttributesList *a, const char *type) +{ int i, j; + struct cwmp1__SetParameterAttributesStruct **p; + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (soap_match_array(soap, type)) + { soap->error = SOAP_TYPE; + return NULL; + } + a = (struct cwmp1SetParameterAttributesList *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1SetParameterAttributesList, sizeof(struct cwmp1SetParameterAttributesList), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1SetParameterAttributesList(soap, a); + if (soap->body && !*soap->href) + { + a->__size = soap_getsize(soap->arraySize, soap->arrayOffset, &j); + if (a->__size >= 0) + { a->__ptrSetParameterAttributesStruct = (struct cwmp1__SetParameterAttributesStruct **)soap_malloc(soap, sizeof(struct cwmp1__SetParameterAttributesStruct *) * a->__size); + for (i = 0; i < a->__size; i++) + a->__ptrSetParameterAttributesStruct[i] = NULL; + for (i = 0; i < a->__size; i++) + { soap_peek_element(soap); + if (soap->position) + { i = soap->positions[0]-j; + if (i < 0 || i >= a->__size) + { soap->error = SOAP_IOB; + return NULL; + } + } + if (!soap_in_PointerTocwmp1__SetParameterAttributesStruct(soap, NULL, a->__ptrSetParameterAttributesStruct + i, "cwmp:SetParameterAttributesStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + } + else + { if (soap_new_block(soap) == NULL) + return NULL; + for (a->__size = 0; ; a->__size++) + { p = (struct cwmp1__SetParameterAttributesStruct **)soap_push_block(soap, NULL, sizeof(struct cwmp1__SetParameterAttributesStruct *)); + if (!p) + return NULL; + *p = NULL; + if (!soap_in_PointerTocwmp1__SetParameterAttributesStruct(soap, NULL, p, "cwmp:SetParameterAttributesStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + soap_pop_block(soap, NULL); + a->__ptrSetParameterAttributesStruct = (struct cwmp1__SetParameterAttributesStruct **)soap_malloc(soap, soap->blist->size); + soap_save_block(soap, NULL, (char*)a->__ptrSetParameterAttributesStruct, 1); + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1SetParameterAttributesList *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1SetParameterAttributesList, 0, sizeof(struct cwmp1SetParameterAttributesList), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetParameterAttributes(struct soap *soap, struct _cwmp1__SetParameterAttributes *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->ParameterList = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__SetParameterAttributes(struct soap *soap, const struct _cwmp1__SetParameterAttributes *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTocwmp1SetParameterAttributesList(soap, &a->ParameterList); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetParameterAttributes(struct soap *soap, const struct _cwmp1__SetParameterAttributes *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__SetParameterAttributes); + if (soap_out__cwmp1__SetParameterAttributes(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetParameterAttributes(struct soap *soap, const char *tag, int id, const struct _cwmp1__SetParameterAttributes *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__SetParameterAttributes), type)) + return soap->error; + if (soap_out_PointerTocwmp1SetParameterAttributesList(soap, "ParameterList", -1, &a->ParameterList, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__SetParameterAttributes * SOAP_FMAC4 soap_get__cwmp1__SetParameterAttributes(struct soap *soap, struct _cwmp1__SetParameterAttributes *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__SetParameterAttributes(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__SetParameterAttributes * SOAP_FMAC4 soap_in__cwmp1__SetParameterAttributes(struct soap *soap, const char *tag, struct _cwmp1__SetParameterAttributes *a, const char *type) +{ + size_t soap_flag_ParameterList = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__SetParameterAttributes *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__SetParameterAttributes, sizeof(struct _cwmp1__SetParameterAttributes), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__SetParameterAttributes(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_ParameterList && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1SetParameterAttributesList(soap, "ParameterList", &a->ParameterList, "cwmp:SetParameterAttributesStruct")) + { soap_flag_ParameterList--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__SetParameterAttributes *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__SetParameterAttributes, 0, sizeof(struct _cwmp1__SetParameterAttributes), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_ParameterList > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1ParameterInfoList(struct soap *soap, struct cwmp1ParameterInfoList *a) +{ + a->__size = 0; + a->__ptrParameterInfoStruct = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1ParameterInfoList(struct soap *soap, struct cwmp1ParameterInfoList const*a) +{ + int i; + if (a->__ptrParameterInfoStruct && !soap_array_reference(soap, a, (struct soap_array*)&a->__ptrParameterInfoStruct, 1, SOAP_TYPE_cwmp1ParameterInfoList)) + for (i = 0; i < a->__size; i++) + { + soap_serialize_PointerTocwmp1__ParameterInfoStruct(soap, a->__ptrParameterInfoStruct + i); + } +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1ParameterInfoList(struct soap *soap, const struct cwmp1ParameterInfoList *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, (struct soap_array*)&a->__ptrParameterInfoStruct, 1, tag, SOAP_TYPE_cwmp1ParameterInfoList); + if (soap_out_cwmp1ParameterInfoList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1ParameterInfoList(struct soap *soap, const char *tag, int id, const struct cwmp1ParameterInfoList *a, const char *type) +{ + int i, n = a->__size; + char *t = a->__ptrParameterInfoStruct ? soap_putsize(soap, "cwmp:ParameterInfoStruct", a->__size) : NULL; + id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptrParameterInfoStruct, 1, type, SOAP_TYPE_cwmp1ParameterInfoList); + if (id < 0) + return soap->error; + if (soap_array_begin_out(soap, tag, id, t, NULL)) + return soap->error; + for (i = 0; i < n; i++) + { + soap->position = 1; + soap->positions[0] = i; + soap_out_PointerTocwmp1__ParameterInfoStruct(soap, "ParameterInfoStruct", -1, &a->__ptrParameterInfoStruct[i], ""); + } + soap->position = 0; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1ParameterInfoList * SOAP_FMAC4 soap_get_cwmp1ParameterInfoList(struct soap *soap, struct cwmp1ParameterInfoList *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1ParameterInfoList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1ParameterInfoList * SOAP_FMAC4 soap_in_cwmp1ParameterInfoList(struct soap *soap, const char *tag, struct cwmp1ParameterInfoList *a, const char *type) +{ int i, j; + struct cwmp1__ParameterInfoStruct **p; + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (soap_match_array(soap, type)) + { soap->error = SOAP_TYPE; + return NULL; + } + a = (struct cwmp1ParameterInfoList *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1ParameterInfoList, sizeof(struct cwmp1ParameterInfoList), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1ParameterInfoList(soap, a); + if (soap->body && !*soap->href) + { + a->__size = soap_getsize(soap->arraySize, soap->arrayOffset, &j); + if (a->__size >= 0) + { a->__ptrParameterInfoStruct = (struct cwmp1__ParameterInfoStruct **)soap_malloc(soap, sizeof(struct cwmp1__ParameterInfoStruct *) * a->__size); + for (i = 0; i < a->__size; i++) + a->__ptrParameterInfoStruct[i] = NULL; + for (i = 0; i < a->__size; i++) + { soap_peek_element(soap); + if (soap->position) + { i = soap->positions[0]-j; + if (i < 0 || i >= a->__size) + { soap->error = SOAP_IOB; + return NULL; + } + } + if (!soap_in_PointerTocwmp1__ParameterInfoStruct(soap, NULL, a->__ptrParameterInfoStruct + i, "cwmp:ParameterInfoStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + } + else + { if (soap_new_block(soap) == NULL) + return NULL; + for (a->__size = 0; ; a->__size++) + { p = (struct cwmp1__ParameterInfoStruct **)soap_push_block(soap, NULL, sizeof(struct cwmp1__ParameterInfoStruct *)); + if (!p) + return NULL; + *p = NULL; + if (!soap_in_PointerTocwmp1__ParameterInfoStruct(soap, NULL, p, "cwmp:ParameterInfoStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + soap_pop_block(soap, NULL); + a->__ptrParameterInfoStruct = (struct cwmp1__ParameterInfoStruct **)soap_malloc(soap, soap->blist->size); + soap_save_block(soap, NULL, (char*)a->__ptrParameterInfoStruct, 1); + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1ParameterInfoList *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1ParameterInfoList, 0, sizeof(struct cwmp1ParameterInfoList), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetParameterNamesResponse(struct soap *soap, struct _cwmp1__GetParameterNamesResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->ParameterList = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetParameterNamesResponse(struct soap *soap, const struct _cwmp1__GetParameterNamesResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTocwmp1ParameterInfoList(soap, &a->ParameterList); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetParameterNamesResponse(struct soap *soap, const struct _cwmp1__GetParameterNamesResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__GetParameterNamesResponse); + if (soap_out__cwmp1__GetParameterNamesResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetParameterNamesResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__GetParameterNamesResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__GetParameterNamesResponse), type)) + return soap->error; + if (soap_out_PointerTocwmp1ParameterInfoList(soap, "ParameterList", -1, &a->ParameterList, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__GetParameterNamesResponse * SOAP_FMAC4 soap_get__cwmp1__GetParameterNamesResponse(struct soap *soap, struct _cwmp1__GetParameterNamesResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__GetParameterNamesResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__GetParameterNamesResponse * SOAP_FMAC4 soap_in__cwmp1__GetParameterNamesResponse(struct soap *soap, const char *tag, struct _cwmp1__GetParameterNamesResponse *a, const char *type) +{ + size_t soap_flag_ParameterList = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__GetParameterNamesResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__GetParameterNamesResponse, sizeof(struct _cwmp1__GetParameterNamesResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__GetParameterNamesResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_ParameterList && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1ParameterInfoList(soap, "ParameterList", &a->ParameterList, "cwmp:ParameterInfoStruct")) + { soap_flag_ParameterList--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__GetParameterNamesResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__GetParameterNamesResponse, 0, sizeof(struct _cwmp1__GetParameterNamesResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_ParameterList > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetParameterNames(struct soap *soap, struct _cwmp1__GetParameterNames *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->ParameterPath = NULL; + soap_default_xsd__boolean(soap, &a->NextLevel); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetParameterNames(struct soap *soap, const struct _cwmp1__GetParameterNames *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTostring(soap, &a->ParameterPath); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetParameterNames(struct soap *soap, const struct _cwmp1__GetParameterNames *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__GetParameterNames); + if (soap_out__cwmp1__GetParameterNames(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetParameterNames(struct soap *soap, const char *tag, int id, const struct _cwmp1__GetParameterNames *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__GetParameterNames), type)) + return soap->error; + if (soap_out_PointerTostring(soap, "ParameterPath", -1, &a->ParameterPath, "")) + return soap->error; + if (soap_out_xsd__boolean(soap, "NextLevel", -1, &a->NextLevel, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__GetParameterNames * SOAP_FMAC4 soap_get__cwmp1__GetParameterNames(struct soap *soap, struct _cwmp1__GetParameterNames *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__GetParameterNames(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__GetParameterNames * SOAP_FMAC4 soap_in__cwmp1__GetParameterNames(struct soap *soap, const char *tag, struct _cwmp1__GetParameterNames *a, const char *type) +{ + size_t soap_flag_ParameterPath = 1; + size_t soap_flag_NextLevel = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__GetParameterNames *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__GetParameterNames, sizeof(struct _cwmp1__GetParameterNames), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__GetParameterNames(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_ParameterPath && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTostring(soap, "ParameterPath", &a->ParameterPath, "xsd:string")) + { soap_flag_ParameterPath--; + continue; + } + if (soap_flag_NextLevel && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_xsd__boolean(soap, "NextLevel", &a->NextLevel, "xsd:boolean")) + { soap_flag_NextLevel--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__GetParameterNames *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__GetParameterNames, 0, sizeof(struct _cwmp1__GetParameterNames), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_NextLevel > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetParameterValuesResponse(struct soap *soap, struct _cwmp1__GetParameterValuesResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->ParameterList = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetParameterValuesResponse(struct soap *soap, const struct _cwmp1__GetParameterValuesResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTocwmp1ParameterValueList(soap, &a->ParameterList); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetParameterValuesResponse(struct soap *soap, const struct _cwmp1__GetParameterValuesResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__GetParameterValuesResponse); + if (soap_out__cwmp1__GetParameterValuesResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetParameterValuesResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__GetParameterValuesResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__GetParameterValuesResponse), type)) + return soap->error; + if (soap_out_PointerTocwmp1ParameterValueList(soap, "ParameterList", -1, &a->ParameterList, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__GetParameterValuesResponse * SOAP_FMAC4 soap_get__cwmp1__GetParameterValuesResponse(struct soap *soap, struct _cwmp1__GetParameterValuesResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__GetParameterValuesResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__GetParameterValuesResponse * SOAP_FMAC4 soap_in__cwmp1__GetParameterValuesResponse(struct soap *soap, const char *tag, struct _cwmp1__GetParameterValuesResponse *a, const char *type) +{ + size_t soap_flag_ParameterList = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__GetParameterValuesResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__GetParameterValuesResponse, sizeof(struct _cwmp1__GetParameterValuesResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__GetParameterValuesResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_ParameterList && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1ParameterValueList(soap, "ParameterList", &a->ParameterList, "cwmp:ParameterValueStruct")) + { soap_flag_ParameterList--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__GetParameterValuesResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__GetParameterValuesResponse, 0, sizeof(struct _cwmp1__GetParameterValuesResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_ParameterList > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1ParameterNames(struct soap *soap, struct cwmp1ParameterNames *a) +{ + a->__size = 0; + a->__ptrstring = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1ParameterNames(struct soap *soap, struct cwmp1ParameterNames const*a) +{ + int i; + if (a->__ptrstring && !soap_array_reference(soap, a, (struct soap_array*)&a->__ptrstring, 1, SOAP_TYPE_cwmp1ParameterNames)) + for (i = 0; i < a->__size; i++) + { + soap_serialize_string(soap, a->__ptrstring + i); + } +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1ParameterNames(struct soap *soap, const struct cwmp1ParameterNames *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, (struct soap_array*)&a->__ptrstring, 1, tag, SOAP_TYPE_cwmp1ParameterNames); + if (soap_out_cwmp1ParameterNames(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1ParameterNames(struct soap *soap, const char *tag, int id, const struct cwmp1ParameterNames *a, const char *type) +{ + int i, n = a->__size; + char *t = a->__ptrstring ? soap_putsize(soap, "xsd:string", a->__size) : NULL; + id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptrstring, 1, type, SOAP_TYPE_cwmp1ParameterNames); + if (id < 0) + return soap->error; + if (soap_array_begin_out(soap, tag, id, t, NULL)) + return soap->error; + for (i = 0; i < n; i++) + { + soap->position = 1; + soap->positions[0] = i; + soap_out_string(soap, "string", -1, &a->__ptrstring[i], ""); + } + soap->position = 0; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1ParameterNames * SOAP_FMAC4 soap_get_cwmp1ParameterNames(struct soap *soap, struct cwmp1ParameterNames *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1ParameterNames(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1ParameterNames * SOAP_FMAC4 soap_in_cwmp1ParameterNames(struct soap *soap, const char *tag, struct cwmp1ParameterNames *a, const char *type) +{ int i, j; + char **p; + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (soap_match_array(soap, type)) + { soap->error = SOAP_TYPE; + return NULL; + } + a = (struct cwmp1ParameterNames *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1ParameterNames, sizeof(struct cwmp1ParameterNames), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1ParameterNames(soap, a); + if (soap->body && !*soap->href) + { + a->__size = soap_getsize(soap->arraySize, soap->arrayOffset, &j); + if (a->__size >= 0) + { a->__ptrstring = (char **)soap_malloc(soap, sizeof(char *) * a->__size); + for (i = 0; i < a->__size; i++) + a->__ptrstring[i] = NULL; + for (i = 0; i < a->__size; i++) + { soap_peek_element(soap); + if (soap->position) + { i = soap->positions[0]-j; + if (i < 0 || i >= a->__size) + { soap->error = SOAP_IOB; + return NULL; + } + } + if (!soap_in_string(soap, NULL, a->__ptrstring + i, "xsd:string")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + } + else + { if (soap_new_block(soap) == NULL) + return NULL; + for (a->__size = 0; ; a->__size++) + { p = (char **)soap_push_block(soap, NULL, sizeof(char *)); + if (!p) + return NULL; + *p = NULL; + if (!soap_in_string(soap, NULL, p, "xsd:string")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + soap_pop_block(soap, NULL); + a->__ptrstring = (char **)soap_malloc(soap, soap->blist->size); + soap_save_block(soap, NULL, (char*)a->__ptrstring, 1); + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1ParameterNames *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1ParameterNames, 0, sizeof(struct cwmp1ParameterNames), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetParameterValues(struct soap *soap, struct _cwmp1__GetParameterValues *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->ParameterNames = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetParameterValues(struct soap *soap, const struct _cwmp1__GetParameterValues *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTocwmp1ParameterNames(soap, &a->ParameterNames); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetParameterValues(struct soap *soap, const struct _cwmp1__GetParameterValues *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__GetParameterValues); + if (soap_out__cwmp1__GetParameterValues(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetParameterValues(struct soap *soap, const char *tag, int id, const struct _cwmp1__GetParameterValues *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__GetParameterValues), type)) + return soap->error; + if (soap_out_PointerTocwmp1ParameterNames(soap, "ParameterNames", -1, &a->ParameterNames, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__GetParameterValues * SOAP_FMAC4 soap_get__cwmp1__GetParameterValues(struct soap *soap, struct _cwmp1__GetParameterValues *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__GetParameterValues(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__GetParameterValues * SOAP_FMAC4 soap_in__cwmp1__GetParameterValues(struct soap *soap, const char *tag, struct _cwmp1__GetParameterValues *a, const char *type) +{ + size_t soap_flag_ParameterNames = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__GetParameterValues *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__GetParameterValues, sizeof(struct _cwmp1__GetParameterValues), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__GetParameterValues(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_ParameterNames && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1ParameterNames(soap, "ParameterNames", &a->ParameterNames, "xsd:string")) + { soap_flag_ParameterNames--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__GetParameterValues *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__GetParameterValues, 0, sizeof(struct _cwmp1__GetParameterValues), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_ParameterNames > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetParameterValuesResponse(struct soap *soap, struct _cwmp1__SetParameterValuesResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default__cwmp1__SetParameterValuesResponse_Status(soap, &a->Status); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__SetParameterValuesResponse(struct soap *soap, const struct _cwmp1__SetParameterValuesResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetParameterValuesResponse(struct soap *soap, const struct _cwmp1__SetParameterValuesResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__SetParameterValuesResponse); + if (soap_out__cwmp1__SetParameterValuesResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetParameterValuesResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__SetParameterValuesResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__SetParameterValuesResponse), type)) + return soap->error; + if (soap_out__cwmp1__SetParameterValuesResponse_Status(soap, "Status", -1, &a->Status, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__SetParameterValuesResponse * SOAP_FMAC4 soap_get__cwmp1__SetParameterValuesResponse(struct soap *soap, struct _cwmp1__SetParameterValuesResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__SetParameterValuesResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__SetParameterValuesResponse * SOAP_FMAC4 soap_in__cwmp1__SetParameterValuesResponse(struct soap *soap, const char *tag, struct _cwmp1__SetParameterValuesResponse *a, const char *type) +{ + size_t soap_flag_Status = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__SetParameterValuesResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__SetParameterValuesResponse, sizeof(struct _cwmp1__SetParameterValuesResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__SetParameterValuesResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_Status && soap->error == SOAP_TAG_MISMATCH) + if (soap_in__cwmp1__SetParameterValuesResponse_Status(soap, "Status", &a->Status, "cwmp:SetParameterValuesResponse-Status")) + { soap_flag_Status--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__SetParameterValuesResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__SetParameterValuesResponse, 0, sizeof(struct _cwmp1__SetParameterValuesResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Status > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1ParameterValueList(struct soap *soap, struct cwmp1ParameterValueList *a) +{ + a->__size = 0; + a->__ptrParameterValueStruct = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1ParameterValueList(struct soap *soap, struct cwmp1ParameterValueList const*a) +{ + int i; + if (a->__ptrParameterValueStruct && !soap_array_reference(soap, a, (struct soap_array*)&a->__ptrParameterValueStruct, 1, SOAP_TYPE_cwmp1ParameterValueList)) + for (i = 0; i < a->__size; i++) + { + soap_serialize_PointerTocwmp1__ParameterValueStruct(soap, a->__ptrParameterValueStruct + i); + } +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1ParameterValueList(struct soap *soap, const struct cwmp1ParameterValueList *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, (struct soap_array*)&a->__ptrParameterValueStruct, 1, tag, SOAP_TYPE_cwmp1ParameterValueList); + if (soap_out_cwmp1ParameterValueList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1ParameterValueList(struct soap *soap, const char *tag, int id, const struct cwmp1ParameterValueList *a, const char *type) +{ + int i, n = a->__size; + char *t = a->__ptrParameterValueStruct ? soap_putsize(soap, "cwmp:ParameterValueStruct", a->__size) : NULL; + id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptrParameterValueStruct, 1, type, SOAP_TYPE_cwmp1ParameterValueList); + if (id < 0) + return soap->error; + if (soap_array_begin_out(soap, tag, id, t, NULL)) + return soap->error; + for (i = 0; i < n; i++) + { + soap->position = 1; + soap->positions[0] = i; + soap_out_PointerTocwmp1__ParameterValueStruct(soap, "ParameterValueStruct", -1, &a->__ptrParameterValueStruct[i], ""); + } + soap->position = 0; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1ParameterValueList * SOAP_FMAC4 soap_get_cwmp1ParameterValueList(struct soap *soap, struct cwmp1ParameterValueList *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1ParameterValueList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1ParameterValueList * SOAP_FMAC4 soap_in_cwmp1ParameterValueList(struct soap *soap, const char *tag, struct cwmp1ParameterValueList *a, const char *type) +{ int i, j; + struct cwmp1__ParameterValueStruct **p; + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (soap_match_array(soap, type)) + { soap->error = SOAP_TYPE; + return NULL; + } + a = (struct cwmp1ParameterValueList *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1ParameterValueList, sizeof(struct cwmp1ParameterValueList), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1ParameterValueList(soap, a); + if (soap->body && !*soap->href) + { + a->__size = soap_getsize(soap->arraySize, soap->arrayOffset, &j); + if (a->__size >= 0) + { a->__ptrParameterValueStruct = (struct cwmp1__ParameterValueStruct **)soap_malloc(soap, sizeof(struct cwmp1__ParameterValueStruct *) * a->__size); + for (i = 0; i < a->__size; i++) + a->__ptrParameterValueStruct[i] = NULL; + for (i = 0; i < a->__size; i++) + { soap_peek_element(soap); + if (soap->position) + { i = soap->positions[0]-j; + if (i < 0 || i >= a->__size) + { soap->error = SOAP_IOB; + return NULL; + } + } + if (!soap_in_PointerTocwmp1__ParameterValueStruct(soap, NULL, a->__ptrParameterValueStruct + i, "cwmp:ParameterValueStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + } + else + { if (soap_new_block(soap) == NULL) + return NULL; + for (a->__size = 0; ; a->__size++) + { p = (struct cwmp1__ParameterValueStruct **)soap_push_block(soap, NULL, sizeof(struct cwmp1__ParameterValueStruct *)); + if (!p) + return NULL; + *p = NULL; + if (!soap_in_PointerTocwmp1__ParameterValueStruct(soap, NULL, p, "cwmp:ParameterValueStruct")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + soap_pop_block(soap, NULL); + a->__ptrParameterValueStruct = (struct cwmp1__ParameterValueStruct **)soap_malloc(soap, soap->blist->size); + soap_save_block(soap, NULL, (char*)a->__ptrParameterValueStruct, 1); + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1ParameterValueList *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1ParameterValueList, 0, sizeof(struct cwmp1ParameterValueList), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__SetParameterValues(struct soap *soap, struct _cwmp1__SetParameterValues *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->ParameterList = NULL; + soap_default_cwmp1__ParameterKeyType(soap, &a->ParameterKey); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__SetParameterValues(struct soap *soap, const struct _cwmp1__SetParameterValues *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTocwmp1ParameterValueList(soap, &a->ParameterList); + soap_serialize_cwmp1__ParameterKeyType(soap, &a->ParameterKey); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__SetParameterValues(struct soap *soap, const struct _cwmp1__SetParameterValues *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__SetParameterValues); + if (soap_out__cwmp1__SetParameterValues(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__SetParameterValues(struct soap *soap, const char *tag, int id, const struct _cwmp1__SetParameterValues *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__SetParameterValues), type)) + return soap->error; + if (soap_out_PointerTocwmp1ParameterValueList(soap, "ParameterList", -1, &a->ParameterList, "")) + return soap->error; + if (soap_out_cwmp1__ParameterKeyType(soap, "ParameterKey", -1, &a->ParameterKey, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__SetParameterValues * SOAP_FMAC4 soap_get__cwmp1__SetParameterValues(struct soap *soap, struct _cwmp1__SetParameterValues *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__SetParameterValues(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__SetParameterValues * SOAP_FMAC4 soap_in__cwmp1__SetParameterValues(struct soap *soap, const char *tag, struct _cwmp1__SetParameterValues *a, const char *type) +{ + size_t soap_flag_ParameterList = 1; + size_t soap_flag_ParameterKey = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__SetParameterValues *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__SetParameterValues, sizeof(struct _cwmp1__SetParameterValues), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__SetParameterValues(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_ParameterList && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1ParameterValueList(soap, "ParameterList", &a->ParameterList, "cwmp:ParameterValueStruct")) + { soap_flag_ParameterList--; + continue; + } + if (soap_flag_ParameterKey && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_cwmp1__ParameterKeyType(soap, "ParameterKey", &a->ParameterKey, "cwmp:ParameterKeyType")) + { soap_flag_ParameterKey--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__SetParameterValues *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__SetParameterValues, 0, sizeof(struct _cwmp1__SetParameterValues), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_ParameterList > 0 || soap_flag_ParameterKey > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1MethodList(struct soap *soap, struct cwmp1MethodList *a) +{ + a->__size = 0; + a->__ptrstring = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1MethodList(struct soap *soap, struct cwmp1MethodList const*a) +{ + int i; + if (a->__ptrstring && !soap_array_reference(soap, a, (struct soap_array*)&a->__ptrstring, 1, SOAP_TYPE_cwmp1MethodList)) + for (i = 0; i < a->__size; i++) + { + soap_serialize_string(soap, a->__ptrstring + i); + } +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1MethodList(struct soap *soap, const struct cwmp1MethodList *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, (struct soap_array*)&a->__ptrstring, 1, tag, SOAP_TYPE_cwmp1MethodList); + if (soap_out_cwmp1MethodList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1MethodList(struct soap *soap, const char *tag, int id, const struct cwmp1MethodList *a, const char *type) +{ + int i, n = a->__size; + char *t = a->__ptrstring ? soap_putsize(soap, "xsd:string", a->__size) : NULL; + id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptrstring, 1, type, SOAP_TYPE_cwmp1MethodList); + if (id < 0) + return soap->error; + if (soap_array_begin_out(soap, tag, id, t, NULL)) + return soap->error; + for (i = 0; i < n; i++) + { + soap->position = 1; + soap->positions[0] = i; + soap_out_string(soap, "string", -1, &a->__ptrstring[i], ""); + } + soap->position = 0; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1MethodList * SOAP_FMAC4 soap_get_cwmp1MethodList(struct soap *soap, struct cwmp1MethodList *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1MethodList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1MethodList * SOAP_FMAC4 soap_in_cwmp1MethodList(struct soap *soap, const char *tag, struct cwmp1MethodList *a, const char *type) +{ int i, j; + char **p; + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (soap_match_array(soap, type)) + { soap->error = SOAP_TYPE; + return NULL; + } + a = (struct cwmp1MethodList *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1MethodList, sizeof(struct cwmp1MethodList), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1MethodList(soap, a); + if (soap->body && !*soap->href) + { + a->__size = soap_getsize(soap->arraySize, soap->arrayOffset, &j); + if (a->__size >= 0) + { a->__ptrstring = (char **)soap_malloc(soap, sizeof(char *) * a->__size); + for (i = 0; i < a->__size; i++) + a->__ptrstring[i] = NULL; + for (i = 0; i < a->__size; i++) + { soap_peek_element(soap); + if (soap->position) + { i = soap->positions[0]-j; + if (i < 0 || i >= a->__size) + { soap->error = SOAP_IOB; + return NULL; + } + } + if (!soap_in_string(soap, NULL, a->__ptrstring + i, "xsd:string")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + } + else + { if (soap_new_block(soap) == NULL) + return NULL; + for (a->__size = 0; ; a->__size++) + { p = (char **)soap_push_block(soap, NULL, sizeof(char *)); + if (!p) + return NULL; + *p = NULL; + if (!soap_in_string(soap, NULL, p, "xsd:string")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + soap_pop_block(soap, NULL); + a->__ptrstring = (char **)soap_malloc(soap, soap->blist->size); + soap_save_block(soap, NULL, (char*)a->__ptrstring, 1); + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1MethodList *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1MethodList, 0, sizeof(struct cwmp1MethodList), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetRPCMethodsResponse(struct soap *soap, struct _cwmp1__GetRPCMethodsResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->MethodList = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetRPCMethodsResponse(struct soap *soap, const struct _cwmp1__GetRPCMethodsResponse *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTocwmp1MethodList(soap, &a->MethodList); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetRPCMethodsResponse(struct soap *soap, const struct _cwmp1__GetRPCMethodsResponse *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__GetRPCMethodsResponse); + if (soap_out__cwmp1__GetRPCMethodsResponse(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetRPCMethodsResponse(struct soap *soap, const char *tag, int id, const struct _cwmp1__GetRPCMethodsResponse *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__GetRPCMethodsResponse), type)) + return soap->error; + if (soap_out_PointerTocwmp1MethodList(soap, "MethodList", -1, &a->MethodList, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__GetRPCMethodsResponse * SOAP_FMAC4 soap_get__cwmp1__GetRPCMethodsResponse(struct soap *soap, struct _cwmp1__GetRPCMethodsResponse *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__GetRPCMethodsResponse(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__GetRPCMethodsResponse * SOAP_FMAC4 soap_in__cwmp1__GetRPCMethodsResponse(struct soap *soap, const char *tag, struct _cwmp1__GetRPCMethodsResponse *a, const char *type) +{ + size_t soap_flag_MethodList = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__GetRPCMethodsResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__GetRPCMethodsResponse, sizeof(struct _cwmp1__GetRPCMethodsResponse), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__GetRPCMethodsResponse(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_MethodList && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1MethodList(soap, "MethodList", &a->MethodList, "xsd:string")) + { soap_flag_MethodList--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__GetRPCMethodsResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__GetRPCMethodsResponse, 0, sizeof(struct _cwmp1__GetRPCMethodsResponse), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_MethodList > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__GetRPCMethods(struct soap *soap, struct _cwmp1__GetRPCMethods *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__GetRPCMethods(struct soap *soap, const struct _cwmp1__GetRPCMethods *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__GetRPCMethods(struct soap *soap, const struct _cwmp1__GetRPCMethods *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__GetRPCMethods); + if (soap_out__cwmp1__GetRPCMethods(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__GetRPCMethods(struct soap *soap, const char *tag, int id, const struct _cwmp1__GetRPCMethods *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__GetRPCMethods), type)) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__GetRPCMethods * SOAP_FMAC4 soap_get__cwmp1__GetRPCMethods(struct soap *soap, struct _cwmp1__GetRPCMethods *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__GetRPCMethods(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__GetRPCMethods * SOAP_FMAC4 soap_in__cwmp1__GetRPCMethods(struct soap *soap, const char *tag, struct _cwmp1__GetRPCMethods *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__GetRPCMethods *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__GetRPCMethods, sizeof(struct _cwmp1__GetRPCMethods), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__GetRPCMethods(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__GetRPCMethods *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__GetRPCMethods, 0, sizeof(struct _cwmp1__GetRPCMethods), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__Fault_SetParameterValuesFault(struct soap *soap, struct _cwmp1__Fault_SetParameterValuesFault *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->ParameterName); + soap_default_cwmp1__FaultCodeType(soap, &a->FaultCode); + soap_default_string(soap, &a->FaultString); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__Fault_SetParameterValuesFault(struct soap *soap, const struct _cwmp1__Fault_SetParameterValuesFault *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->ParameterName); + soap_serialize_cwmp1__FaultCodeType(soap, &a->FaultCode); + soap_serialize_string(soap, &a->FaultString); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__Fault_SetParameterValuesFault(struct soap *soap, const struct _cwmp1__Fault_SetParameterValuesFault *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__Fault_SetParameterValuesFault); + if (soap_out__cwmp1__Fault_SetParameterValuesFault(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__Fault_SetParameterValuesFault(struct soap *soap, const char *tag, int id, const struct _cwmp1__Fault_SetParameterValuesFault *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__Fault_SetParameterValuesFault), type)) + return soap->error; + if (soap_out_string(soap, "ParameterName", -1, &a->ParameterName, "")) + return soap->error; + if (soap_out_cwmp1__FaultCodeType(soap, "FaultCode", -1, &a->FaultCode, "")) + return soap->error; + if (soap_out_string(soap, "FaultString", -1, &a->FaultString, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__Fault_SetParameterValuesFault * SOAP_FMAC4 soap_get__cwmp1__Fault_SetParameterValuesFault(struct soap *soap, struct _cwmp1__Fault_SetParameterValuesFault *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__Fault_SetParameterValuesFault(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__Fault_SetParameterValuesFault * SOAP_FMAC4 soap_in__cwmp1__Fault_SetParameterValuesFault(struct soap *soap, const char *tag, struct _cwmp1__Fault_SetParameterValuesFault *a, const char *type) +{ + size_t soap_flag_ParameterName = 1; + size_t soap_flag_FaultCode = 1; + size_t soap_flag_FaultString = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__Fault_SetParameterValuesFault *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__Fault_SetParameterValuesFault, sizeof(struct _cwmp1__Fault_SetParameterValuesFault), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__Fault_SetParameterValuesFault(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_ParameterName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "ParameterName", &a->ParameterName, "xsd:string")) + { soap_flag_ParameterName--; + continue; + } + if (soap_flag_FaultCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_cwmp1__FaultCodeType(soap, "FaultCode", &a->FaultCode, "cwmp:FaultCodeType")) + { soap_flag_FaultCode--; + continue; + } + if (soap_flag_FaultString && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "FaultString", &a->FaultString, "xsd:string")) + { soap_flag_FaultString--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__Fault_SetParameterValuesFault *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__Fault_SetParameterValuesFault, 0, sizeof(struct _cwmp1__Fault_SetParameterValuesFault), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_ParameterName > 0 || soap_flag_FaultCode > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__cwmp1__Fault(struct soap *soap, struct _cwmp1__Fault *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_cwmp1__FaultCodeType(soap, &a->FaultCode); + soap_default_string(soap, &a->FaultString); + a->__sizeSetParameterValuesFault = 0; + a->SetParameterValuesFault = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__cwmp1__Fault(struct soap *soap, const struct _cwmp1__Fault *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_cwmp1__FaultCodeType(soap, &a->FaultCode); + soap_serialize_string(soap, &a->FaultString); + if (a->SetParameterValuesFault) + { int i; + for (i = 0; i < a->__sizeSetParameterValuesFault; i++) + { + soap_embedded(soap, a->SetParameterValuesFault + i, SOAP_TYPE__cwmp1__Fault_SetParameterValuesFault); + soap_serialize__cwmp1__Fault_SetParameterValuesFault(soap, a->SetParameterValuesFault + i); + } + } +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__cwmp1__Fault(struct soap *soap, const struct _cwmp1__Fault *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__cwmp1__Fault); + if (soap_out__cwmp1__Fault(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__cwmp1__Fault(struct soap *soap, const char *tag, int id, const struct _cwmp1__Fault *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE__cwmp1__Fault), type)) + return soap->error; + if (soap_out_cwmp1__FaultCodeType(soap, "FaultCode", -1, &a->FaultCode, "")) + return soap->error; + if (soap_out_string(soap, "FaultString", -1, &a->FaultString, "")) + return soap->error; + if (a->SetParameterValuesFault) + { int i; + for (i = 0; i < a->__sizeSetParameterValuesFault; i++) + if (soap_out__cwmp1__Fault_SetParameterValuesFault(soap, "SetParameterValuesFault", -1, a->SetParameterValuesFault + i, "")) + return soap->error; + } + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct _cwmp1__Fault * SOAP_FMAC4 soap_get__cwmp1__Fault(struct soap *soap, struct _cwmp1__Fault *p, const char *tag, const char *type) +{ + if ((p = soap_in__cwmp1__Fault(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__Fault * SOAP_FMAC4 soap_in__cwmp1__Fault(struct soap *soap, const char *tag, struct _cwmp1__Fault *a, const char *type) +{ + size_t soap_flag_FaultCode = 1; + size_t soap_flag_FaultString = 1; + struct soap_blist *soap_blist_SetParameterValuesFault = NULL; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct _cwmp1__Fault *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__cwmp1__Fault, sizeof(struct _cwmp1__Fault), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default__cwmp1__Fault(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_FaultCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_cwmp1__FaultCodeType(soap, "FaultCode", &a->FaultCode, "cwmp:FaultCodeType")) + { soap_flag_FaultCode--; + continue; + } + if (soap_flag_FaultString && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "FaultString", &a->FaultString, "xsd:string")) + { soap_flag_FaultString--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH && !soap_element_begin_in(soap, "SetParameterValuesFault", 1, NULL)) + { if (a->SetParameterValuesFault == NULL) + { if (soap_blist_SetParameterValuesFault == NULL) + soap_blist_SetParameterValuesFault = soap_new_block(soap); + a->SetParameterValuesFault = (struct _cwmp1__Fault_SetParameterValuesFault *)soap_push_block(soap, soap_blist_SetParameterValuesFault, sizeof(struct _cwmp1__Fault_SetParameterValuesFault)); + if (a->SetParameterValuesFault == NULL) + return NULL; + soap_default__cwmp1__Fault_SetParameterValuesFault(soap, a->SetParameterValuesFault); + }soap_revert(soap); + if (soap_in__cwmp1__Fault_SetParameterValuesFault(soap, "SetParameterValuesFault", a->SetParameterValuesFault, "")) + { a->__sizeSetParameterValuesFault++; + a->SetParameterValuesFault = NULL; + continue; + } + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (a->SetParameterValuesFault) + soap_pop_block(soap, soap_blist_SetParameterValuesFault); + if (a->__sizeSetParameterValuesFault) + a->SetParameterValuesFault = (struct _cwmp1__Fault_SetParameterValuesFault *)soap_save_block(soap, soap_blist_SetParameterValuesFault, NULL, 1); + else + { a->SetParameterValuesFault = NULL; + if (soap_blist_SetParameterValuesFault) + soap_end_block(soap, soap_blist_SetParameterValuesFault); + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct _cwmp1__Fault *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__cwmp1__Fault, 0, sizeof(struct _cwmp1__Fault), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_FaultCode > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__OptionStruct(struct soap *soap, struct cwmp1__OptionStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->OptionName); + soap_default_unsignedInt(soap, &a->VoucherSN); + soap_default__cwmp1__OptionStruct_State(soap, &a->State); + soap_default__cwmp1__OptionStruct_Mode(soap, &a->Mode); + soap_default_time(soap, &a->StartDate); + a->ExpirationDate = NULL; + soap_default__cwmp1__OptionStruct_IsTransferable(soap, &a->IsTransferable); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__OptionStruct(struct soap *soap, const struct cwmp1__OptionStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->OptionName); + soap_embedded(soap, &a->VoucherSN, SOAP_TYPE_unsignedInt); + soap_embedded(soap, &a->StartDate, SOAP_TYPE_time); + soap_serialize_PointerTotime(soap, &a->ExpirationDate); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__OptionStruct(struct soap *soap, const struct cwmp1__OptionStruct *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__OptionStruct); + if (soap_out_cwmp1__OptionStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__OptionStruct(struct soap *soap, const char *tag, int id, const struct cwmp1__OptionStruct *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_cwmp1__OptionStruct), type)) + return soap->error; + if (soap_out_string(soap, "OptionName", -1, &a->OptionName, "")) + return soap->error; + if (soap_out_unsignedInt(soap, "VoucherSN", -1, &a->VoucherSN, "")) + return soap->error; + if (soap_out__cwmp1__OptionStruct_State(soap, "State", -1, &a->State, "")) + return soap->error; + if (soap_out__cwmp1__OptionStruct_Mode(soap, "Mode", -1, &a->Mode, "")) + return soap->error; + if (soap_out_time(soap, "StartDate", -1, &a->StartDate, "")) + return soap->error; + if (soap_out_PointerTotime(soap, "ExpirationDate", -1, &a->ExpirationDate, "")) + return soap->error; + if (soap_out__cwmp1__OptionStruct_IsTransferable(soap, "IsTransferable", -1, &a->IsTransferable, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1__OptionStruct * SOAP_FMAC4 soap_get_cwmp1__OptionStruct(struct soap *soap, struct cwmp1__OptionStruct *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__OptionStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__OptionStruct * SOAP_FMAC4 soap_in_cwmp1__OptionStruct(struct soap *soap, const char *tag, struct cwmp1__OptionStruct *a, const char *type) +{ + size_t soap_flag_OptionName = 1; + size_t soap_flag_VoucherSN = 1; + size_t soap_flag_State = 1; + size_t soap_flag_Mode = 1; + size_t soap_flag_StartDate = 1; + size_t soap_flag_ExpirationDate = 1; + size_t soap_flag_IsTransferable = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct cwmp1__OptionStruct *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1__OptionStruct, sizeof(struct cwmp1__OptionStruct), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1__OptionStruct(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_OptionName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "OptionName", &a->OptionName, "xsd:string")) + { soap_flag_OptionName--; + continue; + } + if (soap_flag_VoucherSN && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_unsignedInt(soap, "VoucherSN", &a->VoucherSN, "xsd:unsignedInt")) + { soap_flag_VoucherSN--; + continue; + } + if (soap_flag_State && soap->error == SOAP_TAG_MISMATCH) + if (soap_in__cwmp1__OptionStruct_State(soap, "State", &a->State, "cwmp:OptionStruct-State")) + { soap_flag_State--; + continue; + } + if (soap_flag_Mode && soap->error == SOAP_TAG_MISMATCH) + if (soap_in__cwmp1__OptionStruct_Mode(soap, "Mode", &a->Mode, "cwmp:OptionStruct-Mode")) + { soap_flag_Mode--; + continue; + } + if (soap_flag_StartDate && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_time(soap, "StartDate", &a->StartDate, "xsd:dateTime")) + { soap_flag_StartDate--; + continue; + } + if (soap_flag_ExpirationDate && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTotime(soap, "ExpirationDate", &a->ExpirationDate, "xsd:dateTime")) + { soap_flag_ExpirationDate--; + continue; + } + if (soap_flag_IsTransferable && soap->error == SOAP_TAG_MISMATCH) + if (soap_in__cwmp1__OptionStruct_IsTransferable(soap, "IsTransferable", &a->IsTransferable, "cwmp:OptionStruct-IsTransferable")) + { soap_flag_IsTransferable--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1__OptionStruct *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1__OptionStruct, 0, sizeof(struct cwmp1__OptionStruct), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_OptionName > 0 || soap_flag_VoucherSN > 0 || soap_flag_State > 0 || soap_flag_Mode > 0 || soap_flag_StartDate > 0 || soap_flag_IsTransferable > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__ArgStruct(struct soap *soap, struct cwmp1__ArgStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->Name); + soap_default_string(soap, &a->Value); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__ArgStruct(struct soap *soap, const struct cwmp1__ArgStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->Name); + soap_serialize_string(soap, &a->Value); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__ArgStruct(struct soap *soap, const struct cwmp1__ArgStruct *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__ArgStruct); + if (soap_out_cwmp1__ArgStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__ArgStruct(struct soap *soap, const char *tag, int id, const struct cwmp1__ArgStruct *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_cwmp1__ArgStruct), type)) + return soap->error; + if (soap_out_string(soap, "Name", -1, &a->Name, "")) + return soap->error; + if (soap_out_string(soap, "Value", -1, &a->Value, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1__ArgStruct * SOAP_FMAC4 soap_get_cwmp1__ArgStruct(struct soap *soap, struct cwmp1__ArgStruct *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__ArgStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__ArgStruct * SOAP_FMAC4 soap_in_cwmp1__ArgStruct(struct soap *soap, const char *tag, struct cwmp1__ArgStruct *a, const char *type) +{ + size_t soap_flag_Name = 1; + size_t soap_flag_Value = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct cwmp1__ArgStruct *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1__ArgStruct, sizeof(struct cwmp1__ArgStruct), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1__ArgStruct(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_Name && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "Name", &a->Name, "xsd:string")) + { soap_flag_Name--; + continue; + } + if (soap_flag_Value && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "Value", &a->Value, "xsd:string")) + { soap_flag_Value--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1__ArgStruct *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1__ArgStruct, 0, sizeof(struct cwmp1__ArgStruct), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Name > 0 || soap_flag_Value > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__AllQueuedTransferStruct(struct soap *soap, struct cwmp1__AllQueuedTransferStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_cwmp1__CommandKeyType(soap, &a->CommandKey); + soap_default__cwmp1__AllQueuedTransferStruct_State(soap, &a->State); + soap_default_xsd__boolean(soap, &a->IsDownload); + soap_default_string(soap, &a->FileType); + soap_default_unsignedInt(soap, &a->FileSize); + soap_default_string(soap, &a->TargetFileName); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__AllQueuedTransferStruct(struct soap *soap, const struct cwmp1__AllQueuedTransferStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_cwmp1__CommandKeyType(soap, &a->CommandKey); + soap_serialize_string(soap, &a->FileType); + soap_embedded(soap, &a->FileSize, SOAP_TYPE_unsignedInt); + soap_serialize_string(soap, &a->TargetFileName); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__AllQueuedTransferStruct(struct soap *soap, const struct cwmp1__AllQueuedTransferStruct *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__AllQueuedTransferStruct); + if (soap_out_cwmp1__AllQueuedTransferStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__AllQueuedTransferStruct(struct soap *soap, const char *tag, int id, const struct cwmp1__AllQueuedTransferStruct *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_cwmp1__AllQueuedTransferStruct), type)) + return soap->error; + if (soap_out_cwmp1__CommandKeyType(soap, "CommandKey", -1, &a->CommandKey, "")) + return soap->error; + if (soap_out__cwmp1__AllQueuedTransferStruct_State(soap, "State", -1, &a->State, "")) + return soap->error; + if (soap_out_xsd__boolean(soap, "IsDownload", -1, &a->IsDownload, "")) + return soap->error; + if (soap_out_string(soap, "FileType", -1, &a->FileType, "")) + return soap->error; + if (soap_out_unsignedInt(soap, "FileSize", -1, &a->FileSize, "")) + return soap->error; + if (soap_out_string(soap, "TargetFileName", -1, &a->TargetFileName, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1__AllQueuedTransferStruct * SOAP_FMAC4 soap_get_cwmp1__AllQueuedTransferStruct(struct soap *soap, struct cwmp1__AllQueuedTransferStruct *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__AllQueuedTransferStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__AllQueuedTransferStruct * SOAP_FMAC4 soap_in_cwmp1__AllQueuedTransferStruct(struct soap *soap, const char *tag, struct cwmp1__AllQueuedTransferStruct *a, const char *type) +{ + size_t soap_flag_CommandKey = 1; + size_t soap_flag_State = 1; + size_t soap_flag_IsDownload = 1; + size_t soap_flag_FileType = 1; + size_t soap_flag_FileSize = 1; + size_t soap_flag_TargetFileName = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct cwmp1__AllQueuedTransferStruct *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1__AllQueuedTransferStruct, sizeof(struct cwmp1__AllQueuedTransferStruct), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1__AllQueuedTransferStruct(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_CommandKey && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_cwmp1__CommandKeyType(soap, "CommandKey", &a->CommandKey, "cwmp:CommandKeyType")) + { soap_flag_CommandKey--; + continue; + } + if (soap_flag_State && soap->error == SOAP_TAG_MISMATCH) + if (soap_in__cwmp1__AllQueuedTransferStruct_State(soap, "State", &a->State, "cwmp:AllQueuedTransferStruct-State")) + { soap_flag_State--; + continue; + } + if (soap_flag_IsDownload && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_xsd__boolean(soap, "IsDownload", &a->IsDownload, "xsd:boolean")) + { soap_flag_IsDownload--; + continue; + } + if (soap_flag_FileType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "FileType", &a->FileType, "xsd:string")) + { soap_flag_FileType--; + continue; + } + if (soap_flag_FileSize && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_unsignedInt(soap, "FileSize", &a->FileSize, "xsd:unsignedInt")) + { soap_flag_FileSize--; + continue; + } + if (soap_flag_TargetFileName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "TargetFileName", &a->TargetFileName, "xsd:string")) + { soap_flag_TargetFileName--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1__AllQueuedTransferStruct *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1__AllQueuedTransferStruct, 0, sizeof(struct cwmp1__AllQueuedTransferStruct), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_CommandKey > 0 || soap_flag_State > 0 || soap_flag_IsDownload > 0 || soap_flag_FileType > 0 || soap_flag_FileSize > 0 || soap_flag_TargetFileName > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__QueuedTransferStruct(struct soap *soap, struct cwmp1__QueuedTransferStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_cwmp1__CommandKeyType(soap, &a->CommandKey); + soap_default__cwmp1__QueuedTransferStruct_State(soap, &a->State); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__QueuedTransferStruct(struct soap *soap, const struct cwmp1__QueuedTransferStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_cwmp1__CommandKeyType(soap, &a->CommandKey); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__QueuedTransferStruct(struct soap *soap, const struct cwmp1__QueuedTransferStruct *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__QueuedTransferStruct); + if (soap_out_cwmp1__QueuedTransferStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__QueuedTransferStruct(struct soap *soap, const char *tag, int id, const struct cwmp1__QueuedTransferStruct *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_cwmp1__QueuedTransferStruct), type)) + return soap->error; + if (soap_out_cwmp1__CommandKeyType(soap, "CommandKey", -1, &a->CommandKey, "")) + return soap->error; + if (soap_out__cwmp1__QueuedTransferStruct_State(soap, "State", -1, &a->State, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1__QueuedTransferStruct * SOAP_FMAC4 soap_get_cwmp1__QueuedTransferStruct(struct soap *soap, struct cwmp1__QueuedTransferStruct *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__QueuedTransferStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__QueuedTransferStruct * SOAP_FMAC4 soap_in_cwmp1__QueuedTransferStruct(struct soap *soap, const char *tag, struct cwmp1__QueuedTransferStruct *a, const char *type) +{ + size_t soap_flag_CommandKey = 1; + size_t soap_flag_State = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct cwmp1__QueuedTransferStruct *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1__QueuedTransferStruct, sizeof(struct cwmp1__QueuedTransferStruct), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1__QueuedTransferStruct(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_CommandKey && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_cwmp1__CommandKeyType(soap, "CommandKey", &a->CommandKey, "cwmp:CommandKeyType")) + { soap_flag_CommandKey--; + continue; + } + if (soap_flag_State && soap->error == SOAP_TAG_MISMATCH) + if (soap_in__cwmp1__QueuedTransferStruct_State(soap, "State", &a->State, "cwmp:QueuedTransferStruct-State")) + { soap_flag_State--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1__QueuedTransferStruct *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1__QueuedTransferStruct, 0, sizeof(struct cwmp1__QueuedTransferStruct), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_CommandKey > 0 || soap_flag_State > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__ParameterAttributeStruct(struct soap *soap, struct cwmp1__ParameterAttributeStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->Name); + soap_default__cwmp1__ParameterAttributeStruct_Notification(soap, &a->Notification); + a->AccessList = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__ParameterAttributeStruct(struct soap *soap, const struct cwmp1__ParameterAttributeStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->Name); + soap_serialize_PointerTocwmp1AccessList(soap, &a->AccessList); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__ParameterAttributeStruct(struct soap *soap, const struct cwmp1__ParameterAttributeStruct *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__ParameterAttributeStruct); + if (soap_out_cwmp1__ParameterAttributeStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__ParameterAttributeStruct(struct soap *soap, const char *tag, int id, const struct cwmp1__ParameterAttributeStruct *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_cwmp1__ParameterAttributeStruct), type)) + return soap->error; + if (soap_out_string(soap, "Name", -1, &a->Name, "")) + return soap->error; + if (soap_out__cwmp1__ParameterAttributeStruct_Notification(soap, "Notification", -1, &a->Notification, "")) + return soap->error; + if (soap_out_PointerTocwmp1AccessList(soap, "AccessList", -1, &a->AccessList, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1__ParameterAttributeStruct * SOAP_FMAC4 soap_get_cwmp1__ParameterAttributeStruct(struct soap *soap, struct cwmp1__ParameterAttributeStruct *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__ParameterAttributeStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__ParameterAttributeStruct * SOAP_FMAC4 soap_in_cwmp1__ParameterAttributeStruct(struct soap *soap, const char *tag, struct cwmp1__ParameterAttributeStruct *a, const char *type) +{ + size_t soap_flag_Name = 1; + size_t soap_flag_Notification = 1; + size_t soap_flag_AccessList = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct cwmp1__ParameterAttributeStruct *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1__ParameterAttributeStruct, sizeof(struct cwmp1__ParameterAttributeStruct), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1__ParameterAttributeStruct(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_Name && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "Name", &a->Name, "xsd:string")) + { soap_flag_Name--; + continue; + } + if (soap_flag_Notification && soap->error == SOAP_TAG_MISMATCH) + if (soap_in__cwmp1__ParameterAttributeStruct_Notification(soap, "Notification", &a->Notification, "cwmp:ParameterAttributeStruct-Notification")) + { soap_flag_Notification--; + continue; + } + if (soap_flag_AccessList && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1AccessList(soap, "AccessList", &a->AccessList, "xsd:string")) + { soap_flag_AccessList--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1__ParameterAttributeStruct *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1__ParameterAttributeStruct, 0, sizeof(struct cwmp1__ParameterAttributeStruct), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Name > 0 || soap_flag_Notification > 0 || soap_flag_AccessList > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1AccessList(struct soap *soap, struct cwmp1AccessList *a) +{ + a->__size = 0; + a->__ptrstring = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1AccessList(struct soap *soap, struct cwmp1AccessList const*a) +{ + int i; + if (a->__ptrstring && !soap_array_reference(soap, a, (struct soap_array*)&a->__ptrstring, 1, SOAP_TYPE_cwmp1AccessList)) + for (i = 0; i < a->__size; i++) + { + soap_serialize_string(soap, a->__ptrstring + i); + } +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1AccessList(struct soap *soap, const struct cwmp1AccessList *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, (struct soap_array*)&a->__ptrstring, 1, tag, SOAP_TYPE_cwmp1AccessList); + if (soap_out_cwmp1AccessList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1AccessList(struct soap *soap, const char *tag, int id, const struct cwmp1AccessList *a, const char *type) +{ + int i, n = a->__size; + char *t = a->__ptrstring ? soap_putsize(soap, "xsd:string", a->__size) : NULL; + id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptrstring, 1, type, SOAP_TYPE_cwmp1AccessList); + if (id < 0) + return soap->error; + if (soap_array_begin_out(soap, tag, id, t, NULL)) + return soap->error; + for (i = 0; i < n; i++) + { + soap->position = 1; + soap->positions[0] = i; + soap_out_string(soap, "string", -1, &a->__ptrstring[i], ""); + } + soap->position = 0; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1AccessList * SOAP_FMAC4 soap_get_cwmp1AccessList(struct soap *soap, struct cwmp1AccessList *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1AccessList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1AccessList * SOAP_FMAC4 soap_in_cwmp1AccessList(struct soap *soap, const char *tag, struct cwmp1AccessList *a, const char *type) +{ int i, j; + char **p; + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (soap_match_array(soap, type)) + { soap->error = SOAP_TYPE; + return NULL; + } + a = (struct cwmp1AccessList *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1AccessList, sizeof(struct cwmp1AccessList), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1AccessList(soap, a); + if (soap->body && !*soap->href) + { + a->__size = soap_getsize(soap->arraySize, soap->arrayOffset, &j); + if (a->__size >= 0) + { a->__ptrstring = (char **)soap_malloc(soap, sizeof(char *) * a->__size); + for (i = 0; i < a->__size; i++) + a->__ptrstring[i] = NULL; + for (i = 0; i < a->__size; i++) + { soap_peek_element(soap); + if (soap->position) + { i = soap->positions[0]-j; + if (i < 0 || i >= a->__size) + { soap->error = SOAP_IOB; + return NULL; + } + } + if (!soap_in_string(soap, NULL, a->__ptrstring + i, "xsd:string")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + } + else + { if (soap_new_block(soap) == NULL) + return NULL; + for (a->__size = 0; ; a->__size++) + { p = (char **)soap_push_block(soap, NULL, sizeof(char *)); + if (!p) + return NULL; + *p = NULL; + if (!soap_in_string(soap, NULL, p, "xsd:string")) + { if (soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + break; + } + } + soap_pop_block(soap, NULL); + a->__ptrstring = (char **)soap_malloc(soap, soap->blist->size); + soap_save_block(soap, NULL, (char*)a->__ptrstring, 1); + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1AccessList *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1AccessList, 0, sizeof(struct cwmp1AccessList), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__SetParameterAttributesStruct(struct soap *soap, struct cwmp1__SetParameterAttributesStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + a->Name = NULL; + soap_default_xsd__boolean(soap, &a->NotificationChange); + soap_default__cwmp1__SetParameterAttributesStruct_Notification(soap, &a->Notification); + soap_default_xsd__boolean(soap, &a->AccessListChange); + a->AccessList = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__SetParameterAttributesStruct(struct soap *soap, const struct cwmp1__SetParameterAttributesStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_PointerTostring(soap, &a->Name); + soap_serialize_PointerTocwmp1AccessList(soap, &a->AccessList); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__SetParameterAttributesStruct(struct soap *soap, const struct cwmp1__SetParameterAttributesStruct *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__SetParameterAttributesStruct); + if (soap_out_cwmp1__SetParameterAttributesStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__SetParameterAttributesStruct(struct soap *soap, const char *tag, int id, const struct cwmp1__SetParameterAttributesStruct *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_cwmp1__SetParameterAttributesStruct), type)) + return soap->error; + if (soap_out_PointerTostring(soap, "Name", -1, &a->Name, "")) + return soap->error; + if (soap_out_xsd__boolean(soap, "NotificationChange", -1, &a->NotificationChange, "")) + return soap->error; + if (soap_out__cwmp1__SetParameterAttributesStruct_Notification(soap, "Notification", -1, &a->Notification, "")) + return soap->error; + if (soap_out_xsd__boolean(soap, "AccessListChange", -1, &a->AccessListChange, "")) + return soap->error; + if (soap_out_PointerTocwmp1AccessList(soap, "AccessList", -1, &a->AccessList, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1__SetParameterAttributesStruct * SOAP_FMAC4 soap_get_cwmp1__SetParameterAttributesStruct(struct soap *soap, struct cwmp1__SetParameterAttributesStruct *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__SetParameterAttributesStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__SetParameterAttributesStruct * SOAP_FMAC4 soap_in_cwmp1__SetParameterAttributesStruct(struct soap *soap, const char *tag, struct cwmp1__SetParameterAttributesStruct *a, const char *type) +{ + size_t soap_flag_Name = 1; + size_t soap_flag_NotificationChange = 1; + size_t soap_flag_Notification = 1; + size_t soap_flag_AccessListChange = 1; + size_t soap_flag_AccessList = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct cwmp1__SetParameterAttributesStruct *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1__SetParameterAttributesStruct, sizeof(struct cwmp1__SetParameterAttributesStruct), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1__SetParameterAttributesStruct(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_Name && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTostring(soap, "Name", &a->Name, "xsd:string")) + { soap_flag_Name--; + continue; + } + if (soap_flag_NotificationChange && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_xsd__boolean(soap, "NotificationChange", &a->NotificationChange, "xsd:boolean")) + { soap_flag_NotificationChange--; + continue; + } + if (soap_flag_Notification && soap->error == SOAP_TAG_MISMATCH) + if (soap_in__cwmp1__SetParameterAttributesStruct_Notification(soap, "Notification", &a->Notification, "cwmp:SetParameterAttributesStruct-Notification")) + { soap_flag_Notification--; + continue; + } + if (soap_flag_AccessListChange && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_xsd__boolean(soap, "AccessListChange", &a->AccessListChange, "xsd:boolean")) + { soap_flag_AccessListChange--; + continue; + } + if (soap_flag_AccessList && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_PointerTocwmp1AccessList(soap, "AccessList", &a->AccessList, "xsd:string")) + { soap_flag_AccessList--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1__SetParameterAttributesStruct *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1__SetParameterAttributesStruct, 0, sizeof(struct cwmp1__SetParameterAttributesStruct), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_NotificationChange > 0 || soap_flag_Notification > 0 || soap_flag_AccessListChange > 0 || soap_flag_AccessList > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__ParameterInfoStruct(struct soap *soap, struct cwmp1__ParameterInfoStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->Name); + soap_default_xsd__boolean(soap, &a->Writable); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__ParameterInfoStruct(struct soap *soap, const struct cwmp1__ParameterInfoStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->Name); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__ParameterInfoStruct(struct soap *soap, const struct cwmp1__ParameterInfoStruct *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__ParameterInfoStruct); + if (soap_out_cwmp1__ParameterInfoStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__ParameterInfoStruct(struct soap *soap, const char *tag, int id, const struct cwmp1__ParameterInfoStruct *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_cwmp1__ParameterInfoStruct), type)) + return soap->error; + if (soap_out_string(soap, "Name", -1, &a->Name, "")) + return soap->error; + if (soap_out_xsd__boolean(soap, "Writable", -1, &a->Writable, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1__ParameterInfoStruct * SOAP_FMAC4 soap_get_cwmp1__ParameterInfoStruct(struct soap *soap, struct cwmp1__ParameterInfoStruct *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__ParameterInfoStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__ParameterInfoStruct * SOAP_FMAC4 soap_in_cwmp1__ParameterInfoStruct(struct soap *soap, const char *tag, struct cwmp1__ParameterInfoStruct *a, const char *type) +{ + size_t soap_flag_Name = 1; + size_t soap_flag_Writable = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct cwmp1__ParameterInfoStruct *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1__ParameterInfoStruct, sizeof(struct cwmp1__ParameterInfoStruct), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1__ParameterInfoStruct(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_Name && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "Name", &a->Name, "xsd:string")) + { soap_flag_Name--; + continue; + } + if (soap_flag_Writable && soap->error == SOAP_TAG_MISMATCH) + if (soap_in_xsd__boolean(soap, "Writable", &a->Writable, "xsd:boolean")) + { soap_flag_Writable--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1__ParameterInfoStruct *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1__ParameterInfoStruct, 0, sizeof(struct cwmp1__ParameterInfoStruct), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Name > 0 || soap_flag_Writable > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__ParameterValueStruct(struct soap *soap, struct cwmp1__ParameterValueStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->Name); + soap_default_xsd__anySimpleType(soap, &a->Value); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__ParameterValueStruct(struct soap *soap, const struct cwmp1__ParameterValueStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->Name); + soap_serialize_xsd__anySimpleType(soap, &a->Value); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__ParameterValueStruct(struct soap *soap, const struct cwmp1__ParameterValueStruct *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__ParameterValueStruct); + if (soap_out_cwmp1__ParameterValueStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__ParameterValueStruct(struct soap *soap, const char *tag, int id, const struct cwmp1__ParameterValueStruct *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_cwmp1__ParameterValueStruct), type)) + return soap->error; + if (soap_out_string(soap, "Name", -1, &a->Name, "")) + return soap->error; + if (soap_out_xsd__anySimpleType(soap, "Value", -1, &a->Value, a->Type)) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1__ParameterValueStruct * SOAP_FMAC4 soap_get_cwmp1__ParameterValueStruct(struct soap *soap, struct cwmp1__ParameterValueStruct *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__ParameterValueStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__ParameterValueStruct * SOAP_FMAC4 soap_in_cwmp1__ParameterValueStruct(struct soap *soap, const char *tag, struct cwmp1__ParameterValueStruct *a, const char *type) +{ + size_t soap_flag_Name = 1; + size_t soap_flag_Value = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct cwmp1__ParameterValueStruct *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1__ParameterValueStruct, sizeof(struct cwmp1__ParameterValueStruct), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1__ParameterValueStruct(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_Name && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "Name", &a->Name, "xsd:string")) + { soap_flag_Name--; + continue; + } + if (soap_flag_Value && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_xsd__anySimpleType(soap, "Value", &a->Value, "xsd:anySimpleType")) + { soap_flag_Value--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1__ParameterValueStruct *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1__ParameterValueStruct, 0, sizeof(struct cwmp1__ParameterValueStruct), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Name > 0 || soap_flag_Value > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__EventStruct(struct soap *soap, struct cwmp1__EventStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->EventCode); + soap_default_cwmp1__CommandKeyType(soap, &a->CommandKey); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__EventStruct(struct soap *soap, const struct cwmp1__EventStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->EventCode); + soap_serialize_cwmp1__CommandKeyType(soap, &a->CommandKey); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__EventStruct(struct soap *soap, const struct cwmp1__EventStruct *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__EventStruct); + if (soap_out_cwmp1__EventStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__EventStruct(struct soap *soap, const char *tag, int id, const struct cwmp1__EventStruct *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_cwmp1__EventStruct), type)) + return soap->error; + if (soap_out_string(soap, "EventCode", -1, &a->EventCode, "")) + return soap->error; + if (soap_out_cwmp1__CommandKeyType(soap, "CommandKey", -1, &a->CommandKey, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1__EventStruct * SOAP_FMAC4 soap_get_cwmp1__EventStruct(struct soap *soap, struct cwmp1__EventStruct *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__EventStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__EventStruct * SOAP_FMAC4 soap_in_cwmp1__EventStruct(struct soap *soap, const char *tag, struct cwmp1__EventStruct *a, const char *type) +{ + size_t soap_flag_EventCode = 1; + size_t soap_flag_CommandKey = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct cwmp1__EventStruct *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1__EventStruct, sizeof(struct cwmp1__EventStruct), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1__EventStruct(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_EventCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "EventCode", &a->EventCode, "xsd:string")) + { soap_flag_EventCode--; + continue; + } + if (soap_flag_CommandKey && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_cwmp1__CommandKeyType(soap, "CommandKey", &a->CommandKey, "cwmp:CommandKeyType")) + { soap_flag_CommandKey--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1__EventStruct *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1__EventStruct, 0, sizeof(struct cwmp1__EventStruct), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_EventCode > 0 || soap_flag_CommandKey > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__DeviceIdStruct(struct soap *soap, struct cwmp1__DeviceIdStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->Manufacturer); + soap_default_string(soap, &a->OUI); + soap_default_string(soap, &a->ProductClass); + soap_default_string(soap, &a->SerialNumber); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__DeviceIdStruct(struct soap *soap, const struct cwmp1__DeviceIdStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->Manufacturer); + soap_serialize_string(soap, &a->OUI); + soap_serialize_string(soap, &a->ProductClass); + soap_serialize_string(soap, &a->SerialNumber); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__DeviceIdStruct(struct soap *soap, const struct cwmp1__DeviceIdStruct *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__DeviceIdStruct); + if (soap_out_cwmp1__DeviceIdStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__DeviceIdStruct(struct soap *soap, const char *tag, int id, const struct cwmp1__DeviceIdStruct *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_cwmp1__DeviceIdStruct), type)) + return soap->error; + if (soap_out_string(soap, "Manufacturer", -1, &a->Manufacturer, "")) + return soap->error; + if (soap_out_string(soap, "OUI", -1, &a->OUI, "")) + return soap->error; + if (soap_out_string(soap, "ProductClass", -1, &a->ProductClass, "")) + return soap->error; + if (soap_out_string(soap, "SerialNumber", -1, &a->SerialNumber, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1__DeviceIdStruct * SOAP_FMAC4 soap_get_cwmp1__DeviceIdStruct(struct soap *soap, struct cwmp1__DeviceIdStruct *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__DeviceIdStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__DeviceIdStruct * SOAP_FMAC4 soap_in_cwmp1__DeviceIdStruct(struct soap *soap, const char *tag, struct cwmp1__DeviceIdStruct *a, const char *type) +{ + size_t soap_flag_Manufacturer = 1; + size_t soap_flag_OUI = 1; + size_t soap_flag_ProductClass = 1; + size_t soap_flag_SerialNumber = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct cwmp1__DeviceIdStruct *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1__DeviceIdStruct, sizeof(struct cwmp1__DeviceIdStruct), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1__DeviceIdStruct(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_Manufacturer && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "Manufacturer", &a->Manufacturer, "xsd:string")) + { soap_flag_Manufacturer--; + continue; + } + if (soap_flag_OUI && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "OUI", &a->OUI, "xsd:string")) + { soap_flag_OUI--; + continue; + } + if (soap_flag_ProductClass && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "ProductClass", &a->ProductClass, "xsd:string")) + { soap_flag_ProductClass--; + continue; + } + if (soap_flag_SerialNumber && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "SerialNumber", &a->SerialNumber, "xsd:string")) + { soap_flag_SerialNumber--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1__DeviceIdStruct *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1__DeviceIdStruct, 0, sizeof(struct cwmp1__DeviceIdStruct), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Manufacturer > 0 || soap_flag_OUI > 0 || soap_flag_ProductClass > 0 || soap_flag_SerialNumber > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__FaultStruct(struct soap *soap, struct cwmp1__FaultStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_default_string(soap, &a->FaultCode); + soap_default_string(soap, &a->FaultString); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__FaultStruct(struct soap *soap, const struct cwmp1__FaultStruct *a) +{ + (void)soap; (void)a; /* appease -Wall -Werror */ + soap_serialize_string(soap, &a->FaultCode); + soap_serialize_string(soap, &a->FaultString); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__FaultStruct(struct soap *soap, const struct cwmp1__FaultStruct *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__FaultStruct); + if (soap_out_cwmp1__FaultStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__FaultStruct(struct soap *soap, const char *tag, int id, const struct cwmp1__FaultStruct *a, const char *type) +{ + if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_cwmp1__FaultStruct), type)) + return soap->error; + if (soap_out_string(soap, "FaultCode", -1, &a->FaultCode, "")) + return soap->error; + if (soap_out_string(soap, "FaultString", -1, &a->FaultString, "")) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct cwmp1__FaultStruct * SOAP_FMAC4 soap_get_cwmp1__FaultStruct(struct soap *soap, struct cwmp1__FaultStruct *p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__FaultStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__FaultStruct * SOAP_FMAC4 soap_in_cwmp1__FaultStruct(struct soap *soap, const char *tag, struct cwmp1__FaultStruct *a, const char *type) +{ + size_t soap_flag_FaultCode = 1; + size_t soap_flag_FaultString = 1; + if (soap_element_begin_in(soap, tag, 0, type)) + return NULL; + a = (struct cwmp1__FaultStruct *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_cwmp1__FaultStruct, sizeof(struct cwmp1__FaultStruct), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_cwmp1__FaultStruct(soap, a); + if (soap->body && !*soap->href) + { + for (;;) + { soap->error = SOAP_TAG_MISMATCH; + if (soap_flag_FaultCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "FaultCode", &a->FaultCode, "xsd:string")) + { soap_flag_FaultCode--; + continue; + } + if (soap_flag_FaultString && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) + if (soap_in_string(soap, "FaultString", &a->FaultString, "xsd:string")) + { soap_flag_FaultString--; + continue; + } + if (soap->error == SOAP_TAG_MISMATCH) + soap->error = soap_ignore_element(soap); + if (soap->error == SOAP_NO_TAG) + break; + if (soap->error) + return NULL; + } + if (soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct cwmp1__FaultStruct *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_cwmp1__FaultStruct, 0, sizeof(struct cwmp1__FaultStruct), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_FaultCode > 0 || soap_flag_FaultString > 0)) + { soap->error = SOAP_OCCURS; + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENC__base64(struct soap *soap, struct SOAP_ENC__base64 *a) +{ + a->__size = 0; + a->__ptr = NULL; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENC__base64(struct soap *soap, struct SOAP_ENC__base64 const*a) +{ + if (a->__ptr) + soap_array_reference(soap, a, (struct soap_array*)&a->__ptr, 1, SOAP_TYPE_SOAP_ENC__base64); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENC__base64(struct soap *soap, const struct SOAP_ENC__base64 *a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, (struct soap_array*)&a->__ptr, 1, tag, SOAP_TYPE_SOAP_ENC__base64); + if (soap_out_SOAP_ENC__base64(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENC__base64(struct soap *soap, const char *tag, int id, const struct SOAP_ENC__base64 *a, const char *type) +{ + id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptr, 1, type, SOAP_TYPE_SOAP_ENC__base64); + if (id < 0) + return soap->error; + if (soap_element_begin_out(soap, tag, id, type)) + return soap->error; + if (soap_putbase64(soap, a->__ptr, a->__size)) + return soap->error; + return soap_element_end_out(soap, tag); +} + +SOAP_FMAC3 struct SOAP_ENC__base64 * SOAP_FMAC4 soap_get_SOAP_ENC__base64(struct soap *soap, struct SOAP_ENC__base64 *p, const char *tag, const char *type) +{ + if ((p = soap_in_SOAP_ENC__base64(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct SOAP_ENC__base64 * SOAP_FMAC4 soap_in_SOAP_ENC__base64(struct soap *soap, const char *tag, struct SOAP_ENC__base64 *a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (*soap->type && soap_match_tag(soap, soap->type, type) && soap_match_tag(soap, soap->type, ":base64Binary") && soap_match_tag(soap, soap->type, ":base64")) + { soap->error = SOAP_TYPE; + return NULL; + } + a = (struct SOAP_ENC__base64 *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENC__base64, sizeof(struct SOAP_ENC__base64), 0, NULL, NULL, NULL); + if (!a) + return NULL; + soap_default_SOAP_ENC__base64(soap, a); + if (soap->body && !*soap->href) + { + a->__ptr = soap_getbase64(soap, &a->__size, 0); + if ((!a->__ptr && soap->error) || soap_element_end_in(soap, tag)) + return NULL; + } + else + { a = (struct SOAP_ENC__base64 *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENC__base64, 0, sizeof(struct SOAP_ENC__base64), 0, NULL); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +#ifndef WITH_NOGLOBAL + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_SOAP_ENV__Reason)) + soap_serialize_SOAP_ENV__Reason(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Reason); + if (soap_out_PointerToSOAP_ENV__Reason(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Reason(struct soap *soap, const char *tag, int id, struct SOAP_ENV__Reason *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_SOAP_ENV__Reason); + if (id < 0) + return soap->error; + return soap_out_SOAP_ENV__Reason(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerToSOAP_ENV__Reason(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reason(struct soap *soap, const char *tag, struct SOAP_ENV__Reason **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct SOAP_ENV__Reason **)soap_malloc(soap, sizeof(struct SOAP_ENV__Reason *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_SOAP_ENV__Reason(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct SOAP_ENV__Reason **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Reason, sizeof(struct SOAP_ENV__Reason), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +#endif + +#ifndef WITH_NOGLOBAL + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_SOAP_ENV__Detail)) + soap_serialize_SOAP_ENV__Detail(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Detail); + if (soap_out_PointerToSOAP_ENV__Detail(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Detail(struct soap *soap, const char *tag, int id, struct SOAP_ENV__Detail *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_SOAP_ENV__Detail); + if (id < 0) + return soap->error; + return soap_out_SOAP_ENV__Detail(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerToSOAP_ENV__Detail(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Detail(struct soap *soap, const char *tag, struct SOAP_ENV__Detail **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct SOAP_ENV__Detail **)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_SOAP_ENV__Detail(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct SOAP_ENV__Detail **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Detail, sizeof(struct SOAP_ENV__Detail), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +#endif + +#ifndef WITH_NOGLOBAL + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_SOAP_ENV__Code)) + soap_serialize_SOAP_ENV__Code(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Code); + if (soap_out_PointerToSOAP_ENV__Code(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Code(struct soap *soap, const char *tag, int id, struct SOAP_ENV__Code *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_SOAP_ENV__Code); + if (id < 0) + return soap->error; + return soap_out_SOAP_ENV__Code(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerToSOAP_ENV__Code(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(struct soap *soap, const char *tag, struct SOAP_ENV__Code **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct SOAP_ENV__Code **)soap_malloc(soap, sizeof(struct SOAP_ENV__Code *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_SOAP_ENV__Code(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct SOAP_ENV__Code **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Code, sizeof(struct SOAP_ENV__Code), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +#endif + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTounsignedInt(struct soap *soap, unsigned int *const*a) +{ + soap_reference(soap, *a, SOAP_TYPE_unsignedInt); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTounsignedInt(struct soap *soap, unsigned int *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTounsignedInt); + if (soap_out_PointerTounsignedInt(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTounsignedInt(struct soap *soap, const char *tag, int id, unsigned int *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_unsignedInt); + if (id < 0) + return soap->error; + return soap_out_unsignedInt(soap, tag, id, *a, type); +} + +SOAP_FMAC3 unsigned int ** SOAP_FMAC4 soap_get_PointerTounsignedInt(struct soap *soap, unsigned int **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTounsignedInt(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 unsigned int ** SOAP_FMAC4 soap_in_PointerTounsignedInt(struct soap *soap, const char *tag, unsigned int **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (unsigned int **)soap_malloc(soap, sizeof(unsigned int *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_unsignedInt(soap, tag, *a, type))) + return NULL; + } + else + { a = (unsigned int **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_unsignedInt, sizeof(unsigned int), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__ArgStruct(struct soap *soap, struct cwmp1__ArgStruct **const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_PointerTocwmp1__ArgStruct)) + soap_serialize_PointerTocwmp1__ArgStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__ArgStruct(struct soap *soap, struct cwmp1__ArgStruct **const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToPointerTocwmp1__ArgStruct); + if (soap_out_PointerToPointerTocwmp1__ArgStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__ArgStruct(struct soap *soap, const char *tag, int id, struct cwmp1__ArgStruct **const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_PointerTocwmp1__ArgStruct); + if (id < 0) + return soap->error; + return soap_out_PointerTocwmp1__ArgStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__ArgStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__ArgStruct(struct soap *soap, struct cwmp1__ArgStruct ***p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerToPointerTocwmp1__ArgStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__ArgStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__ArgStruct(struct soap *soap, const char *tag, struct cwmp1__ArgStruct ***a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__ArgStruct ***)soap_malloc(soap, sizeof(struct cwmp1__ArgStruct **)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_PointerTocwmp1__ArgStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__ArgStruct ***)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_PointerTocwmp1__ArgStruct, sizeof(struct cwmp1__ArgStruct *), 1); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__ArgStruct(struct soap *soap, struct cwmp1__ArgStruct *const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_cwmp1__ArgStruct)) + soap_serialize_cwmp1__ArgStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__ArgStruct(struct soap *soap, struct cwmp1__ArgStruct *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1__ArgStruct); + if (soap_out_PointerTocwmp1__ArgStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__ArgStruct(struct soap *soap, const char *tag, int id, struct cwmp1__ArgStruct *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_cwmp1__ArgStruct); + if (id < 0) + return soap->error; + return soap_out_cwmp1__ArgStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__ArgStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__ArgStruct(struct soap *soap, struct cwmp1__ArgStruct **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1__ArgStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__ArgStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__ArgStruct(struct soap *soap, const char *tag, struct cwmp1__ArgStruct **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__ArgStruct **)soap_malloc(soap, sizeof(struct cwmp1__ArgStruct *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1__ArgStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__ArgStruct **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1__ArgStruct, sizeof(struct cwmp1__ArgStruct), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__OptionStruct(struct soap *soap, struct cwmp1__OptionStruct **const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_PointerTocwmp1__OptionStruct)) + soap_serialize_PointerTocwmp1__OptionStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__OptionStruct(struct soap *soap, struct cwmp1__OptionStruct **const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToPointerTocwmp1__OptionStruct); + if (soap_out_PointerToPointerTocwmp1__OptionStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__OptionStruct(struct soap *soap, const char *tag, int id, struct cwmp1__OptionStruct **const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_PointerTocwmp1__OptionStruct); + if (id < 0) + return soap->error; + return soap_out_PointerTocwmp1__OptionStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__OptionStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__OptionStruct(struct soap *soap, struct cwmp1__OptionStruct ***p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerToPointerTocwmp1__OptionStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__OptionStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__OptionStruct(struct soap *soap, const char *tag, struct cwmp1__OptionStruct ***a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__OptionStruct ***)soap_malloc(soap, sizeof(struct cwmp1__OptionStruct **)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_PointerTocwmp1__OptionStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__OptionStruct ***)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_PointerTocwmp1__OptionStruct, sizeof(struct cwmp1__OptionStruct *), 1); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__OptionStruct(struct soap *soap, struct cwmp1__OptionStruct *const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_cwmp1__OptionStruct)) + soap_serialize_cwmp1__OptionStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__OptionStruct(struct soap *soap, struct cwmp1__OptionStruct *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1__OptionStruct); + if (soap_out_PointerTocwmp1__OptionStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__OptionStruct(struct soap *soap, const char *tag, int id, struct cwmp1__OptionStruct *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_cwmp1__OptionStruct); + if (id < 0) + return soap->error; + return soap_out_cwmp1__OptionStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__OptionStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__OptionStruct(struct soap *soap, struct cwmp1__OptionStruct **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1__OptionStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__OptionStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__OptionStruct(struct soap *soap, const char *tag, struct cwmp1__OptionStruct **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__OptionStruct **)soap_malloc(soap, sizeof(struct cwmp1__OptionStruct *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1__OptionStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__OptionStruct **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1__OptionStruct, sizeof(struct cwmp1__OptionStruct), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerToSOAP_ENC__base64(struct soap *soap, struct SOAP_ENC__base64 **const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_PointerToSOAP_ENC__base64)) + soap_serialize_PointerToSOAP_ENC__base64(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerToSOAP_ENC__base64(struct soap *soap, struct SOAP_ENC__base64 **const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToPointerToSOAP_ENC__base64); + if (soap_out_PointerToPointerToSOAP_ENC__base64(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerToSOAP_ENC__base64(struct soap *soap, const char *tag, int id, struct SOAP_ENC__base64 **const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_PointerToSOAP_ENC__base64); + if (id < 0) + return soap->error; + return soap_out_PointerToSOAP_ENC__base64(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct SOAP_ENC__base64 *** SOAP_FMAC4 soap_get_PointerToPointerToSOAP_ENC__base64(struct soap *soap, struct SOAP_ENC__base64 ***p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerToPointerToSOAP_ENC__base64(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct SOAP_ENC__base64 *** SOAP_FMAC4 soap_in_PointerToPointerToSOAP_ENC__base64(struct soap *soap, const char *tag, struct SOAP_ENC__base64 ***a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct SOAP_ENC__base64 ***)soap_malloc(soap, sizeof(struct SOAP_ENC__base64 **)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_PointerToSOAP_ENC__base64(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct SOAP_ENC__base64 ***)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_PointerToSOAP_ENC__base64, sizeof(struct SOAP_ENC__base64 *), 1); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENC__base64(struct soap *soap, struct SOAP_ENC__base64 *const*a) +{ + if (*a) + soap_serialize_SOAP_ENC__base64(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENC__base64(struct soap *soap, struct SOAP_ENC__base64 *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToSOAP_ENC__base64); + if (soap_out_PointerToSOAP_ENC__base64(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENC__base64(struct soap *soap, const char *tag, int id, struct SOAP_ENC__base64 *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, (struct soap_array*)&(*a)->__ptr, 1, type, SOAP_TYPE_SOAP_ENC__base64); + if (id < 0) + return soap->error; + return soap_out_SOAP_ENC__base64(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct SOAP_ENC__base64 ** SOAP_FMAC4 soap_get_PointerToSOAP_ENC__base64(struct soap *soap, struct SOAP_ENC__base64 **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerToSOAP_ENC__base64(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct SOAP_ENC__base64 ** SOAP_FMAC4 soap_in_PointerToSOAP_ENC__base64(struct soap *soap, const char *tag, struct SOAP_ENC__base64 **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct SOAP_ENC__base64 **)soap_malloc(soap, sizeof(struct SOAP_ENC__base64 *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_SOAP_ENC__base64(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct SOAP_ENC__base64 **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENC__base64, sizeof(struct SOAP_ENC__base64), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__AllQueuedTransferStruct(struct soap *soap, struct cwmp1__AllQueuedTransferStruct **const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_PointerTocwmp1__AllQueuedTransferStruct)) + soap_serialize_PointerTocwmp1__AllQueuedTransferStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__AllQueuedTransferStruct(struct soap *soap, struct cwmp1__AllQueuedTransferStruct **const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToPointerTocwmp1__AllQueuedTransferStruct); + if (soap_out_PointerToPointerTocwmp1__AllQueuedTransferStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__AllQueuedTransferStruct(struct soap *soap, const char *tag, int id, struct cwmp1__AllQueuedTransferStruct **const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_PointerTocwmp1__AllQueuedTransferStruct); + if (id < 0) + return soap->error; + return soap_out_PointerTocwmp1__AllQueuedTransferStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__AllQueuedTransferStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__AllQueuedTransferStruct(struct soap *soap, struct cwmp1__AllQueuedTransferStruct ***p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerToPointerTocwmp1__AllQueuedTransferStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__AllQueuedTransferStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__AllQueuedTransferStruct(struct soap *soap, const char *tag, struct cwmp1__AllQueuedTransferStruct ***a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__AllQueuedTransferStruct ***)soap_malloc(soap, sizeof(struct cwmp1__AllQueuedTransferStruct **)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_PointerTocwmp1__AllQueuedTransferStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__AllQueuedTransferStruct ***)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_PointerTocwmp1__AllQueuedTransferStruct, sizeof(struct cwmp1__AllQueuedTransferStruct *), 1); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__AllQueuedTransferStruct(struct soap *soap, struct cwmp1__AllQueuedTransferStruct *const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_cwmp1__AllQueuedTransferStruct)) + soap_serialize_cwmp1__AllQueuedTransferStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__AllQueuedTransferStruct(struct soap *soap, struct cwmp1__AllQueuedTransferStruct *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1__AllQueuedTransferStruct); + if (soap_out_PointerTocwmp1__AllQueuedTransferStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__AllQueuedTransferStruct(struct soap *soap, const char *tag, int id, struct cwmp1__AllQueuedTransferStruct *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_cwmp1__AllQueuedTransferStruct); + if (id < 0) + return soap->error; + return soap_out_cwmp1__AllQueuedTransferStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__AllQueuedTransferStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__AllQueuedTransferStruct(struct soap *soap, struct cwmp1__AllQueuedTransferStruct **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1__AllQueuedTransferStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__AllQueuedTransferStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__AllQueuedTransferStruct(struct soap *soap, const char *tag, struct cwmp1__AllQueuedTransferStruct **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__AllQueuedTransferStruct **)soap_malloc(soap, sizeof(struct cwmp1__AllQueuedTransferStruct *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1__AllQueuedTransferStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__AllQueuedTransferStruct **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1__AllQueuedTransferStruct, sizeof(struct cwmp1__AllQueuedTransferStruct), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__QueuedTransferStruct(struct soap *soap, struct cwmp1__QueuedTransferStruct **const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_PointerTocwmp1__QueuedTransferStruct)) + soap_serialize_PointerTocwmp1__QueuedTransferStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__QueuedTransferStruct(struct soap *soap, struct cwmp1__QueuedTransferStruct **const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToPointerTocwmp1__QueuedTransferStruct); + if (soap_out_PointerToPointerTocwmp1__QueuedTransferStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__QueuedTransferStruct(struct soap *soap, const char *tag, int id, struct cwmp1__QueuedTransferStruct **const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_PointerTocwmp1__QueuedTransferStruct); + if (id < 0) + return soap->error; + return soap_out_PointerTocwmp1__QueuedTransferStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__QueuedTransferStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__QueuedTransferStruct(struct soap *soap, struct cwmp1__QueuedTransferStruct ***p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerToPointerTocwmp1__QueuedTransferStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__QueuedTransferStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__QueuedTransferStruct(struct soap *soap, const char *tag, struct cwmp1__QueuedTransferStruct ***a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__QueuedTransferStruct ***)soap_malloc(soap, sizeof(struct cwmp1__QueuedTransferStruct **)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_PointerTocwmp1__QueuedTransferStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__QueuedTransferStruct ***)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_PointerTocwmp1__QueuedTransferStruct, sizeof(struct cwmp1__QueuedTransferStruct *), 1); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__QueuedTransferStruct(struct soap *soap, struct cwmp1__QueuedTransferStruct *const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_cwmp1__QueuedTransferStruct)) + soap_serialize_cwmp1__QueuedTransferStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__QueuedTransferStruct(struct soap *soap, struct cwmp1__QueuedTransferStruct *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1__QueuedTransferStruct); + if (soap_out_PointerTocwmp1__QueuedTransferStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__QueuedTransferStruct(struct soap *soap, const char *tag, int id, struct cwmp1__QueuedTransferStruct *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_cwmp1__QueuedTransferStruct); + if (id < 0) + return soap->error; + return soap_out_cwmp1__QueuedTransferStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__QueuedTransferStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__QueuedTransferStruct(struct soap *soap, struct cwmp1__QueuedTransferStruct **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1__QueuedTransferStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__QueuedTransferStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__QueuedTransferStruct(struct soap *soap, const char *tag, struct cwmp1__QueuedTransferStruct **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__QueuedTransferStruct **)soap_malloc(soap, sizeof(struct cwmp1__QueuedTransferStruct *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1__QueuedTransferStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__QueuedTransferStruct **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1__QueuedTransferStruct, sizeof(struct cwmp1__QueuedTransferStruct), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__ParameterAttributeStruct(struct soap *soap, struct cwmp1__ParameterAttributeStruct **const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_PointerTocwmp1__ParameterAttributeStruct)) + soap_serialize_PointerTocwmp1__ParameterAttributeStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__ParameterAttributeStruct(struct soap *soap, struct cwmp1__ParameterAttributeStruct **const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToPointerTocwmp1__ParameterAttributeStruct); + if (soap_out_PointerToPointerTocwmp1__ParameterAttributeStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__ParameterAttributeStruct(struct soap *soap, const char *tag, int id, struct cwmp1__ParameterAttributeStruct **const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_PointerTocwmp1__ParameterAttributeStruct); + if (id < 0) + return soap->error; + return soap_out_PointerTocwmp1__ParameterAttributeStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__ParameterAttributeStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__ParameterAttributeStruct(struct soap *soap, struct cwmp1__ParameterAttributeStruct ***p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerToPointerTocwmp1__ParameterAttributeStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__ParameterAttributeStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__ParameterAttributeStruct(struct soap *soap, const char *tag, struct cwmp1__ParameterAttributeStruct ***a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__ParameterAttributeStruct ***)soap_malloc(soap, sizeof(struct cwmp1__ParameterAttributeStruct **)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_PointerTocwmp1__ParameterAttributeStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__ParameterAttributeStruct ***)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_PointerTocwmp1__ParameterAttributeStruct, sizeof(struct cwmp1__ParameterAttributeStruct *), 1); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__ParameterAttributeStruct(struct soap *soap, struct cwmp1__ParameterAttributeStruct *const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_cwmp1__ParameterAttributeStruct)) + soap_serialize_cwmp1__ParameterAttributeStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__ParameterAttributeStruct(struct soap *soap, struct cwmp1__ParameterAttributeStruct *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1__ParameterAttributeStruct); + if (soap_out_PointerTocwmp1__ParameterAttributeStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__ParameterAttributeStruct(struct soap *soap, const char *tag, int id, struct cwmp1__ParameterAttributeStruct *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_cwmp1__ParameterAttributeStruct); + if (id < 0) + return soap->error; + return soap_out_cwmp1__ParameterAttributeStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__ParameterAttributeStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__ParameterAttributeStruct(struct soap *soap, struct cwmp1__ParameterAttributeStruct **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1__ParameterAttributeStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__ParameterAttributeStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__ParameterAttributeStruct(struct soap *soap, const char *tag, struct cwmp1__ParameterAttributeStruct **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__ParameterAttributeStruct **)soap_malloc(soap, sizeof(struct cwmp1__ParameterAttributeStruct *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1__ParameterAttributeStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__ParameterAttributeStruct **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1__ParameterAttributeStruct, sizeof(struct cwmp1__ParameterAttributeStruct), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__SetParameterAttributesStruct(struct soap *soap, struct cwmp1__SetParameterAttributesStruct **const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_PointerTocwmp1__SetParameterAttributesStruct)) + soap_serialize_PointerTocwmp1__SetParameterAttributesStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__SetParameterAttributesStruct(struct soap *soap, struct cwmp1__SetParameterAttributesStruct **const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToPointerTocwmp1__SetParameterAttributesStruct); + if (soap_out_PointerToPointerTocwmp1__SetParameterAttributesStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__SetParameterAttributesStruct(struct soap *soap, const char *tag, int id, struct cwmp1__SetParameterAttributesStruct **const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_PointerTocwmp1__SetParameterAttributesStruct); + if (id < 0) + return soap->error; + return soap_out_PointerTocwmp1__SetParameterAttributesStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__SetParameterAttributesStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__SetParameterAttributesStruct(struct soap *soap, struct cwmp1__SetParameterAttributesStruct ***p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerToPointerTocwmp1__SetParameterAttributesStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__SetParameterAttributesStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__SetParameterAttributesStruct(struct soap *soap, const char *tag, struct cwmp1__SetParameterAttributesStruct ***a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__SetParameterAttributesStruct ***)soap_malloc(soap, sizeof(struct cwmp1__SetParameterAttributesStruct **)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_PointerTocwmp1__SetParameterAttributesStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__SetParameterAttributesStruct ***)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_PointerTocwmp1__SetParameterAttributesStruct, sizeof(struct cwmp1__SetParameterAttributesStruct *), 1); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__SetParameterAttributesStruct(struct soap *soap, struct cwmp1__SetParameterAttributesStruct *const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_cwmp1__SetParameterAttributesStruct)) + soap_serialize_cwmp1__SetParameterAttributesStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__SetParameterAttributesStruct(struct soap *soap, struct cwmp1__SetParameterAttributesStruct *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1__SetParameterAttributesStruct); + if (soap_out_PointerTocwmp1__SetParameterAttributesStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__SetParameterAttributesStruct(struct soap *soap, const char *tag, int id, struct cwmp1__SetParameterAttributesStruct *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_cwmp1__SetParameterAttributesStruct); + if (id < 0) + return soap->error; + return soap_out_cwmp1__SetParameterAttributesStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__SetParameterAttributesStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__SetParameterAttributesStruct(struct soap *soap, struct cwmp1__SetParameterAttributesStruct **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1__SetParameterAttributesStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__SetParameterAttributesStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__SetParameterAttributesStruct(struct soap *soap, const char *tag, struct cwmp1__SetParameterAttributesStruct **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__SetParameterAttributesStruct **)soap_malloc(soap, sizeof(struct cwmp1__SetParameterAttributesStruct *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1__SetParameterAttributesStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__SetParameterAttributesStruct **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1__SetParameterAttributesStruct, sizeof(struct cwmp1__SetParameterAttributesStruct), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__ParameterInfoStruct(struct soap *soap, struct cwmp1__ParameterInfoStruct **const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_PointerTocwmp1__ParameterInfoStruct)) + soap_serialize_PointerTocwmp1__ParameterInfoStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__ParameterInfoStruct(struct soap *soap, struct cwmp1__ParameterInfoStruct **const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToPointerTocwmp1__ParameterInfoStruct); + if (soap_out_PointerToPointerTocwmp1__ParameterInfoStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__ParameterInfoStruct(struct soap *soap, const char *tag, int id, struct cwmp1__ParameterInfoStruct **const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_PointerTocwmp1__ParameterInfoStruct); + if (id < 0) + return soap->error; + return soap_out_PointerTocwmp1__ParameterInfoStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__ParameterInfoStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__ParameterInfoStruct(struct soap *soap, struct cwmp1__ParameterInfoStruct ***p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerToPointerTocwmp1__ParameterInfoStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__ParameterInfoStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__ParameterInfoStruct(struct soap *soap, const char *tag, struct cwmp1__ParameterInfoStruct ***a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__ParameterInfoStruct ***)soap_malloc(soap, sizeof(struct cwmp1__ParameterInfoStruct **)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_PointerTocwmp1__ParameterInfoStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__ParameterInfoStruct ***)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_PointerTocwmp1__ParameterInfoStruct, sizeof(struct cwmp1__ParameterInfoStruct *), 1); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__ParameterInfoStruct(struct soap *soap, struct cwmp1__ParameterInfoStruct *const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_cwmp1__ParameterInfoStruct)) + soap_serialize_cwmp1__ParameterInfoStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__ParameterInfoStruct(struct soap *soap, struct cwmp1__ParameterInfoStruct *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1__ParameterInfoStruct); + if (soap_out_PointerTocwmp1__ParameterInfoStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__ParameterInfoStruct(struct soap *soap, const char *tag, int id, struct cwmp1__ParameterInfoStruct *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_cwmp1__ParameterInfoStruct); + if (id < 0) + return soap->error; + return soap_out_cwmp1__ParameterInfoStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__ParameterInfoStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__ParameterInfoStruct(struct soap *soap, struct cwmp1__ParameterInfoStruct **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1__ParameterInfoStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__ParameterInfoStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__ParameterInfoStruct(struct soap *soap, const char *tag, struct cwmp1__ParameterInfoStruct **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__ParameterInfoStruct **)soap_malloc(soap, sizeof(struct cwmp1__ParameterInfoStruct *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1__ParameterInfoStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__ParameterInfoStruct **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1__ParameterInfoStruct, sizeof(struct cwmp1__ParameterInfoStruct), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__ParameterValueStruct(struct soap *soap, struct cwmp1__ParameterValueStruct **const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_PointerTocwmp1__ParameterValueStruct)) + soap_serialize_PointerTocwmp1__ParameterValueStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__ParameterValueStruct(struct soap *soap, struct cwmp1__ParameterValueStruct **const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToPointerTocwmp1__ParameterValueStruct); + if (soap_out_PointerToPointerTocwmp1__ParameterValueStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__ParameterValueStruct(struct soap *soap, const char *tag, int id, struct cwmp1__ParameterValueStruct **const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_PointerTocwmp1__ParameterValueStruct); + if (id < 0) + return soap->error; + return soap_out_PointerTocwmp1__ParameterValueStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__ParameterValueStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__ParameterValueStruct(struct soap *soap, struct cwmp1__ParameterValueStruct ***p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerToPointerTocwmp1__ParameterValueStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__ParameterValueStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__ParameterValueStruct(struct soap *soap, const char *tag, struct cwmp1__ParameterValueStruct ***a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__ParameterValueStruct ***)soap_malloc(soap, sizeof(struct cwmp1__ParameterValueStruct **)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_PointerTocwmp1__ParameterValueStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__ParameterValueStruct ***)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_PointerTocwmp1__ParameterValueStruct, sizeof(struct cwmp1__ParameterValueStruct *), 1); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__ParameterValueStruct(struct soap *soap, struct cwmp1__ParameterValueStruct *const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_cwmp1__ParameterValueStruct)) + soap_serialize_cwmp1__ParameterValueStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__ParameterValueStruct(struct soap *soap, struct cwmp1__ParameterValueStruct *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1__ParameterValueStruct); + if (soap_out_PointerTocwmp1__ParameterValueStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__ParameterValueStruct(struct soap *soap, const char *tag, int id, struct cwmp1__ParameterValueStruct *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_cwmp1__ParameterValueStruct); + if (id < 0) + return soap->error; + return soap_out_cwmp1__ParameterValueStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__ParameterValueStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__ParameterValueStruct(struct soap *soap, struct cwmp1__ParameterValueStruct **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1__ParameterValueStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__ParameterValueStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__ParameterValueStruct(struct soap *soap, const char *tag, struct cwmp1__ParameterValueStruct **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__ParameterValueStruct **)soap_malloc(soap, sizeof(struct cwmp1__ParameterValueStruct *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1__ParameterValueStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__ParameterValueStruct **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1__ParameterValueStruct, sizeof(struct cwmp1__ParameterValueStruct), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToPointerTocwmp1__EventStruct(struct soap *soap, struct cwmp1__EventStruct **const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_PointerTocwmp1__EventStruct)) + soap_serialize_PointerTocwmp1__EventStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToPointerTocwmp1__EventStruct(struct soap *soap, struct cwmp1__EventStruct **const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToPointerTocwmp1__EventStruct); + if (soap_out_PointerToPointerTocwmp1__EventStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToPointerTocwmp1__EventStruct(struct soap *soap, const char *tag, int id, struct cwmp1__EventStruct **const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_PointerTocwmp1__EventStruct); + if (id < 0) + return soap->error; + return soap_out_PointerTocwmp1__EventStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__EventStruct *** SOAP_FMAC4 soap_get_PointerToPointerTocwmp1__EventStruct(struct soap *soap, struct cwmp1__EventStruct ***p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerToPointerTocwmp1__EventStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__EventStruct *** SOAP_FMAC4 soap_in_PointerToPointerTocwmp1__EventStruct(struct soap *soap, const char *tag, struct cwmp1__EventStruct ***a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__EventStruct ***)soap_malloc(soap, sizeof(struct cwmp1__EventStruct **)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_PointerTocwmp1__EventStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__EventStruct ***)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_PointerTocwmp1__EventStruct, sizeof(struct cwmp1__EventStruct *), 1); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__EventStruct(struct soap *soap, struct cwmp1__EventStruct *const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_cwmp1__EventStruct)) + soap_serialize_cwmp1__EventStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__EventStruct(struct soap *soap, struct cwmp1__EventStruct *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1__EventStruct); + if (soap_out_PointerTocwmp1__EventStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__EventStruct(struct soap *soap, const char *tag, int id, struct cwmp1__EventStruct *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_cwmp1__EventStruct); + if (id < 0) + return soap->error; + return soap_out_cwmp1__EventStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__EventStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__EventStruct(struct soap *soap, struct cwmp1__EventStruct **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1__EventStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__EventStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__EventStruct(struct soap *soap, const char *tag, struct cwmp1__EventStruct **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__EventStruct **)soap_malloc(soap, sizeof(struct cwmp1__EventStruct *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1__EventStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__EventStruct **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1__EventStruct, sizeof(struct cwmp1__EventStruct), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1FileTypeArg(struct soap *soap, struct cwmp1FileTypeArg *const*a) +{ + if (*a) + soap_serialize_cwmp1FileTypeArg(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1FileTypeArg(struct soap *soap, struct cwmp1FileTypeArg *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1FileTypeArg); + if (soap_out_PointerTocwmp1FileTypeArg(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1FileTypeArg(struct soap *soap, const char *tag, int id, struct cwmp1FileTypeArg *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, (struct soap_array*)&(*a)->__ptrArgStruct, 1, type, SOAP_TYPE_cwmp1FileTypeArg); + if (id < 0) + return soap->error; + return soap_out_cwmp1FileTypeArg(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1FileTypeArg ** SOAP_FMAC4 soap_get_PointerTocwmp1FileTypeArg(struct soap *soap, struct cwmp1FileTypeArg **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1FileTypeArg(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1FileTypeArg ** SOAP_FMAC4 soap_in_PointerTocwmp1FileTypeArg(struct soap *soap, const char *tag, struct cwmp1FileTypeArg **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1FileTypeArg **)soap_malloc(soap, sizeof(struct cwmp1FileTypeArg *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1FileTypeArg(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1FileTypeArg **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1FileTypeArg, sizeof(struct cwmp1FileTypeArg), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__FaultStruct(struct soap *soap, struct cwmp1__FaultStruct *const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_cwmp1__FaultStruct)) + soap_serialize_cwmp1__FaultStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__FaultStruct(struct soap *soap, struct cwmp1__FaultStruct *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1__FaultStruct); + if (soap_out_PointerTocwmp1__FaultStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__FaultStruct(struct soap *soap, const char *tag, int id, struct cwmp1__FaultStruct *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_cwmp1__FaultStruct); + if (id < 0) + return soap->error; + return soap_out_cwmp1__FaultStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__FaultStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__FaultStruct(struct soap *soap, struct cwmp1__FaultStruct **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1__FaultStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__FaultStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__FaultStruct(struct soap *soap, const char *tag, struct cwmp1__FaultStruct **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__FaultStruct **)soap_malloc(soap, sizeof(struct cwmp1__FaultStruct *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1__FaultStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__FaultStruct **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1__FaultStruct, sizeof(struct cwmp1__FaultStruct), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1EventList(struct soap *soap, struct cwmp1EventList *const*a) +{ + if (*a) + soap_serialize_cwmp1EventList(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1EventList(struct soap *soap, struct cwmp1EventList *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1EventList); + if (soap_out_PointerTocwmp1EventList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1EventList(struct soap *soap, const char *tag, int id, struct cwmp1EventList *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, (struct soap_array*)&(*a)->__ptrEventStruct, 1, type, SOAP_TYPE_cwmp1EventList); + if (id < 0) + return soap->error; + return soap_out_cwmp1EventList(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1EventList ** SOAP_FMAC4 soap_get_PointerTocwmp1EventList(struct soap *soap, struct cwmp1EventList **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1EventList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1EventList ** SOAP_FMAC4 soap_in_PointerTocwmp1EventList(struct soap *soap, const char *tag, struct cwmp1EventList **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1EventList **)soap_malloc(soap, sizeof(struct cwmp1EventList *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1EventList(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1EventList **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1EventList, sizeof(struct cwmp1EventList), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1__DeviceIdStruct(struct soap *soap, struct cwmp1__DeviceIdStruct *const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_cwmp1__DeviceIdStruct)) + soap_serialize_cwmp1__DeviceIdStruct(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1__DeviceIdStruct(struct soap *soap, struct cwmp1__DeviceIdStruct *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1__DeviceIdStruct); + if (soap_out_PointerTocwmp1__DeviceIdStruct(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1__DeviceIdStruct(struct soap *soap, const char *tag, int id, struct cwmp1__DeviceIdStruct *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_cwmp1__DeviceIdStruct); + if (id < 0) + return soap->error; + return soap_out_cwmp1__DeviceIdStruct(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1__DeviceIdStruct ** SOAP_FMAC4 soap_get_PointerTocwmp1__DeviceIdStruct(struct soap *soap, struct cwmp1__DeviceIdStruct **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1__DeviceIdStruct(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1__DeviceIdStruct ** SOAP_FMAC4 soap_in_PointerTocwmp1__DeviceIdStruct(struct soap *soap, const char *tag, struct cwmp1__DeviceIdStruct **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1__DeviceIdStruct **)soap_malloc(soap, sizeof(struct cwmp1__DeviceIdStruct *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1__DeviceIdStruct(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1__DeviceIdStruct **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1__DeviceIdStruct, sizeof(struct cwmp1__DeviceIdStruct), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1AllTransferList(struct soap *soap, struct cwmp1AllTransferList *const*a) +{ + if (*a) + soap_serialize_cwmp1AllTransferList(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1AllTransferList(struct soap *soap, struct cwmp1AllTransferList *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1AllTransferList); + if (soap_out_PointerTocwmp1AllTransferList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1AllTransferList(struct soap *soap, const char *tag, int id, struct cwmp1AllTransferList *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, (struct soap_array*)&(*a)->__ptrAllQueuedTransferStruct, 1, type, SOAP_TYPE_cwmp1AllTransferList); + if (id < 0) + return soap->error; + return soap_out_cwmp1AllTransferList(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1AllTransferList ** SOAP_FMAC4 soap_get_PointerTocwmp1AllTransferList(struct soap *soap, struct cwmp1AllTransferList **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1AllTransferList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1AllTransferList ** SOAP_FMAC4 soap_in_PointerTocwmp1AllTransferList(struct soap *soap, const char *tag, struct cwmp1AllTransferList **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1AllTransferList **)soap_malloc(soap, sizeof(struct cwmp1AllTransferList *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1AllTransferList(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1AllTransferList **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1AllTransferList, sizeof(struct cwmp1AllTransferList), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1OptionList(struct soap *soap, struct cwmp1OptionList *const*a) +{ + if (*a) + soap_serialize_cwmp1OptionList(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1OptionList(struct soap *soap, struct cwmp1OptionList *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1OptionList); + if (soap_out_PointerTocwmp1OptionList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1OptionList(struct soap *soap, const char *tag, int id, struct cwmp1OptionList *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, (struct soap_array*)&(*a)->__ptrOptionStruct, 1, type, SOAP_TYPE_cwmp1OptionList); + if (id < 0) + return soap->error; + return soap_out_cwmp1OptionList(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1OptionList ** SOAP_FMAC4 soap_get_PointerTocwmp1OptionList(struct soap *soap, struct cwmp1OptionList **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1OptionList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1OptionList ** SOAP_FMAC4 soap_in_PointerTocwmp1OptionList(struct soap *soap, const char *tag, struct cwmp1OptionList **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1OptionList **)soap_malloc(soap, sizeof(struct cwmp1OptionList *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1OptionList(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1OptionList **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1OptionList, sizeof(struct cwmp1OptionList), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1VoucherList(struct soap *soap, struct cwmp1VoucherList *const*a) +{ + if (*a) + soap_serialize_cwmp1VoucherList(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1VoucherList(struct soap *soap, struct cwmp1VoucherList *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1VoucherList); + if (soap_out_PointerTocwmp1VoucherList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1VoucherList(struct soap *soap, const char *tag, int id, struct cwmp1VoucherList *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, (struct soap_array*)&(*a)->__ptrbase64, 1, type, SOAP_TYPE_cwmp1VoucherList); + if (id < 0) + return soap->error; + return soap_out_cwmp1VoucherList(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1VoucherList ** SOAP_FMAC4 soap_get_PointerTocwmp1VoucherList(struct soap *soap, struct cwmp1VoucherList **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1VoucherList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1VoucherList ** SOAP_FMAC4 soap_in_PointerTocwmp1VoucherList(struct soap *soap, const char *tag, struct cwmp1VoucherList **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1VoucherList **)soap_malloc(soap, sizeof(struct cwmp1VoucherList *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1VoucherList(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1VoucherList **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1VoucherList, sizeof(struct cwmp1VoucherList), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1TransferList(struct soap *soap, struct cwmp1TransferList *const*a) +{ + if (*a) + soap_serialize_cwmp1TransferList(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1TransferList(struct soap *soap, struct cwmp1TransferList *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1TransferList); + if (soap_out_PointerTocwmp1TransferList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1TransferList(struct soap *soap, const char *tag, int id, struct cwmp1TransferList *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, (struct soap_array*)&(*a)->__ptrQueuedTransferStruct, 1, type, SOAP_TYPE_cwmp1TransferList); + if (id < 0) + return soap->error; + return soap_out_cwmp1TransferList(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1TransferList ** SOAP_FMAC4 soap_get_PointerTocwmp1TransferList(struct soap *soap, struct cwmp1TransferList **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1TransferList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1TransferList ** SOAP_FMAC4 soap_in_PointerTocwmp1TransferList(struct soap *soap, const char *tag, struct cwmp1TransferList **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1TransferList **)soap_malloc(soap, sizeof(struct cwmp1TransferList *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1TransferList(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1TransferList **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1TransferList, sizeof(struct cwmp1TransferList), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1ParameterAttributeList(struct soap *soap, struct cwmp1ParameterAttributeList *const*a) +{ + if (*a) + soap_serialize_cwmp1ParameterAttributeList(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1ParameterAttributeList(struct soap *soap, struct cwmp1ParameterAttributeList *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1ParameterAttributeList); + if (soap_out_PointerTocwmp1ParameterAttributeList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1ParameterAttributeList(struct soap *soap, const char *tag, int id, struct cwmp1ParameterAttributeList *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, (struct soap_array*)&(*a)->__ptrParameterAttributeStruct, 1, type, SOAP_TYPE_cwmp1ParameterAttributeList); + if (id < 0) + return soap->error; + return soap_out_cwmp1ParameterAttributeList(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1ParameterAttributeList ** SOAP_FMAC4 soap_get_PointerTocwmp1ParameterAttributeList(struct soap *soap, struct cwmp1ParameterAttributeList **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1ParameterAttributeList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1ParameterAttributeList ** SOAP_FMAC4 soap_in_PointerTocwmp1ParameterAttributeList(struct soap *soap, const char *tag, struct cwmp1ParameterAttributeList **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1ParameterAttributeList **)soap_malloc(soap, sizeof(struct cwmp1ParameterAttributeList *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1ParameterAttributeList(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1ParameterAttributeList **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1ParameterAttributeList, sizeof(struct cwmp1ParameterAttributeList), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1SetParameterAttributesList(struct soap *soap, struct cwmp1SetParameterAttributesList *const*a) +{ + if (*a) + soap_serialize_cwmp1SetParameterAttributesList(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1SetParameterAttributesList(struct soap *soap, struct cwmp1SetParameterAttributesList *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1SetParameterAttributesList); + if (soap_out_PointerTocwmp1SetParameterAttributesList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1SetParameterAttributesList(struct soap *soap, const char *tag, int id, struct cwmp1SetParameterAttributesList *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, (struct soap_array*)&(*a)->__ptrSetParameterAttributesStruct, 1, type, SOAP_TYPE_cwmp1SetParameterAttributesList); + if (id < 0) + return soap->error; + return soap_out_cwmp1SetParameterAttributesList(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1SetParameterAttributesList ** SOAP_FMAC4 soap_get_PointerTocwmp1SetParameterAttributesList(struct soap *soap, struct cwmp1SetParameterAttributesList **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1SetParameterAttributesList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1SetParameterAttributesList ** SOAP_FMAC4 soap_in_PointerTocwmp1SetParameterAttributesList(struct soap *soap, const char *tag, struct cwmp1SetParameterAttributesList **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1SetParameterAttributesList **)soap_malloc(soap, sizeof(struct cwmp1SetParameterAttributesList *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1SetParameterAttributesList(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1SetParameterAttributesList **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1SetParameterAttributesList, sizeof(struct cwmp1SetParameterAttributesList), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1ParameterInfoList(struct soap *soap, struct cwmp1ParameterInfoList *const*a) +{ + if (*a) + soap_serialize_cwmp1ParameterInfoList(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1ParameterInfoList(struct soap *soap, struct cwmp1ParameterInfoList *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1ParameterInfoList); + if (soap_out_PointerTocwmp1ParameterInfoList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1ParameterInfoList(struct soap *soap, const char *tag, int id, struct cwmp1ParameterInfoList *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, (struct soap_array*)&(*a)->__ptrParameterInfoStruct, 1, type, SOAP_TYPE_cwmp1ParameterInfoList); + if (id < 0) + return soap->error; + return soap_out_cwmp1ParameterInfoList(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1ParameterInfoList ** SOAP_FMAC4 soap_get_PointerTocwmp1ParameterInfoList(struct soap *soap, struct cwmp1ParameterInfoList **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1ParameterInfoList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1ParameterInfoList ** SOAP_FMAC4 soap_in_PointerTocwmp1ParameterInfoList(struct soap *soap, const char *tag, struct cwmp1ParameterInfoList **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1ParameterInfoList **)soap_malloc(soap, sizeof(struct cwmp1ParameterInfoList *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1ParameterInfoList(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1ParameterInfoList **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1ParameterInfoList, sizeof(struct cwmp1ParameterInfoList), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1ParameterNames(struct soap *soap, struct cwmp1ParameterNames *const*a) +{ + if (*a) + soap_serialize_cwmp1ParameterNames(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1ParameterNames(struct soap *soap, struct cwmp1ParameterNames *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1ParameterNames); + if (soap_out_PointerTocwmp1ParameterNames(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1ParameterNames(struct soap *soap, const char *tag, int id, struct cwmp1ParameterNames *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, (struct soap_array*)&(*a)->__ptrstring, 1, type, SOAP_TYPE_cwmp1ParameterNames); + if (id < 0) + return soap->error; + return soap_out_cwmp1ParameterNames(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1ParameterNames ** SOAP_FMAC4 soap_get_PointerTocwmp1ParameterNames(struct soap *soap, struct cwmp1ParameterNames **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1ParameterNames(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1ParameterNames ** SOAP_FMAC4 soap_in_PointerTocwmp1ParameterNames(struct soap *soap, const char *tag, struct cwmp1ParameterNames **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1ParameterNames **)soap_malloc(soap, sizeof(struct cwmp1ParameterNames *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1ParameterNames(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1ParameterNames **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1ParameterNames, sizeof(struct cwmp1ParameterNames), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1ParameterValueList(struct soap *soap, struct cwmp1ParameterValueList *const*a) +{ + if (*a) + soap_serialize_cwmp1ParameterValueList(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1ParameterValueList(struct soap *soap, struct cwmp1ParameterValueList *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1ParameterValueList); + if (soap_out_PointerTocwmp1ParameterValueList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1ParameterValueList(struct soap *soap, const char *tag, int id, struct cwmp1ParameterValueList *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, (struct soap_array*)&(*a)->__ptrParameterValueStruct, 1, type, SOAP_TYPE_cwmp1ParameterValueList); + if (id < 0) + return soap->error; + return soap_out_cwmp1ParameterValueList(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1ParameterValueList ** SOAP_FMAC4 soap_get_PointerTocwmp1ParameterValueList(struct soap *soap, struct cwmp1ParameterValueList **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1ParameterValueList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1ParameterValueList ** SOAP_FMAC4 soap_in_PointerTocwmp1ParameterValueList(struct soap *soap, const char *tag, struct cwmp1ParameterValueList **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1ParameterValueList **)soap_malloc(soap, sizeof(struct cwmp1ParameterValueList *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1ParameterValueList(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1ParameterValueList **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1ParameterValueList, sizeof(struct cwmp1ParameterValueList), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1MethodList(struct soap *soap, struct cwmp1MethodList *const*a) +{ + if (*a) + soap_serialize_cwmp1MethodList(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1MethodList(struct soap *soap, struct cwmp1MethodList *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1MethodList); + if (soap_out_PointerTocwmp1MethodList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1MethodList(struct soap *soap, const char *tag, int id, struct cwmp1MethodList *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, (struct soap_array*)&(*a)->__ptrstring, 1, type, SOAP_TYPE_cwmp1MethodList); + if (id < 0) + return soap->error; + return soap_out_cwmp1MethodList(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1MethodList ** SOAP_FMAC4 soap_get_PointerTocwmp1MethodList(struct soap *soap, struct cwmp1MethodList **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1MethodList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1MethodList ** SOAP_FMAC4 soap_in_PointerTocwmp1MethodList(struct soap *soap, const char *tag, struct cwmp1MethodList **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1MethodList **)soap_malloc(soap, sizeof(struct cwmp1MethodList *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1MethodList(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1MethodList **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1MethodList, sizeof(struct cwmp1MethodList), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTo_cwmp1__Fault_SetParameterValuesFault(struct soap *soap, struct _cwmp1__Fault_SetParameterValuesFault *const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE__cwmp1__Fault_SetParameterValuesFault)) + soap_serialize__cwmp1__Fault_SetParameterValuesFault(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTo_cwmp1__Fault_SetParameterValuesFault(struct soap *soap, struct _cwmp1__Fault_SetParameterValuesFault *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTo_cwmp1__Fault_SetParameterValuesFault); + if (soap_out_PointerTo_cwmp1__Fault_SetParameterValuesFault(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTo_cwmp1__Fault_SetParameterValuesFault(struct soap *soap, const char *tag, int id, struct _cwmp1__Fault_SetParameterValuesFault *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE__cwmp1__Fault_SetParameterValuesFault); + if (id < 0) + return soap->error; + return soap_out__cwmp1__Fault_SetParameterValuesFault(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct _cwmp1__Fault_SetParameterValuesFault ** SOAP_FMAC4 soap_get_PointerTo_cwmp1__Fault_SetParameterValuesFault(struct soap *soap, struct _cwmp1__Fault_SetParameterValuesFault **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTo_cwmp1__Fault_SetParameterValuesFault(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct _cwmp1__Fault_SetParameterValuesFault ** SOAP_FMAC4 soap_in_PointerTo_cwmp1__Fault_SetParameterValuesFault(struct soap *soap, const char *tag, struct _cwmp1__Fault_SetParameterValuesFault **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct _cwmp1__Fault_SetParameterValuesFault **)soap_malloc(soap, sizeof(struct _cwmp1__Fault_SetParameterValuesFault *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in__cwmp1__Fault_SetParameterValuesFault(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct _cwmp1__Fault_SetParameterValuesFault **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE__cwmp1__Fault_SetParameterValuesFault, sizeof(struct _cwmp1__Fault_SetParameterValuesFault), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTotime(struct soap *soap, time_t *const*a) +{ + soap_reference(soap, *a, SOAP_TYPE_time); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTotime(struct soap *soap, time_t *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTotime); + if (soap_out_PointerTotime(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTotime(struct soap *soap, const char *tag, int id, time_t *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_time); + if (id < 0) + return soap->error; + return soap_out_time(soap, tag, id, *a, type); +} + +SOAP_FMAC3 time_t ** SOAP_FMAC4 soap_get_PointerTotime(struct soap *soap, time_t **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTotime(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 time_t ** SOAP_FMAC4 soap_in_PointerTotime(struct soap *soap, const char *tag, time_t **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (time_t **)soap_malloc(soap, sizeof(time_t *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_time(soap, tag, *a, type))) + return NULL; + } + else + { a = (time_t **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_time, sizeof(time_t), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTocwmp1AccessList(struct soap *soap, struct cwmp1AccessList *const*a) +{ + if (*a) + soap_serialize_cwmp1AccessList(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTocwmp1AccessList(struct soap *soap, struct cwmp1AccessList *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTocwmp1AccessList); + if (soap_out_PointerTocwmp1AccessList(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTocwmp1AccessList(struct soap *soap, const char *tag, int id, struct cwmp1AccessList *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, (struct soap_array*)&(*a)->__ptrstring, 1, type, SOAP_TYPE_cwmp1AccessList); + if (id < 0) + return soap->error; + return soap_out_cwmp1AccessList(soap, tag, id, *a, type); +} + +SOAP_FMAC3 struct cwmp1AccessList ** SOAP_FMAC4 soap_get_PointerTocwmp1AccessList(struct soap *soap, struct cwmp1AccessList **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTocwmp1AccessList(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 struct cwmp1AccessList ** SOAP_FMAC4 soap_in_PointerTocwmp1AccessList(struct soap *soap, const char *tag, struct cwmp1AccessList **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (struct cwmp1AccessList **)soap_malloc(soap, sizeof(struct cwmp1AccessList *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_cwmp1AccessList(soap, tag, *a, type))) + return NULL; + } + else + { a = (struct cwmp1AccessList **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_cwmp1AccessList, sizeof(struct cwmp1AccessList), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTostring(struct soap *soap, char **const*a) +{ + if (!soap_reference(soap, *a, SOAP_TYPE_string)) + soap_serialize_string(soap, *a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTostring(struct soap *soap, char **const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTostring); + if (soap_out_PointerTostring(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTostring(struct soap *soap, const char *tag, int id, char **const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_string); + if (id < 0) + return soap->error; + return soap_out_string(soap, tag, id, *a, type); +} + +SOAP_FMAC3 char *** SOAP_FMAC4 soap_get_PointerTostring(struct soap *soap, char ***p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTostring(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 char *** SOAP_FMAC4 soap_in_PointerTostring(struct soap *soap, const char *tag, char ***a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (char ***)soap_malloc(soap, sizeof(char **)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_string(soap, tag, *a, type))) + return NULL; + } + else + { a = (char ***)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_string, sizeof(char *), 1); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__ObjectNameType(struct soap *soap, char **a) +{ soap_default_string(soap, a); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__ObjectNameType(struct soap *soap, char *const*a) +{ soap_serialize_string(soap, a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__ObjectNameType(struct soap *soap, char *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__ObjectNameType); + if (soap_out_cwmp1__ObjectNameType(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__ObjectNameType(struct soap *soap, const char *tag, int id, char *const*a, const char *type) +{ + return soap_outstring(soap, tag, id, a, type, SOAP_TYPE_cwmp1__ObjectNameType); +} + +SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_cwmp1__ObjectNameType(struct soap *soap, char **p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__ObjectNameType(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_cwmp1__ObjectNameType(struct soap *soap, const char *tag, char **a, const char *type) +{ char **p; + p = soap_instring(soap, tag, a, type, SOAP_TYPE_cwmp1__ObjectNameType, 1, -1, 256); + return p; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__CommandKeyType(struct soap *soap, char **a) +{ soap_default_string(soap, a); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__CommandKeyType(struct soap *soap, char *const*a) +{ soap_serialize_string(soap, a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__CommandKeyType(struct soap *soap, char *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__CommandKeyType); + if (soap_out_cwmp1__CommandKeyType(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__CommandKeyType(struct soap *soap, const char *tag, int id, char *const*a, const char *type) +{ + return soap_outstring(soap, tag, id, a, type, SOAP_TYPE_cwmp1__CommandKeyType); +} + +SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_cwmp1__CommandKeyType(struct soap *soap, char **p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__CommandKeyType(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_cwmp1__CommandKeyType(struct soap *soap, const char *tag, char **a, const char *type) +{ char **p; + p = soap_instring(soap, tag, a, type, SOAP_TYPE_cwmp1__CommandKeyType, 1, -1, 32); + return p; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__ParameterKeyType(struct soap *soap, char **a) +{ soap_default_string(soap, a); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__ParameterKeyType(struct soap *soap, char *const*a) +{ soap_serialize_string(soap, a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__ParameterKeyType(struct soap *soap, char *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__ParameterKeyType); + if (soap_out_cwmp1__ParameterKeyType(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__ParameterKeyType(struct soap *soap, const char *tag, int id, char *const*a, const char *type) +{ + return soap_outstring(soap, tag, id, a, type, SOAP_TYPE_cwmp1__ParameterKeyType); +} + +SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_cwmp1__ParameterKeyType(struct soap *soap, char **p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__ParameterKeyType(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_cwmp1__ParameterKeyType(struct soap *soap, const char *tag, char **a, const char *type) +{ char **p; + p = soap_instring(soap, tag, a, type, SOAP_TYPE_cwmp1__ParameterKeyType, 1, -1, 32); + return p; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_cwmp1__FaultCodeType(struct soap *soap, char **a) +{ soap_default_string(soap, a); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_cwmp1__FaultCodeType(struct soap *soap, char *const*a) +{ soap_serialize_string(soap, a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_cwmp1__FaultCodeType(struct soap *soap, char *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_cwmp1__FaultCodeType); + if (soap_out_cwmp1__FaultCodeType(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_cwmp1__FaultCodeType(struct soap *soap, const char *tag, int id, char *const*a, const char *type) +{ + return soap_outstring(soap, tag, id, a, type, SOAP_TYPE_cwmp1__FaultCodeType); +} + +SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_cwmp1__FaultCodeType(struct soap *soap, char **p, const char *tag, const char *type) +{ + if ((p = soap_in_cwmp1__FaultCodeType(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_cwmp1__FaultCodeType(struct soap *soap, const char *tag, char **a, const char *type) +{ char **p; + p = soap_instring(soap, tag, a, type, SOAP_TYPE_cwmp1__FaultCodeType, 1, -1, -1); + return p; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__anySimpleType(struct soap *soap, char **a) +{ soap_default_string(soap, a); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_xsd__anySimpleType(struct soap *soap, char *const*a) +{ soap_serialize_string(soap, a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__anySimpleType(struct soap *soap, char *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_xsd__anySimpleType); + if (soap_out_xsd__anySimpleType(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__anySimpleType(struct soap *soap, const char *tag, int id, char *const*a, const char *type) +{ + return soap_outstring(soap, tag, id, a, type, SOAP_TYPE_xsd__anySimpleType); +} + +SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_xsd__anySimpleType(struct soap *soap, char **p, const char *tag, const char *type) +{ + if ((p = soap_in_xsd__anySimpleType(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_xsd__anySimpleType(struct soap *soap, const char *tag, char **a, const char *type) +{ char **p; + p = soap_instring(soap, tag, a, type, SOAP_TYPE_xsd__anySimpleType, 1, -1, -1); + return p; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTounsignedByte(struct soap *soap, unsigned char *const*a) +{ + soap_reference(soap, *a, SOAP_TYPE_unsignedByte); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTounsignedByte(struct soap *soap, unsigned char *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTounsignedByte); + if (soap_out_PointerTounsignedByte(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTounsignedByte(struct soap *soap, const char *tag, int id, unsigned char *const*a, const char *type) +{ + id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_unsignedByte); + if (id < 0) + return soap->error; + return soap_out_unsignedByte(soap, tag, id, *a, type); +} + +SOAP_FMAC3 unsigned char ** SOAP_FMAC4 soap_get_PointerTounsignedByte(struct soap *soap, unsigned char **p, const char *tag, const char *type) +{ + if ((p = soap_in_PointerTounsignedByte(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 unsigned char ** SOAP_FMAC4 soap_in_PointerTounsignedByte(struct soap *soap, const char *tag, unsigned char **a, const char *type) +{ + if (soap_element_begin_in(soap, tag, 1, NULL)) + return NULL; + if (!a) + if (!(a = (unsigned char **)soap_malloc(soap, sizeof(unsigned char *)))) + return NULL; + *a = NULL; + if (!soap->null && *soap->href != '#') + { soap_revert(soap); + if (!(*a = soap_in_unsignedByte(soap, tag, *a, type))) + return NULL; + } + else + { a = (unsigned char **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_unsignedByte, sizeof(unsigned char), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + } + return a; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default__QName(struct soap *soap, char **a) +{ soap_default_string(soap, a); +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__QName(struct soap *soap, char *const*a) +{ soap_serialize_string(soap, a); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put__QName(struct soap *soap, char *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__QName); + if (soap_out__QName(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out__QName(struct soap *soap, const char *tag, int id, char *const*a, const char *type) +{ + return soap_outstring(soap, tag, id, a, type, SOAP_TYPE__QName); +} + +SOAP_FMAC3 char ** SOAP_FMAC4 soap_get__QName(struct soap *soap, char **p, const char *tag, const char *type) +{ + if ((p = soap_in__QName(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 char * * SOAP_FMAC4 soap_in__QName(struct soap *soap, const char *tag, char **a, const char *type) +{ char **p; + p = soap_instring(soap, tag, a, type, SOAP_TYPE__QName, 2, -1, -1); + return p; +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_default_string(struct soap *soap, char **a) +{ (void)soap; /* appease -Wall -Werror */ +#ifdef SOAP_DEFAULT_string + *a = SOAP_DEFAULT_string; +#else + *a = (char *)0; +#endif +} + +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_string(struct soap *soap, char *const*a) +{ + soap_reference(soap, *a, SOAP_TYPE_string); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_put_string(struct soap *soap, char *const*a, const char *tag, const char *type) +{ + register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_string); + if (soap_out_string(soap, tag, id, a, type)) + return soap->error; + return soap_putindependent(soap); +} + +SOAP_FMAC3 int SOAP_FMAC4 soap_out_string(struct soap *soap, const char *tag, int id, char *const*a, const char *type) +{ + return soap_outstring(soap, tag, id, a, type, SOAP_TYPE_string); +} + +SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_string(struct soap *soap, char **p, const char *tag, const char *type) +{ + if ((p = soap_in_string(soap, tag, p, type))) + if (soap_getindependent(soap)) + return NULL; + return p; +} + +SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_string(struct soap *soap, const char *tag, char **a, const char *type) +{ char **p; + p = soap_instring(soap, tag, a, type, SOAP_TYPE_string, 1, -1, -1); + return p; +} + +#ifdef __cplusplus +} +#endif + +/* End of soapC.c */ diff --git a/src/soapClient.c b/src/soapClient.c new file mode 100644 index 0000000..1257897 --- /dev/null +++ b/src/soapClient.c @@ -0,0 +1,566 @@ +/* + soapClient.c + + cwmp service client in C + +-------------------------------------------------------------------------------- +cwmp service client +Copyright (C) 2011-2012, Inteno, Inc. All Rights Reserved. + +Any distribution, dissemination, modification, conversion, integral or partial +reproduction, can not be made without the prior written permission of Inteno. +-------------------------------------------------------------------------------- +Author contact information: + +-------------------------------------------------------------------------------- +*/ +#include "soapH.h" +#include "cwmp.h" +#include "cwmpBinding.nsmap" +#include "httpda.h" +#ifdef __cplusplus +extern "C" { +#endif + +SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.12 2011-10-17 13:06:56 GMT") + +static struct http_da_info http_da_info; + +struct rpc_cpe *cwmp_add_session_rpc_cpe_getRPCMethods (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_reboot (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_download (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_getParameterValues (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_setParameterValues (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_getParameterNames (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_factoryReset (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_scheduleInform (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_getParameterAttributes (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_setParameterAttributes (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_addObject (struct session *session); +struct rpc_cpe *cwmp_add_session_rpc_cpe_deleteObject (struct session *session); + +const struct CPE_METHOD_CONSTRUCTORS CPE_METHOD_CONSTRUCTORS_ARRAY [] = { + {"GetRPCMethods", cwmp_add_session_rpc_cpe_getRPCMethods}, + {"SetParameterValues", cwmp_add_session_rpc_cpe_setParameterValues}, + {"GetParameterValues", cwmp_add_session_rpc_cpe_getParameterValues}, + {"GetParameterNames", cwmp_add_session_rpc_cpe_getParameterNames}, + {"SetParameterAttributes", cwmp_add_session_rpc_cpe_setParameterAttributes}, + {"GetParameterAttributes", cwmp_add_session_rpc_cpe_getParameterAttributes}, + {"AddObject", cwmp_add_session_rpc_cpe_addObject}, + {"DeleteObject", cwmp_add_session_rpc_cpe_deleteObject}, + {"Reboot", cwmp_add_session_rpc_cpe_reboot}, + {"Download", cwmp_add_session_rpc_cpe_download}, + {"Upload", NULL}, + {"FactoryReset", cwmp_add_session_rpc_cpe_factoryReset}, + {"GetQueuedTransfers", NULL}, + {"GetAllQueuedTransfers", NULL}, + {"ScheduleInform", cwmp_add_session_rpc_cpe_scheduleInform}, + {"SetVouchers", NULL}, + {"GetOptions", NULL} +}; + +struct rpc_cpe *cwmp_add_session_rpc_cpe_Fault (struct session *session, int idx); + +void cwmp_session_soap_init (struct session *session) +{ + soap_init2(&session->soap, SOAP_IO_KEEPALIVE, SOAP_IO_KEEPALIVE); + soap_set_omode(&session->soap, SOAP_XML_INDENT); + session->soap.recv_timeout = SOAP_TIMEOUT; + session->soap.send_timeout = SOAP_TIMEOUT; + session->soap.connect_timeout = SOAP_TIMEOUT; + session->soap.accept_timeout = SOAP_TIMEOUT; + if (soap_register_plugin(&session->soap, http_da)) + { + CWMP_LOG (ERROR,"Failed to register HTTP authentication plugin"); + } + CWMP_LOG (INFO,"Open session"); + CWMP_LOG (INFO,"ACS URL: %s",session->acs_url); +} + +void cwmp_session_done (struct session *session) +{ + soap_done(&session->soap); + http_da_release(&session->soap, &http_da_info); + CWMP_LOG (INFO,"Close session"); +} + +void cwmp_session_soap_destroy_end (struct session *session) +{ + soap_destroy(&session->soap); + soap_end(&session->soap); + if (session->digest_auth == TRUE) + { + http_da_restore(&session->soap, &http_da_info); + } +} + +int cwmp_soap_set_header_rpc_acs (struct soap *soap) +{ + static int id=MIN_INT_ID; + static char buf_id[16]; + static struct SOAP_ENV__Header soap_header; + memset(&soap_header, 0, sizeof(struct SOAP_ENV__Header)); + if(id>=MAX_INT_ID) + { + id=MIN_INT_ID; + } + id++; + sprintf(buf_id,"%d",id); + soap_header.ID.__item = buf_id; + soap_header.ID.SOAP_ENV__mustUnderstand = "1"; + soap->header = &soap_header; + return CWMP_OK; +} + +int cwmp_soap_get_header_rpc_cpe (struct soap *soap) +{ + static struct SOAP_ENV__Header soap_header; + static char *buf_id=NULL; + + if (soap->header == NULL) + { + soap->header = &soap_header; + return CWMP_OK; + } + + memset(&soap_header, 0, sizeof(struct SOAP_ENV__Header)); + if (buf_id!=NULL) + { + free(buf_id); + buf_id = NULL; + } + buf_id = strdup(soap->header->ID.__item); + soap_header.ID.__item = buf_id; + soap_header.ID.SOAP_ENV__mustUnderstand = "1"; + soap->header = NULL; + return CWMP_OK; +} + +SOAP_FMAC3 char * SOAP_FMAC4 soap_get_fault_code(struct soap *soap) +{ + struct SOAP_ENV__Fault *soap_fault; + struct _cwmp1__Fault *fault=NULL; + struct SOAP_ENV__Detail *detail=NULL; + + soap_fault = soap->fault; + + if (soap_fault == NULL) + { + return NULL; + } + + if (soap_fault->detail!=NULL) + { + detail = soap_fault->detail; + } + else + { + detail = soap_fault->SOAP_ENV__Detail; + } + if (detail!=NULL) + { + fault = (struct _cwmp1__Fault *) detail->fault; + if (fault!=NULL) + { + if (fault->FaultCode!=NULL) + { + return fault->FaultCode; + } + } + } + return NULL; +} + +SOAP_FMAC5 int SOAP_FMAC6 cwmp_soap_call_rpc_acs + ( + struct cwmp *cwmp, + struct session *session, + struct rpc_acs *rpc_acs + ) +{ + struct soap *soap; + struct soap_cwmp1_methods__rpc *soap_methods; + char *soap_fault_code; + int u=0,r=0; + + soap_methods = &(rpc_acs->soap_methods); + soap = &(session->soap); + soap->encodingStyle = ENCODING_STYLE_URL; + + while (1) + { + session->error = CWMP_OK; + cwmp_soap_set_header_rpc_acs(soap); + soap_begin(soap); + cwmp_soap_send_rpc_acs (cwmp, session, rpc_acs, soap, soap_methods); + if (rpc_acs->error != CWMP_SUCCESS_RPC) + { + session->error = CWMP_RETRY_SESSION; + break; + } + if (soap_begin_recv(soap) || + cwmp_soap_receive_rpc_acs_response (cwmp, session, rpc_acs, soap, soap_methods)) + { + if (soap->error == 401) // challenge: HTTP authentication required + { + CWMP_LOG(INFO,"Receive http 401: need authentication"); + if(u>0) + { + session->error = CWMP_RETRY_SESSION; + break; + } + u++; + // to store userid and passwd + http_da_save(soap, &http_da_info, soap->authrealm, cwmp->conf.acs_userid, cwmp->conf.acs_passwd); // set userid and passwd for this realm + session->digest_auth = TRUE; + cwmp_session_soap_destroy_end(session); + } + else if ((soap_fault_code = soap_get_fault_code(soap))!=NULL) + { + + if (strcmp(soap_fault_code,"8005") == 0) + { + CWMP_LOG(INFO,"Receive soap 8005: need to re-send"); + if (r>5) + { + session->error = CWMP_RETRY_SESSION; + break; + } + r++; + cwmp_session_soap_destroy_end(session); + } + else if (rpc_acs->type != RPC_ACS_INFORM_IDX) + { + rpc_acs->error = CWMP_SUCCESS_RPC; + session->error = CWMP_CONTINUE_SESSION; + break; + } + else + { + session->error = CWMP_RETRY_SESSION; + break; + } + } + else + { + session->error = CWMP_RETRY_SESSION; + break; + } + } + else + { + break; + } + } + return rpc_acs->error; +} + +SOAP_FMAC5 int SOAP_FMAC6 cwmp_soap_send_rpc_acs + ( + struct cwmp *cwmp, + struct session *session, + struct rpc_acs *rpc_acs, + struct soap *soap, + struct soap_cwmp1_methods__rpc *soap_methods + ) +{ + char *soap_endpoint; + char *soap_action = ""; + + soap_endpoint = session->acs_url; + + soap_serializeheader(soap); + soap_methods->soap_serialize_cwmp1__send_data (soap, rpc_acs->method_data); + if (soap_begin_count(soap)) + { + rpc_acs->error = CWMP_FAIL_RPC; + return soap->error; + } + if (soap->mode & SOAP_IO_LENGTH) + { if (soap_envelope_begin_out(soap) + || soap_putheader(soap) + || soap_body_begin_out(soap) + || soap_methods->soap_put_cwmp1__send_data(soap, rpc_acs->method_data, soap_methods->envelope,"") + || soap_body_end_out(soap) + || soap_envelope_end_out(soap)) + { + rpc_acs->error = CWMP_FAIL_RPC; + return soap->error; + } + } + if (soap_end_count(soap)) + { + rpc_acs->error = CWMP_FAIL_RPC; + return soap->error; + } + + if (soap_connect(soap, soap_endpoint, soap_action)) + { + rpc_acs->error = CWMP_RETRY_RPC; + return soap->error; + } + if (soap_envelope_begin_out(soap) + || soap_putheader(soap) + || soap_body_begin_out(soap) + || soap_methods->soap_put_cwmp1__send_data(soap, rpc_acs->method_data, soap_methods->envelope,"") + || soap_body_end_out(soap) + || soap_envelope_end_out(soap)) + { + rpc_acs->error = CWMP_FAIL_RPC; + return soap->error; + } + + if (soap_end_send(soap)) + { + rpc_acs->error = CWMP_RETRY_RPC; + CWMP_LOG (ERROR,"Problem when trying to send SOAP RPC to the ACS"); + return soap->error; + } + CWMP_LOG (INFO,"Send SOAP RPC to the ACS"); + rpc_acs->error = CWMP_SUCCESS_RPC; + return soap->error; +} +SOAP_FMAC5 int SOAP_FMAC6 cwmp_soap_receive_rpc_acs_response + ( + struct cwmp *cwmp, + struct session *session, + struct rpc_acs *rpc_acs, + struct soap *soap, + struct soap_cwmp1_methods__rpc *soap_methods + ) +{ + + if (soap_envelope_begin_in(soap) + || soap_recv_header(soap) /* KMD IN */ + || soap_body_begin_in(soap)) + { + rpc_acs->error = CWMP_RETRY_RPC; + CWMP_LOG (ERROR,"Problem when receiving SOAP RPC response from the ACS"); + return soap->error; + } + soap_methods->soap_get_cwmp1__rpc_received_data (soap, rpc_acs->method_response_data, soap_methods->envelope_response,""); + CWMP_LOG (INFO,"Receive SOAP RPC response from the ACS"); + if (soap->error) + { + rpc_acs->error = CWMP_RETRY_RPC; + if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) + return soap_recv_fault(soap); + return soap->error; + } + if (soap_body_end_in(soap) + || soap_envelope_end_in(soap) + || soap_end_recv(soap)) + { + return soap->error; + } + session->hold_request = (soap->header==NULL) ? FALSE : soap->header->HoldRequests.__item; + rpc_acs->error = CWMP_SUCCESS_RPC; + return soap->error; +} + +SOAP_FMAC5 int SOAP_FMAC6 cwmp_soap_send_http_empty (struct cwmp *cwmp, struct session *session) +{ + struct soap *soap; + char *soap_action = ""; + char *soap_endpoint; + + soap = &(session->soap); + soap_endpoint = session->acs_url; + soap_begin(soap); + + if (soap_connect(soap, soap_endpoint, soap_action) || + soap_send(soap, "") || + soap_end_send(soap)) + { + session->error = CWMP_RETRY_SESSION; + CWMP_LOG(ERROR,"Fail when trying to send HTTP empty"); + return soap->error; + } + + CWMP_LOG(INFO,"Send HTTP empty"); + return CWMP_OK; +} + +SOAP_FMAC5 int SOAP_FMAC6 cwmp_soap_recv_http_empty (struct cwmp *cwmp, struct session *session) +{ + struct soap *soap; + static int uc=0; + + soap = &(session->soap); + + soap_begin_recv(soap); + + if (soap->error == 401) // challenge: HTTP authentication required + { + if(uc>0) + { + session->error = CWMP_RETRY_SESSION; + uc = 0; + return CWMP_UNAUTHORIZED_401; + } + uc++; + // to store userid and passwd + http_da_save(soap, &http_da_info, soap->authrealm, cwmp->conf.acs_userid, cwmp->conf.acs_passwd); // set userid and passwd for this realm + session->digest_auth = TRUE; + return CWMP_UNAUTHORIZED_401; + } + uc = 0; + if (soap->status == 204) + { + CWMP_LOG (INFO,"Receive HTTP 204 No Content"); + session->error = CWMP_SUCCESS_SESSION; + session->hold_request = FALSE; + return CWMP_OK; + } + else if (soap->status == 200) + { + CWMP_LOG (INFO,"Receive HTTP 200 OK"); + session->error = CWMP_CONTINUE_SESSION; + return CWMP_OK; + } + + return CWMP_OK; +} + + +struct rpc_cpe *cwmp_soap_receive_rpc_cpe ( + struct cwmp *cwmp, + struct session *session + ) +{ + struct soap *soap; + int i; + struct rpc_cpe *rpc_cpe=NULL; + struct soap_cwmp1_methods__rpc *soap_methods; + char *method; + struct rpc_cpe *(*constructor)(struct session *session); + + soap = &(session->soap); + + if (soap_envelope_begin_in(soap)|| + soap_recv_header(soap) || + soap_body_begin_in(soap)) + { + CWMP_LOG (ERROR,"Problem when receiving SOAP RPC from ACS"); + return NULL; + } + soap_peek_element(soap); + cwmp_soap_get_header_rpc_cpe (soap); + CWMP_LOG (INFO,"Receive SOAP RPC from ACS: %s", soap->tag); + for (i=0;itag, method)) + { + if (constructor!=NULL) + { + rpc_cpe = constructor(session); + if (rpc_cpe == NULL) + { + return NULL; + } + CWMP_LOG (INFO,"%s RPC is supported",soap->tag); + } + break; + } + } + if (rpc_cpe == NULL) + { + CWMP_LOG (INFO,"%s RPC is not supported",soap->tag); + rpc_cpe = cwmp_add_session_rpc_cpe_Fault(session,FAULT_CPE_METHOD_NOT_SUPPORTED_IDX); + return rpc_cpe; + } + + soap_methods = &(rpc_cpe->soap_methods); + if (!soap_methods->soap_get_cwmp1__rpc_received_data(soap, rpc_cpe->method_data, soap_methods->envelope, NULL)) + { + /*error*/ + } + + if (soap_body_end_in(soap) + || soap_envelope_end_in(soap) + || soap_end_recv(soap)) + { + /*error*/ + } + + session->hold_request = (soap->header==NULL) ? FALSE : soap->header->HoldRequests.__item; + + return rpc_cpe; +} + +SOAP_FMAC5 int SOAP_FMAC6 cwmp_soap_send_rpc_cpe_response + ( + struct cwmp *cwmp, + struct session *session, + struct rpc_cpe *rpc_cpe + ) +{ + char *soap_endpoint; + char *soap_action = ""; + struct soap_cwmp1_methods__rpc *soap_methods; + struct soap *soap; + + soap_endpoint = session->acs_url; + soap_methods = &(rpc_cpe->soap_methods); + soap = &(session->soap); + + soap_begin(soap); + cwmp_soap_get_header_rpc_cpe (soap); + soap_serializeheader(soap); + soap_methods->soap_serialize_cwmp1__send_data (soap, rpc_cpe->method_response_data); + if (soap_begin_count(soap)) + { + rpc_cpe->error = CWMP_FAIL_RPC; + return soap->error; + } + if (soap->mode & SOAP_IO_LENGTH) + { if (soap_envelope_begin_out(soap) + || soap_putheader(soap) + || soap_body_begin_out(soap) + || soap_methods->soap_put_cwmp1__send_data(soap, rpc_cpe->method_response_data, soap_methods->envelope_response,"") + || soap_body_end_out(soap) + || soap_envelope_end_out(soap)) + { + rpc_cpe->error = CWMP_FAIL_RPC; + return soap->error; + } + } + if (soap_end_count(soap)) + { + rpc_cpe->error = CWMP_FAIL_RPC; + return soap->error; + } + + if (soap_connect(soap, soap_endpoint, soap_action)) + { + rpc_cpe->error = CWMP_RETRY_RPC; + return soap->error; + } + if (soap_envelope_begin_out(soap) + || soap_putheader(soap) + || soap_body_begin_out(soap) + || soap_methods->soap_put_cwmp1__send_data(soap, rpc_cpe->method_response_data, soap_methods->envelope_response,"") + || soap_body_end_out(soap) + || soap_envelope_end_out(soap)) + { + rpc_cpe->error = CWMP_FAIL_RPC; + return soap->error; + } + + if (soap_end_send(soap)) + { + CWMP_LOG (ERROR,"Problem when trying to send SOAP RPC response to the ACS"); + rpc_cpe->error = CWMP_RETRY_RPC; + return soap->error; + } + CWMP_LOG (INFO,"Send SOAP RPC response to the ACS"); + return CWMP_OK; +} + +#ifdef __cplusplus +} +#endif +/* End of soapClient.c */ + diff --git a/src/stdsoap2.c b/src/stdsoap2.c new file mode 100644 index 0000000..d397e9b --- /dev/null +++ b/src/stdsoap2.c @@ -0,0 +1,15170 @@ +/* + stdsoap2.c[pp] 2.7.12 + + gSOAP runtime engine + +gSOAP XML Web services tools +Copyright (C) 2000-2008, Robert van Engelen, Genivia Inc., All Rights Reserved. +This part of the software is released under ONE of the following licenses: +GPL, or the gSOAP public license, or Genivia's license for commercial use. +-------------------------------------------------------------------------------- +Contributors: + +Wind River Systems Inc., for the following additions under gSOAP public license: + - vxWorks compatible +-------------------------------------------------------------------------------- +gSOAP public license. + +The contents of this file are subject to the gSOAP Public License Version 1.3 +(the "License"); you may not use this file except in compliance with the +License. You may obtain a copy of the License at +http://www.cs.fsu.edu/~engelen/soaplicense.html +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +for the specific language governing rights and limitations under the License. + +The Initial Developer of the Original Code is Robert A. van Engelen. +Copyright (C) 2000-2008, Robert van Engelen, Genivia Inc., All Rights Reserved. +-------------------------------------------------------------------------------- +GPL license. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA + +Author contact information: +engelen@genivia.com / engelen@acm.org + +This program is released under the GPL with the additional exemption that +compiling, linking, and/or using OpenSSL is allowed. +-------------------------------------------------------------------------------- +A commercial use license is available from Genivia, Inc., contact@genivia.com +-------------------------------------------------------------------------------- + +Installation note: + +Win32 build needs winsock.dll (Visual C++ "wsock32.lib") +To do this in Visual C++ 6.0, go to "Project", "settings", select the "Link" +tab (the project file needs to be selected in the file view) and add +"wsock32.lib" to the "Object/library modules" entry + +On Mac OS X with gcc (GCC) 3.1 20020420 (prerelease) you MUST compile with +-fstack_check when using -O2 because gcc 3.1 has a bug that smashes the stack +when locally allocated data exceeds 64K. + +*/ + +#ifdef AS400 +# pragma convert(819) /* EBCDIC to ASCII */ +#endif + +#include "stdsoap2.h" + +#ifdef __BORLANDC__ +# pragma warn -8060 +#else +# ifdef WIN32 +# ifdef UNDER_CE +# pragma comment(lib, "winsock.lib") +# else +# pragma comment(lib, "wsock32.lib") +# endif +# pragma warning(disable : 4996) /* disable deprecation warnings */ +# endif +#endif + +#ifdef __cplusplus +SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.7.12 2008-10-01 00:00:00 GMT") +extern "C" { +#else +SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.7.12 2008-10-01 00:00:00 GMT") +#endif + +/* 8bit character representing unknown/nonrepresentable character data (e.g. not supported by current locale with multibyte support enabled) */ +#ifndef SOAP_UNKNOWN_CHAR +#define SOAP_UNKNOWN_CHAR (127) +#endif + +/* EOF=-1 */ +#define SOAP_LT (soap_wchar)(-2) /* XML character '<' */ +#define SOAP_TT (soap_wchar)(-3) /* XML character '' */ +#define SOAP_QT (soap_wchar)(-5) /* XML character '"' */ +#define SOAP_AP (soap_wchar)(-6) /* XML character ''' */ + +#define soap_blank(c) ((c) >= 0 && (c) <= 32) +#define soap_notblank(c) ((c) > 32) + +#if defined(WIN32) && !defined(UNDER_CE) +#define soap_hash_ptr(p) ((PtrToUlong(p) >> 3) & (SOAP_PTRHASH - 1)) +#else +#define soap_hash_ptr(p) ((size_t)(((unsigned long)(p) >> 3) & (SOAP_PTRHASH-1))) +#endif + +#ifndef PALM_1 +static void soap_init_logs(struct soap*); +#endif +#ifdef SOAP_DEBUG +static void soap_close_logfile(struct soap*, int); +static void soap_set_logfile(struct soap*, int, const char*); +#endif + +#ifdef SOAP_MEM_DEBUG +static void soap_init_mht(struct soap*); +static void soap_free_mht(struct soap*); +static void soap_track_unlink(struct soap*, const void*); +#endif + +#ifndef PALM_2 +static int soap_set_error(struct soap*, const char*, const char*, const char*, const char*, int); +static int soap_copy_fault(struct soap*, const char*, const char*, const char*, const char*); +static int soap_getattrval(struct soap*, char*, size_t, soap_wchar); +#endif + +#ifndef PALM_1 +static void soap_free_ns(struct soap *soap); +static soap_wchar soap_char(struct soap*); +static soap_wchar soap_get_pi(struct soap*); +static int soap_isxdigit(int); +static void *fplugin(struct soap*, const char*); +static char *soap_get_http_body(struct soap*); +static size_t soap_count_attachments(struct soap *soap); +static int soap_try_connect_command(struct soap*, int http_command, const char *endpoint, const char *action); +#ifndef WITH_NOIDREF +static void soap_update_ptrs(struct soap*, char*, char*, char*, char*); +static int soap_has_copies(struct soap*, const char*, const char*); +static void soap_init_iht(struct soap*); +static void soap_free_iht(struct soap*); +static void soap_init_pht(struct soap*); +static void soap_free_pht(struct soap*); +#endif +#endif + +#ifndef WITH_LEAN +static const char *soap_set_validation_fault(struct soap*, const char*, const char*); +static int soap_isnumeric(struct soap*, const char*); +static struct soap_nlist *soap_push_ns(struct soap *soap, const char *id, const char *ns, short utilized); +static void soap_pop_ns(struct soap *soap); +static void soap_utilize_ns(struct soap *soap, const char *tag, size_t n); +#endif + +#ifndef WITH_LEANER +#ifndef PALM_1 +static struct soap_multipart *soap_new_multipart(struct soap*, struct soap_multipart**, struct soap_multipart**, char*, size_t); +static int soap_putdimefield(struct soap*, const char*, size_t); +static char *soap_getdimefield(struct soap*, size_t); +static void soap_select_mime_boundary(struct soap*); +static int soap_valid_mime_boundary(struct soap*); +static void soap_resolve_attachment(struct soap*, struct soap_multipart*); +#endif +#endif + +#ifdef WITH_GZIP +static int soap_getgziphdr(struct soap*); +#endif + +#ifdef WITH_OPENSSL +int soap_ssl_init_done = 0; + +static int ssl_auth_init(struct soap*); +static int ssl_verify_callback(int, X509_STORE_CTX*); +static int ssl_verify_callback_allow_expired_certificate(int, X509_STORE_CTX*); +static int ssl_password(char*, int, int, void *); +/* The callback below is included for future references: +static DH *ssl_tmp_dh(SSL*, int, int); +*/ +#endif + +#if !defined(WITH_NOHTTP) || !defined(WITH_LEANER) +#ifndef PALM_1 +static const char *soap_decode(char*, size_t, const char*, const char*); +#endif +#endif + +#ifndef WITH_NOHTTP +#ifndef PALM_1 +static soap_wchar soap_getchunkchar(struct soap*); +static const char *http_error(struct soap*, int); +static int http_post(struct soap*, const char*, const char*, int, const char*, const char*, size_t); +static int http_get(struct soap*); +static int http_put(struct soap*); +static int http_del(struct soap*); +static int http_head(struct soap*); +static int http_send_header(struct soap*, const char*); +static int http_post_header(struct soap*, const char*, const char*); +static int http_response(struct soap*, int, size_t); +static int http_parse(struct soap*); +static int http_parse_header(struct soap*, const char*, const char*); +#endif +#endif + +#ifndef WITH_NOIO + +#ifndef PALM_1 +static int fsend(struct soap*, const char*, size_t); +static size_t frecv(struct soap*, char*, size_t); +static int tcp_init(struct soap*); +static const char *tcp_error(struct soap*); +#ifndef WITH_IPV6 +static int tcp_gethost(struct soap*, const char *addr, struct in_addr *inaddr); +#endif +static SOAP_SOCKET tcp_connect(struct soap*, const char *endpoint, const char *host, int port); +static SOAP_SOCKET tcp_accept(struct soap*, SOAP_SOCKET, struct sockaddr*, int*); +static int tcp_disconnect(struct soap*); +static int tcp_closesocket(struct soap*, SOAP_SOCKET); +static int tcp_shutdownsocket(struct soap*, SOAP_SOCKET, int); +static const char *soap_strerror(struct soap*); +#endif + +#if defined(WIN32) + #define SOAP_SOCKBLOCK(fd) \ + { u_long blocking = 0; \ + ioctlsocket(fd, FIONBIO, &blocking); \ + } + #define SOAP_SOCKNONBLOCK(fd) \ + { u_long nonblocking = 1; \ + ioctlsocket(fd, FIONBIO, &nonblocking); \ + } +#elif defined(VXWORKS) + #define SOAP_SOCKBLOCK(fd) \ + { u_long blocking = 0; \ + ioctl(fd, FIONBIO, (int)(&blocking)); \ + } + #define SOAP_SOCKNONBLOCK(fd) \ + { u_long nonblocking = 1; \ + ioctl(fd, FIONBIO, (int)(&nonblocking)); \ + } +#elif defined(PALM) + #define SOAP_SOCKBLOCK(fd) fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0)&~O_NONBLOCK); + #define SOAP_SOCKNONBLOCK(fd) fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0)|O_NONBLOCK); +#elif defined(SYMBIAN) + #define SOAP_SOCKBLOCK(fd) \ + { long blocking = 0; \ + ioctl(fd, 0/*FIONBIO*/, &blocking); \ + } + #define SOAP_SOCKNONBLOCK(fd) \ + { long nonblocking = 1; \ + ioctl(fd, 0/*FIONBIO*/, &nonblocking); \ + } +#else + #define SOAP_SOCKBLOCK(fd) fcntl(fd, F_SETFL, fcntl(fd, F_GETFL)&~O_NONBLOCK); + #define SOAP_SOCKNONBLOCK(fd) fcntl(fd, F_SETFL, fcntl(fd, F_GETFL)|O_NONBLOCK); +#endif + +#endif + +#if defined(PALM) && !defined(PALM_2) +unsigned short errno; +#endif + +#ifndef PALM_1 +static const char soap_env1[42] = "http://schemas.xmlsoap.org/soap/envelope/"; +static const char soap_enc1[42] = "http://schemas.xmlsoap.org/soap/encoding/"; +static const char soap_env2[40] = "http://www.w3.org/2003/05/soap-envelope"; +static const char soap_enc2[40] = "http://www.w3.org/2003/05/soap-encoding"; +static const char soap_rpc[35] = "http://www.w3.org/2003/05/soap-rpc"; +#endif + +#ifndef PALM_1 +const struct soap_double_nan soap_double_nan = {0xFFFFFFFF, 0xFFFFFFFF}; +static const char soap_base64o[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +static const char soap_base64i[81] = "\76XXX\77\64\65\66\67\70\71\72\73\74\75XXXXXXX\00\01\02\03\04\05\06\07\10\11\12\13\14\15\16\17\20\21\22\23\24\25\26\27\30\31XXXXXX\32\33\34\35\36\37\40\41\42\43\44\45\46\47\50\51\52\53\54\55\56\57\60\61\62\63"; +#endif + +#ifndef WITH_LEAN +/*static const char soap_indent[11] = "\n\t\t\t\t\t\t\t\t\t"; + Alternative indentation form for SOAP_XML_INDENT:*/ +static const char soap_indent[21] = "\n "; + +#endif + +#ifndef SOAP_CANARY +# define SOAP_CANARY (0xC0DE) +#endif + +static const char soap_padding[4] = "\0\0\0"; +#define SOAP_STR_PADDING (soap_padding) +#define SOAP_STR_EOS (soap_padding) +#define SOAP_NON_NULL (soap_padding) + +#ifndef WITH_LEAN +static const struct soap_code_map html_entity_codes[] = /* entities for XHTML parsing */ +{ { 160, "nbsp" }, + { 161, "iexcl" }, + { 162, "cent" }, + { 163, "pound" }, + { 164, "curren" }, + { 165, "yen" }, + { 166, "brvbar" }, + { 167, "sect" }, + { 168, "uml" }, + { 169, "copy" }, + { 170, "ordf" }, + { 171, "laquo" }, + { 172, "not" }, + { 173, "shy" }, + { 174, "reg" }, + { 175, "macr" }, + { 176, "deg" }, + { 177, "plusmn" }, + { 178, "sup2" }, + { 179, "sup3" }, + { 180, "acute" }, + { 181, "micro" }, + { 182, "para" }, + { 183, "middot" }, + { 184, "cedil" }, + { 185, "sup1" }, + { 186, "ordm" }, + { 187, "raquo" }, + { 188, "frac14" }, + { 189, "frac12" }, + { 190, "frac34" }, + { 191, "iquest" }, + { 192, "Agrave" }, + { 193, "Aacute" }, + { 194, "Acirc" }, + { 195, "Atilde" }, + { 196, "Auml" }, + { 197, "Aring" }, + { 198, "AElig" }, + { 199, "Ccedil" }, + { 200, "Egrave" }, + { 201, "Eacute" }, + { 202, "Ecirc" }, + { 203, "Euml" }, + { 204, "Igrave" }, + { 205, "Iacute" }, + { 206, "Icirc" }, + { 207, "Iuml" }, + { 208, "ETH" }, + { 209, "Ntilde" }, + { 210, "Ograve" }, + { 211, "Oacute" }, + { 212, "Ocirc" }, + { 213, "Otilde" }, + { 214, "Ouml" }, + { 215, "times" }, + { 216, "Oslash" }, + { 217, "Ugrave" }, + { 218, "Uacute" }, + { 219, "Ucirc" }, + { 220, "Uuml" }, + { 221, "Yacute" }, + { 222, "THORN" }, + { 223, "szlig" }, + { 224, "agrave" }, + { 225, "aacute" }, + { 226, "acirc" }, + { 227, "atilde" }, + { 228, "auml" }, + { 229, "aring" }, + { 230, "aelig" }, + { 231, "ccedil" }, + { 232, "egrave" }, + { 233, "eacute" }, + { 234, "ecirc" }, + { 235, "euml" }, + { 236, "igrave" }, + { 237, "iacute" }, + { 238, "icirc" }, + { 239, "iuml" }, + { 240, "eth" }, + { 241, "ntilde" }, + { 242, "ograve" }, + { 243, "oacute" }, + { 244, "ocirc" }, + { 245, "otilde" }, + { 246, "ouml" }, + { 247, "divide" }, + { 248, "oslash" }, + { 249, "ugrave" }, + { 250, "uacute" }, + { 251, "ucirc" }, + { 252, "uuml" }, + { 253, "yacute" }, + { 254, "thorn" }, + { 255, "yuml" }, + { 0, NULL } +}; +#endif + +#ifndef WITH_NOIO +#ifndef WITH_LEAN +static const struct soap_code_map h_error_codes[] = +{ +#ifdef HOST_NOT_FOUND + { HOST_NOT_FOUND, "Host not found" }, +#endif +#ifdef TRY_AGAIN + { TRY_AGAIN, "Try Again" }, +#endif +#ifdef NO_RECOVERY + { NO_RECOVERY, "No Recovery" }, +#endif +#ifdef NO_DATA + { NO_DATA, "No Data" }, +#endif +#ifdef NO_ADDRESS + { NO_ADDRESS, "No Address" }, +#endif + { 0, NULL } +}; +#endif +#endif + +#ifndef WITH_NOHTTP +#ifndef WITH_LEAN +static const struct soap_code_map h_http_error_codes[] = +{ { 200, "OK" }, + { 201, "Created" }, + { 202, "Accepted" }, + { 203, "Non-Authoritative Information" }, + { 204, "No Content" }, + { 205, "Reset Content" }, + { 206, "Partial Content" }, + { 300, "Multiple Choices" }, + { 301, "Moved Permanently" }, + { 302, "Found" }, + { 303, "See Other" }, + { 304, "Not Modified" }, + { 305, "Use Proxy" }, + { 307, "Temporary Redirect" }, + { 400, "Bad Request" }, + { 401, "Unauthorized" }, + { 402, "Payment Required" }, + { 403, "Forbidden" }, + { 404, "Not Found" }, + { 405, "Method Not Allowed" }, + { 406, "Not Acceptable" }, + { 407, "Proxy Authentication Required" }, + { 408, "Request Time-out" }, + { 409, "Conflict" }, + { 410, "Gone" }, + { 411, "Length Required" }, + { 412, "Precondition Failed" }, + { 413, "Request Entity Too Large" }, + { 414, "Request-URI Too Large" }, + { 415, "Unsupported Media Type" }, + { 416, "Requested range not satisfiable" }, + { 417, "Expectation Failed" }, + { 500, "Internal Server Error" }, + { 501, "Not Implemented" }, + { 502, "Bad Gateway" }, + { 503, "Service Unavailable" }, + { 504, "Gateway Time-out" }, + { 505, "HTTP Version not supported" }, + { 0, NULL } +}; +#endif +#endif + +#ifdef WITH_OPENSSL +static const struct soap_code_map h_ssl_error_codes[] = +{ +#define _SSL_ERROR(e) { e, #e } + _SSL_ERROR(SSL_ERROR_SSL), + _SSL_ERROR(SSL_ERROR_ZERO_RETURN), + _SSL_ERROR(SSL_ERROR_WANT_READ), + _SSL_ERROR(SSL_ERROR_WANT_WRITE), + _SSL_ERROR(SSL_ERROR_WANT_CONNECT), + _SSL_ERROR(SSL_ERROR_WANT_X509_LOOKUP), + _SSL_ERROR(SSL_ERROR_SYSCALL), + { 0, NULL } +}; +#endif + +#ifndef WITH_LEANER +static const struct soap_code_map mime_codes[] = +{ { SOAP_MIME_7BIT, "7bit" }, + { SOAP_MIME_8BIT, "8bit" }, + { SOAP_MIME_BINARY, "binary" }, + { SOAP_MIME_QUOTED_PRINTABLE, "quoted-printable" }, + { SOAP_MIME_BASE64, "base64" }, + { SOAP_MIME_IETF_TOKEN, "ietf-token" }, + { SOAP_MIME_X_TOKEN, "x-token" }, + { 0, NULL } +}; +#endif + +#ifdef WIN32 +static int tcp_done = 0; +#endif + +#if defined(HP_UX) && defined(HAVE_GETHOSTBYNAME_R) +extern int h_errno; +#endif + +/******************************************************************************/ +#ifndef WITH_NOIO +#ifndef PALM_1 +static int +fsend(struct soap *soap, const char *s, size_t n) +{ register int nwritten, err; +#if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT) + if (soap->os) + { soap->os->write(s, (std::streamsize)n); + if (soap->os->good()) + return SOAP_OK; + soap->errnum = 0; + return SOAP_EOF; + } +#endif + while (n) + { if (soap_valid_socket(soap->socket)) + { +#ifndef WITH_LEAN + if (soap->send_timeout) + { +#ifndef WIN32 + if ((int)soap->socket >= (int)FD_SETSIZE) + return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ +#endif + for (;;) + { struct timeval timeout; + fd_set fd; + register int r; + if (soap->send_timeout > 0) + { timeout.tv_sec = soap->send_timeout; + timeout.tv_usec = 0; + } + else + { timeout.tv_sec = -soap->send_timeout/1000000; + timeout.tv_usec = -soap->send_timeout%1000000; + } + FD_ZERO(&fd); + FD_SET(soap->socket, &fd); +#ifdef WITH_OPENSSL + if (soap->ssl) + r = select((int)soap->socket + 1, &fd, &fd, &fd, &timeout); + else +#endif + r = select((int)soap->socket + 1, NULL, &fd, &fd, &timeout); + if (r > 0) + break; + if (!r) + { soap->errnum = 0; + return SOAP_EOF; + } + err = soap_socket_errno(soap->socket); + if (err != SOAP_EINTR && err != SOAP_EAGAIN && err != SOAP_EWOULDBLOCK) + { soap->errnum = err; + return SOAP_EOF; + } + } + } +#endif +#ifdef WITH_OPENSSL + if (soap->ssl) + nwritten = SSL_write(soap->ssl, s, (int)n); + else if (soap->bio) + nwritten = BIO_write(soap->bio, s, (int)n); + else +#endif +#ifndef WITH_LEAN + if ((soap->omode & SOAP_IO_UDP)) + { if (soap->peerlen) + nwritten = sendto(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, (SOAP_WINSOCKINT)soap->peerlen); + else + nwritten = send(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags); + /* retry and back-off algorithm */ + /* TODO: this is not very clear from specs so verify and limit conditions under which we should loop (e.g. ENOBUFS) */ + if (nwritten < 0) + { struct timeval timeout; + fd_set fd; + int udp_repeat; + int udp_delay; +#ifndef WIN32 + if ((int)soap->socket >= (int)FD_SETSIZE) + return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ +#endif + if ((soap->connect_flags & SO_BROADCAST)) + udp_repeat = 3; /* SOAP-over-UDP MULTICAST_UDP_REPEAT - 1 */ + else + udp_repeat = 1; /* SOAP-over-UDP UNICAST_UDP_REPEAT - 1 */ + udp_delay = (soap_random % 201) + 50; /* UDP_MIN_DELAY .. UDP_MAX_DELAY */ + do + { timeout.tv_sec = 0; + timeout.tv_usec = 1000 * udp_delay; /* ms */ + FD_ZERO(&fd); + FD_SET(soap->socket, &fd); + select((int)soap->socket + 1, NULL, NULL, &fd, &timeout); + if (soap->peerlen) + nwritten = sendto(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, (SOAP_WINSOCKINT)soap->peerlen); + else + nwritten = send(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags); + udp_delay <<= 1; + if (udp_delay > 500) /* UDP_UPPER_DELAY */ + udp_delay = 500; + } + while (nwritten < 0 && --udp_repeat > 0); + } + } + else +#endif +#if !defined(PALM) && !defined(AS400) + nwritten = send(soap->socket, s, (int)n, soap->socket_flags); +#else + nwritten = send(soap->socket, (void*)s, n, soap->socket_flags); +#endif + if (nwritten <= 0) + { +#if defined(WITH_OPENSSL) || !defined(WITH_LEAN) + register int r = 0; +#endif + err = soap_socket_errno(soap->socket); +#ifdef WITH_OPENSSL + if (soap->ssl && (r = SSL_get_error(soap->ssl, nwritten)) != SSL_ERROR_NONE && r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE) + { soap->errnum = err; + return SOAP_EOF; + } +#endif + if (err == SOAP_EWOULDBLOCK || err == SOAP_EAGAIN) + { +#ifndef WITH_LEAN + struct timeval timeout; + fd_set fd; +#ifndef WIN32 + if ((int)soap->socket >= (int)FD_SETSIZE) + return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ +#endif + if (soap->send_timeout > 0) + { timeout.tv_sec = soap->send_timeout; + timeout.tv_usec = 0; + } + else if (soap->send_timeout < 0) + { timeout.tv_sec = -soap->send_timeout/1000000; + timeout.tv_usec = -soap->send_timeout%1000000; + } + else + { timeout.tv_sec = 0; + timeout.tv_usec = 10000; + } + FD_ZERO(&fd); + FD_SET(soap->socket, &fd); +#ifdef WITH_OPENSSL + if (soap->ssl && r == SSL_ERROR_WANT_READ) + r = select((int)soap->socket + 1, &fd, NULL, &fd, &timeout); + else + r = select((int)soap->socket + 1, NULL, &fd, &fd, &timeout); +#else + r = select((int)soap->socket + 1, NULL, &fd, &fd, &timeout); +#endif + if (!r && soap->send_timeout) + { soap->errnum = 0; + return SOAP_EOF; + } + if (r < 0 && (r = soap_socket_errno(soap->socket)) != SOAP_EINTR) + { soap->errnum = r; + return SOAP_EOF; + } +#endif + } + else if (err && err != SOAP_EINTR) + { soap->errnum = err; + return SOAP_EOF; + } + nwritten = 0; /* and call write() again */ + } + } + else + { +#ifdef WITH_FASTCGI + nwritten = fwrite((void*)s, 1, n, stdout); + fflush(stdout); +#else +#ifdef UNDER_CE + nwritten = fwrite(s, 1, n, soap->sendfd); +#else +#ifdef VXWORKS +#ifdef WMW_RPM_IO + if (soap->rpmreqid) + nwritten = (httpBlockPut(soap->rpmreqid, s, n) == 0) ? n : -1; + else +#endif + nwritten = fwrite(s, sizeof(char), n, fdopen(soap->sendfd, "w")); +#else +#ifdef WIN32 + nwritten = _write(soap->sendfd, s, (unsigned int)n); +#else + nwritten = write(soap->sendfd, s, (unsigned int)n); +#endif +#endif +#endif +#endif + if (nwritten <= 0) + { +#ifndef WITH_FASTCGI + err = soap_errno; +#else + err = EOF; +#endif + if (err && err != SOAP_EINTR && err != SOAP_EWOULDBLOCK && err != SOAP_EAGAIN) + { soap->errnum = err; + return SOAP_EOF; + } + nwritten = 0; /* and call write() again */ + } + } + n -= nwritten; + s += nwritten; + } + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_send_raw(struct soap *soap, const char *s, size_t n) +{ if (!n) + return SOAP_OK; + if (soap->mode & SOAP_IO_LENGTH) + { soap->count += n; +#ifndef WITH_LEANER + if (soap->fpreparesend && (soap->mode & SOAP_IO) != SOAP_IO_STORE) + return soap->error = soap->fpreparesend(soap, s, n); +#endif + return SOAP_OK; + } + if (soap->mode & SOAP_IO) + { register size_t i = SOAP_BUFLEN - soap->bufidx; + while (n >= i) + { memcpy(soap->buf + soap->bufidx, s, i); + soap->bufidx = SOAP_BUFLEN; + if (soap_flush(soap)) + return soap->error; + s += i; + n -= i; + i = SOAP_BUFLEN; + } + memcpy(soap->buf + soap->bufidx, s, n); + soap->bufidx += n; + return SOAP_OK; + } + return soap_flush_raw(soap, s, n); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_flush(struct soap *soap) +{ register size_t n = soap->bufidx; + if (n) + { soap->bufidx = 0; +#ifdef WITH_ZLIB + if (soap->mode & SOAP_ENC_ZLIB) + { soap->d_stream->next_in = (Byte*)soap->buf; + soap->d_stream->avail_in = (unsigned int)n; +#ifdef WITH_GZIP + soap->z_crc = crc32(soap->z_crc, (Byte*)soap->buf, (unsigned int)n); +#endif + do + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflating %u bytes\n", soap->d_stream->avail_in)); + if (deflate(soap->d_stream, Z_NO_FLUSH) != Z_OK) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to deflate: %s\n", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS)); + return soap->error = SOAP_ZLIB_ERROR; + } + if (!soap->d_stream->avail_out) + { if (soap_flush_raw(soap, soap->z_buf, SOAP_BUFLEN)) + return soap->error; + soap->d_stream->next_out = (Byte*)soap->z_buf; + soap->d_stream->avail_out = SOAP_BUFLEN; + } + } while (soap->d_stream->avail_in); + } + else +#endif + return soap_flush_raw(soap, soap->buf, n); + } + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_flush_raw(struct soap *soap, const char *s, size_t n) +{ if ((soap->mode & SOAP_IO) == SOAP_IO_STORE) + { register char *t; + if (!(t = (char*)soap_push_block(soap, NULL, n))) + return soap->error = SOAP_EOM; + memcpy(t, s, n); +#ifndef WITH_LEANER + if (soap->fpreparesend) + return soap->error = soap->fpreparesend(soap, s, n); +#endif + return SOAP_OK; + } +#ifndef WITH_LEANER + if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) + { char t[16]; + sprintf(t, "\r\n%lX\r\n" + (soap->chunksize ? 0 : 2), (unsigned long)n); + DBGMSG(SENT, t, strlen(t)); + if ((soap->error = soap->fsend(soap, t, strlen(t)))) + return soap->error; + soap->chunksize += n; + } + DBGMSG(SENT, s, n); +#endif + return soap->error = soap->fsend(soap, s, n); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_send(struct soap *soap, const char *s) +{ if (s) + return soap_send_raw(soap, s, strlen(s)); + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_send2(struct soap *soap, const char *s1, const char *s2) +{ if (soap_send(soap, s1)) + return soap->error; + return soap_send(soap, s2); +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_send3(struct soap *soap, const char *s1, const char *s2, const char *s3) +{ if (soap_send(soap, s1) + || soap_send(soap, s2)) + return soap->error; + return soap_send(soap, s3); +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIO +#ifndef PALM_1 +static size_t +frecv(struct soap *soap, char *s, size_t n) +{ register int r; +#ifndef WITH_LEAN + register int retries = 100; /* max 100 retries with non-blocking sockets */ +#endif + soap->errnum = 0; +#if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT) + if (soap->is) + { if (soap->is->good()) + return soap->is->read(s, (std::streamsize)n).gcount(); + return 0; + } +#endif + if (soap_valid_socket(soap->socket)) + { for (;;) + { +#ifdef WITH_OPENSSL + register int err = 0; +#endif +#ifndef WITH_LEAN +#ifdef WITH_OPENSSL + if (soap->recv_timeout && !soap->ssl) /* SSL: sockets are nonblocking */ +#else + if (soap->recv_timeout) +#endif + { +#ifndef WIN32 + if ((int)soap->socket >= (int)FD_SETSIZE) + { soap->error = SOAP_FD_EXCEEDED; + return 0; /* Hint: MUST increase FD_SETSIZE */ + } +#endif + for (;;) + { struct timeval timeout; + fd_set fd; + if (soap->recv_timeout > 0) + { timeout.tv_sec = soap->recv_timeout; + timeout.tv_usec = 0; + } + else + { timeout.tv_sec = -soap->recv_timeout/1000000; + timeout.tv_usec = -soap->recv_timeout%1000000; + } + FD_ZERO(&fd); + FD_SET(soap->socket, &fd); + r = select((int)soap->socket + 1, &fd, NULL, &fd, &timeout); + if (r > 0) + break; + if (!r) + { soap->errnum = 0; + return 0; + } + r = soap_socket_errno(soap->socket); + if (r != SOAP_EINTR && r != SOAP_EAGAIN && r != SOAP_EWOULDBLOCK) + { soap->errnum = r; + return 0; + } + } + } +#endif +#ifdef WITH_OPENSSL + if (soap->ssl) + { r = SSL_read(soap->ssl, s, (int)n); + if (r > 0) + return (size_t)r; + err = SSL_get_error(soap->ssl, r); + if (err != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) + return 0; + } + else if (soap->bio) + { r = BIO_read(soap->bio, s, (int)n); + if (r > 0) + return (size_t)r; + return 0; + } + else +#endif + { +#ifndef WITH_LEAN + if ((soap->omode & SOAP_IO_UDP)) + { SOAP_SOCKLEN_T k = (SOAP_SOCKLEN_T)sizeof(soap->peer); + memset((void*)&soap->peer, 0, sizeof(soap->peer)); + r = recvfrom(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, &k); /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */ + soap->peerlen = (size_t)k; +#ifndef WITH_IPV6 + soap->ip = ntohl(soap->peer.sin_addr.s_addr); +#endif + } + else +#endif + r = recv(soap->socket, s, (int)n, soap->socket_flags); +#ifdef PALM + /* CycleSyncDisplay(curStatusMsg); */ +#endif + if (r >= 0) + return (size_t)r; + r = soap_socket_errno(soap->socket); + if (r != SOAP_EINTR && r != SOAP_EAGAIN && r != SOAP_EWOULDBLOCK) + { soap->errnum = r; + return 0; + } + } +#ifndef WITH_LEAN + { struct timeval timeout; + fd_set fd; + if (soap->recv_timeout > 0) + { timeout.tv_sec = soap->recv_timeout; + timeout.tv_usec = 0; + } + else if (soap->recv_timeout < 0) + { timeout.tv_sec = -soap->recv_timeout/1000000; + timeout.tv_usec = -soap->recv_timeout%1000000; + } + else + { timeout.tv_sec = 5; + timeout.tv_usec = 0; + } +#ifndef WIN32 + if ((int)soap->socket >= (int)FD_SETSIZE) + { soap->error = SOAP_FD_EXCEEDED; + return 0; /* Hint: MUST increase FD_SETSIZE */ + } +#endif + FD_ZERO(&fd); + FD_SET(soap->socket, &fd); +#ifdef WITH_OPENSSL + if (soap->ssl && err == SSL_ERROR_WANT_WRITE) + r = select((int)soap->socket + 1, NULL, &fd, &fd, &timeout); + else + r = select((int)soap->socket + 1, &fd, NULL, &fd, &timeout); +#else + r = select((int)soap->socket + 1, &fd, NULL, &fd, &timeout); +#endif + if (!r && soap->recv_timeout) + { soap->errnum = 0; + return 0; + } + if (r < 0) + { r = soap_socket_errno(soap->socket); + if (r != SOAP_EINTR && r != SOAP_EAGAIN && r != SOAP_EWOULDBLOCK) + { soap->errnum = r; + return 0; + } + } + if (retries-- <= 0) + { soap->errnum = soap_socket_errno(soap->socket); + return 0; + } + } +#endif +#ifdef PALM + r = soap_socket_errno(soap->socket); + if (r != SOAP_EINTR && retries-- <= 0) + { soap->errnum = r; + return 0; + } +#endif + } + } +#ifdef WITH_FASTCGI + return fread(s, 1, n, stdin); +#else +#ifdef UNDER_CE + return fread(s, 1, n, soap->recvfd); +#else +#ifdef WMW_RPM_IO + if (soap->rpmreqid) + r = httpBlockRead(soap->rpmreqid, s, n); + else +#endif +#ifdef WIN32 + r = _read(soap->recvfd, s, (unsigned int)n); +#else + r = read(soap->recvfd, s, (unsigned int)n); +#endif + if (r >= 0) + return (size_t)r; + soap->errnum = soap_errno; + return 0; +#endif +#endif +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOHTTP +#ifndef PALM_1 +static soap_wchar +soap_getchunkchar(struct soap *soap) +{ if (soap->bufidx < soap->buflen) + return soap->buf[soap->bufidx++]; + soap->bufidx = 0; + soap->buflen = soap->chunkbuflen = soap->frecv(soap, soap->buf, SOAP_BUFLEN); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes from socket %d\n", (unsigned int)soap->buflen, soap->socket)); + DBGMSG(RECV, soap->buf, soap->buflen); + if (soap->buflen) + return soap->buf[soap->bufidx++]; + return EOF; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +static int +soap_isxdigit(int c) +{ return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_recv_raw(struct soap *soap) +{ register size_t ret; +#ifdef WITH_ZLIB + if (soap->mode & SOAP_ENC_ZLIB) + { if (soap->d_stream->next_out == Z_NULL) + return EOF; + if (soap->d_stream->avail_in || !soap->d_stream->avail_out) + { register int r; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflating\n")); + soap->d_stream->next_out = (Byte*)soap->buf; + soap->d_stream->avail_out = SOAP_BUFLEN; + r = inflate(soap->d_stream, Z_NO_FLUSH); + if (r == Z_OK || r == Z_STREAM_END) + { soap->bufidx = 0; + ret = soap->buflen = SOAP_BUFLEN - soap->d_stream->avail_out; + if (soap->zlib_in == SOAP_ZLIB_GZIP) + soap->z_crc = crc32(soap->z_crc, (Byte*)soap->buf, (unsigned int)ret); + if (r == Z_STREAM_END) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated %lu->%lu bytes\n", soap->d_stream->total_in, soap->d_stream->total_out)); + soap->z_ratio_in = (float)soap->d_stream->total_in / (float)soap->d_stream->total_out; + soap->d_stream->next_out = Z_NULL; + } + if (ret) + { soap->count += ret; + DBGLOG(RECV, SOAP_MESSAGE(fdebug, "\n---- decompressed ----\n")); + DBGMSG(RECV, soap->buf, ret); + DBGLOG(RECV, SOAP_MESSAGE(fdebug, "\n----\n")); + return SOAP_OK; + } + } + else if (r != Z_BUF_ERROR) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflate error: %s\n", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS)); + soap->d_stream->next_out = Z_NULL; + soap->error = SOAP_ZLIB_ERROR; + return EOF; + } + } +zlib_again: + if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK && !soap->chunksize) + { memcpy(soap->buf, soap->z_buf, SOAP_BUFLEN); + soap->buflen = soap->z_buflen; + } + DBGLOG(RECV, SOAP_MESSAGE(fdebug, "\n---- compressed ----\n")); + } +#endif +#ifndef WITH_NOHTTP + if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) /* read HTTP chunked transfer */ + { for (;;) + { register soap_wchar c; + char *t, tmp[8]; + if (soap->chunksize) + { soap->buflen = ret = soap->frecv(soap, soap->buf, soap->chunksize > SOAP_BUFLEN ? SOAP_BUFLEN : soap->chunksize); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk: read %u bytes\n", (unsigned int)ret)); + DBGMSG(RECV, soap->buf, ret); + soap->bufidx = 0; + soap->chunksize -= ret; + break; + } + t = tmp; + if (!soap->chunkbuflen) + { soap->chunkbuflen = ret = soap->frecv(soap, soap->buf, SOAP_BUFLEN); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes (chunked) from socket %d\n", (unsigned int)ret, soap->socket)); + DBGMSG(RECV, soap->buf, ret); + soap->bufidx = 0; + if (!ret) + return soap->ahead = EOF; + } + else + soap->bufidx = soap->buflen; + soap->buflen = soap->chunkbuflen; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk size (idx=%u len=%u)\n", (unsigned int)soap->bufidx, (unsigned int)soap->buflen)); + while (!soap_isxdigit((int)(c = soap_getchunkchar(soap)))) + { if ((int)c == EOF) + return soap->ahead = EOF; + } + do + *t++ = (char)c; + while (soap_isxdigit((int)(c = soap_getchunkchar(soap))) && t - tmp < 7); + while ((int)c != EOF && c != '\n') + c = soap_getchunkchar(soap); + if ((int)c == EOF) + return soap->ahead = EOF; + *t = '\0'; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Chunk size = %s (hex)\n", tmp)); + soap->chunksize = soap_strtoul(tmp, &t, 16); + if (!soap->chunksize) + { soap->chunkbuflen = 0; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of chunked message\n")); + while ((int)c != EOF && c != '\n') + c = soap_getchunkchar(soap); + ret = 0; + soap->ahead = EOF; + break; + } + soap->buflen = soap->bufidx + soap->chunksize; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Moving buf len to idx=%u len=%u (%s)\n", (unsigned int)soap->bufidx, (unsigned int)soap->buflen, tmp)); + if (soap->buflen > soap->chunkbuflen) + { soap->buflen = soap->chunkbuflen; + soap->chunksize -= soap->buflen - soap->bufidx; + soap->chunkbuflen = 0; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Passed end of buffer for chunked HTTP (%u bytes left)\n", (unsigned int)(soap->buflen - soap->bufidx))); + } + else if (soap->chunkbuflen) + soap->chunksize = 0; + ret = soap->buflen - soap->bufidx; + if (ret) + break; + } + } + else +#endif + { soap->bufidx = 0; + soap->buflen = ret = soap->frecv(soap, soap->buf, SOAP_BUFLEN); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes from socket %d\n", (unsigned int)ret, soap->socket)); + DBGMSG(RECV, soap->buf, ret); + } +#ifndef WITH_LEANER + if (soap->fpreparerecv && (soap->error = soap->fpreparerecv(soap, soap->buf, ret))) + return soap->error; +#endif +#ifdef WITH_ZLIB + if (soap->mode & SOAP_ENC_ZLIB) + { register int r; + memcpy(soap->z_buf, soap->buf, SOAP_BUFLEN); + soap->d_stream->next_in = (Byte*)(soap->z_buf + soap->bufidx); + soap->d_stream->avail_in = (unsigned int)ret; + soap->d_stream->next_out = (Byte*)soap->buf; + soap->d_stream->avail_out = SOAP_BUFLEN; + r = inflate(soap->d_stream, Z_NO_FLUSH); + if (r == Z_OK || r == Z_STREAM_END) + { soap->bufidx = 0; + soap->z_buflen = soap->buflen; + soap->buflen = SOAP_BUFLEN - soap->d_stream->avail_out; + if (soap->zlib_in == SOAP_ZLIB_GZIP) + soap->z_crc = crc32(soap->z_crc, (Byte*)soap->buf, (unsigned int)soap->buflen); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated %u bytes\n", (unsigned int)soap->buflen)); + if (ret && !soap->buflen) + goto zlib_again; + ret = soap->buflen; + if (r == Z_STREAM_END) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflated total %lu->%lu bytes\n", soap->d_stream->total_in, soap->d_stream->total_out)); + soap->z_ratio_in = (float)soap->d_stream->total_in / (float)soap->d_stream->total_out; + soap->d_stream->next_out = Z_NULL; + } + DBGLOG(RECV, SOAP_MESSAGE(fdebug, "\n---- decompressed ----\n")); + DBGMSG(RECV, soap->buf, ret); + } + else + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to inflate: (%d) %s\n", r, soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS)); + soap->d_stream->next_out = Z_NULL; + soap->error = SOAP_ZLIB_ERROR; + return EOF; + } + } +#endif + soap->count += ret; + return !ret; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_recv(struct soap *soap) +{ +#ifndef WITH_LEANER + if (soap->mode & SOAP_ENC_DIME) + { if (soap->dime.buflen) + { char *s; + int i; + unsigned char tmp[12]; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "DIME hdr for chunked DIME is in buffer\n")); + soap->count += soap->dime.buflen - soap->buflen; + soap->buflen = soap->dime.buflen; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Skip padding (%ld bytes)\n", -(long)soap->dime.size&3)); + for (i = -(long)soap->dime.size&3; i > 0; i--) + { soap->bufidx++; + if (soap->bufidx >= soap->buflen) + if (soap_recv_raw(soap)) + return EOF; + } + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Get DIME hdr for next chunk\n")); + s = (char*)tmp; + for (i = 12; i > 0; i--) + { *s++ = soap->buf[soap->bufidx++]; + if (soap->bufidx >= soap->buflen) + if (soap_recv_raw(soap)) + return EOF; + } + soap->dime.flags = tmp[0] & 0x7; + soap->dime.size = ((size_t)tmp[8] << 24) | ((size_t)tmp[9] << 16) | ((size_t)tmp[10] << 8) | ((size_t)tmp[11]); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Get DIME chunk (%u bytes)\n", (unsigned int)soap->dime.size)); + if (soap->dime.flags & SOAP_DIME_CF) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "More chunking\n")); + soap->dime.chunksize = soap->dime.size; + if (soap->buflen - soap->bufidx >= soap->dime.size) + { soap->dime.buflen = soap->buflen; + soap->buflen = soap->bufidx + soap->dime.chunksize; + } + else + soap->dime.chunksize -= soap->buflen - soap->bufidx; + } + else + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Last chunk\n")); + soap->dime.buflen = 0; + soap->dime.chunksize = 0; + } + soap->count = soap->buflen - soap->bufidx; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%u bytes remaining\n", (unsigned int)soap->count)); + return SOAP_OK; + } + if (soap->dime.chunksize) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Get next DIME hdr for chunked DIME (%u bytes chunk)\n", (unsigned int)soap->dime.chunksize)); + if (soap_recv_raw(soap)) + return EOF; + if (soap->buflen - soap->bufidx >= soap->dime.chunksize) + { soap->dime.buflen = soap->buflen; + soap->count -= soap->buflen - soap->bufidx - soap->dime.chunksize; + soap->buflen = soap->bufidx + soap->dime.chunksize; + } + else + soap->dime.chunksize -= soap->buflen - soap->bufidx; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%lu bytes remaining, count=%u\n", (unsigned long)(soap->buflen-soap->bufidx), (unsigned int)soap->count)); + return SOAP_OK; + } + } +#endif + return soap_recv_raw(soap); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +soap_wchar +SOAP_FMAC2 +soap_getchar(struct soap *soap) +{ register soap_wchar c; + c = soap->ahead; + if (c) + { if (c != EOF) + soap->ahead = 0; + return c; + } + return soap_get1(soap); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +const struct soap_code_map* +SOAP_FMAC2 +soap_code(const struct soap_code_map *code_map, const char *str) +{ if (code_map && str) + { while (code_map->string) + { if (!strcmp(str, code_map->string)) /* case sensitive */ + return code_map; + code_map++; + } + } + return NULL; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +long +SOAP_FMAC2 +soap_code_int(const struct soap_code_map *code_map, const char *str, long other) +{ if (code_map) + { while (code_map->string) + { if (!soap_tag_cmp(str, code_map->string)) /* case insensitive */ + return code_map->code; + code_map++; + } + } + return other; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_code_str(const struct soap_code_map *code_map, long code) +{ if (!code_map) + return NULL; + while (code_map->code != code && code_map->string) + code_map++; + return code_map->string; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +long +SOAP_FMAC2 +soap_code_bits(const struct soap_code_map *code_map, const char *str) +{ register long bits = 0; + if (code_map) + { while (str && *str) + { const struct soap_code_map *p; + for (p = code_map; p->string; p++) + { register size_t n = strlen(p->string); + if (!strncmp(p->string, str, n) && soap_blank(str[n])) + { bits |= p->code; + str += n; + while (*str > 0 && *str <= 32) + str++; + break; + } + } + if (!p->string) + return 0; + } + } + return bits; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_code_list(struct soap *soap, const struct soap_code_map *code_map, long code) +{ register char *t = soap->tmpbuf; + if (code_map) + { while (code_map->string) + { if (code_map->code & code) + { register const char *s = code_map->string; + if (t != soap->tmpbuf) + *t++ = ' '; + while (*s && t < soap->tmpbuf + sizeof(soap->tmpbuf) - 1) + *t++ = *s++; + if (t == soap->tmpbuf + sizeof(soap->tmpbuf) - 1) + break; + } + code_map++; + } + } + *t = '\0'; + return soap->tmpbuf; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +static soap_wchar +soap_char(struct soap *soap) +{ char tmp[8]; + register int i; + register soap_wchar c; + register char *s = tmp; + for (i = 0; i < 7; i++) + { c = soap_get1(soap); + if (c == ';' || (int)c == EOF) + break; + *s++ = (char)c; + } + *s = '\0'; + if (*tmp == '#') + { if (tmp[1] == 'x' || tmp[1] == 'X') + return soap_strtol(tmp + 2, NULL, 16); + return atol(tmp + 1); + } + if (!strcmp(tmp, "lt")) + return '<'; + if (!strcmp(tmp, "gt")) + return '>'; + if (!strcmp(tmp, "amp")) + return '&'; + if (!strcmp(tmp, "quot")) + return '"'; + if (!strcmp(tmp, "apos")) + return '\''; +#ifndef WITH_LEAN + return (soap_wchar)soap_code_int(html_entity_codes, tmp, SOAP_UNKNOWN_CHAR); +#else + return SOAP_UNKNOWN_CHAR; /* use this to represent unknown code */ +#endif +} +#endif + +/******************************************************************************/ +#ifdef WITH_LEAN +#ifndef PALM_1 +soap_wchar +soap_get0(struct soap *soap) +{ if (soap->bufidx >= soap->buflen && soap_recv(soap)) + return EOF; + return (unsigned char)soap->buf[soap->bufidx]; +} +#endif +#endif + +/******************************************************************************/ +#ifdef WITH_LEAN +#ifndef PALM_1 +soap_wchar +soap_get1(struct soap *soap) +{ if (soap->bufidx >= soap->buflen && soap_recv(soap)) + return EOF; + return (unsigned char)soap->buf[soap->bufidx++]; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +soap_wchar +SOAP_FMAC2 +soap_get(struct soap *soap) +{ register soap_wchar c; + c = soap->ahead; + if (c) + { if ((int)c != EOF) + soap->ahead = 0; + } + else + c = soap_get1(soap); + while ((int)c != EOF) + { if (soap->cdata) + { if (c == ']') + { c = soap_get1(soap); + if (c == ']') + { c = soap_get0(soap); + if (c == '>') + { soap->cdata = 0; + soap_get1(soap); + c = soap_get1(soap); + } + else + { soap_unget(soap, ']'); + return ']'; + } + } + else + { soap_revget1(soap); + return ']'; + } + } + else + return c; + } + switch (c) + { case '<': + do c = soap_get1(soap); + while (soap_blank(c)); + if (c == '!' || c == '?' || c == '%') + { register int k = 1; + if (c == '!') + { c = soap_get1(soap); + if (c == '[') + { do c = soap_get1(soap); + while ((int)c != EOF && c != '['); + if ((int)c == EOF) + break; + soap->cdata = 1; + c = soap_get1(soap); + continue; + } + if (c == '-' && (c = soap_get1(soap)) == '-') + { do + { c = soap_get1(soap); + if (c == '-' && (c = soap_get1(soap)) == '-') + break; + } while ((int)c != EOF); + } + } + else if (c == '?') + c = soap_get_pi(soap); + while ((int)c != EOF) + { if (c == '<') + k++; + else if (c == '>') + { if (--k <= 0) + break; + } + c = soap_get1(soap); + } + if ((int)c == EOF) + break; + c = soap_get1(soap); + continue; + } + if (c == '/') + return SOAP_TT; + soap_revget1(soap); + return SOAP_LT; + case '>': + return SOAP_GT; + case '"': + return SOAP_QT; + case '\'': + return SOAP_AP; + case '&': + return soap_char(soap) | 0x80000000; + } + break; + } + return c; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +static soap_wchar +soap_get_pi(struct soap *soap) +{ char buf[64]; + register char *s = buf; + register int i = sizeof(buf); + register soap_wchar c = soap_getchar(soap); + /* This is a quick way to parse XML PI and we could use a callback instead to + * enable applications to intercept processing instructions */ + while ((int)c != EOF && c != '?') + { if (--i > 0) + { if (soap_blank(c)) + c = ' '; + *s++ = (char)c; + } + c = soap_getchar(soap); + } + *s = '\0'; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "XML PI \n", buf)); + if (!strncmp(buf, "xml ", 4)) + { s = strstr(buf, " encoding="); + if (s && s[10]) + { if (!soap_tag_cmp(s + 11, "iso-8859-1*") + || !soap_tag_cmp(s + 11, "latin1*")) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Switching to latin1 encoding\n")); + soap->mode |= SOAP_ENC_LATIN; + } + else if (!soap_tag_cmp(s + 11, "utf-8*")) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Switching to utf-8 encoding\n")); + soap->mode &= ~SOAP_ENC_LATIN; + } + } + } + if ((int)c != EOF) + c = soap_getchar(soap); + return c; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_move(struct soap *soap, long n) +{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Moving %ld bytes forward\n", (long)n)); + for (; n > 0; n--) + if ((int)soap_getchar(soap) == EOF) + return SOAP_EOF; + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +size_t +SOAP_FMAC2 +soap_tell(struct soap *soap) +{ return soap->count - soap->buflen + soap->bufidx - (soap->ahead != 0); +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_pututf8(struct soap *soap, register unsigned long c) +{ char tmp[16]; + if (c < 0x80 && c > 0) + { *tmp = (char)c; + return soap_send_raw(soap, tmp, 1); + } +#ifndef WITH_LEAN + if (c >= 0x80) + { register char *t = tmp; + if (c < 0x0800) + *t++ = (char)(0xC0 | ((c >> 6) & 0x1F)); + else + { if (c < 0x010000) + *t++ = (char)(0xE0 | ((c >> 12) & 0x0F)); + else + { if (c < 0x200000) + *t++ = (char)(0xF0 | ((c >> 18) & 0x07)); + else + { if (c < 0x04000000) + *t++ = (char)(0xF8 | ((c >> 24) & 0x03)); + else + { *t++ = (char)(0xFC | ((c >> 30) & 0x01)); + *t++ = (char)(0x80 | ((c >> 24) & 0x3F)); + } + *t++ = (char)(0x80 | ((c >> 18) & 0x3F)); + } + *t++ = (char)(0x80 | ((c >> 12) & 0x3F)); + } + *t++ = (char)(0x80 | ((c >> 6) & 0x3F)); + } + *t++ = (char)(0x80 | (c & 0x3F)); + *t = '\0'; + } +#else + sprintf(tmp, "&#%lu;", c); +#endif + return soap_send(soap, tmp); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +soap_wchar +SOAP_FMAC2 +soap_getutf8(struct soap *soap) +{ register soap_wchar c, c1, c2, c3, c4; + c = soap->ahead; + if (c > 0xFF) + { soap->ahead = 0; + return c; + } +again: + c = soap_get(soap); + if (c < 0x80 || (soap->mode & SOAP_ENC_LATIN)) + return c; + c1 = soap_get1(soap); + if (c1 < 0x80) + { soap_revget1(soap); /* doesn't look like this is UTF8 */ + return c; + } + c1 &= 0x3F; + if (c < 0xE0) + return ((soap_wchar)(c & 0x1F) << 6) | c1; + c2 = (soap_wchar)soap_get1(soap) & 0x3F; + if (c == 0xEF && c1 == 0x3B && c2 == 0x3F) /* ignore UTF-8 BOM */ + goto again; + if (c < 0xF0) + return ((soap_wchar)(c & 0x0F) << 12) | (c1 << 6) | c2; + c3 = (soap_wchar)soap_get1(soap) & 0x3F; + if (c < 0xF8) + return ((soap_wchar)(c & 0x07) << 18) | (c1 << 12) | (c2 << 6) | c3; + c4 = (soap_wchar)soap_get1(soap) & 0x3F; + if (c < 0xFC) + return ((soap_wchar)(c & 0x03) << 24) | (c1 << 18) | (c2 << 12) | (c3 << 6) | c4; + return ((soap_wchar)(c & 0x01) << 30) | (c1 << 24) | (c2 << 18) | (c3 << 12) | (c4 << 6) | (soap_wchar)(soap_get1(soap) & 0x3F); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_puthex(struct soap *soap, const unsigned char *s, int n) +{ char d[2]; + register int i; +#ifdef WITH_DOM + if ((soap->mode & SOAP_XML_DOM) && soap->dom) + { if (!(soap->dom->data = soap_s2hex(soap, s, NULL, n))) + return soap->error; + return SOAP_OK; + } +#endif + for (i = 0; i < n; i++) + { register int m = *s++; + d[0] = (char)((m >> 4) + (m > 159 ? '7' : '0')); + m &= 0x0F; + d[1] = (char)(m + (m > 9 ? '7' : '0')); + if (soap_send_raw(soap, d, 2)) + return soap->error; + } + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +unsigned char* +SOAP_FMAC2 +soap_gethex(struct soap *soap, int *n) +{ +#ifdef WITH_DOM + if ((soap->mode & SOAP_XML_DOM) && soap->dom) + { soap->dom->data = soap_string_in(soap, 0, -1, -1); + return (unsigned char*)soap_hex2s(soap, soap->dom->data, NULL, 0, n); + } +#endif +#ifdef WITH_FAST + soap->labidx = 0; + for (;;) + { register char *s; + register size_t i, k; + if (soap_append_lab(soap, NULL, 0)) + return NULL; + s = soap->labbuf + soap->labidx; + k = soap->lablen - soap->labidx; + soap->labidx = soap->lablen; + for (i = 0; i < k; i++) + { register char d1, d2; + register soap_wchar c; + c = soap_get(soap); + if (soap_isxdigit(c)) + { d1 = (char)c; + c = soap_get(soap); + if (soap_isxdigit(c)) + d2 = (char)c; + else + { soap->error = SOAP_TYPE; + return NULL; + } + } + else + { unsigned char *p; + soap_unget(soap, c); + if (n) + *n = (int)(soap->lablen + i - k); + p = (unsigned char*)soap_malloc(soap, soap->lablen + i - k); + if (p) + memcpy(p, soap->labbuf, soap->lablen + i - k); + return p; + } + *s++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0'); + } + } +#else + if (soap_new_block(soap) == NULL) + return NULL; + for (;;) + { register int i; + register char *s = (char*)soap_push_block(soap, NULL, SOAP_BLKLEN); + if (!s) + { soap_end_block(soap, NULL); + return NULL; + } + for (i = 0; i < SOAP_BLKLEN; i++) + { register char d1, d2; + register soap_wchar c = soap_get(soap); + if (soap_isxdigit(c)) + { d1 = (char)c; + c = soap_get(soap); + if (soap_isxdigit(c)) + d2 = (char)c; + else + { soap_end_block(soap, NULL); + soap->error = SOAP_TYPE; + return NULL; + } + } + else + { unsigned char *p; + soap_unget(soap, c); + if (n) + *n = (int)soap_size_block(soap, NULL, i); + p = (unsigned char*)soap_save_block(soap, NULL, 0); + return p; + } + *s++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0'); + } + } +#endif +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_putbase64(struct soap *soap, const unsigned char *s, int n) +{ register int i; + register unsigned long m; + char d[4]; + if (!s) + return SOAP_OK; +#ifdef WITH_DOM + if ((soap->mode & SOAP_XML_DOM) && soap->dom) + { if (!(soap->dom->data = soap_s2base64(soap, s, NULL, n))) + return soap->error; + return SOAP_OK; + } +#endif + for (; n > 2; n -= 3, s += 3) + { m = s[0]; + m = (m << 8) | s[1]; + m = (m << 8) | s[2]; + for (i = 4; i > 0; m >>= 6) + d[--i] = soap_base64o[m & 0x3F]; + if (soap_send_raw(soap, d, 4)) + return soap->error; + } + if (n > 0) + { m = 0; + for (i = 0; i < n; i++) + m = (m << 8) | *s++; + for (; i < 3; i++) + m <<= 8; + for (i++; i > 0; m >>= 6) + d[--i] = soap_base64o[m & 0x3F]; + for (i = 3; i > n; i--) + d[i] = '='; + if (soap_send_raw(soap, d, 4)) + return soap->error; + } + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +unsigned char* +SOAP_FMAC2 +soap_getbase64(struct soap *soap, int *n, int malloc_flag) +{ +#ifdef WITH_DOM + if ((soap->mode & SOAP_XML_DOM) && soap->dom) + { soap->dom->data = soap_string_in(soap, 0, -1, -1); + return (unsigned char*)soap_base642s(soap, soap->dom->data, NULL, 0, n); + } +#endif +#ifdef WITH_FAST + soap->labidx = 0; + for (;;) + { register size_t i, k; + register char *s; + if (soap_append_lab(soap, NULL, 2)) + return NULL; + s = soap->labbuf + soap->labidx; + k = soap->lablen - soap->labidx; + soap->labidx = 3 * (soap->lablen / 3); + if (!s) + return NULL; + if (k > 2) + { for (i = 0; i < k - 2; i += 3) + { register unsigned long m = 0; + register int j = 0; + do + { register soap_wchar c = soap_get(soap); + if (c == '=' || c < 0) + { unsigned char *p; + switch (j) + { case 2: + *s++ = (char)((m >> 4) & 0xFF); + i++; + break; + case 3: + *s++ = (char)((m >> 10) & 0xFF); + *s++ = (char)((m >> 2) & 0xFF); + i += 2; + } + if (n) + *n = (int)(soap->lablen + i - k); + p = (unsigned char*)soap_malloc(soap, soap->lablen + i - k); + if (p) + memcpy(p, soap->labbuf, soap->lablen + i - k); + if (c >= 0) + { while ((int)((c = soap_get(soap)) != EOF) && c != SOAP_LT && c != SOAP_TT) + ; + } + soap_unget(soap, c); + return p; + } + c -= '+'; + if (c >= 0 && c <= 79) + { register int b = soap_base64i[c]; + if (b >= 64) + { soap->error = SOAP_TYPE; + return NULL; + } + m = (m << 6) + b; + j++; + } + else if (!soap_blank(c + '+')) + { soap->error = SOAP_TYPE; + return NULL; + } + } while (j < 4); + *s++ = (char)((m >> 16) & 0xFF); + *s++ = (char)((m >> 8) & 0xFF); + *s++ = (char)(m & 0xFF); + } + } + } +#else + if (soap_new_block(soap) == NULL) + return NULL; + for (;;) + { register int i; + register char *s = (char*)soap_push_block(soap, NULL, 3 * SOAP_BLKLEN); /* must be multiple of 3 */ + if (!s) + { soap_end_block(soap, NULL); + return NULL; + } + for (i = 0; i < SOAP_BLKLEN; i++) + { register unsigned long m = 0; + register int j = 0; + do + { register soap_wchar c = soap_get(soap); + if (c == '=' || c < 0) + { unsigned char *p; + i *= 3; + switch (j) + { case 2: + *s++ = (char)((m >> 4) & 0xFF); + i++; + break; + case 3: + *s++ = (char)((m >> 10) & 0xFF); + *s++ = (char)((m >> 2) & 0xFF); + i += 2; + } + if (n) + *n = (int)soap_size_block(soap, NULL, i); + p = (unsigned char*)soap_save_block(soap, NULL, 0); + if (c >= 0) + { while ((int)((c = soap_get(soap)) != EOF) && c != SOAP_LT && c != SOAP_TT) + ; + } + soap_unget(soap, c); + return p; + } + c -= '+'; + if (c >= 0 && c <= 79) + { int b = soap_base64i[c]; + if (b >= 64) + { soap->error = SOAP_TYPE; + return NULL; + } + m = (m << 6) + b; + j++; + } + else if (!soap_blank(c)) + { soap->error = SOAP_TYPE; + return NULL; + } + } while (j < 4); + *s++ = (char)((m >> 16) & 0xFF); + *s++ = (char)((m >> 8) & 0xFF); + *s++ = (char)(m & 0xFF); + } + } +#endif +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_xop_forward(struct soap *soap, unsigned char **ptr, int *size, char **id, char **type, char **options) +{ /* Check MTOM xop:Include element (within hex/base64Binary) */ + /* TODO: this code to be obsoleted with new import/xop.h conventions */ + int body = soap->body; /* should save type too? */ + if (!soap_peek_element(soap)) + { if (!soap_element_begin_in(soap, "xop:Include", 0, NULL) && *soap->href) + { if (soap_dime_forward(soap, ptr, size, id, type, options)) + return soap->error; + } + if (soap->body && soap_element_end_in(soap, NULL)) + return soap->error; + } + soap->body = body; + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_dime_forward(struct soap *soap, unsigned char **ptr, int *size, char **id, char **type, char **options) +{ struct soap_xlist *xp; + *ptr = NULL; + *size = 0; + *id = NULL; + *type = NULL; + *options = NULL; + if (!*soap->href) + return SOAP_OK; + *id = soap_strdup(soap, soap->href); + xp = (struct soap_xlist*)SOAP_MALLOC(soap, sizeof(struct soap_xlist)); + if (!xp) + return soap->error = SOAP_EOM; + xp->next = soap->xlist; + xp->ptr = ptr; + xp->size = size; + xp->id = *id; + xp->type = type; + xp->options = options; + soap->xlist = xp; + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +char * +SOAP_FMAC2 +soap_strdup(struct soap *soap, const char *s) +{ char *t = NULL; + if (s && (t = (char*)soap_malloc(soap, strlen(s) + 1))) + strcpy(t, s); + return t; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +wchar_t * +SOAP_FMAC2 +soap_wstrdup(struct soap *soap, const wchar_t *s) +{ wchar_t *t = NULL; + if (s) + { size_t n = 0; + while (s[n]) + n++; + if ((t = (wchar_t*)soap_malloc(soap, sizeof(wchar_t)*(n+1)))) + memcpy(t, s, sizeof(wchar_t)*(n+1)); + } + return t; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +struct soap_blist* +SOAP_FMAC2 +soap_new_block(struct soap *soap) +{ struct soap_blist *p; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "New block sequence (prev=%p)\n", soap->blist)); + if (!(p = (struct soap_blist*)SOAP_MALLOC(soap, sizeof(struct soap_blist)))) + { soap->error = SOAP_EOM; + return NULL; + } + p->next = soap->blist; + p->ptr = NULL; + p->size = 0; + soap->blist = p; + return p; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +void* +SOAP_FMAC2 +soap_push_block(struct soap *soap, struct soap_blist *b, size_t n) +{ char *p; + if (!b) + b = soap->blist; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push block of %u bytes (%u bytes total)\n", (unsigned int)n, (unsigned int)b->size + (unsigned int)n)); + if (!(p = (char*)SOAP_MALLOC(soap, n + sizeof(char*) + sizeof(size_t)))) + { soap->error = SOAP_EOM; + return NULL; + } + *(char**)p = b->ptr; + *(size_t*)(p + sizeof(char*)) = n; + b->ptr = p; + b->size += n; + return p + sizeof(char*) + sizeof(size_t); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_pop_block(struct soap *soap, struct soap_blist *b) +{ char *p; + if (!b) + b = soap->blist; + if (!b->ptr) + return; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pop block\n")); + p = b->ptr; + b->size -= *(size_t*)(p + sizeof(char*)); + b->ptr = *(char**)p; + SOAP_FREE(soap, p); +} +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_1 +static void +soap_update_ptrs(struct soap *soap, char *start, char *end, char *p1, char *p2) +{ int i; + register struct soap_ilist *ip = NULL; + register struct soap_flist *fp = NULL; +#ifndef WITH_LEANER + register struct soap_xlist *xp = NULL; +#endif + register void *p, **q; + for (i = 0; i < SOAP_IDHASH; i++) + { for (ip = soap->iht[i]; ip; ip = ip->next) + { if (ip->ptr && (char*)ip->ptr >= start && (char*)ip->ptr < end) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Update id='%s' %p -> %p\n", ip->id, ip->ptr, (char*)ip->ptr + (p1-p2))); + ip->ptr = (char*)ip->ptr + (p1-p2); + } + for (q = &ip->link; q; q = (void**)p) + { p = *q; + if (p && (char*)p >= start && (char*)p < end) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Link update id='%s' %p\n", ip->id, p)); + *q = (char*)p + (p1-p2); + } + } + for (q = &ip->copy; q; q = (void**)p) + { p = *q; + if (p && (char*)p >= start && (char*)p < end) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copy chain update id='%s' %p\n", ip->id, p)); + *q = (char*)p + (p1-p2); + } + } + for (fp = ip->flist; fp; fp = fp->next) + { if ((char*)fp->ptr >= start && (char*)fp->ptr < end) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copy list update id='%s' %p\n", ip->id, fp)); + fp->ptr = (char*)fp->ptr + (p1-p2); + } + } + } + } +#ifndef WITH_LEANER + for (xp = soap->xlist; xp; xp = xp->next) + { if (xp->ptr && (char*)xp->ptr >= start && (char*)xp->ptr < end) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Update id='%s' %p -> %p\n", xp->id?xp->id:SOAP_STR_EOS, xp->ptr, (char*)xp->ptr + (p1-p2))); + xp->ptr = (unsigned char**)((char*)xp->ptr + (p1-p2)); + xp->size = (int*)((char*)xp->size + (p1-p2)); + xp->type = (char**)((char*)xp->type + (p1-p2)); + xp->options = (char**)((char*)xp->options + (p1-p2)); + } + } +#endif +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_1 +static int +soap_has_copies(struct soap *soap, register const char *start, register const char *end) +{ register int i; + register struct soap_ilist *ip = NULL; + register struct soap_flist *fp = NULL; + register const char *p; + for (i = 0; i < SOAP_IDHASH; i++) + { for (ip = soap->iht[i]; ip; ip = ip->next) + { for (p = (const char*)ip->copy; p; p = *(const char**)p) + if (p >= start && p < end) + return SOAP_ERR; + for (fp = ip->flist; fp; fp = fp->next) + if ((const char*)fp->ptr >= start && (const char*)fp->ptr < end) + return SOAP_ERR; + } + } + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_resolve(struct soap *soap) +{ register int i; + register struct soap_ilist *ip = NULL; + register struct soap_flist *fp = NULL; + short flag; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolving forwarded data\n")); + for (i = 0; i < SOAP_IDHASH; i++) + { for (ip = soap->iht[i]; ip; ip = ip->next) + { if (ip->ptr) + { register void *p, **q, *r; + q = (void**)ip->link; + ip->link = NULL; + r = ip->ptr; + DBGLOG(TEST, if (q) SOAP_MESSAGE(fdebug, "Traversing link chain to resolve id='%s'\n", ip->id)); + while (q) + { p = *q; + *q = r; + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "... link %p -> %p\n", q, r)); + q = (void**)p; + } + } + else if (*ip->id == '#') + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Missing data for id='%s'\n", ip->id)); + strcpy(soap->id, ip->id + 1); + return soap->error = SOAP_MISSING_ID; + } + } + } + do + { flag = 0; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolution phase\n")); + for (i = 0; i < SOAP_IDHASH; i++) + { for (ip = soap->iht[i]; ip; ip = ip->next) + { if (ip->ptr && !soap_has_copies(soap, (const char*)ip->ptr, (const char*)ip->ptr + ip->size)) + { if (ip->copy) + { register void *p, **q = (void**)ip->copy; + DBGLOG(TEST, if (q) SOAP_MESSAGE(fdebug, "Traversing copy chain to resolve id='%s'\n", ip->id)); + ip->copy = NULL; + do + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "... copy %p -> %p (%u bytes)\n", ip->ptr, q, (unsigned int)ip->size)); + p = *q; + memcpy(q, ip->ptr, ip->size); + q = (void**)p; + } while (q); + flag = 1; + } + for (fp = ip->flist; fp; fp = ip->flist) + { register unsigned int k = fp->level; + register void *p = ip->ptr; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolving forwarded data type=%d location=%p level=%u,%u id='%s'\n", ip->type, p, ip->level, fp->level, ip->id)); + while (ip->level < k) + { register void **q = (void**)soap_malloc(soap, sizeof(void*)); + if (!q) + return soap->error; + *q = p; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Descending one level, new location=%p holds=%p...\n", q, *q)); + p = (void*)q; + k--; + } + if (fp->fcopy) + fp->fcopy(soap, ip->type, fp->type, fp->ptr, fp->len, p, ip->size); + else + soap_fcopy(soap, ip->type, fp->type, fp->ptr, fp->len, p, ip->size); + ip->flist = fp->next; + SOAP_FREE(soap, fp); + flag = 1; + } + } + } + } + } while (flag); +#ifdef SOAP_DEBUG + for (i = 0; i < SOAP_IDHASH; i++) + { for (ip = soap->iht[i]; ip; ip = ip->next) + { if (ip->copy || ip->flist) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolution error: forwarded data for id='%s' could not be propagated, please report this problem to the developers\n", ip->id)); + } + } + } +#endif + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolution done\n")); + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +size_t +SOAP_FMAC2 +soap_size_block(struct soap *soap, struct soap_blist *b, size_t n) +{ if (!b) + b = soap->blist; + if (b->ptr) + { b->size -= *(size_t*)(b->ptr + sizeof(char*)) - n; + *(size_t*)(b->ptr + sizeof(char*)) = n; + } + return b->size; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +char* +SOAP_FMAC2 +soap_first_block(struct soap *soap, struct soap_blist *b) +{ char *p, *q, *r; + if (!b) + b = soap->blist; + p = b->ptr; + if (!p) + return NULL; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "First block\n")); + r = NULL; + do + { q = *(char**)p; + *(char**)p = r; + r = p; + p = q; + } while (p); + b->ptr = r; + return r + sizeof(char*) + sizeof(size_t); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +char* +SOAP_FMAC2 +soap_next_block(struct soap *soap, struct soap_blist *b) +{ char *p; + if (!b) + b = soap->blist; + p = b->ptr; + if (p) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Next block\n")); + b->ptr = *(char**)p; + SOAP_FREE(soap, p); + if (b->ptr) + return b->ptr + sizeof(char*) + sizeof(size_t); + } + return NULL; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +size_t +SOAP_FMAC2 +soap_block_size(struct soap *soap, struct soap_blist *b) +{ if (!b) + b = soap->blist; + return *(size_t*)(b->ptr + sizeof(char*)); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_end_block(struct soap *soap, struct soap_blist *b) +{ char *p, *q; + if (!b) + b = soap->blist; + if (b) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of block sequence, free all remaining blocks\n")); + for (p = b->ptr; p; p = q) + { q = *(char**)p; + SOAP_FREE(soap, p); + } + if (soap->blist == b) + soap->blist = b->next; + else + { struct soap_blist *bp; + for (bp = soap->blist; bp; bp = bp->next) + { if (bp->next == b) + { bp->next = b->next; + break; + } + } + } + SOAP_FREE(soap, b); + } + DBGLOG(TEST, if (soap->blist) SOAP_MESSAGE(fdebug, "Restore previous block sequence\n")); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +char* +SOAP_FMAC2 +soap_save_block(struct soap *soap, struct soap_blist *b, char *p, int flag) +{ register size_t n; + register char *q, *s; + if (!b) + b = soap->blist; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Save all blocks in contiguous memory space of %u bytes (%p->%p)\n", (unsigned int)b->size, b->ptr, p)); + if (b->size) + { if (!p) + p = (char*)soap_malloc(soap, b->size); + if (p) + { for (s = p, q = soap_first_block(soap, b); q; q = soap_next_block(soap, b)) + { n = soap_block_size(soap, b); +#ifndef WITH_NOIDREF + if (flag) + soap_update_ptrs(soap, q, q + n, s, q); +#endif + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copy %u bytes from %p to %p\n", (unsigned int)n, q, s)); + memcpy(s, q, n); + s += n; + } + } + else + soap->error = SOAP_EOM; + } + soap_end_block(soap, b); + return p; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +char * +SOAP_FMAC2 +soap_putsize(struct soap *soap, const char *type, int size) +{ return soap_putsizes(soap, type, &size, 1); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +char * +SOAP_FMAC2 +soap_putsizes(struct soap *soap, const char *type, const int *size, int dim) +{ return soap_putsizesoffsets(soap, type, size, NULL, dim); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +char * +SOAP_FMAC2 +soap_putsizesoffsets(struct soap *soap, const char *type, const int *size, const int *offset, int dim) +{ int i; + if (!type) + return NULL; + if (soap->version == 2) + { sprintf(soap->type, "%s[%d", type, size[0]); + for (i = 1; i < dim; i++) + sprintf(soap->type + strlen(soap->type), " %d", size[i]); + } + else + { if (offset) + { sprintf(soap->type, "%s[%d", type, size[0] + offset[0]); + for (i = 1; i < dim; i++) + sprintf(soap->type + strlen(soap->type), ",%d", size[i] + offset[i]); + } + else + { sprintf(soap->type, "%s[%d", type, size[0]); + for (i = 1; i < dim; i++) + sprintf(soap->type + strlen(soap->type), ",%d", size[i]); + } + strcat(soap->type, "]"); + } + return soap->type; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +char * +SOAP_FMAC2 +soap_putoffset(struct soap *soap, int offset) +{ return soap_putoffsets(soap, &offset, 1); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +char * +SOAP_FMAC2 +soap_putoffsets(struct soap *soap, const int *offset, int dim) +{ register int i; + sprintf(soap->arrayOffset, "[%d", offset[0]); + for (i = 1; i < dim; i++) + sprintf(soap->arrayOffset + strlen(soap->arrayOffset), ",%d", offset[i]); + strcat(soap->arrayOffset, "]"); + return soap->arrayOffset; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_size(const int *size, int dim) +{ register int i, n = size[0]; + for (i = 1; i < dim; i++) + n *= size[i]; + return n; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_getoffsets(const char *attr, const int *size, int *offset, int dim) +{ register int i, j = 0; + if (offset) + for (i = 0; i < dim && attr && *attr; i++) + { attr++; + j *= size[i]; + j += offset[i] = (int)atol(attr); + attr = strchr(attr, ','); + } + else + for (i = 0; i < dim && attr && *attr; i++) + { attr++; + j *= size[i]; + j += (int)atol(attr); + attr = strchr(attr, ','); + } + return j; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_getsize(const char *attr1, const char *attr2, int *j) +{ register int n, k; + char *s; + *j = 0; + if (!*attr1) + return -1; + if (*attr1 == '[') + attr1++; + n = 1; + for (;;) + { k = (int)soap_strtol(attr1, &s, 10); + n *= k; + if (k < 0 || n > SOAP_MAXARRAYSIZE || s == attr1) + return -1; + attr1 = strchr(s, ','); + if (!attr1) + attr1 = strchr(s, ' '); + if (attr2 && *attr2) + { attr2++; + *j *= k; + k = (int)soap_strtol(attr2, &s, 10); + *j += k; + if (k < 0) + return -1; + attr2 = s; + } + if (!attr1) + break; + attr1++; + } + return n - *j; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_getsizes(const char *attr, int *size, int dim) +{ register int i, k, n; + if (!*attr) + return -1; + i = (int)strlen(attr); + n = 1; + do + { for (i = i-1; i >= 0; i--) + if (attr[i] == '[' || attr[i] == ',' || attr[i] == ' ') + break; + k = (int)atol(attr + i + 1); + n *= size[--dim] = k; + if (k < 0 || n > SOAP_MAXARRAYSIZE) + return -1; + } while (i >= 0 && attr[i] != '['); + return n; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_getposition(const char *attr, int *pos) +{ register int i, n; + if (!*attr) + return -1; + n = 0; + i = 1; + do + { pos[n++] = (int)atol(attr + i); + while (attr[i] && attr[i] != ',' && attr[i] != ']') + i++; + if (attr[i] == ',') + i++; + } while (n < SOAP_MAXDIMS && attr[i] && attr[i] != ']'); + return n; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_push_namespace(struct soap *soap, const char *id, const char *ns) +{ register struct soap_nlist *np; + register struct Namespace *p; + register short i = -1; + register size_t n, k; + n = strlen(id); + k = strlen(ns) + 1; + /* KMD Support both spec versions urn:dslforum-org:cwmp-1-0 and urn:dslforum-org:cwmp-1-1*/ + p = soap->local_namespaces; + if (p) + { for (i = 0; p->id; p++, i++) + { if (p->ns && !strcmp(ns, p->ns)) + { if (p->out) + { SOAP_FREE(soap, p->out); + p->out = NULL; + } + break; + } + if (p->out) + { if (!strcmp(ns, p->out)) + break; + } + else if (p->in) + { if (!soap_tag_cmp(ns, p->in)) + { if ((p->out = (char*)SOAP_MALLOC(soap, k))) + strcpy(p->out, ns); + break; + } + } + } + if (!p || !p->id) + i = -1; + } + if (i >= 0) + k = 0; + np = (struct soap_nlist*)SOAP_MALLOC(soap, sizeof(struct soap_nlist) + n + k); + if (!np) + return soap->error = SOAP_EOM; + np->next = soap->nlist; + soap->nlist = np; + np->level = soap->level; + np->index = i; + strcpy(np->id, id); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push namespace binding (level=%u) '%s' '%s'\n", soap->level, id, ns)); + if (i < 0) + { np->ns = np->id + n + 1; + strcpy(np->ns, ns); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push NOT OK: no match found for '%s' in namespace mapping table (added to stack anyway)\n", ns)); + } + else + { np->ns = NULL; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push OK ('%s' matches '%s' in namespace table)\n", id, p->id)); + } + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_pop_namespace(struct soap *soap) +{ register struct soap_nlist *np, *nq; + for (np = soap->nlist; np && np->level >= soap->level; np = nq) + { nq = np->next; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pop namespace binding (level=%u) '%s'\n", soap->level, np->id)); + SOAP_FREE(soap, np); + } + soap->nlist = np; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_match_namespace(struct soap *soap, const char *id1, const char *id2, size_t n1, size_t n2) +{ register struct soap_nlist *np = soap->nlist; + while (np && (strncmp(np->id, id1, n1) || np->id[n1])) + np = np->next; + if (np) + { if (np->index < 0 + || (soap->local_namespaces[np->index].id + && (strncmp(soap->local_namespaces[np->index].id, id2, n2) + || soap->local_namespaces[np->index].id[n2]))) + return SOAP_NAMESPACE; + return SOAP_OK; + } + if (n1 == 3 && n1 == n2 && !strncmp(id1, "xml", 3) && !strncmp(id1, id2, 3)) + return SOAP_OK; + return soap->error = SOAP_SYNTAX_ERROR; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_current_namespace(struct soap *soap, const char *tag) +{ register struct soap_nlist *np; + register const char *s; + if (!tag || !strncmp(tag, "xml", 3)) + return NULL; + np = soap->nlist; + if (!(s = strchr(tag, ':'))) + { while (np && *np->id) /* find default namespace, if present */ + np = np->next; + } + else + { while (np && (strncmp(np->id, tag, s - tag) || np->id[s - tag])) + np = np->next; + if (!np) + soap->error = SOAP_NAMESPACE; + } + if (np) + { if (np->index >= 0) + return soap->namespaces[np->index].ns; + if (np->ns) + return soap_strdup(soap, np->ns); + } + return NULL; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_tag_cmp(const char *s, const char *t) +{ for (;;) + { register int c1 = *s; + register int c2 = *t; + if (!c1 || c1 == '"') + break; + if (c2 != '-') + { if (c1 != c2) + { if (c1 >= 'A' && c1 <= 'Z') + c1 += 'a' - 'A'; + if (c2 >= 'A' && c2 <= 'Z') + c2 += 'a' - 'A'; + } + if (c1 != c2) + { if (c2 != '*') + return 1; + c2 = *++t; + if (!c2) + return 0; + if (c2 >= 'A' && c2 <= 'Z') + c2 += 'a' - 'A'; + for (;;) + { c1 = *s; + if (!c1 || c1 == '"') + break; + if (c1 >= 'A' && c1 <= 'Z') + c1 += 'a' - 'A'; + if (c1 == c2 && !soap_tag_cmp(s + 1, t + 1)) + return 0; + s++; + } + break; + } + } + s++; + t++; + } + if (*t == '*' && !t[1]) + return 0; + return *t; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_match_tag(struct soap *soap, const char *tag1, const char *tag2) +{ register const char *s, *t; + register int err; + if (!tag1 || !tag2 || !*tag2) + return SOAP_OK; + s = strchr(tag1, ':'); + t = strchr(tag2, ':'); + if (t) + { if (s) + { if (t[1] && SOAP_STRCMP(s + 1, t + 1)) + return SOAP_TAG_MISMATCH; + /* KMD Support both spec versions urn:dslforum-org:cwmp-1-0 and urn:dslforum-org:cwmp-1-1*/ + if (t != tag2 && (err = soap_match_namespace(soap, tag1, tag2, s - tag1, t - tag2))) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Tags '%s' and '%s' match but namespaces differ\n", tag1, tag2)); + if (err == SOAP_NAMESPACE) + return SOAP_TAG_MISMATCH; + return err; + } + } + else if (SOAP_STRCMP(tag1, t + 1)) + { return SOAP_TAG_MISMATCH; + } + else if (t != tag2 && (err = soap_match_namespace(soap, tag1, tag2, 0, t - tag2))) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Tags '%s' and '%s' match but namespaces differ\n", tag1, tag2)); + if (err == SOAP_NAMESPACE) + return SOAP_TAG_MISMATCH; + return err; + } + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Tags and (default) namespaces match: '%s' '%s'\n", tag1, tag2)); + return SOAP_OK; + } + if (s) + { if (SOAP_STRCMP(s + 1, tag2)) + return SOAP_TAG_MISMATCH; + } + else if (SOAP_STRCMP(tag1, tag2)) + return SOAP_TAG_MISMATCH; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Tags match: '%s' '%s'\n", tag1, tag2)); + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_match_array(struct soap *soap, const char *type) +{ if (*soap->arrayType) + if (soap_match_tag(soap, soap->arrayType, type) + && soap_match_tag(soap, soap->arrayType, "xsd:anyType") + && soap_match_tag(soap, soap->arrayType, "xsd:ur-type") + ) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Array type mismatch: '%s' '%s'\n", soap->arrayType, type)); + return SOAP_TAG_MISMATCH; + } + return SOAP_OK; +} +#endif + +/******************************************************************************\ + * + * SSL + * +\******************************************************************************/ + +#ifdef WITH_OPENSSL +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_rand() +{ unsigned char buf[4]; + if (!soap_ssl_init_done) + soap_ssl_init(); + RAND_pseudo_bytes(buf, 4); + return *(int*)buf; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_ssl_server_context(struct soap *soap, unsigned short flags, const char *keyfile, const char *password, const char *cafile, const char *capath, const char *dhfile, const char *randfile, const char *sid) +{ int err; + soap->keyfile = keyfile; + soap->password = password; + soap->cafile = cafile; + soap->capath = capath; + soap->dhfile = dhfile; + soap->randfile = randfile; + soap->ssl_flags = flags | (dhfile == NULL ? SOAP_SSL_RSA : 0); + if (!(err = soap->fsslauth(soap))) + { if (sid) + SSL_CTX_set_session_id_context(soap->ctx, (unsigned char*)sid, (unsigned int)strlen(sid)); + } + return err; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_ssl_client_context(struct soap *soap, unsigned short flags, const char *keyfile, const char *password, const char *cafile, const char *capath, const char *randfile) +{ soap->keyfile = keyfile; + soap->password = password; + soap->cafile = cafile; + soap->capath = capath; + soap->dhfile = NULL; + soap->ssl_flags = flags; + soap->randfile = randfile; + soap->fsslverify = (flags & SOAP_SSL_ALLOW_EXPIRED_CERTIFICATE) == 0 ? ssl_verify_callback : ssl_verify_callback_allow_expired_certificate; + return soap->fsslauth(soap); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_ssl_init() +{ /* Note: for MT systems, the main program MUST call soap_ssl_init() before any threads are started */ + if (!soap_ssl_init_done) + { soap_ssl_init_done = 1; + SSL_library_init(); +#ifndef WITH_LEAN + SSL_load_error_strings(); +#endif + if (!RAND_load_file("/dev/urandom", 1024)) + { char buf[1024]; + RAND_seed(buf, sizeof(buf)); + while (!RAND_status()) + { int r = rand(); + RAND_seed(&r, sizeof(int)); + } + } + } +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +const char * +SOAP_FMAC2 +soap_ssl_error(struct soap *soap, int ret) +{ int err = SSL_get_error(soap->ssl, ret); + const char *msg = soap_code_str(h_ssl_error_codes, err); + if (msg) + strcpy(soap->msgbuf, msg); + else + return ERR_error_string(err, soap->msgbuf); + if (ERR_peek_error()) + { unsigned long r; + strcat(soap->msgbuf, "\n"); + while ((r = ERR_get_error())) + ERR_error_string_n(r, soap->msgbuf + strlen(soap->msgbuf), sizeof(soap->msgbuf) - strlen(soap->msgbuf)); + } + else + { switch (ret) + { case 0: + strcpy(soap->msgbuf, "EOF was observed that violates the protocol. The client probably provided invalid authentication information."); + break; + case -1: + sprintf(soap->msgbuf, "Error observed by underlying BIO: %s", strerror(errno)); + break; + } + } + return soap->msgbuf; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +static int +ssl_password(char *buf, int num, int rwflag, void *userdata) +{ if (num < (int)strlen((char*)userdata) + 1) + return 0; + return (int)strlen(strcpy(buf, (char*)userdata)); +} +#endif + +/******************************************************************************/ +/* This callback is included for future references. It should not be deleted +#ifndef PALM_2 +static DH * +ssl_tmp_dh(SSL *ssl, int is_export, int keylength) +{ static DH *dh512 = NULL; + static DH *dh1024 = NULL; + DH *dh; + switch (keylength) + { case 512: + if (!dh512) + { BIO *bio = BIO_new_file("dh512.pem", "r"); + if (bio) + { dh512 = PEM_read_bio_DHparams(bio, NULL, NULL, NULL); + BIO_free(bio); + return dh512; + } + } + else + return dh512; + default: + if (!dh1024) + { BIO *bio = BIO_new_file("dh1024.pem", "r"); + if (bio) + { dh1024 = PEM_read_bio_DHparams(bio, NULL, NULL, NULL); + BIO_free(bio); + } + } + dh = dh1024; + } + return dh; +} +#endif +*/ + +/******************************************************************************/ +#ifndef PALM_1 +static int +ssl_auth_init(struct soap *soap) +{ long flags; + int mode; + if (!soap_ssl_init_done) + soap_ssl_init(); + ERR_clear_error(); + if (!soap->ctx) + { if (!(soap->ctx = SSL_CTX_new(SSLv23_method()))) + return soap_set_receiver_error(soap, "SSL error", "Can't setup context", SOAP_SSL_ERROR); + /* Alters the behavior of SSL read/write: + SSL_CTX_set_mode(soap->ctx, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_AUTO_RETRY); + */ + } + if (soap->randfile) + { if (!RAND_load_file(soap->randfile, -1)) + return soap_set_receiver_error(soap, "SSL error", "Can't load randomness", SOAP_SSL_ERROR); + } + if (soap->cafile || soap->capath) + { if (!SSL_CTX_load_verify_locations(soap->ctx, soap->cafile, soap->capath)) + return soap_set_receiver_error(soap, "SSL error", "Can't read CA file and directory", SOAP_SSL_ERROR); + if (soap->cafile && (soap->ssl_flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION)) + SSL_CTX_set_client_CA_list(soap->ctx, SSL_load_client_CA_file(soap->cafile)); + } + if (!(soap->ssl_flags & SOAP_SSL_NO_DEFAULT_CA_PATH)) + { if (!SSL_CTX_set_default_verify_paths(soap->ctx)) + return soap_set_receiver_error(soap, "SSL error", "Can't read default CA file and/or directory", SOAP_SSL_ERROR); + } +/* This code assumes a typical scenario, see alternative code below */ + if (soap->keyfile) + { if (!SSL_CTX_use_certificate_chain_file(soap->ctx, soap->keyfile)) + return soap_set_receiver_error(soap, "SSL error", "Can't read certificate key file", SOAP_SSL_ERROR); + if (soap->password) + { SSL_CTX_set_default_passwd_cb_userdata(soap->ctx, (void*)soap->password); + SSL_CTX_set_default_passwd_cb(soap->ctx, ssl_password); + } + if (!SSL_CTX_use_PrivateKey_file(soap->ctx, soap->keyfile, SSL_FILETYPE_PEM)) + return soap_set_receiver_error(soap, "SSL error", "Can't read key file", SOAP_SSL_ERROR); + } +/* Suggested alternative approach to check the key file for certs (cafile=NULL): + if (soap->password) + { SSL_CTX_set_default_passwd_cb_userdata(soap->ctx, (void*)soap->password); + SSL_CTX_set_default_passwd_cb(soap->ctx, ssl_password); + } + if (!soap->cafile || !SSL_CTX_use_certificate_chain_file(soap->ctx, soap->cafile)) + { if (soap->keyfile) + { if (!SSL_CTX_use_certificate_chain_file(soap->ctx, soap->keyfile)) + return soap_set_receiver_error(soap, "SSL error", "Can't read certificate or key file", SOAP_SSL_ERROR); + if (!SSL_CTX_use_PrivateKey_file(soap->ctx, soap->keyfile, SSL_FILETYPE_PEM)) + return soap_set_receiver_error(soap, "SSL error", "Can't read key file", SOAP_SSL_ERROR); + } + } +*/ + if ((soap->ssl_flags & SOAP_SSL_RSA)) + { RSA *rsa = RSA_generate_key(1024, RSA_F4, NULL, NULL); + if (!SSL_CTX_set_tmp_rsa(soap->ctx, rsa)) + { if (rsa) + RSA_free(rsa); + return soap_set_receiver_error(soap, "SSL error", "Can't set RSA key", SOAP_SSL_ERROR); + } + RSA_free(rsa); + } + else if (soap->dhfile) + { DH *dh = 0; + BIO *bio; + bio = BIO_new_file(soap->dhfile, "r"); + if (!bio) + return soap_set_receiver_error(soap, "SSL error", "Can't read DH file", SOAP_SSL_ERROR); + dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL); + BIO_free(bio); + if (SSL_CTX_set_tmp_dh(soap->ctx, dh) < 0) + { if (dh) + DH_free(dh); + return soap_set_receiver_error(soap, "SSL error", "Can't set DH parameters", SOAP_SSL_ERROR); + } + DH_free(dh); + } + flags = (SSL_OP_ALL | SSL_OP_NO_SSLv2); + if ((soap->ssl_flags & SOAP_SSLv3)) + flags |= SSL_OP_NO_TLSv1; + if ((soap->ssl_flags & SOAP_TLSv1)) + flags |= SSL_OP_NO_SSLv3; + SSL_CTX_set_options(soap->ctx, flags); + if ((soap->ssl_flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION)) + mode = (SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT); + else if ((soap->ssl_flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION)) + mode = SSL_VERIFY_PEER; + else + mode = SSL_VERIFY_NONE; + SSL_CTX_set_verify(soap->ctx, mode, soap->fsslverify); +#if (OPENSSL_VERSION_NUMBER < 0x00905100L) + SSL_CTX_set_verify_depth(soap->ctx, 1); +#else + SSL_CTX_set_verify_depth(soap->ctx, 9); +#endif + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +static int +ssl_verify_callback(int ok, X509_STORE_CTX *store) +{ +#ifdef SOAP_DEBUG + if (!ok) + { char data[256]; + X509 *cert = X509_STORE_CTX_get_current_cert(store); + fprintf(stderr, "SSL verify error or warning with certificate at depth %d: %s\n", X509_STORE_CTX_get_error_depth(store), X509_verify_cert_error_string(X509_STORE_CTX_get_error(store))); + X509_NAME_oneline(X509_get_issuer_name(cert), data, sizeof(data)); + fprintf(stderr, "certificate issuer %s\n", data); + X509_NAME_oneline(X509_get_subject_name(cert), data, sizeof(data)); + fprintf(stderr, "certificate subject %s\n", data); + } +#endif + /* Note: return 1 to continue, but unsafe progress will be terminated by SSL */ + return ok; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +static int +ssl_verify_callback_allow_expired_certificate(int ok, X509_STORE_CTX *store) +{ ok = ssl_verify_callback(ok, store); + if (ok == 0 && X509_STORE_CTX_get_error(store) == X509_V_ERR_CERT_HAS_EXPIRED) + { +#ifdef SOAP_DEBUG + fprintf(stderr, "ignoring certificate expiration\n"); +#endif + X509_STORE_CTX_set_error(store, X509_V_OK); + ok = 1; + } + /* Note: return 1 to continue, but unsafe progress will be terminated by SSL */ + return ok; +} +#endif + +/******************************************************************************/ +#ifndef WITH_NOIO +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_ssl_accept(struct soap *soap) +{ BIO *bio; + int retries, r, s; + if (!soap_valid_socket(soap->socket)) + return soap_set_receiver_error(soap, "SSL error", "No socket in soap_ssl_accept()", SOAP_SSL_ERROR); + if (!soap->ctx && (soap->error = soap->fsslauth(soap))) + return SOAP_SSL_ERROR; + if (!soap->ssl) + { soap->ssl = SSL_new(soap->ctx); + if (!soap->ssl) + return soap_set_receiver_error(soap, "SSL error", "SSL_new() failed in soap_ssl_accept()", SOAP_SSL_ERROR); + } + else + SSL_clear(soap->ssl); + soap->imode |= SOAP_ENC_SSL; + soap->omode |= SOAP_ENC_SSL; + /* Set SSL sockets to non-blocking */ + SOAP_SOCKNONBLOCK(soap->socket) + bio = BIO_new_socket((int)soap->socket, BIO_NOCLOSE); + SSL_set_bio(soap->ssl, bio, bio); + retries = 100; /* 10 sec retries, 100 times 0.1 sec */ + while ((r = SSL_accept(soap->ssl)) <= 0) + { int err = SSL_get_error(soap->ssl, r); + if (err == SSL_ERROR_WANT_ACCEPT || err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) + { struct timeval timeout; + fd_set fd; +#ifndef WIN32 + if ((int)soap->socket >= (int)FD_SETSIZE) + return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ +#endif + timeout.tv_sec = 0; + timeout.tv_usec = 100000; + FD_ZERO(&fd); + FD_SET(soap->socket, &fd); + if (err == SSL_ERROR_WANT_READ) + s = select((int)soap->socket + 1, &fd, NULL, &fd, &timeout); + else + s = select((int)soap->socket + 1, NULL, &fd, &fd, &timeout); + if (s < 0 && (s = soap_socket_errno(soap->socket)) != SOAP_EINTR) + { soap->errnum = s; + break; + } + } + else + { soap->errnum = err; + break; + } + if (retries-- <= 0) + break; + } + if (r <= 0) + { soap_set_receiver_error(soap, soap_ssl_error(soap, r), "SSL_accept() failed in soap_ssl_accept()", SOAP_SSL_ERROR); + soap_closesock(soap); + return SOAP_SSL_ERROR; + } + if ((soap->ssl_flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION)) + { X509 *peer; + int err; + if ((err = SSL_get_verify_result(soap->ssl)) != X509_V_OK) + { soap_closesock(soap); + return soap_set_sender_error(soap, X509_verify_cert_error_string(err), "SSL certificate presented by peer cannot be verified in soap_ssl_accept()", SOAP_SSL_ERROR); + } + peer = SSL_get_peer_certificate(soap->ssl); + if (!peer) + { soap_closesock(soap); + return soap_set_sender_error(soap, "SSL error", "No SSL certificate was presented by the peer in soap_ssl_accept()", SOAP_SSL_ERROR); + } + X509_free(peer); + } + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#endif /* WITH_OPENSSL */ + +/******************************************************************************/ +#ifndef WITH_NOIO +#ifndef PALM_1 +static int +tcp_init(struct soap *soap) +{ soap->errmode = 1; +#ifdef WIN32 + if (tcp_done) + return 0; + else + { WSADATA w; + if (WSAStartup(MAKEWORD(1, 1), &w)) + return -1; + tcp_done = 1; + } +#endif + return 0; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_done(struct soap *soap) +{ +#ifdef SOAP_DEBUG + int i; +#endif + if (soap_check_state(soap)) + return; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Done with context\n")); + soap_free_temp(soap); + while (soap->clist) + { struct soap_clist *p = soap->clist->next; + SOAP_FREE(soap, soap->clist); + soap->clist = p; + } + soap->omode &= ~SOAP_IO_UDP; /* to force close the socket */ + soap->keep_alive = 0; /* to force close the socket */ + soap_closesock(soap); +#ifdef WITH_COOKIES + soap_free_cookies(soap); +#endif + while (soap->plugins) + { register struct soap_plugin *p = soap->plugins->next; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Removing plugin '%s'\n", soap->plugins->id)); + if (soap->plugins->fcopy || soap->state == SOAP_INIT) + soap->plugins->fdelete(soap, soap->plugins); + SOAP_FREE(soap, soap->plugins); + soap->plugins = p; + } + soap->fplugin = fplugin; + soap->fmalloc = NULL; +#ifndef WITH_NOHTTP + soap->fpost = http_post; + soap->fget = http_get; + soap->fput = http_put; + soap->fdel = http_del; + soap->fhead = http_head; + soap->fform = NULL; + soap->fposthdr = http_post_header; + soap->fresponse = http_response; + soap->fparse = http_parse; + soap->fparsehdr = http_parse_header; +#endif + soap->fheader = NULL; +#ifndef WITH_NOIO +#ifndef WITH_IPV6 + soap->fresolve = tcp_gethost; +#else + soap->fresolve = NULL; +#endif + soap->faccept = tcp_accept; + soap->fopen = tcp_connect; + soap->fclose = tcp_disconnect; + soap->fclosesocket = tcp_closesocket; + soap->fshutdownsocket = tcp_shutdownsocket; + soap->fsend = fsend; + soap->frecv = frecv; + soap->fpoll = soap_poll; +#else + soap->fopen = NULL; + soap->fclose = NULL; + soap->fpoll = NULL; +#endif +#ifndef WITH_LEANER + soap->fprepareinit = NULL; + soap->fpreparesend = NULL; + soap->fpreparerecv = NULL; + soap->fpreparefinal = NULL; +#endif + soap->fseterror = NULL; + soap->fignore = NULL; + soap->fserveloop = NULL; +#ifdef WITH_OPENSSL + if (soap->session) + { SSL_SESSION_free(soap->session); + soap->session = NULL; + } +#endif + if (soap->state == SOAP_INIT) + { if (soap_valid_socket(soap->master)) + { soap->fclosesocket(soap, soap->master); + soap->master = SOAP_INVALID_SOCKET; + } + } +#ifdef WITH_OPENSSL + if (soap->ssl) + { SSL_free(soap->ssl); + soap->ssl = NULL; + } + if (soap->state == SOAP_INIT) + { if (soap->ctx) + { SSL_CTX_free(soap->ctx); + soap->ctx = NULL; + } + } +#endif +#ifdef WITH_OPENSSL + ERR_remove_state(0); +#endif +#ifdef WITH_C_LOCALE + freelocale(soap->c_locale); +#endif +#ifdef WITH_ZLIB + if (soap->d_stream) + { SOAP_FREE(soap, (void*)soap->d_stream); + soap->d_stream = NULL; + } + if (soap->z_buf) + { SOAP_FREE(soap, (void*)soap->z_buf); + soap->z_buf = NULL; + } +#endif +#ifdef SOAP_DEBUG + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free logfiles\n")); + for (i = 0; i < SOAP_MAXLOGS; i++) + { if (soap->logfile[i]) + { SOAP_FREE(soap, (void*)soap->logfile[i]); + soap->logfile[i] = NULL; + } + soap_close_logfile(soap, i); + } + soap->state = SOAP_NONE; +#endif +#ifdef SOAP_MEM_DEBUG + soap_free_mht(soap); +#endif +} +#endif + +/******************************************************************************/ +#ifndef WITH_NOIO +#ifndef PALM_2 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_cleanup(struct soap *soap) +{ soap_done(soap); +#ifdef WIN32 + if (!tcp_done) + return; + tcp_done = 0; + WSACleanup(); +#endif +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIO +#ifndef PALM_1 +static const char* +tcp_error(struct soap *soap) +{ register const char *msg = NULL; + switch (soap->errmode) + { case 0: + msg = soap_strerror(soap); + break; + case 1: + msg = "WSAStartup failed"; + break; + case 2: + { +#ifndef WITH_LEAN + msg = soap_code_str(h_error_codes, soap->errnum); + if (!msg) +#endif + { sprintf(soap->msgbuf, "TCP/UDP IP error %d", soap->errnum); + msg = soap->msgbuf; + } + } + } + return msg; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOHTTP +#ifndef PALM_1 +static const char* +http_error(struct soap *soap, int status) +{ register const char *msg = SOAP_STR_EOS; +#ifndef WITH_LEAN + msg = soap_code_str(h_http_error_codes, status); + if (!msg) + msg = SOAP_STR_EOS; +#endif + return msg; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_IPV6 +#ifndef WITH_NOIO +#ifndef PALM_1 +static int +tcp_gethost(struct soap *soap, const char *addr, struct in_addr *inaddr) +{ soap_int32 iadd = -1; + struct hostent hostent, *host = &hostent; +#ifdef VXWORKS + int hostint; + /* inet_addr(), and hostGetByName() expect "char *"; addr is a "const char *". */ + iadd = inet_addr((char*)addr); +#else +#if defined(_AIX43) || ((defined(TRU64) || defined(HP_UX)) && defined(HAVE_GETHOSTBYNAME_R)) + struct hostent_data ht_data; +#endif +#ifdef AS400 + iadd = inet_addr((void*)addr); +#else + iadd = inet_addr(addr); +#endif +#endif + if (iadd != -1) + { memcpy(inaddr, &iadd, sizeof(iadd)); + return SOAP_OK; + } +#if defined(__GLIBC__) || (defined(HAVE_GETHOSTBYNAME_R) && (defined(FREEBSD) || defined(__FreeBSD__))) + if (gethostbyname_r(addr, &hostent, soap->buf, SOAP_BUFLEN, &host, &soap->errnum) < 0) + host = NULL; +#elif defined(_AIX43) || ((defined(TRU64) || defined(HP_UX)) && defined(HAVE_GETHOSTBYNAME_R)) + memset((void*)&ht_data, 0, sizeof(ht_data)); + if (gethostbyname_r(addr, &hostent, &ht_data) < 0) + { host = NULL; + soap->errnum = h_errno; + } +#elif defined(HAVE_GETHOSTBYNAME_R) + host = gethostbyname_r(addr, &hostent, soap->buf, SOAP_BUFLEN, &soap->errnum); +#elif defined(VXWORKS) + /* If the DNS resolver library resolvLib has been configured in the vxWorks + * image, a query for the host IP address is sent to the DNS server, if the + * name was not found in the local host table. */ + hostint = hostGetByName((char*)addr); + if (hostint == ERROR) + { host = NULL; + soap->errnum = soap_errno; + } +#else +#ifdef AS400 + if (!(host = gethostbyname((void*)addr))) + soap->errnum = h_errno; +#else + if (!(host = gethostbyname(addr))) + soap->errnum = h_errno; +#endif +#endif + if (!host) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Host name not found\n")); + return SOAP_ERR; + } +#ifdef VXWORKS + inaddr->s_addr = hostint; +#else + memcpy(inaddr, host->h_addr, host->h_length); +#endif + return SOAP_OK; +} +#endif +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIO +#ifndef PALM_1 +static SOAP_SOCKET +tcp_connect(struct soap *soap, const char *endpoint, const char *host, int port) +{ +#ifdef WITH_IPV6 + struct addrinfo hints, *res, *ressave; +#endif + SOAP_SOCKET fd; + int err = 0; +#ifndef WITH_LEAN + int retry = 10; + int len = SOAP_BUFLEN; + int set = 1; +#endif + if (soap_valid_socket(soap->socket)) + soap->fclosesocket(soap, soap->socket); + soap->socket = SOAP_INVALID_SOCKET; + if (tcp_init(soap)) + { soap->errnum = 0; + soap_set_sender_error(soap, tcp_error(soap), "TCP init failed in tcp_connect()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } + soap->errmode = 0; +#ifdef WITH_IPV6 + memset((void*)&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; +#ifndef WITH_LEAN + if ((soap->omode & SOAP_IO_UDP)) + hints.ai_socktype = SOCK_DGRAM; + else +#endif + hints.ai_socktype = SOCK_STREAM; + soap->errmode = 2; + if (soap->proxy_host) + err = getaddrinfo(soap->proxy_host, soap_int2s(soap, soap->proxy_port), &hints, &res); + else + err = getaddrinfo(host, soap_int2s(soap, port), &hints, &res); + if (err) + { soap_set_sender_error(soap, SOAP_GAI_STRERROR(err), "getaddrinfo failed in tcp_connect()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } + ressave = res; +again: + fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + soap->errmode = 0; +#else +#ifndef WITH_LEAN +again: +#endif +#ifndef WITH_LEAN + if ((soap->omode & SOAP_IO_UDP)) + fd = socket(AF_INET, SOCK_DGRAM, 0); + else +#endif + fd = socket(AF_INET, SOCK_STREAM, 0); +#endif + if (!soap_valid_socket(fd)) + { +#ifdef WITH_IPV6 + if (res->ai_next) + { res = res->ai_next; + goto again; + } +#endif + soap->errnum = soap_socket_errno(fd); + soap_set_sender_error(soap, tcp_error(soap), "socket failed in tcp_connect()", SOAP_TCP_ERROR); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } +#ifdef SOCKET_CLOSE_ON_EXEC +#ifdef WIN32 +#ifndef UNDER_CE + SetHandleInformation((HANDLE)fd, HANDLE_FLAG_INHERIT, 0); +#endif +#else + fcntl(fd, F_SETFD, 1); +#endif +#endif +#ifndef WITH_LEAN + if (soap->connect_flags == SO_LINGER) + { struct linger linger; + memset((void*)&linger, 0, sizeof(linger)); + linger.l_onoff = 1; + linger.l_linger = soap->linger_time; + if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) + { soap->errnum = soap_socket_errno(fd); + soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_LINGER failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } + } + else if (soap->connect_flags && setsockopt(fd, SOL_SOCKET, soap->connect_flags, (char*)&set, sizeof(int))) + { soap->errnum = soap_socket_errno(fd); + soap_set_sender_error(soap, tcp_error(soap), "setsockopt failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } + if ((soap->keep_alive || soap->tcp_keep_alive) && setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) + { soap->errnum = soap_socket_errno(fd); + soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } + if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) + { soap->errnum = soap_socket_errno(fd); + soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } + if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) + { soap->errnum = soap_socket_errno(fd); + soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } +#ifdef TCP_KEEPIDLE + if (soap->tcp_keep_idle && setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_KEEPIDLE, (char*)&(soap->tcp_keep_idle), sizeof(int))) + { soap->errnum = soap_socket_errno(fd); + soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_KEEPIDLE failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, (SOAP_SOCKET)fd); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } +#endif +#ifdef TCP_KEEPINTVL + if (soap->tcp_keep_intvl && setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_KEEPINTVL, (char*)&(soap->tcp_keep_intvl), sizeof(int))) + { soap->errnum = soap_socket_errno(fd); + soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_KEEPINTVL failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, (SOAP_SOCKET)fd); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } +#endif +#ifdef TCP_KEEPCNT + if (soap->tcp_keep_cnt && setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_KEEPCNT, (char*)&(soap->tcp_keep_cnt), sizeof(int))) + { soap->errnum = soap_socket_errno(fd); + soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_KEEPCNT failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, (SOAP_SOCKET)fd); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } +#endif +#ifdef TCP_NODELAY + if (!(soap->omode & SOAP_IO_UDP) && setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) + { soap->errnum = soap_socket_errno(fd); + soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } +#endif +#ifdef WITH_IPV6 + if ((soap->omode & SOAP_IO_UDP) && soap->ipv6_multicast_if) + { struct sockaddr_in6 *in6addr = (struct sockaddr_in6*)res->ai_addr; + in6addr->sin6_scope_id = soap->ipv6_multicast_if; + } +#elif defined(IP_MULTICAST_TTL) + if ((soap->omode & SOAP_IO_UDP) && soap->ipv4_multicast_if) + { if (soap->ipv4_multicast_ttl > 0) + { char ttl = (char)(soap->ipv4_multicast_ttl); + if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, (char*)&ttl, sizeof(ttl))) + { soap->errnum = soap_socket_errno(fd); + soap_set_sender_error(soap, tcp_error(soap), "setsockopt IP_MULTICAST_TTL failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); + return SOAP_INVALID_SOCKET; + } + } +#ifndef WINDOWS + if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, (char*)soap->ipv4_multicast_if, sizeof(struct in_addr))) + { soap->errnum = soap_socket_errno(fd); + soap_set_sender_error(soap, tcp_error(soap), "setsockopt IP_MULTICAST_IF failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); + return SOAP_INVALID_SOCKET; + } +#else +#ifndef IP_MULTICAST_IF +#define IP_MULTICAST_IF 2 +#endif + if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, (char*)soap->ipv4_multicast_if, sizeof(struct in_addr))) + { soap->errnum = soap_socket_errno(fd); + soap_set_sender_error(soap, tcp_error(soap), "setsockopt IP_MULTICAST_IF failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); + return SOAP_INVALID_SOCKET; + } +#endif + } +#endif +#endif + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Opening socket %d to host='%s' port=%d\n", fd, host, port)); +#ifndef WITH_IPV6 + soap->peerlen = sizeof(soap->peer); + memset((void*)&soap->peer, 0, sizeof(soap->peer)); + soap->peer.sin_family = AF_INET; + soap->errmode = 2; + if (soap->proxy_host) + { if (soap->fresolve(soap, soap->proxy_host, &soap->peer.sin_addr)) + { soap_set_sender_error(soap, tcp_error(soap), "get proxy host by name failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } + soap->peer.sin_port = htons((short)soap->proxy_port); + } + else + { if (soap->fresolve(soap, host, &soap->peer.sin_addr)) + { soap_set_sender_error(soap, tcp_error(soap), "get host by name failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } + soap->peer.sin_port = htons((short)port); + } + soap->errmode = 0; +#ifndef WITH_LEAN + if ((soap->omode & SOAP_IO_UDP)) + { +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return fd; + } +#endif +#endif +#ifndef WITH_LEAN + if (soap->connect_timeout) + SOAP_SOCKNONBLOCK(fd) + else + SOAP_SOCKBLOCK(fd) +#endif + for (;;) + { +#ifdef WITH_IPV6 + if (connect(fd, res->ai_addr, (int)res->ai_addrlen)) +#else + if (connect(fd, (struct sockaddr*)&soap->peer, sizeof(soap->peer))) +#endif + { err = soap_socket_errno(fd); +#ifndef WITH_LEAN + if (err == SOAP_EADDRINUSE) + { soap->fclosesocket(soap, fd); + if (retry-- > 0) + goto again; + } + else if (soap->connect_timeout && (err == SOAP_EINPROGRESS || err == SOAP_EAGAIN || err == SOAP_EWOULDBLOCK)) + { + SOAP_SOCKLEN_T k; +#ifndef WIN32 + if ((int)fd >= (int)FD_SETSIZE) + { soap->error = SOAP_FD_EXCEEDED; +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; /* Hint: MUST increase FD_SETSIZE */ + } +#endif + for (;;) + { struct timeval timeout; + fd_set fds; + register int r; + if (soap->connect_timeout > 0) + { timeout.tv_sec = soap->connect_timeout; + timeout.tv_usec = 0; + } + else + { timeout.tv_sec = -soap->connect_timeout/1000000; + timeout.tv_usec = -soap->connect_timeout%1000000; + } + FD_ZERO(&fds); + FD_SET(fd, &fds); + r = select((int)fd + 1, NULL, &fds, NULL, &timeout); + if (r > 0) + break; + if (!r) + { soap->errnum = 0; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connect timeout\n")); + soap_set_sender_error(soap, "Timeout", "connect failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } + r = soap_socket_errno(fd); + if (r != SOAP_EINTR) + { soap->errnum = r; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); + soap_set_sender_error(soap, tcp_error(soap), "connect failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } + } + k = (SOAP_SOCKLEN_T)sizeof(soap->errnum); + if (!getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*)&soap->errnum, &k) && !soap->errnum) /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */ + break; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); + if (!soap->errnum) + soap->errnum = soap_socket_errno(fd); + soap_set_sender_error(soap, tcp_error(soap), "connect failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } +#endif +#ifdef WITH_IPV6 + if (res->ai_next) + { res = res->ai_next; + soap->fclosesocket(soap, fd); + goto again; + } +#endif + if (err && err != SOAP_EINTR) + { soap->errnum = err; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); + soap_set_sender_error(soap, tcp_error(soap), "connect failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); +#ifdef WITH_IPV6 + freeaddrinfo(ressave); +#endif + return SOAP_INVALID_SOCKET; + } + } + else + break; + } +#ifdef WITH_IPV6 + soap->peerlen = 0; /* IPv6: already connected so use send() */ + freeaddrinfo(ressave); +#endif +#ifndef WITH_LEAN + if (soap->recv_timeout || soap->send_timeout) + SOAP_SOCKNONBLOCK(fd) + else + SOAP_SOCKBLOCK(fd) +#endif + soap->socket = fd; + soap->imode &= ~SOAP_ENC_SSL; + soap->omode &= ~SOAP_ENC_SSL; + if (!soap_tag_cmp(endpoint, "https:*")) + { +#ifdef WITH_OPENSSL + BIO *bio; + int r; + if (soap->proxy_host) + { soap_mode m = soap->omode; /* make sure we only parse HTTP */ + size_t n = soap->count; /* save the content length */ + char *userid, *passwd; + soap->omode &= ~SOAP_ENC; /* mask IO and ENC */ + soap->omode |= SOAP_IO_BUFFER; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connecting to %s proxy server\n", soap->proxy_http_version)); + sprintf(soap->tmpbuf, "CONNECT %s:%d HTTP/%s", host, port, soap->proxy_http_version); + if (soap_begin_send(soap) + || (soap->error = soap->fposthdr(soap, soap->tmpbuf, NULL))) + { soap->fclosesocket(soap, fd); + return SOAP_INVALID_SOCKET; + } +#ifndef WITH_LEAN + if (soap->proxy_userid && soap->proxy_passwd && strlen(soap->proxy_userid) + strlen(soap->proxy_passwd) < 761) + { sprintf(soap->tmpbuf + 262, "%s:%s", soap->proxy_userid, soap->proxy_passwd); + strcpy(soap->tmpbuf, "Basic "); + soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262)); + if ((soap->error = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf))) + { soap->fclosesocket(soap, fd); + return soap->error; + } + } +#endif + if ((soap->error = soap->fposthdr(soap, NULL, NULL)) + || soap_flush(soap)) + { soap->fclosesocket(soap, fd); + return SOAP_INVALID_SOCKET; + } + soap->omode = m; + m = soap->imode; + soap->imode &= ~SOAP_ENC; /* mask IO and ENC */ + userid = soap->userid; /* preserve */ + passwd = soap->passwd; /* preserve */ + if ((soap->error = soap->fparse(soap))) + { soap->fclosesocket(soap, fd); + return SOAP_INVALID_SOCKET; + } + soap->userid = userid; /* restore */ + soap->passwd = passwd; /* restore */ + soap->imode = m; /* restore */ + soap->count = n; /* restore */ + if (soap_begin_send(soap)) + { soap->fclosesocket(soap, fd); + return SOAP_INVALID_SOCKET; + } + if (endpoint) + strncpy(soap->endpoint, endpoint, sizeof(soap->endpoint)-1); /* restore */ + } + if (!soap->ctx && (soap->error = soap->fsslauth(soap))) + { soap_set_sender_error(soap, "SSL error", "SSL authentication failed in tcp_connect(): check password, key file, and ca file.", SOAP_SSL_ERROR); + soap->fclosesocket(soap, fd); + return SOAP_INVALID_SOCKET; + } + if (!soap->ssl) + { soap->ssl = SSL_new(soap->ctx); + if (!soap->ssl) + { soap->fclosesocket(soap, fd); + soap->error = SOAP_SSL_ERROR; + return SOAP_INVALID_SOCKET; + } + } + else + SSL_clear(soap->ssl); + if (soap->session) + { if (!strcmp(soap->session_host, host) && soap->session_port == port) + SSL_set_session(soap->ssl, soap->session); + SSL_SESSION_free(soap->session); + soap->session = NULL; + } + soap->imode |= SOAP_ENC_SSL; + soap->omode |= SOAP_ENC_SSL; + bio = BIO_new_socket((int)fd, BIO_NOCLOSE); + SSL_set_bio(soap->ssl, bio, bio); +#ifndef WITH_LEAN + /* Connect timeout: set SSL sockets to non-blocking */ + if (soap->connect_timeout) + SOAP_SOCKNONBLOCK(fd) + else + SOAP_SOCKBLOCK(fd) + /* Try connecting until success or timeout */ + do + { if ((r = SSL_connect(soap->ssl)) <= 0) + { int err = SSL_get_error(soap->ssl, r); + if (err != SSL_ERROR_WANT_CONNECT && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) + { soap_set_sender_error(soap, soap_ssl_error(soap, r), "SSL connect failed in tcp_connect()", SOAP_SSL_ERROR); + soap->fclosesocket(soap, fd); + return SOAP_INVALID_SOCKET; + } + if (soap->connect_timeout) + { struct timeval timeout; + fd_set fds; +#ifndef WIN32 + if ((int)soap->socket >= (int)FD_SETSIZE) + { soap->error = SOAP_FD_EXCEEDED; + return SOAP_INVALID_SOCKET; /* Hint: MUST increase FD_SETSIZE */ + } +#endif + if (soap->connect_timeout > 0) + { timeout.tv_sec = soap->connect_timeout; + timeout.tv_usec = 0; + } + else + { timeout.tv_sec = -soap->connect_timeout/1000000; + timeout.tv_usec = -soap->connect_timeout%1000000; + } + FD_ZERO(&fds); + FD_SET(fd, &fds); + if (err == SSL_ERROR_WANT_READ) + r = select((int)fd + 1, &fds, NULL, NULL, &timeout); + else + r = select((int)fd + 1, NULL, &fds, NULL, &timeout); + if (r < 0) + { soap->errnum = 0; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connect timeout\n")); + soap_set_sender_error(soap, "Timeout", "connect failed in tcp_connect()", SOAP_TCP_ERROR); + soap->fclosesocket(soap, fd); + return SOAP_INVALID_SOCKET; + } + } + } + } while (!SSL_is_init_finished(soap->ssl)); + /* Set SSL sockets to nonblocking */ + SOAP_SOCKNONBLOCK(fd) +#endif + /* Check server credentials when required */ + if ((soap->ssl_flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION)) + { int err; + if ((err = SSL_get_verify_result(soap->ssl)) != X509_V_OK) + { soap_set_sender_error(soap, X509_verify_cert_error_string(err), "SSL certificate presented by peer cannot be verified in tcp_connect()", SOAP_SSL_ERROR); + soap->fclosesocket(soap, fd); + return SOAP_INVALID_SOCKET; + } + if (!(soap->ssl_flags & SOAP_SSL_SKIP_HOST_CHECK)) + { X509_NAME *subj; + int ext_count; + int ok = 0; + X509 *peer; + peer = SSL_get_peer_certificate(soap->ssl); + if (!peer) + { soap_set_sender_error(soap, "SSL error", "No SSL certificate was presented by the peer in tcp_connect()", SOAP_SSL_ERROR); + soap->fclosesocket(soap, fd); + return SOAP_INVALID_SOCKET; + } + ext_count = X509_get_ext_count(peer); + if (ext_count > 0) + { int i; + for (i = 0; i < ext_count; i++) + { X509_EXTENSION *ext = X509_get_ext(peer, i); + const char *ext_str = OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(ext))); + if (ext_str && !strcmp(ext_str, "subjectAltName")) + { X509V3_EXT_METHOD *meth = X509V3_EXT_get(ext); + void *ext_data; +#if (OPENSSL_VERSION_NUMBER >= 0x0090800fL) + const unsigned char *data; +#else + unsigned char *data; +#endif + STACK_OF(CONF_VALUE) *val; + int j; + if (!meth) + break; + data = ext->value->data; +#if (OPENSSL_VERSION_NUMBER > 0x00907000L) + if (meth->it) + ext_data = ASN1_item_d2i(NULL, &data, ext->value->length, ASN1_ITEM_ptr(meth->it)); + else + { /* OpenSSL not perfectly portable at this point (?): + Some compilers appear to prefer + meth->d2i(NULL, (const unsigned char**)&data, ... + or + meth->d2i(NULL, &data, ext->value->length); + */ + ext_data = meth->d2i(NULL, &data, ext->value->length); + } +#else + ext_data = meth->d2i(NULL, &data, ext->value->length); +#endif + val = meth->i2v(meth, ext_data, NULL); + for (j = 0; j < sk_CONF_VALUE_num(val); j++) + { CONF_VALUE *nval = sk_CONF_VALUE_value(val, j); + if (nval && !strcmp(nval->name, "DNS") && !strcmp(nval->value, host)) + { ok = 1; + break; + } + } + } + if (ok) + break; + } + } + if (!ok && (subj = X509_get_subject_name(peer))) + { int i = -1; + do + { ASN1_STRING *name; + i = X509_NAME_get_index_by_NID(subj, NID_commonName, i); + if (i == -1) + break; + name = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(subj, i)); + if (name) + { if (!soap_tag_cmp(host, (const char*)name)) + ok = 1; + else + { unsigned char *tmp = NULL; + ASN1_STRING_to_UTF8(&tmp, name); + if (tmp) + { if (!soap_tag_cmp(host, (const char*)tmp)) + ok = 1; + OPENSSL_free(tmp); + } + } + } + } while (!ok); + } + X509_free(peer); + if (!ok) + { soap_set_sender_error(soap, "SSL error", "SSL certificate host name mismatch in tcp_connect()", SOAP_SSL_ERROR); + soap->fclosesocket(soap, fd); + return SOAP_INVALID_SOCKET; + } + } + } +#else + soap->fclosesocket(soap, fd); + soap->error = SOAP_SSL_ERROR; + return SOAP_INVALID_SOCKET; +#endif + } + return fd; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIO +#ifndef PALM_1 +SOAP_FMAC1 +SOAP_SOCKET +SOAP_FMAC2 +soap_bind(struct soap *soap, const char *host, int port, int backlog) +{ +#ifdef WITH_IPV6 + struct addrinfo *addrinfo = NULL; + struct addrinfo hints; + struct addrinfo res; + int err; +#ifdef IPV6_V6ONLY + int unset = 0; +#ifdef SOL_IP + int level = SOL_IP; +#else + int level = IPPROTO_IPV6; +#endif +#endif +#endif +#ifndef WITH_LEAN + int len = SOAP_BUFLEN; + int set = 1; +#endif + if (soap_valid_socket(soap->master)) + { soap->fclosesocket(soap, soap->master); + soap->master = SOAP_INVALID_SOCKET; + } + soap->socket = SOAP_INVALID_SOCKET; + soap->errmode = 1; + if (tcp_init(soap)) + { soap_set_receiver_error(soap, tcp_error(soap), "TCP init failed in soap_bind()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } +#ifdef WITH_IPV6 + memset((void*)&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; +#ifndef WITH_LEAN + if ((soap->omode & SOAP_IO_UDP)) + hints.ai_socktype = SOCK_DGRAM; + else +#endif + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_PASSIVE; + soap->errmode = 2; + err = getaddrinfo(host, soap_int2s(soap, port), &hints, &addrinfo); + if (addrinfo) + { res = *addrinfo; + memcpy(&soap->peer, addrinfo->ai_addr, addrinfo->ai_addrlen); + soap->peerlen = addrinfo->ai_addrlen; + res.ai_addr = (struct sockaddr*)&soap->peer; + res.ai_addrlen = soap->peerlen; + freeaddrinfo(addrinfo); + } + if (err || !addrinfo) + { soap_set_receiver_error(soap, SOAP_GAI_STRERROR(err), "getaddrinfo failed in soap_bind()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } + soap->master = (int)socket(res.ai_family, res.ai_socktype, res.ai_protocol); +#else +#ifndef WITH_LEAN + if ((soap->omode & SOAP_IO_UDP)) + soap->master = (int)socket(AF_INET, SOCK_DGRAM, 0); + else +#endif + soap->master = (int)socket(AF_INET, SOCK_STREAM, 0); +#endif + soap->errmode = 0; + if (!soap_valid_socket(soap->master)) + { soap->errnum = soap_socket_errno(soap->master); + soap_set_receiver_error(soap, tcp_error(soap), "socket failed in soap_bind()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } +#ifndef WITH_LEAN + if ((soap->omode & SOAP_IO_UDP)) + soap->socket = soap->master; +#endif +#ifdef SOCKET_CLOSE_ON_EXEC +#ifdef WIN32 +#ifndef UNDER_CE + SetHandleInformation((HANDLE)soap->master, HANDLE_FLAG_INHERIT, 0); +#endif +#else + fcntl(soap->master, F_SETFD, 1); +#endif +#endif +#ifndef WITH_LEAN + if (soap->bind_flags && setsockopt(soap->master, SOL_SOCKET, soap->bind_flags, (char*)&set, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->master); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt failed in soap_bind()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } + if (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) && setsockopt(soap->master, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->master); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in soap_bind()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } + if (setsockopt(soap->master, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->master); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in soap_bind()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } + if (setsockopt(soap->master, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->master); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in soap_bind()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } +#ifdef TCP_NODELAY + if (!(soap->omode & SOAP_IO_UDP) && setsockopt(soap->master, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->master); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in soap_bind()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } +#endif +#endif +#ifdef WITH_IPV6 +#ifdef IPV6_V6ONLY + if (setsockopt(soap->master, level, IPV6_V6ONLY, (char*)&unset, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->master); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt IPV6_V6ONLY failed in soap_bind()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } +#endif + soap->errmode = 0; + if (bind(soap->master, res.ai_addr, (int)res.ai_addrlen)) + { soap->errnum = soap_socket_errno(soap->master); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not bind to host\n")); + soap_closesock(soap); + soap_set_receiver_error(soap, tcp_error(soap), "bind failed in soap_bind()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } +#else + soap->peerlen = sizeof(soap->peer); + memset((void*)&soap->peer, 0, sizeof(soap->peer)); + soap->peer.sin_family = AF_INET; + soap->errmode = 2; + if (host) + { if (soap->fresolve(soap, host, &soap->peer.sin_addr)) + { soap_set_receiver_error(soap, tcp_error(soap), "get host by name failed in soap_bind()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } + } + else + soap->peer.sin_addr.s_addr = htonl(INADDR_ANY); + soap->peer.sin_port = htons((short)port); + soap->errmode = 0; + if (bind(soap->master, (struct sockaddr*)&soap->peer, (int)soap->peerlen)) + { soap->errnum = soap_socket_errno(soap->master); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not bind to host\n")); + soap_closesock(soap); + soap_set_receiver_error(soap, tcp_error(soap), "bind failed in soap_bind()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } +#endif + if (!(soap->omode & SOAP_IO_UDP) && listen(soap->master, backlog)) + { soap->errnum = soap_socket_errno(soap->master); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not bind to host\n")); + soap_closesock(soap); + soap_set_receiver_error(soap, tcp_error(soap), "listen failed in soap_bind()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } + return soap->master; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIO +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_poll(struct soap *soap) +{ +#ifndef WITH_LEAN + struct timeval timeout; + fd_set rfd, sfd, xfd; + register int r; +#ifndef WIN32 + if ((int)soap->socket >= (int)FD_SETSIZE) + return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ +#endif + timeout.tv_sec = 0; + timeout.tv_usec = 0; + FD_ZERO(&rfd); + FD_ZERO(&sfd); + FD_ZERO(&xfd); + if (soap_valid_socket(soap->socket)) + { FD_SET(soap->socket, &rfd); + FD_SET(soap->socket, &sfd); + FD_SET(soap->socket, &xfd); + r = select((int)soap->socket + 1, &rfd, &sfd, &xfd, &timeout); + if (r > 0 && FD_ISSET(soap->socket, &xfd)) + r = -1; + } + else if (soap_valid_socket(soap->master)) + { FD_SET(soap->master, &sfd); + r = select((int)soap->master + 1, NULL, &sfd, NULL, &timeout); + } + else + return SOAP_OK; + if (r > 0) + { +#ifdef WITH_OPENSSL + if (soap->imode & SOAP_ENC_SSL) + { + if (soap_valid_socket(soap->socket) + && FD_ISSET(soap->socket, &sfd) + && (!FD_ISSET(soap->socket, &rfd) + || SSL_peek(soap->ssl, soap->tmpbuf, 1) > 0)) + return SOAP_OK; + } + else +#endif + if (soap_valid_socket(soap->socket) + && FD_ISSET(soap->socket, &sfd) + && (!FD_ISSET(soap->socket, &rfd) + || recv(soap->socket, soap->tmpbuf, 1, MSG_PEEK) > 0)) + return SOAP_OK; + } + else if (r < 0) + { soap->errnum = soap_socket_errno(soap->master); + if ((soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) && soap_socket_errno(soap->master) != SOAP_EINTR) + { soap_set_receiver_error(soap, tcp_error(soap), "select failed in soap_poll()", SOAP_TCP_ERROR); + return soap->error = SOAP_TCP_ERROR; + } + } + else + soap->errnum = 0; + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Polling: other end down on socket=%d select=%d\n", soap->socket, r)); + return SOAP_EOF; +#else + return SOAP_OK; +#endif +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIO +#ifndef PALM_1 +static SOAP_SOCKET +tcp_accept(struct soap *soap, SOAP_SOCKET s, struct sockaddr *a, int *n) +{ SOAP_SOCKET fd; + fd = accept(s, a, (SOAP_SOCKLEN_T*)n); /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */ +#ifdef SOCKET_CLOSE_ON_EXEC +#ifdef WIN32 +#ifndef UNDER_CE + SetHandleInformation((HANDLE)fd, HANDLE_FLAG_INHERIT, 0); +#endif +#else + fcntl(fd, F_SETFD, FD_CLOEXEC); +#endif +#endif + return fd; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIO +#ifndef PALM_1 +SOAP_FMAC1 +SOAP_SOCKET +SOAP_FMAC2 +soap_accept(struct soap *soap) +{ int n = (int)sizeof(soap->peer); +#ifndef WITH_LEAN + int len = SOAP_BUFLEN; + int set = 1; +#endif + soap->error = SOAP_OK; +#ifndef WITH_LEAN + if ((soap->omode & SOAP_IO_UDP)) + return soap->socket = soap->master; +#endif + memset((void*)&soap->peer, 0, sizeof(soap->peer)); + soap->socket = SOAP_INVALID_SOCKET; + soap->errmode = 0; + soap->keep_alive = 0; + if (soap_valid_socket(soap->master)) + { register int err; + for (;;) + { +#ifndef WITH_LEAN + if (soap->accept_timeout || soap->send_timeout || soap->recv_timeout) + { +#ifndef WIN32 + if ((int)soap->socket >= (int)FD_SETSIZE) + { soap->error = SOAP_FD_EXCEEDED; + return SOAP_INVALID_SOCKET; /* Hint: MUST increase FD_SETSIZE */ + } +#endif + for (;;) + { struct timeval timeout; + fd_set fd; + register int r; + if (soap->accept_timeout > 0) + { timeout.tv_sec = soap->accept_timeout; + timeout.tv_usec = 0; + } + else if (soap->accept_timeout < 0) + { timeout.tv_sec = -soap->accept_timeout/1000000; + timeout.tv_usec = -soap->accept_timeout%1000000; + } + else + { timeout.tv_sec = 60; + timeout.tv_usec = 0; + } + FD_ZERO(&fd); + FD_SET(soap->master, &fd); + r = select((int)soap->master + 1, &fd, &fd, &fd, &timeout); + if (r > 0) + break; + if (!r && soap->accept_timeout) + { soap->errnum = 0; + soap_set_receiver_error(soap, "Timeout", "accept failed in soap_accept()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } + if (r < 0) + { r = soap_socket_errno(soap->master); + if (r != SOAP_EINTR) + { soap->errnum = r; + soap_closesock(soap); + soap_set_sender_error(soap, tcp_error(soap), "accept failed in soap_accept()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } + } + } + } + if (soap->accept_timeout || soap->send_timeout || soap->recv_timeout) + SOAP_SOCKNONBLOCK(soap->master) + else + SOAP_SOCKBLOCK(soap->master) +#endif + soap->socket = soap->faccept(soap, soap->master, (struct sockaddr*)&soap->peer, &n); + soap->peerlen = (size_t)n; + if (soap_valid_socket(soap->socket)) + { +#ifdef WITH_IPV6 +/* Use soap->host to store the numeric form of the remote host */ + getnameinfo((struct sockaddr*)&soap->peer, n, soap->host, sizeof(soap->host), NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV); + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept socket %d from %s\n", soap->socket, soap->host)); + soap->ip = 0; /* info stored in soap->peer and soap->host */ + soap->port = 0; /* info stored in soap->peer and soap->host */ +#else + soap->ip = ntohl(soap->peer.sin_addr.s_addr); + soap->port = (int)ntohs(soap->peer.sin_port); /* does not return port number on some systems */ + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept socket %d at port %d from IP %d.%d.%d.%d\n", soap->socket, soap->port, (int)(soap->ip>>24)&0xFF, (int)(soap->ip>>16)&0xFF, (int)(soap->ip>>8)&0xFF, (int)soap->ip&0xFF)); +#endif +#ifndef WITH_LEAN + if (soap->accept_flags == SO_LINGER) + { struct linger linger; + memset((void*)&linger, 0, sizeof(linger)); + linger.l_onoff = 1; + linger.l_linger = soap->linger_time; + if (setsockopt(soap->socket, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) + { soap->errnum = soap_socket_errno(soap->socket); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_LINGER failed in soap_accept()", SOAP_TCP_ERROR); + soap_closesock(soap); + return SOAP_INVALID_SOCKET; + } + } + else if (soap->accept_flags && setsockopt(soap->socket, SOL_SOCKET, soap->accept_flags, (char*)&set, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->socket); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt failed in soap_accept()", SOAP_TCP_ERROR); + soap_closesock(soap); + return SOAP_INVALID_SOCKET; + } + if (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) && setsockopt(soap->socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->socket); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in soap_accept()", SOAP_TCP_ERROR); + soap_closesock(soap); + return SOAP_INVALID_SOCKET; + } + if (setsockopt(soap->socket, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->socket); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in soap_accept()", SOAP_TCP_ERROR); + soap_closesock(soap); + return SOAP_INVALID_SOCKET; + } + if (setsockopt(soap->socket, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->socket); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in soap_accept()", SOAP_TCP_ERROR); + soap_closesock(soap); + return SOAP_INVALID_SOCKET; + } +#ifdef TCP_NODELAY + if (!(soap->omode & SOAP_IO_UDP) && setsockopt(soap->socket, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->socket); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in soap_accept()", SOAP_TCP_ERROR); + soap_closesock(soap); + return SOAP_INVALID_SOCKET; + } +#endif +#endif + soap->keep_alive = (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) != 0); + return soap->socket; + } + err = soap_socket_errno(soap->socket); + if (err != 0 && err != SOAP_EINTR && err != SOAP_EAGAIN && err != SOAP_EWOULDBLOCK) + { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept failed from %s\n", soap->host)); + soap->errnum = err; + soap_set_receiver_error(soap, tcp_error(soap), "accept failed in soap_accept()", SOAP_TCP_ERROR); + soap_closesock(soap); + return SOAP_INVALID_SOCKET; + } + } + } + else + { soap->errnum = 0; + soap_set_receiver_error(soap, tcp_error(soap), "no master socket in soap_accept()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIO +#ifndef PALM_1 +static int +tcp_disconnect(struct soap *soap) +{ +#ifdef WITH_OPENSSL + if (soap->ssl) + { int r, s = 0; + if (soap->session) + { SSL_SESSION_free(soap->session); + soap->session = NULL; + } + if (*soap->host) + { soap->session = SSL_get1_session(soap->ssl); + if (soap->session) + { strcpy(soap->session_host, soap->host); + soap->session_port = soap->port; + } + } + r = SSL_shutdown(soap->ssl); + if (r == 0) + { if (soap_valid_socket(soap->socket)) + { struct timeval timeout; + fd_set fd; + if (soap->fshutdownsocket(soap, soap->socket, 1)) + { /* + wait up to 10 seconds for close_notify to be sent by peer (if peer not + present, this avoids calling SSL_shutdown() which has a lengthy return + timeout) + */ +#ifndef WIN32 + if ((int)soap->socket < (int)FD_SETSIZE) + { +#endif + timeout.tv_sec = 10; + timeout.tv_usec = 0; + FD_ZERO(&fd); + FD_SET(soap->socket, &fd); + r = select((int)soap->socket + 1, &fd, NULL, &fd, &timeout); + if (r <= 0 && soap_socket_errno(soap->socket) != SOAP_EINTR) + { soap->errnum = 0; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connection lost...\n")); + soap->fclosesocket(soap, soap->socket); + soap->socket = SOAP_INVALID_SOCKET; + ERR_remove_state(0); + return SOAP_OK; + } +#ifndef WIN32 + } +#endif + } + } + r = SSL_shutdown(soap->ssl); + } + if (r != 1) + { s = ERR_get_error(); + if (s) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Shutdown failed: %d\n", SSL_get_error(soap->ssl, r))); + if (soap_valid_socket(soap->socket) && !(soap->omode & SOAP_IO_UDP)) + { soap->fclosesocket(soap, soap->socket); + soap->socket = SOAP_INVALID_SOCKET; + } + } + } + SSL_free(soap->ssl); + soap->ssl = NULL; + if (s) + return SOAP_SSL_ERROR; + ERR_remove_state(0); + } +#endif + if (soap_valid_socket(soap->socket) && !(soap->omode & SOAP_IO_UDP)) + { soap->fshutdownsocket(soap, soap->socket, 2); + soap->fclosesocket(soap, soap->socket); + soap->socket = SOAP_INVALID_SOCKET; + } + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIO +#ifndef PALM_1 +static int +tcp_closesocket(struct soap *soap, SOAP_SOCKET fd) +{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Close socket %d\n", (int)fd)); + return soap_closesocket(fd); +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIO +#ifndef PALM_1 +static int +tcp_shutdownsocket(struct soap *soap, SOAP_SOCKET fd, int how) +{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Shutdown socket %d how=%d\n", (int)fd, how)); + return shutdown(fd, how); +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_closesock(struct soap *soap) +{ register int status = soap->error; + if (status == SOAP_EOF || status == SOAP_TCP_ERROR || status == SOAP_SSL_ERROR || !soap->keep_alive) + { if (soap->fclose && (soap->error = soap->fclose(soap))) + return soap->error; + soap->keep_alive = 0; + } +#ifdef WITH_ZLIB + if (soap->zlib_state == SOAP_ZLIB_DEFLATE) + deflateEnd(soap->d_stream); + else if (soap->zlib_state == SOAP_ZLIB_INFLATE) + inflateEnd(soap->d_stream); + soap->zlib_state = SOAP_ZLIB_NONE; +#endif + return soap->error = status; +} +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +size_t +SOAP_FMAC2 +soap_hash(register const char *s) +{ register size_t h = 0; + while (*s) + h = 65599*h + *s++; + return h % SOAP_IDHASH; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_1 +static void +soap_init_pht(struct soap *soap) +{ register int i; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing pointer hashtable\n")); + soap->pblk = NULL; + soap->pidx = 0; + for (i = 0; i < (int)SOAP_PTRHASH; i++) + soap->pht[i] = NULL; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +struct soap* +SOAP_FMAC2 +soap_new1(soap_mode mode) +{ return soap_new2(mode, mode); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +struct soap* +SOAP_FMAC2 +soap_new() +{ return soap_new2(SOAP_IO_DEFAULT, SOAP_IO_DEFAULT); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +struct soap* +SOAP_FMAC2 +soap_new2(soap_mode imode, soap_mode omode) +{ struct soap *soap = (struct soap*)malloc(sizeof(struct soap)); + if (soap) + soap_init2(soap, imode, omode); + return soap; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_free(struct soap *soap) +{ soap_done(soap); + free(soap); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_del(struct soap *soap) +{ free(soap); +} +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_1 +static void +soap_free_pht(struct soap *soap) +{ register struct soap_pblk *pb, *next; + register int i; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free pointer hashtable\n")); + for (pb = soap->pblk; pb; pb = next) + { next = pb->next; + SOAP_FREE(soap, pb); + } + soap->pblk = NULL; + soap->pidx = 0; + for (i = 0; i < (int)SOAP_PTRHASH; i++) + soap->pht[i] = NULL; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_embed(struct soap *soap, const void *p, const struct soap_array *a, int n, const char *tag, int type) +{ register int i; + struct soap_plist *pp; + if (soap->version != 1) + soap->encoding = 1; + if (a) + i = soap_array_pointer_lookup(soap, p, a, n, type, &pp); + else + i = soap_pointer_lookup(soap, p, type, &pp); + if (i) + { if (soap_is_embedded(soap, pp) + || soap_is_single(soap, pp)) + return 0; + soap_set_embedded(soap, pp); + } + return i; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_pointer_lookup(struct soap *soap, const void *p, int type, struct soap_plist **ppp) +{ register struct soap_plist *pp; + *ppp = NULL; + if (p) + { for (pp = soap->pht[soap_hash_ptr(p)]; pp; pp = pp->next) + { if (pp->ptr == p && pp->type == type) + { *ppp = pp; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Lookup location=%p type=%d id=%d\n", p, type, pp->id)); + return pp->id; + } + } + } + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Lookup location=%p type=%d: not found\n", p, type)); + return 0; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_pointer_enter(struct soap *soap, const void *p, const struct soap_array *a, int n, int type, struct soap_plist **ppp) +{ register size_t h; + register struct soap_plist *pp; + if (!soap->pblk || soap->pidx >= SOAP_PTRBLK) + { register struct soap_pblk *pb = (struct soap_pblk*)SOAP_MALLOC(soap, sizeof(struct soap_pblk)); + if (!pb) + { soap->error = SOAP_EOM; + return 0; + } + pb->next = soap->pblk; + soap->pblk = pb; + soap->pidx = 0; + } + *ppp = pp = &soap->pblk->plist[soap->pidx++]; + if (a) + h = soap_hash_ptr(a->__ptr); + else + h = soap_hash_ptr(p); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pointer enter location=%p array=%p size=%d dim=%d type=%d id=%d\n", p, a?a->__ptr:NULL, a?a->__size:0, n, type, soap->idnum+1)); + pp->next = soap->pht[h]; + pp->type = type; + pp->mark1 = 0; + pp->mark2 = 0; + pp->ptr = p; + pp->array = a; + soap->pht[h] = pp; + pp->id = ++soap->idnum; + return pp->id; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_array_pointer_lookup(struct soap *soap, const void *p, const struct soap_array *a, int n, int type, struct soap_plist **ppp) +{ register struct soap_plist *pp; + *ppp = NULL; + if (!p || !a->__ptr) + return 0; + for (pp = soap->pht[soap_hash_ptr(a->__ptr)]; pp; pp = pp->next) + { if (pp->type == type && pp->array && pp->array->__ptr == a->__ptr) + { register int i; + for (i = 0; i < n; i++) + if (((const int*)&pp->array->__size)[i] != ((const int*)&a->__size)[i]) + break; + if (i == n) + { *ppp = pp; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Array lookup location=%p type=%d id=%d\n", a->__ptr, type, pp->id)); + return pp->id; + } + } + } + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Array lookup location=%p type=%d: not found\n", a->__ptr, type)); + return 0; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_begin_count(struct soap *soap) +{ soap_free_ns(soap); +#ifndef WITH_LEANER + if ((soap->mode & SOAP_ENC_DIME) || (soap->omode & SOAP_ENC_DIME)) + soap->mode = soap->omode | SOAP_IO_LENGTH | SOAP_ENC_DIME; + else +#endif + { soap->mode = soap->omode; + if ((soap->mode & SOAP_IO) == SOAP_IO_STORE + || (((soap->mode & SOAP_IO) == SOAP_IO_CHUNK || (soap->mode & SOAP_ENC_XML)) +#ifndef WITH_LEANER + && !soap->fpreparesend +#endif + )) + soap->mode &= ~SOAP_IO_LENGTH; + else + soap->mode |= SOAP_IO_LENGTH; + } +#ifdef WITH_ZLIB + if ((soap->mode & SOAP_ENC_ZLIB) && (soap->mode & SOAP_IO) == SOAP_IO_FLUSH) + { if (!(soap->mode & SOAP_ENC_DIME)) + soap->mode &= ~SOAP_IO_LENGTH; + if (soap->mode & SOAP_ENC_XML) + soap->mode |= SOAP_IO_BUFFER; + else + soap->mode |= SOAP_IO_STORE; + } +#endif + if (!soap->encodingStyle && !(soap->mode & SOAP_XML_GRAPH)) + soap->mode |= SOAP_XML_TREE; +#ifndef WITH_LEANER + if ((soap->mode & SOAP_ENC_MTOM) && (soap->mode & SOAP_ENC_DIME)) + soap->mode |= SOAP_ENC_MIME; + else + soap->mode &= ~SOAP_ENC_MTOM; + if (soap->mode & SOAP_ENC_MIME) + soap_select_mime_boundary(soap); + soap->dime.list = soap->dime.last; /* keep track of last DIME attachment */ +#endif + soap->count = 0; + soap->ns = 0; + soap->null = 0; + soap->position = 0; + soap->mustUnderstand = 0; + soap->encoding = 0; + soap->part = SOAP_BEGIN; + soap->idnum = 0; + soap_clr_attr(soap); + soap_set_local_namespaces(soap); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin count phase (socket=%d mode=0x%x count=%lu)\n", soap->socket, soap->mode, (unsigned long)soap->count)); +#ifndef WITH_LEANER + soap->dime.count = 0; /* count # of attachments */ + soap->dime.size = 0; /* accumulate total size of attachments */ + if (soap->fprepareinit && (soap->mode & SOAP_IO) != SOAP_IO_STORE) + return soap->error = soap->fprepareinit(soap); +#endif + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_end_count(struct soap *soap) +{ +#ifndef WITH_LEANER + if (soap->fpreparefinal) + return soap->error = soap->fpreparefinal(soap); +#endif + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of count phase\n")); + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_begin_send(struct soap *soap) +{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing for output\n")); + soap_free_ns(soap); + soap->error = SOAP_OK; + soap->mode = soap->omode | (soap->mode & (SOAP_IO_LENGTH | SOAP_ENC_DIME)); +#ifdef WITH_ZLIB + if ((soap->mode & SOAP_ENC_ZLIB) && (soap->mode & SOAP_IO) == SOAP_IO_FLUSH) + { if (soap->mode & SOAP_ENC_XML) + soap->mode |= SOAP_IO_BUFFER; + else + soap->mode |= SOAP_IO_STORE; + } +#endif +#ifndef WITH_LEAN + if ((soap->mode & SOAP_IO_UDP)) + { soap->mode |= SOAP_ENC_XML; + if (soap->count > SOAP_BUFLEN) + return soap->error = SOAP_UDP_ERROR; + } +#endif + if ((soap->mode & SOAP_IO) == SOAP_IO_FLUSH && soap_valid_socket(soap->socket)) + { if (soap->count || (soap->mode & SOAP_IO_LENGTH) || (soap->mode & SOAP_ENC_XML)) + soap->mode |= SOAP_IO_BUFFER; + else + soap->mode |= SOAP_IO_STORE; + } + soap->mode &= ~SOAP_IO_LENGTH; + if ((soap->mode & SOAP_IO) == SOAP_IO_STORE) + if (soap_new_block(soap) == NULL) + return soap->error; + if (!(soap->mode & SOAP_IO_KEEPALIVE)) + soap->keep_alive = 0; + if (!soap->encodingStyle && !(soap->mode & SOAP_XML_GRAPH)) + soap->mode |= SOAP_XML_TREE; +#ifndef WITH_LEANER + if ((soap->mode & SOAP_ENC_MTOM) && (soap->mode & SOAP_ENC_DIME)) + { soap->mode |= SOAP_ENC_MIME; + soap->mode &= ~SOAP_ENC_DIME; + } + else + soap->mode &= ~SOAP_ENC_MTOM; + if (soap->mode & SOAP_ENC_MIME) + soap_select_mime_boundary(soap); +#ifdef WIN32 +#ifndef UNDER_CE +#ifndef WITH_FASTCGI + if (!soap_valid_socket(soap->socket)) /* Set win32 stdout or soap->sendfd to BINARY, e.g. to support DIME */ + _setmode(soap->sendfd, _O_BINARY); +#endif +#endif +#endif +#endif + if (soap->mode & SOAP_IO) + { soap->bufidx = 0; + soap->buflen = 0; + } + soap->chunksize = 0; + soap->ns = 0; + soap->null = 0; + soap->position = 0; + soap->mustUnderstand = 0; + soap->encoding = 0; + soap->idnum = 0; + soap->level = 0; + soap_clr_attr(soap); + soap_set_local_namespaces(soap); +#ifdef WITH_ZLIB + soap->z_ratio_out = 1.0; + if ((soap->mode & SOAP_ENC_ZLIB) && soap->zlib_state != SOAP_ZLIB_DEFLATE) + { if (!soap->z_buf) + soap->z_buf = (char*)SOAP_MALLOC(soap, SOAP_BUFLEN); + soap->d_stream->next_out = (Byte*)soap->z_buf; + soap->d_stream->avail_out = SOAP_BUFLEN; +#ifdef WITH_GZIP + if (soap->zlib_out != SOAP_ZLIB_DEFLATE) + { memcpy(soap->z_buf, "\37\213\10\0\0\0\0\0\0\377", 10); + soap->d_stream->next_out = (Byte*)soap->z_buf + 10; + soap->d_stream->avail_out = SOAP_BUFLEN - 10; + soap->z_crc = crc32(0L, NULL, 0); + soap->zlib_out = SOAP_ZLIB_GZIP; + if (deflateInit2(soap->d_stream, soap->z_level, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY) != Z_OK) + return soap->error = SOAP_ZLIB_ERROR; + } + else +#endif + if (deflateInit(soap->d_stream, soap->z_level) != Z_OK) + return soap->error = SOAP_ZLIB_ERROR; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflate initialized\n")); + soap->zlib_state = SOAP_ZLIB_DEFLATE; + } +#endif +#ifdef WITH_OPENSSL + if (soap->ssl) + ERR_clear_error(); +#endif + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin send phase (socket=%d mode=0x%x count=%lu)\n", soap->socket, soap->mode, (unsigned long)soap->count)); + soap->part = SOAP_BEGIN; +#ifndef WITH_LEANER + if (soap->fprepareinit && (soap->mode & SOAP_IO) == SOAP_IO_STORE) + soap->fprepareinit(soap); +#endif + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_embedded(struct soap *soap, const void *p, int t) +{ struct soap_plist *pp; + if (soap_pointer_lookup(soap, p, t, &pp)) + { pp->mark1 = 1; + pp->mark2 = 1; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Embedded %p type=%d mark set to 1\n", p, t)); + } +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_reference(struct soap *soap, const void *p, int t) +{ struct soap_plist *pp; + if (!p || (soap->mode & SOAP_XML_TREE)) + return 1; + if (soap_pointer_lookup(soap, p, t, &pp)) + { if (pp->mark1 == 0) + { pp->mark1 = 2; + pp->mark2 = 2; + } + } + else if (soap_pointer_enter(soap, p, NULL, 0, t, &pp)) + { pp->mark1 = 0; + pp->mark2 = 0; + } + else + return 1; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Reference %p type=%d (%d %d)\n", p, t, (int)pp->mark1, (int)pp->mark2)); + return pp->mark1; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_array_reference(struct soap *soap, const void *p, const struct soap_array *a, int n, int t) +{ register int i; + struct soap_plist *pp; + if (!p || !a->__ptr) + return 1; + i = soap_array_pointer_lookup(soap, p, a, n, t, &pp); + if (i) + { if (pp->mark1 == 0) + { pp->mark1 = 2; + pp->mark2 = 2; + } + } + else if (!soap_pointer_enter(soap, p, a, n, t, &pp)) + return 1; + else + { pp->mark1 = 0; + pp->mark2 = 0; + } + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Array reference %p ptr=%p dim=%d type=%d (%d %d)\n", p, a->__ptr, n, t, (int)pp->mark1, (int)pp->mark2)); + return pp->mark1; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_embedded_id(struct soap *soap, int id, const void *p, int t) +{ struct soap_plist *pp = NULL; + if (soap->mode & SOAP_XML_TREE) + return id; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Embedded_id %p type=%d id=%d\n", p, t, id)); + if (soap->version == 1 && soap->encodingStyle && !(soap->mode & SOAP_XML_GRAPH) && soap->part != SOAP_IN_HEADER) + { if (id < 0) + { id = soap_pointer_lookup(soap, p, t, &pp); + if (id) + { if (soap->mode & SOAP_IO_LENGTH) + pp->mark1 = 2; + else + pp->mark2 = 2; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Embedded_id multiref id=%d %p type=%d = (%d %d)\n", id, p, t, (int)pp->mark1, (int)pp->mark2)); + } + return -1; + } + return id; + } + if (id < 0) + id = soap_pointer_lookup(soap, p, t, &pp); + else if (id && !soap_pointer_lookup(soap, p, t, &pp)) + return 0; + if (id && pp) + { if (soap->mode & SOAP_IO_LENGTH) + pp->mark1 = 1; + else + pp->mark2 = 1; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Embedded_id embedded ref id=%d %p type=%d = (%d %d)\n", id, p, t, (int)pp->mark1, (int)pp->mark2)); + } + return id; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_is_embedded(struct soap *soap, struct soap_plist *pp) +{ if (!pp) + return 0; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Is embedded? %d %d\n", (int)pp->mark1, (int)pp->mark2)); + if (soap->version == 1 && soap->encodingStyle && !(soap->mode & SOAP_XML_GRAPH) && soap->part != SOAP_IN_HEADER) + { if (soap->mode & SOAP_IO_LENGTH) + return pp->mark1 != 0; + return pp->mark2 != 0; + } + if (soap->mode & SOAP_IO_LENGTH) + return pp->mark1 == 1; + return pp->mark2 == 1; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_is_single(struct soap *soap, struct soap_plist *pp) +{ if (soap->part == SOAP_IN_HEADER) + return 1; + if (!pp) + return 0; + if (soap->mode & SOAP_IO_LENGTH) + return pp->mark1 == 0; + return pp->mark2 == 0; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_set_embedded(struct soap *soap, struct soap_plist *pp) +{ if (!pp) + return; + if (soap->mode & SOAP_IO_LENGTH) + pp->mark1 = 1; + else + pp->mark2 = 1; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_attachment(struct soap *soap, const char *tag, int id, const void *p, const struct soap_array *a, const char *aid, const char *atype, const char *aoptions, int n, const char *type, int t) +{ +#ifndef WITH_NOIDREF + struct soap_plist *pp; + int i; + if (!p || !a->__ptr || (!aid && !atype)) + return soap_element_id(soap, tag, id, p, a, n, type, t); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Attachment tag='%s' id='%s' (%d) type='%s'\n", tag, aid?aid:SOAP_STR_EOS, id, atype?atype:SOAP_STR_EOS)); + i = soap_array_pointer_lookup(soap, p, a, n, t, &pp); + if (!i) + { i = soap_pointer_enter(soap, p, a, n, t, &pp); + if (!i) + { soap->error = SOAP_EOM; + return -1; + } + } + if (id <= 0) + id = i; + if (!aid) + { sprintf(soap->tmpbuf, soap->dime_id_format, id); + aid = soap_strdup(soap, soap->tmpbuf); + } + /* Add MTOM xop:Include element when necessary */ + /* TODO: this code to be obsoleted with new import/xop.h conventions */ + if ((soap->mode & SOAP_ENC_MTOM) && strcmp(tag, "xop:Include")) + { if (soap_element_begin_out(soap, tag, 0, type) + || soap_element_href(soap, "xop:Include", 0, "href", aid) + || soap_element_end_out(soap, tag)) + return soap->error; + } + else if (soap_element_href(soap, tag, 0, "href", aid)) + return soap->error; + if (soap->mode & SOAP_IO_LENGTH) + { if (pp->mark1 != 3) + { struct soap_multipart *content; + if (soap->mode & SOAP_ENC_MTOM) + content = soap_new_multipart(soap, &soap->mime.first, &soap->mime.last, (char*)a->__ptr, a->__size); + else + content = soap_new_multipart(soap, &soap->dime.first, &soap->dime.last, (char*)a->__ptr, a->__size); + if (!content) + { soap->error = SOAP_EOM; + return -1; + } + if (!strncmp(aid, "cid:", 4)) /* RFC 2111 */ + { if (soap->mode & SOAP_ENC_MTOM) + { char *s = (char*)soap_malloc(soap, strlen(aid) - 1); + if (s) + { *s = '<'; + strcpy(s + 1, aid + 4); + strcat(s, ">"); + content->id = s; + } + } + else + content->id = aid + 4; + } + else + content->id = aid; + content->type = atype; + content->options = aoptions; + content->encoding = SOAP_MIME_BINARY; + pp->mark1 = 3; + } + } + else + pp->mark2 = 3; +#endif + return -1; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_1 +static void +soap_init_iht(struct soap *soap) +{ register int i; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing ID hashtable\n")); + for (i = 0; i < SOAP_IDHASH; i++) + soap->iht[i] = NULL; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_1 +static void +soap_free_iht(struct soap *soap) +{ register int i; + register struct soap_ilist *ip = NULL, *p = NULL; + register struct soap_flist *fp = NULL, *fq = NULL; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free ID hashtable\n")); + for (i = 0; i < SOAP_IDHASH; i++) + { for (ip = soap->iht[i]; ip; ip = p) + { for (fp = ip->flist; fp; fp = fq) + { fq = fp->next; + SOAP_FREE(soap, fp); + } + p = ip->next; + SOAP_FREE(soap, ip); + } + soap->iht[i] = NULL; + } +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +struct soap_ilist * +SOAP_FMAC2 +soap_lookup(struct soap *soap, const char *id) +{ register struct soap_ilist *ip = NULL; + for (ip = soap->iht[soap_hash(id)]; ip; ip = ip->next) + if (!strcmp(ip->id, id)) + return ip; + return NULL; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +struct soap_ilist * +SOAP_FMAC2 +soap_enter(struct soap *soap, const char *id) +{ register size_t h; + register struct soap_ilist *ip; + ip = (struct soap_ilist*)SOAP_MALLOC(soap, sizeof(struct soap_ilist) + strlen(id)); + if (ip) + { h = soap_hash(id); + strcpy(ip->id, id); + ip->next = soap->iht[h]; + soap->iht[h] = ip; + } + return ip; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +void* +SOAP_FMAC2 +soap_malloc(struct soap *soap, size_t n) +{ register char *p; + if (!n) + return (void*)SOAP_NON_NULL; + if (!soap) + return SOAP_MALLOC(soap, n); + if (soap->fmalloc) + p = (char*)soap->fmalloc(soap, n); + else + { n += sizeof(short); + n += (-(long)n) & (sizeof(void*)-1); /* align at 4-, 8- or 16-byte boundary */ + if (!(p = (char*)SOAP_MALLOC(soap, n + sizeof(void*) + sizeof(size_t)))) + { soap->error = SOAP_EOM; + return NULL; + } + /* set the canary to detect corruption */ + *(short*)(p + n - sizeof(short)) = (short)SOAP_CANARY; + /* keep chain of alloced cells for destruction */ + *(void**)(p + n) = soap->alist; + *(size_t*)(p + n + sizeof(void*)) = n; + soap->alist = p + n; + } + soap->alloced = 1; + return p; +} +#endif + +/******************************************************************************/ +#ifdef SOAP_MEM_DEBUG +static void +soap_init_mht(struct soap *soap) +{ register int i; + for (i = 0; i < (int)SOAP_PTRHASH; i++) + soap->mht[i] = NULL; +} +#endif + +/******************************************************************************/ +#ifdef SOAP_MEM_DEBUG +static void +soap_free_mht(struct soap *soap) +{ register int i; + register struct soap_mlist *mp, *mq; + for (i = 0; i < (int)SOAP_PTRHASH; i++) + { for (mp = soap->mht[i]; mp; mp = mq) + { mq = mp->next; + if (mp->live) + fprintf(stderr, "%s(%d): malloc() = %p not freed (memory leak or forgot to call soap_end()?)\n", mp->file, mp->line, mp->ptr); + free(mp); + } + soap->mht[i] = NULL; + } +} +#endif + +/******************************************************************************/ +#ifdef SOAP_MEM_DEBUG +SOAP_FMAC1 +void* +SOAP_FMAC2 +soap_track_malloc(struct soap *soap, const char *file, int line, size_t size) +{ register void *p = malloc(size); + if (soap) + { register size_t h = soap_hash_ptr(p); + register struct soap_mlist *mp = (struct soap_mlist*)malloc(sizeof(struct soap_mlist)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): malloc(%lu) = %p\n", file, line, (unsigned long)size, p)); + mp->next = soap->mht[h]; + mp->ptr = p; + mp->file = file; + mp->line = line; + mp->live = 1; + soap->mht[h] = mp; + } + return p; +} +#endif + +/******************************************************************************/ +#ifdef SOAP_MEM_DEBUG +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_track_free(struct soap *soap, const char *file, int line, void *p) +{ register size_t h = soap_hash_ptr(p); + register struct soap_mlist *mp; + for (mp = soap->mht[h]; mp; mp = mp->next) + if (mp->ptr == p) + break; + if (mp) + { if (mp->live) + { free(p); + if (soap->fdebug[SOAP_INDEX_TEST]) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): free(%p)\n", file, line, p)); + } + mp->live = 0; + } + else + fprintf(stderr, "%s(%d): free(%p) double free of pointer malloced at %s(%d)\n", file, line, p, mp->file, mp->line); + } + else + fprintf(stderr, "%s(%d): free(%p) pointer not malloced\n", file, line, p); +} +#endif + +/******************************************************************************/ +#ifdef SOAP_MEM_DEBUG +static void +soap_track_unlink(struct soap *soap, const void *p) +{ register size_t h = soap_hash_ptr(p); + register struct soap_mlist *mp; + for (mp = soap->mht[h]; mp; mp = mp->next) + if (mp->ptr == p) + break; + if (mp) + mp->live = 0; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_dealloc(struct soap *soap, void *p) +{ if (soap_check_state(soap)) + return; + if (p) + { register char **q; + for (q = (char**)&soap->alist; *q; q = *(char***)q) + { + if (*(short*)(char*)(*q - sizeof(short)) != (short)SOAP_CANARY) + { +#ifdef SOAP_MEM_DEBUG + fprintf(stderr, "Data corruption in dynamic allocation (see logs)\n"); +#endif + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Data corruption:\n")); + DBGHEX(TEST, *q - 200, 200); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "\n")); + soap->error = SOAP_MOE; + return; + } + if (p == (void*)(*q - *(size_t*)(*q + sizeof(void*)))) + { *q = **(char***)q; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Freed data at %p\n", p)); + SOAP_FREE(soap, p); + return; + } + } + soap_delete(soap, p); + } + else + { register char *q; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free all soap_malloc() data\n")); + while (soap->alist) + { q = (char*)soap->alist; + if (*(short*)(char*)(q - sizeof(short)) != (short)SOAP_CANARY) + { +#ifdef SOAP_MEM_DEBUG + fprintf(stderr, "Data corruption in dynamic allocation (see logs)\n"); +#endif + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Data corruption:\n")); + DBGHEX(TEST, q - 200, 200); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "\n")); + soap->error = SOAP_MOE; + return; + } + soap->alist = *(void**)q; + q -= *(size_t*)(q + sizeof(void*)); + SOAP_FREE(soap, q); + } + /* we must assume these were deallocated: */ + soap->action = NULL; + soap->fault = NULL; + soap->header = NULL; + soap->userid = NULL; + soap->passwd = NULL; + soap->authrealm = NULL; + soap->http_content = NULL; +#ifndef WITH_LEANER + soap_clr_mime(soap); +#endif + } +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_delete(struct soap *soap, void *p) +{ register struct soap_clist **cp; + if (soap_check_state(soap)) + return; + cp = &soap->clist; + if (p) + { while (*cp) + { if (p == (*cp)->ptr) + { register struct soap_clist *q = *cp; + *cp = q->next; + if (q->fdelete(q)) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not dealloc data %p: deletion callback failed for object type %d\n", q->ptr, q->type)); +#ifdef SOAP_MEM_DEBUG + fprintf(stderr, "new(object type = %d) = %p not freed: deletion callback failed\n", q->type, q->ptr); +#endif + } + SOAP_FREE(soap, q); + return; + } + cp = &(*cp)->next; + } + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not dealloc data %p: address not in list\n", p)); + } + else + { while (*cp) + { register struct soap_clist *q = *cp; + *cp = q->next; + if (q->fdelete(q)) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not dealloc data %p: deletion callback failed for object type %d\n", q->ptr, q->type)); +#ifdef SOAP_MEM_DEBUG + fprintf(stderr, "new(object type = %d) = %p not freed: deletion callback failed\n", q->type, q->ptr); +#endif + } + SOAP_FREE(soap, q); + } + } + soap->fault = NULL; /* this was possibly deallocated */ + soap->header = NULL; /* this was possibly deallocated */ +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +struct soap_clist * +SOAP_FMAC2 +soap_link(struct soap *soap, void *p, int t, int n, int (*fdelete)(struct soap_clist*)) +{ register struct soap_clist *cp; + if ((cp = (struct soap_clist*)SOAP_MALLOC(soap, sizeof(struct soap_clist)))) + { cp->next = soap->clist; + cp->type = t; + cp->size = n; + cp->ptr = p; + cp->fdelete = fdelete; + soap->clist = cp; + } + return cp; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_unlink(struct soap *soap, const void *p) +{ register char **q; + register struct soap_clist **cp; + if (!soap || !p) + return; + for (q = (char**)&soap->alist; *q; q = *(char***)q) + { if (p == (void*)(*q - *(size_t*)(*q + sizeof(void*)))) + { *q = **(char***)q; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unlinked data %p\n", p)); +#ifdef SOAP_MEM_DEBUG + soap_track_unlink(soap, p); +#endif + return; + } + } + for (cp = &soap->clist; *cp; cp = &(*cp)->next) + { if (p == (*cp)->ptr) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unlinked class instance %p\n", p)); + q = (char**)*cp; + *cp = (*cp)->next; + SOAP_FREE(soap, q); + return; + } + } +} +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_lookup_type(struct soap *soap, const char *id) +{ register struct soap_ilist *ip; + if (id && *id) + { ip = soap_lookup(soap, id); + if (ip) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Lookup id='%s' type=%d\n", id, ip->type)); + return ip->type; + } + } + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "lookup type id='%s' NOT FOUND! Need to get it from xsi:type\n", id)); + return 0; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +void* +SOAP_FMAC2 +soap_id_lookup(struct soap *soap, const char *id, void **p, int t, size_t n, unsigned int k) +{ struct soap_ilist *ip; + void **q; + if (!p || !id || !*id) + return p; + ip = soap_lookup(soap, id); /* lookup pointer to hash table entry for string id */ + if (!ip) + { if (!(ip = soap_enter(soap, id))) /* new hash table entry for string id */ + return NULL; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding first href='%s' type=%d %p (%u bytes)\n", id, t, p, (unsigned int)n)); + ip->type = t; + ip->size = n; + ip->link = p; + ip->copy = NULL; + ip->flist = NULL; + ip->ptr = NULL; + ip->level = k; + *p = NULL; + } + else if (ip->ptr) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolved href='%s' type=%d location=%p (%u bytes)\n", id, t, ip->ptr, (unsigned int)n)); + if (ip->type != t) + { strcpy(soap->id, id); + soap->error = SOAP_HREF; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Type incompatibility: href='%s' id-type=%d href-type=%d\n", id, ip->type, t)); + return NULL; + } + while (ip->level < k) + { q = (void**)soap_malloc(soap, sizeof(void*)); + if (!q) + return NULL; + *p = (void*)q; + p = q; + k--; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Descending one level...\n")); + } + *p = ip->ptr; + } + else if (ip->level > k) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolving level %u pointers to href='%s'\n", ip->level, id)); + while (ip->level > k) + { void *s, **r = &ip->link; + q = (void**)ip->link; + while (q) + { *r = (void*)soap_malloc(soap, sizeof(void*)); + if (!*r) + return NULL; + s = *q; + *q = *r; + r = (void**)*r; + q = (void**)s; + } + *r = NULL; + ip->size = n; + ip->copy = NULL; + ip->level = ip->level - 1; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Descending one level...\n")); + } + q = (void**)ip->link; + ip->link = p; + *p = (void*)q; + } + else + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarded href='%s' type=%d location=%p (%u bytes)\n", id, t, p, (unsigned int)n)); + while (ip->level < k) + { q = (void**)soap_malloc(soap, sizeof(void*)); + if (!q) + return NULL; + *p = q; + p = q; + k--; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Descending one level...\n")); + } + q = (void**)ip->link; + ip->link = p; + *p = (void*)q; + } + return p; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIDREF +#ifndef PALM_2 +SOAP_FMAC1 +void* +SOAP_FMAC2 +soap_id_forward(struct soap *soap, const char *href, void *p, size_t len, int st, int tt, size_t n, unsigned int k, void (*fcopy)(struct soap*, int, int, void*, size_t, const void*, size_t)) +{ struct soap_ilist *ip; + if (!p || !href || !*href) + return p; + ip = soap_lookup(soap, href); /* lookup pointer to hash table entry for string id */ + if (!ip) + { if (!(ip = soap_enter(soap, href))) /* new hash table entry for string id */ + return NULL; + ip->type = st; + ip->size = n; + ip->link = NULL; + ip->copy = NULL; + ip->ptr = NULL; + ip->level = 0; + ip->flist = NULL; + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "New entry href='%s' type=%d size=%lu level=%d location=%p\n", href, st, (unsigned long)n, k, p)); + } + else if (ip->type != st || (ip->level == k && ip->size != n)) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Type incompatibility id='%s' expect type=%d size=%lu level=%u got type=%d size=%lu\n", href, ip->type, (unsigned long)ip->size, k, st, (unsigned long)n)); + strcpy(soap->id, href); + soap->error = SOAP_HREF; + return NULL; + } + if (fcopy || n < sizeof(void*) || *href != '#') + { register struct soap_flist *fp = (struct soap_flist*)SOAP_MALLOC(soap, sizeof(struct soap_flist)); + if (!fp) + { soap->error = SOAP_EOM; + return NULL; + } + fp->next = ip->flist; + fp->type = tt; + fp->ptr = p; + fp->level = k; + fp->len = len; + if (fcopy) + fp->fcopy = fcopy; + else + fp->fcopy = soap_fcopy; + ip->flist = fp; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding type=%d (target type=%d) size=%lu location=%p level=%u len=%lu href='%s'\n", st, tt, (unsigned long)n, p, k, (unsigned long)len, href)); + } + else + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding copying address %p for type=%d href='%s'\n", p, st, href)); + *(void**)p = ip->copy; + ip->copy = p; + } + return p; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +void* +SOAP_FMAC2 +soap_id_enter(struct soap *soap, const char *id, void *p, int t, size_t n, unsigned int k, const char *type, const char *arrayType, void *(*finstantiate)(struct soap*, int, const char*, const char*, size_t*)) +{ +#ifndef WITH_NOIDREF + struct soap_ilist *ip; +#endif + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Enter id='%s' type=%d loc=%p size=%lu level=%u\n", id, t, p, (unsigned long)n, k)); + soap->alloced = 0; + if (!p) + { if (finstantiate) + p = finstantiate(soap, t, type, arrayType, &n); + else + p = soap_malloc(soap, n); + if (p) + soap->alloced = 1; + } +#ifndef WITH_NOIDREF + if (!id || !*id) +#endif + return p; +#ifndef WITH_NOIDREF + ip = soap_lookup(soap, id); /* lookup pointer to hash table entry for string id */ + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Lookup entry id='%s for location=%p'\n", id, p)); + if (!ip) + { if (!(ip = soap_enter(soap, id))) /* new hash table entry for string id */ + return NULL; + ip->type = t; + ip->link = NULL; + ip->copy = NULL; + ip->flist = NULL; + ip->size = n; + ip->ptr = p; + ip->level = k; + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "New entry id='%s' type=%d size=%lu level=%u location=%p\n", id, t, (unsigned long)n, k, p)); + } + else if ((ip->type != t || (ip->level == k && ip->size != n)) && (ip->copy || ip->flist)) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Type incompatibility id='%s' expect type=%d size=%lu level=%u got type=%d size=%lu\n", id, ip->type, (unsigned long)ip->size, k, t, (unsigned long)n)); + strcpy(soap->id, id); + soap->error = SOAP_HREF; + return NULL; + } + else if (ip->ptr) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Multiply defined id='%s'\n", id)); + strcpy(soap->id, id); + soap->error = SOAP_DUPLICATE_ID; + return NULL; + } + else + { ip->size = n; + ip->ptr = p; + ip->level = k; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Update entry id='%s' type=%d location=%p size=%lu level=%u\n", id, t, p, (unsigned long)n, k)); + } + return ip->ptr; +#endif +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_fcopy(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) +{ DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Copying data type=%d (target type=%d) %p -> %p (%lu bytes)\n", st, tt, q, p, (unsigned long)n)); + memcpy(p, q, n); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_end_send(struct soap *soap) +{ +#ifndef WITH_LEANER + if (soap->dime.list) + { /* SOAP body referenced attachments must appear first */ + soap->dime.last->next = soap->dime.first; + soap->dime.first = soap->dime.list->next; + soap->dime.list->next = NULL; + soap->dime.last = soap->dime.list; + } + if (soap_putdime(soap) || soap_putmime(soap)) + return soap->error; + soap->mime.list = NULL; + soap->mime.first = NULL; + soap->mime.last = NULL; + soap->dime.list = NULL; + soap->dime.first = NULL; + soap->dime.last = NULL; +#endif + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End send\n")); + if (soap->mode & SOAP_IO) /* need to flush the remaining data in buffer */ + { if (soap_flush(soap)) +#ifdef WITH_ZLIB + { if (soap->mode & SOAP_ENC_ZLIB && soap->zlib_state == SOAP_ZLIB_DEFLATE) + { soap->zlib_state = SOAP_ZLIB_NONE; + deflateEnd(soap->d_stream); + } + return soap->error; + } +#else + return soap->error; +#endif +#ifdef WITH_ZLIB + if (soap->mode & SOAP_ENC_ZLIB) + { int r; + soap->d_stream->avail_in = 0; + do + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflating remainder\n")); + r = deflate(soap->d_stream, Z_FINISH); + if (soap->d_stream->avail_out != SOAP_BUFLEN) + { if (soap_flush_raw(soap, soap->z_buf, SOAP_BUFLEN - soap->d_stream->avail_out)) + { soap->zlib_state = SOAP_ZLIB_NONE; + deflateEnd(soap->d_stream); + return soap->error; + } + soap->d_stream->next_out = (Byte*)soap->z_buf; + soap->d_stream->avail_out = SOAP_BUFLEN; + } + } while (r == Z_OK); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflated total %lu->%lu bytes\n", soap->d_stream->total_in, soap->d_stream->total_out)); + soap->z_ratio_out = (float)soap->d_stream->total_out / (float)soap->d_stream->total_in; + soap->mode &= ~SOAP_ENC_ZLIB; + soap->zlib_state = SOAP_ZLIB_NONE; + if (deflateEnd(soap->d_stream) != Z_OK || r != Z_STREAM_END) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to end deflate: %s\n", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS)); + return soap->error = SOAP_ZLIB_ERROR; + } +#ifdef WITH_GZIP + if (soap->zlib_out != SOAP_ZLIB_DEFLATE) + { soap->z_buf[0] = soap->z_crc & 0xFF; + soap->z_buf[1] = (soap->z_crc >> 8) & 0xFF; + soap->z_buf[2] = (soap->z_crc >> 16) & 0xFF; + soap->z_buf[3] = (soap->z_crc >> 24) & 0xFF; + soap->z_buf[4] = soap->d_stream->total_in & 0xFF; + soap->z_buf[5] = (soap->d_stream->total_in >> 8) & 0xFF; + soap->z_buf[6] = (soap->d_stream->total_in >> 16) & 0xFF; + soap->z_buf[7] = (soap->d_stream->total_in >> 24) & 0xFF; + if (soap_flush_raw(soap, soap->z_buf, 8)) + return soap->error; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip crc32=%lu\n", (unsigned long)soap->z_crc)); + } +#endif + } +#endif + if ((soap->mode & SOAP_IO) == SOAP_IO_STORE) + { char *p; +#ifndef WITH_NOHTTP + if (!(soap->mode & SOAP_ENC_XML)) + { soap->mode--; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Sending buffered message of length %u\n", (unsigned int)soap->blist->size)); + if (soap->status >= SOAP_POST) + soap->error = soap->fpost(soap, soap->endpoint, soap->host, soap->port, soap->path, soap->action, soap->blist->size); + else if (soap->status != SOAP_STOP) + soap->error = soap->fresponse(soap, soap->status, soap->blist->size); + if (soap->error || soap_flush(soap)) + return soap->error; + soap->mode++; + } +#endif + for (p = soap_first_block(soap, NULL); p; p = soap_next_block(soap, NULL)) + { DBGMSG(SENT, p, soap_block_size(soap, NULL)); + if ((soap->error = soap->fsend(soap, p, soap_block_size(soap, NULL)))) + { soap_end_block(soap, NULL); + return soap->error; + } + } + soap_end_block(soap, NULL); + } +#ifndef WITH_LEANER + else if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) + { DBGMSG(SENT, "\r\n0\r\n\r\n", 7); + if ((soap->error = soap->fsend(soap, "\r\n0\r\n\r\n", 7))) + return soap->error; + } +#endif + } +#ifdef WITH_TCPFIN +#ifdef WITH_OPENSSL + if (!soap->ssl && soap_valid_socket(soap->socket) && !soap->keep_alive && !(soap->omode & SOAP_IO_UDP)) + soap->fshutdownsocket(soap, soap->socket, 1); /* Send TCP FIN */ +#else + if (soap_valid_socket(soap->socket) && !soap->keep_alive && !(soap->omode & SOAP_IO_UDP)) + soap->fshutdownsocket(soap, soap->socket, 1); /* Send TCP FIN */ +#endif +#endif + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of send phase\n")); + soap->omode &= ~SOAP_XML_SEC; + soap->count = 0; + soap->part = SOAP_END; + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_end_recv(struct soap *soap) +{ soap->part = SOAP_END; +#ifndef WITH_LEANER + if ((soap->mode & SOAP_ENC_DIME) && soap_getdime(soap)) + { soap->dime.first = NULL; + soap->dime.last = NULL; + return soap->error; + } + soap->dime.list = soap->dime.first; + soap->dime.first = NULL; + soap->dime.last = NULL; + /* Check if MIME attachments and mime-post-check flag is set, if set call soap_resolve() and return */ + if (soap->mode & SOAP_ENC_MIME) + { +#ifndef WITH_NOIDREF + if (soap->mode & SOAP_MIME_POSTCHECK) + { soap_resolve(soap); + return SOAP_OK; + } +#endif + if (soap_getmime(soap)) + return soap->error; + } + soap->mime.list = soap->mime.first; + soap->mime.first = NULL; + soap->mime.last = NULL; + soap->mime.boundary = NULL; + if (soap->xlist) + { struct soap_multipart *content; + for (content = soap->mime.list; content; content = content->next) + soap_resolve_attachment(soap, content); + } +#endif + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "End of receive message ok\n")); +#ifdef WITH_ZLIB + if (soap->mode & SOAP_ENC_ZLIB) + { /* Make sure end of compressed content is reached */ + while (soap->d_stream->next_out != Z_NULL) + if ((int)soap_get1(soap) == EOF) + break; + soap->mode &= ~SOAP_ENC_ZLIB; + memcpy(soap->buf, soap->z_buf, SOAP_BUFLEN); + soap->bufidx = (char*)soap->d_stream->next_in - soap->z_buf; + soap->buflen = soap->z_buflen; + soap->zlib_state = SOAP_ZLIB_NONE; + if (inflateEnd(soap->d_stream) != Z_OK) + return soap->error = SOAP_ZLIB_ERROR; + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Inflate end ok\n")); +#ifdef WITH_GZIP + if (soap->zlib_in == SOAP_ZLIB_GZIP) + { soap_wchar c; + short i; + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Inflate gzip crc check\n")); + for (i = 0; i < 8; i++) + { if ((int)(c = soap_get1(soap)) == EOF) + return soap->error = SOAP_EOF; + soap->z_buf[i] = (char)c; + } + if (soap->z_crc != ((uLong)(unsigned char)soap->z_buf[0] | ((uLong)(unsigned char)soap->z_buf[1] << 8) | ((uLong)(unsigned char)soap->z_buf[2] << 16) | ((uLong)(unsigned char)soap->z_buf[3] << 24))) + { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Gzip error: crc check failed, message corrupted? (crc32=%lu)\n", (unsigned long)soap->z_crc)); + return soap->error = SOAP_ZLIB_ERROR; + } + if (soap->d_stream->total_out != ((uLong)(unsigned char)soap->z_buf[4] | ((uLong)(unsigned char)soap->z_buf[5] << 8) | ((uLong)(unsigned char)soap->z_buf[6] << 16) | ((uLong)(unsigned char)soap->z_buf[7] << 24))) + { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Gzip error: incorrect message length\n")); + return soap->error = SOAP_ZLIB_ERROR; + } + } + soap->zlib_in = SOAP_ZLIB_NONE; +#endif + } +#endif + if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) + while ((int)soap_getchar(soap) != EOF) /* advance to last chunk */ + ; + if (soap->fdisconnect && (soap->error = soap->fdisconnect(soap))) + return soap->error; +#ifndef WITH_NOIDREF + if (soap_resolve(soap)) + return soap->error; +#endif +#ifndef WITH_LEANER + if (soap->xlist) + { if (soap->mode & SOAP_ENC_MTOM) + return soap->error = SOAP_MIME_HREF; + return soap->error = SOAP_DIME_HREF; + } +#endif + soap_free_ns(soap); + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_free_temp(struct soap *soap) +{ register struct soap_attribute *tp, *tq; + register struct Namespace *ns; + soap_free_ns(soap); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free any remaining temp blocks\n")); + while (soap->blist) + soap_end_block(soap, NULL); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free attribute storage\n")); + for (tp = soap->attributes; tp; tp = tq) + { tq = tp->next; + if (tp->value) + SOAP_FREE(soap, tp->value); + SOAP_FREE(soap, tp); + } + soap->attributes = NULL; +#ifdef WITH_FAST + if (soap->labbuf) + SOAP_FREE(soap, soap->labbuf); + soap->labbuf = NULL; + soap->lablen = 0; + soap->labidx = 0; +#endif + ns = soap->local_namespaces; + if (ns) + { for (; ns->id; ns++) + { if (ns->out) + { if (soap->encodingStyle == ns->out) + soap->encodingStyle = SOAP_STR_EOS; + SOAP_FREE(soap, ns->out); + ns->out = NULL; + } + if (soap->encodingStyle == ns->ns) + soap->encodingStyle = SOAP_STR_EOS; + } + SOAP_FREE(soap, soap->local_namespaces); + soap->local_namespaces = NULL; + } +#ifndef WITH_LEANER + while (soap->xlist) + { struct soap_xlist *xp = soap->xlist->next; + SOAP_FREE(soap, soap->xlist); + soap->xlist = xp; + } +#endif +#ifndef WITH_NOIDREF + soap_free_pht(soap); + soap_free_iht(soap); +#endif +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +static void +soap_free_ns(struct soap *soap) +{ register struct soap_nlist *np, *nq; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free namespace stack\n")); + for (np = soap->nlist; np; np = nq) + { nq = np->next; + SOAP_FREE(soap, np); + } + soap->nlist = NULL; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +#if !defined(WITH_LEAN) || defined(SOAP_DEBUG) +static void +soap_init_logs(struct soap *soap) +{ int i; + for (i = 0; i < SOAP_MAXLOGS; i++) + { soap->logfile[i] = NULL; + soap->fdebug[i] = NULL; + } +} +#endif +#endif + +/******************************************************************************/ +#if !defined(WITH_LEAN) || defined(SOAP_DEBUG) +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_open_logfile(struct soap *soap, int i) +{ if (soap->logfile[i]) + soap->fdebug[i] = fopen(soap->logfile[i], i < 2 ? "ab" : "a"); +} +#endif + +/******************************************************************************/ +#ifdef SOAP_DEBUG +static void +soap_close_logfile(struct soap *soap, int i) +{ if (soap->fdebug[i]) + { fclose(soap->fdebug[i]); + soap->fdebug[i] = NULL; + } +} +#endif + +/******************************************************************************/ +#ifdef SOAP_DEBUG +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_close_logfiles(struct soap *soap) +{ int i; + for (i = 0; i < SOAP_MAXLOGS; i++) + soap_close_logfile(soap, i); +} +#endif + +/******************************************************************************/ +#ifdef SOAP_DEBUG +static void +soap_set_logfile(struct soap *soap, int i, const char *logfile) +{ const char *s; + char *t = NULL; + soap_close_logfile(soap, i); + s = soap->logfile[i]; + soap->logfile[i] = logfile; + if (s) + SOAP_FREE(soap, (void*)s); + if (logfile) + if ((t = (char*)SOAP_MALLOC(soap, strlen(logfile) + 1))) + strcpy(t, logfile); + soap->logfile[i] = t; +} +#endif + +/******************************************************************************/ +#ifdef SOAP_DEBUG +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_set_recv_logfile(struct soap *soap, const char *logfile) +{ soap_set_logfile(soap, SOAP_INDEX_RECV, logfile); +} +#endif + +/******************************************************************************/ +#ifdef SOAP_DEBUG +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_set_sent_logfile(struct soap *soap, const char *logfile) +{ soap_set_logfile(soap, SOAP_INDEX_SENT, logfile); +} +#endif + +/******************************************************************************/ +#ifdef SOAP_DEBUG +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_set_test_logfile(struct soap *soap, const char *logfile) +{ soap_set_logfile(soap, SOAP_INDEX_TEST, logfile); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +struct soap* +SOAP_FMAC2 +soap_copy(const struct soap *soap) +{ return soap_copy_context((struct soap*)malloc(sizeof(struct soap)), soap); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +struct soap* +SOAP_FMAC2 +soap_copy_context(struct soap *copy, const struct soap *soap) +{ if (soap_check_state(soap)) + return NULL; + if (copy) + { register struct soap_plugin *p = NULL; +#ifdef __cplusplus + *copy = *soap; +#else + memcpy(copy, soap, sizeof(struct soap)); +#endif + copy->state = SOAP_COPY; + copy->error = SOAP_OK; + copy->userid = NULL; + copy->passwd = NULL; + copy->nlist = NULL; + copy->blist = NULL; + copy->clist = NULL; + copy->alist = NULL; + copy->attributes = NULL; + copy->labbuf = NULL; + copy->lablen = 0; + copy->labidx = 0; +#ifdef SOAP_MEM_DEBUG + soap_init_mht(copy); +#endif +#if !defined(WITH_LEAN) || defined(SOAP_DEBUG) + soap_init_logs(copy); +#endif +#ifdef SOAP_DEBUG + soap_set_test_logfile(copy, soap->logfile[SOAP_INDEX_TEST]); + soap_set_sent_logfile(copy, soap->logfile[SOAP_INDEX_SENT]); + soap_set_recv_logfile(copy, soap->logfile[SOAP_INDEX_RECV]); +#endif +#ifdef WITH_C_LOCALE + copy->c_locale = duplocale(soap->c_locale); +#else + copy->c_locale = NULL; +#endif +#ifdef WITH_OPENSSL + copy->bio = NULL; + copy->ssl = NULL; +#endif +#ifdef WITH_ZLIB + copy->d_stream = (z_stream*)SOAP_MALLOC(copy, sizeof(z_stream)); + copy->d_stream->zalloc = Z_NULL; + copy->d_stream->zfree = Z_NULL; + copy->d_stream->opaque = Z_NULL; + copy->z_buf = NULL; +#endif + copy->local_namespaces = NULL; +#ifndef WITH_NOIDREF + soap_init_iht(copy); + soap_init_pht(copy); +#endif + copy->header = NULL; + copy->fault = NULL; + copy->action = NULL; +#ifndef WITH_LEAN +#ifdef WITH_COOKIES + copy->cookies = soap_copy_cookies(copy, soap); +#else + copy->cookies = NULL; +#endif +#endif + copy->plugins = NULL; + for (p = soap->plugins; p; p = p->next) + { register struct soap_plugin *q = (struct soap_plugin*)SOAP_MALLOC(copy, sizeof(struct soap_plugin)); + if (!q) + return NULL; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying plugin '%s'\n", p->id)); + *q = *p; + if (p->fcopy && p->fcopy(copy, q, p)) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not copy plugin '%s'\n", p->id)); + SOAP_FREE(copy, q); + return NULL; + } + q->next = copy->plugins; + copy->plugins = q; + } + } + return copy; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_copy_stream(struct soap *copy, struct soap *soap) +{ copy->mode = soap->mode; + copy->imode = soap->imode; + copy->omode = soap->omode; + copy->socket = soap->socket; + copy->recv_timeout = soap->recv_timeout; + copy->send_timeout = soap->send_timeout; +#if defined(__cplusplus) && !defined(WITH_LEAN) + copy->os = soap->os; + copy->is = soap->is; +#endif + copy->sendfd = soap->sendfd; + copy->recvfd = soap->recvfd; + copy->bufidx = soap->bufidx; + copy->buflen = soap->buflen; + copy->ahead = soap->ahead; + copy->cdata = soap->cdata; + copy->chunksize = soap->chunksize; + copy->chunkbuflen = soap->chunkbuflen; + copy->keep_alive = soap->keep_alive; + copy->tcp_keep_alive = soap->tcp_keep_alive; + copy->tcp_keep_idle = soap->tcp_keep_idle; + copy->tcp_keep_intvl = soap->tcp_keep_intvl; + copy->tcp_keep_cnt = soap->tcp_keep_cnt; + copy->max_keep_alive = soap->max_keep_alive; +#ifndef WITH_NOIO + copy->peer = soap->peer; + copy->peerlen = soap->peerlen; +#endif +#ifdef WITH_OPENSSL + copy->bio = soap->bio; + copy->ssl = soap->ssl; + copy->ctx = soap->ctx; +#endif +#ifdef WITH_ZLIB + copy->zlib_state = soap->zlib_state; + copy->zlib_in = soap->zlib_in; + copy->zlib_out = soap->zlib_out; + copy->d_stream = (z_stream*)SOAP_MALLOC(copy, sizeof(z_stream)); + memcpy(copy->d_stream, soap->d_stream, sizeof(z_stream)); + copy->z_crc = soap->z_crc; + copy->z_ratio_in = soap->z_ratio_in; + copy->z_ratio_out = soap->z_ratio_out; + copy->z_buf = NULL; + copy->z_buflen = soap->z_buflen; + copy->z_level = soap->z_level; + if (soap->z_buf && soap->zlib_state != SOAP_ZLIB_NONE) + { copy->z_buf = (char*)SOAP_MALLOC(copy, SOAP_BUFLEN); + memcpy(copy->z_buf, soap->z_buf, sizeof(soap->z_buf)); + } +#endif + memcpy(copy->buf, soap->buf, sizeof(soap->buf)); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_init(struct soap *soap) +{ soap->state = SOAP_INIT; +#ifdef SOAP_MEM_DEBUG + soap_init_mht(soap); +#endif +#if !defined(WITH_LEAN) || defined(SOAP_DEBUG) + soap_init_logs(soap); +#endif +#ifdef SOAP_DEBUG + soap_set_test_logfile(soap, "TEST.log"); + soap_set_sent_logfile(soap, "SENT.log"); + soap_set_recv_logfile(soap, "RECV.log"); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing context\n")); +#endif + soap->version = 0; + soap_imode(soap, SOAP_IO_DEFAULT); + soap_omode(soap, SOAP_IO_DEFAULT); + soap->plugins = NULL; + soap->user = NULL; + soap->userid = NULL; + soap->passwd = NULL; +#ifndef WITH_NOHTTP + soap->fpost = http_post; + soap->fget = http_get; + soap->fput = http_put; + soap->fdel = http_del; + soap->fhead = http_head; + soap->fform = NULL; + soap->fposthdr = http_post_header; + soap->fresponse = http_response; + soap->fparse = http_parse; + soap->fparsehdr = http_parse_header; +#endif + soap->fheader = NULL; + soap->fconnect = NULL; + soap->fdisconnect = NULL; +#ifndef WITH_NOIO + soap->ipv6_multicast_if = 0; + soap->ipv4_multicast_if = NULL; +#ifndef WITH_IPV6 + soap->fresolve = tcp_gethost; +#else + soap->fresolve = NULL; +#endif + soap->faccept = tcp_accept; + soap->fopen = tcp_connect; + soap->fclose = tcp_disconnect; + soap->fclosesocket = tcp_closesocket; + soap->fshutdownsocket = tcp_shutdownsocket; + soap->fsend = fsend; + soap->frecv = frecv; + soap->fpoll = soap_poll; +#else + soap->fopen = NULL; + soap->fclose = NULL; + soap->fpoll = NULL; +#endif + soap->fseterror = NULL; + soap->fignore = NULL; + soap->fserveloop = NULL; + soap->fplugin = fplugin; + soap->fmalloc = NULL; +#ifndef WITH_LEANER + soap->fprepareinit = NULL; + soap->fpreparesend = NULL; + soap->fpreparerecv = NULL; + soap->fpreparefinal = NULL; + soap->fdimereadopen = NULL; + soap->fdimewriteopen = NULL; + soap->fdimereadclose = NULL; + soap->fdimewriteclose = NULL; + soap->fdimeread = NULL; + soap->fdimewrite = NULL; + soap->fmimereadopen = NULL; + soap->fmimewriteopen = NULL; + soap->fmimereadclose = NULL; + soap->fmimewriteclose = NULL; + soap->fmimeread = NULL; + soap->fmimewrite = NULL; +#endif + soap->float_format = "%.9G"; /* Alternative: use "%G" */ + soap->double_format = "%.17lG"; /* Alternative: use "%lG" */ + soap->dime_id_format = "cid:id%d"; /* default DIME id format */ + soap->http_version = "1.1"; + soap->proxy_http_version = "1.0"; + soap->http_content = NULL; + soap->actor = NULL; + soap->lang = "en"; + soap->keep_alive = 0; + soap->tcp_keep_alive = 0; + soap->tcp_keep_idle = 0; + soap->tcp_keep_intvl = 0; + soap->tcp_keep_cnt = 0; + soap->max_keep_alive = SOAP_MAXKEEPALIVE; + soap->recv_timeout = 0; + soap->send_timeout = 0; + soap->connect_timeout = 0; + soap->accept_timeout = 0; + soap->socket_flags = 0; + soap->connect_flags = 0; + soap->bind_flags = 0; + soap->accept_flags = 0; + soap->linger_time = 0; + soap->ip = 0; + soap->labbuf = NULL; + soap->lablen = 0; + soap->labidx = 0; + soap->encodingStyle = SOAP_STR_EOS; +#ifndef WITH_NONAMESPACES + soap->namespaces = namespaces; +#else + soap->namespaces = NULL; +#endif + soap->local_namespaces = NULL; + soap->nlist = NULL; + soap->blist = NULL; + soap->clist = NULL; + soap->alist = NULL; + soap->attributes = NULL; + soap->header = NULL; + soap->fault = NULL; + soap->master = SOAP_INVALID_SOCKET; + soap->socket = SOAP_INVALID_SOCKET; + soap->os = NULL; + soap->is = NULL; +#ifndef WITH_LEANER + soap->dom = NULL; + soap->dime.list = NULL; + soap->dime.first = NULL; + soap->dime.last = NULL; + soap->mime.list = NULL; + soap->mime.first = NULL; + soap->mime.last = NULL; + soap->mime.boundary = NULL; + soap->mime.start = NULL; + soap->xlist = NULL; +#endif +#ifndef UNDER_CE + soap->recvfd = 0; + soap->sendfd = 1; +#else + soap->recvfd = stdin; + soap->sendfd = stdout; +#endif + soap->host[0] = '\0'; + soap->port = 0; + soap->action = NULL; + soap->proxy_host = NULL; + soap->proxy_port = 8080; + soap->proxy_userid = NULL; + soap->proxy_passwd = NULL; + soap->authrealm = NULL; + soap->prolog = NULL; +#ifdef WITH_ZLIB + soap->zlib_state = SOAP_ZLIB_NONE; + soap->zlib_in = SOAP_ZLIB_NONE; + soap->zlib_out = SOAP_ZLIB_NONE; + soap->d_stream = (z_stream*)SOAP_MALLOC(soap, sizeof(z_stream)); + soap->d_stream->zalloc = Z_NULL; + soap->d_stream->zfree = Z_NULL; + soap->d_stream->opaque = Z_NULL; + soap->z_buf = NULL; + soap->z_level = 6; +#endif +#ifndef WITH_LEAN + soap->c14ninclude = NULL; + soap->c14nexclude = NULL; + soap->cookies = NULL; + soap->cookie_domain = NULL; + soap->cookie_path = NULL; + soap->cookie_max = 32; +#endif +#ifdef WMW_RPM_IO + soap->rpmreqid = NULL; +#endif +#ifdef PALM + palmNetLibOpen(); +#endif +#ifndef WITH_NOIDREF + soap_init_iht(soap); + soap_init_pht(soap); +#endif +#ifdef WITH_OPENSSL + if (!soap_ssl_init_done) + { soap_ssl_init(); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing OpenSSL, version=%ld\n", (long)OPENSSL_VERSION_NUMBER)); + } + soap->fsslauth = ssl_auth_init; + soap->fsslverify = ssl_verify_callback; + soap->bio = NULL; + soap->ssl = NULL; + soap->ctx = NULL; + soap->ssl_flags = SOAP_SSL_DEFAULT; + soap->keyfile = NULL; + soap->password = NULL; + soap->dhfile = NULL; + soap->cafile = NULL; + soap->capath = NULL; + soap->crlfile = NULL; + soap->randfile = NULL; + soap->session = NULL; +#endif +#ifdef WITH_C_LOCALE + soap->c_locale = newlocale(LC_ALL_MASK, "C", NULL); +#else + soap->c_locale = NULL; +#endif + soap_begin(soap); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_init1(struct soap *soap, soap_mode mode) +{ soap_init2(soap, mode, mode); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_init2(struct soap *soap, soap_mode imode, soap_mode omode) +{ soap_init(soap); + soap_imode(soap, imode); + soap_omode(soap, omode); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_begin(struct soap *soap) +{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Reinitializing context\n")); + if (!soap->keep_alive) + { soap->buflen = 0; + soap->bufidx = 0; + } + soap->keep_alive = (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) != 0); + soap->null = 0; + soap->position = 0; + soap->encoding = 0; + soap->mustUnderstand = 0; + soap->mode = 0; + soap->ns = 0; + soap->part = SOAP_END; + soap->alloced = 0; + soap->count = 0; + soap->length = 0; + soap->cdata = 0; + soap->error = SOAP_OK; + soap->peeked = 0; + soap->ahead = 0; + soap->idnum = 0; + soap->level = 0; + soap->endpoint[0] = '\0'; +#ifndef WITH_LEANER + soap->dime.chunksize = 0; + soap->dime.buflen = 0; +#endif + soap_free_temp(soap); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_end(struct soap *soap) +{ if (soap_check_state(soap)) + return; + soap_free_temp(soap); + soap_dealloc(soap, NULL); + while (soap->clist) + { register struct soap_clist *cp = soap->clist->next; + SOAP_FREE(soap, soap->clist); + soap->clist = cp; + } + soap_closesock(soap); +#ifdef SOAP_DEBUG + soap_close_logfiles(soap); +#endif +#ifdef PALM + palmNetLibClose(); +#endif +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_set_namespaces(struct soap *soap, const struct Namespace *p) +{ register struct Namespace *ns = soap->local_namespaces; + register struct soap_nlist *np, *nq, *nr; + register unsigned int level = soap->level; + soap->namespaces = p; + soap->local_namespaces = NULL; + soap_set_local_namespaces(soap); + /* reverse the namespace list */ + np = soap->nlist; + soap->nlist = NULL; + if (np) + { nq = np->next; + np->next = NULL; + while (nq) + { nr = nq->next; + nq->next = np; + np = nq; + nq = nr; + } + } + /* then push on new stack */ + while (np) + { register const char *s; + soap->level = np->level; /* preserve element nesting level */ + s = np->ns; + if (!s && np->index >= 0 && ns) + { s = ns[np->index].out; + if (!s) + s = ns[np->index].ns; + } + if (s && soap_push_namespace(soap, np->id, s)) + return soap->error; + nq = np; + np = np->next; + SOAP_FREE(soap, nq); + } + if (ns) + { register int i; + for (i = 0; ns[i].id; i++) + { if (ns[i].out) + { SOAP_FREE(soap, ns[i].out); + ns[i].out = NULL; + } + } + SOAP_FREE(soap, ns); + } + soap->level = level; /* restore level */ + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_set_local_namespaces(struct soap *soap) +{ if (soap->namespaces && !soap->local_namespaces) + { register const struct Namespace *ns1; + register struct Namespace *ns2; + register size_t n = 1; + for (ns1 = soap->namespaces; ns1->id; ns1++) + n++; + n *= sizeof(struct Namespace); + ns2 = (struct Namespace*)SOAP_MALLOC(soap, n); + if (ns2) + { memcpy(ns2, soap->namespaces, n); + if (ns2[0].ns) + { if (!strcmp(ns2[0].ns, soap_env1)) + soap->version = 1; + else + soap->version = 2; + } + soap->local_namespaces = ns2; + } + } +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +#ifndef PALM_1 +SOAP_FMAC1 +const char * +SOAP_FMAC2 +soap_strsearch(const char *big, const char *little) +{ register size_t n = strlen(little); + register const char *s = big; + while (s) + { if (!strncmp(s, little, n) && (s[n] == '\0' || s[n] == ' ')) + return s; + s = strchr(s, ' '); + if (s) + s++; + } + return NULL; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +#ifndef PALM_1 +SOAP_FMAC1 +struct soap_nlist * +SOAP_FMAC2 +soap_lookup_ns(struct soap *soap, const char *tag, size_t n) +{ register struct soap_nlist *np; + for (np = soap->nlist; np; np = np->next) + { if (!strncmp(np->id, tag, n) && !np->id[n]) + return np; + } + return NULL; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +static struct soap_nlist * +soap_push_ns(struct soap *soap, const char *id, const char *ns, short utilized) +{ register struct soap_nlist *np; + size_t n, k; + if (soap_strsearch(soap->c14nexclude, id)) + return NULL; + if (!utilized) + { for (np = soap->nlist; np; np = np->next) + { if (!strcmp(np->id, id) && (!np->ns || !strcmp(np->ns, ns))) + break; + } + if (np) + { if ((np->level < soap->level || !np->ns) && np->index == 1) + utilized = 1; + else + return NULL; + } + } + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Adding namespace binding (level=%u) '%s' '%s' utilized=%d\n", soap->level, id, ns?ns:"(null)", utilized)); + n = strlen(id); + if (ns) + k = strlen(ns); + else + k = 0; + np = (struct soap_nlist*)SOAP_MALLOC(soap, sizeof(struct soap_nlist) + n + k + 1); + if (!np) + { soap->error = SOAP_EOM; + return NULL; + } + np->next = soap->nlist; + soap->nlist = np; + strcpy(np->id, id); + if (ns) + { np->ns = np->id + n + 1; + strcpy(np->ns, ns); + } + else + np->ns = NULL; + np->level = soap->level; + np->index = utilized; + return np; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +static void +soap_utilize_ns(struct soap *soap, const char *tag, size_t n) +{ register struct soap_nlist *np = soap_lookup_ns(soap, tag, n); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Utilizing namespace of '%s'\n", tag)); + if (np) + { if (np->index == 0) + soap_push_ns(soap, np->id, np->ns, 1); + } + else if (strncmp(tag, "xml", 3)) + { strncpy(soap->tmpbuf, tag, n); + soap->tmpbuf[n] = '\0'; + soap_push_ns(soap, soap->tmpbuf, NULL, 1); + } +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +static void +soap_pop_ns(struct soap *soap) +{ soap_pop_namespace(soap); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_element(struct soap *soap, const char *tag, int id, const char *type) +{ +#ifdef WITH_XMLNS + register const char *s; +#endif + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element begin tag='%s' id='%d' type='%s'\n", tag, id, type?type:SOAP_STR_EOS)); +#ifdef WITH_DOM + if (soap->part == SOAP_BEGIN_SECURITY && (soap->mode & SOAP_XML_CANONICAL) && !(soap->mode & SOAP_DOM_ASIS)) + { register struct soap_nlist *np; + /* wsu:Id found: clear xmlns renderings, so re-emit them for exc-c14n */ + for (np = soap->nlist; np; np = np->next) + { if (np->index == 2) + np->index = 0; + } + } + if (soap->mode & SOAP_XML_DOM) + { register struct soap_dom_element *elt = (struct soap_dom_element*)soap_malloc(soap, sizeof(struct soap_dom_element)); + if (!elt) + return soap->error; + elt->soap = soap; + elt->next = NULL; + elt->prnt = soap->dom; + elt->name = soap_strdup(soap, tag); + elt->elts = NULL; + elt->atts = NULL; + elt->nstr = NULL; + elt->data = NULL; + elt->wide = NULL; + elt->node = NULL; + elt->type = 0; + elt->head = NULL; + elt->tail = NULL; + if (soap->dom) + { struct soap_dom_element *p = soap->dom->elts; + if (p) + { while (p->next) + p = p->next; + p->next = elt; + } + else + soap->dom->elts = elt; + } + soap->dom = elt; + } + else + { +#endif + soap->level++; +#ifndef WITH_LEAN + if (!soap->ns) + { if (!(soap->mode & SOAP_XML_CANONICAL) + && soap_send(soap, NULL))/* TODO KMD to avoid the put of xml tag in the soap messages */ + return soap->error; + } + else if (soap->mode & SOAP_XML_INDENT) + { if (soap->ns == 1 && soap_send_raw(soap, soap_indent, soap->level < sizeof(soap_indent) ? soap->level : sizeof(soap_indent) - 1)) + return soap->error; + soap->body = 1; + } +#endif +#ifdef WITH_XMLNS + s = strchr(tag, ':'); + if (s && strncmp(tag, "SOAP-ENV", s - tag)) + { struct Namespace *ns = soap->local_namespaces; + size_t n = s - tag; + if (soap_send_raw(soap, "<", 1) + || soap_send(soap, s + 1)) + return soap->error; + if (soap->nlist && !strncmp(soap->nlist->id, tag, n) && !soap->nlist->id[n]) + ns = NULL; + for (; ns && ns->id; ns++) + { if (*ns->id && (ns->out || ns->ns) && !strncmp(ns->id, tag, n) && !ns->id[n]) + { soap_push_ns(soap, ns->id, ns->out ? ns->out : ns->ns, 0); + if (soap_attribute(soap, "xmlns", ns->out ? ns->out : ns->ns)) + return soap->error; + break; + } + } + } + else +#endif + if (soap_send_raw(soap, "<", 1) + || soap_send(soap, tag)) + return soap->error; +#ifdef WITH_DOM + } +#endif + if (!soap->ns) + { struct Namespace *ns; + for (ns = soap->local_namespaces; ns && ns->id; ns++) + { if (*ns->id && (ns->out || ns->ns)) + { sprintf(soap->tmpbuf, "xmlns:%s", ns->id); + if (soap_attribute(soap, soap->tmpbuf, ns->out ? ns->out : ns->ns)) + return soap->error; + } + } + } + soap->ns = 1; /* namespace table control: ns = 0 or 2 to start, then 1 to stop dumping the table */ +#ifndef WITH_LEAN + if (soap->mode & SOAP_XML_CANONICAL) + { const char *t = strchr(tag, ':'); + if (t) + soap_utilize_ns(soap, tag, t - tag); + } +#endif + if (id > 0) + { sprintf(soap->tmpbuf, "_%d", id); + if (soap_attribute(soap, "id", soap->tmpbuf)) + return soap->error; + } + if (type && *type && (!(soap->mode & SOAP_XML_SEC) || soap->part == SOAP_IN_BODY)) + { if (soap_attribute(soap, "xsi:type", type)) + return soap->error; +#ifndef WITH_LEAN + if (soap->mode & SOAP_XML_CANONICAL) + { const char *t = strchr(type, ':'); + if (t) + soap_utilize_ns(soap, type, t - type); + } +#endif + } + if (soap->null && soap->position > 0) + { register int i; + sprintf(soap->tmpbuf, "[%d", soap->positions[0]); + for (i = 1; i < soap->position; i++) + sprintf(soap->tmpbuf + strlen(soap->tmpbuf), ",%d", soap->positions[i]); + strcat(soap->tmpbuf, "]"); + if (soap_attribute(soap, "SOAP-ENC:position", soap->tmpbuf)) + return soap->error; + } + if (soap->mustUnderstand) + { if (soap->actor && *soap->actor) + { if (soap_attribute(soap, soap->version == 2 ? "SOAP-ENV:role" : "SOAP-ENV:actor", soap->actor)) + return soap->error; + } + if (soap_attribute(soap, "SOAP-ENV:mustUnderstand", soap->version == 2 ? "true" : "1")) + return soap->error; + soap->mustUnderstand = 0; + } + if (soap->encoding) + { if (soap->encodingStyle && soap->local_namespaces) + { if (!*soap->encodingStyle) + { if (soap->local_namespaces[1].out) + soap->encodingStyle = soap->local_namespaces[1].out; + else + soap->encodingStyle = soap->local_namespaces[1].ns; + } + if (soap_attribute(soap, "SOAP-ENV:encodingStyle", soap->encodingStyle)) + return soap->error; + } + soap->encoding = 0; + } + soap->null = 0; + soap->position = 0; + if (soap->part == SOAP_BEGIN_SECURITY && (soap->mode & SOAP_XML_CANONICAL)) + soap->part = SOAP_IN_SECURITY; + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_element_begin_out(struct soap *soap, const char *tag, int id, const char *type) +{ if (*tag == '-') + return SOAP_OK; + if (soap_element(soap, tag, id, type)) + return soap->error; + return soap_element_start_end_out(soap, NULL); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +#ifndef HAVE_STRRCHR +SOAP_FMAC1 +char* +SOAP_FMAC2 +soap_strrchr(const char *s, int t) +{ register char *r = NULL; + while (*s) + if (*s++ == t) + r = (char*)s - 1; + return r; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_2 +#ifndef HAVE_STRTOL +SOAP_FMAC1 +long +SOAP_FMAC2 +soap_strtol(const char *s, char **t, int b) +{ register long n = 0; + register int c; + while (*s > 0 && *s <= 32) + s++; + if (b == 10) + { short neg = 0; + if (*s == '-') + { s++; + neg = 1; + } + else if (*s == '+') + s++; + while ((c = *s) && c >= '0' && c <= '9') + { if (n >= 214748364 && (n > 214748364 || c >= '8')) + break; + n *= 10; + n += c - '0'; + s++; + } + if (neg) + n = -n; + } + else /* b == 16 and value is always positive */ + { while ((c = *s)) + { if (c >= '0' && c <= '9') + c -= '0'; + else if (c >= 'A' && c <= 'F') + c -= 'A' - 10; + else if (c >= 'a' && c <= 'f') + c -= 'a' - 10; + if (n > 0x07FFFFFF) + break; + n <<= 4; + n += c; + s++; + } + } + if (t) + *t = (char*)s; + return n; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_2 +#ifndef HAVE_STRTOUL +SOAP_FMAC1 +unsigned long +SOAP_FMAC2 +soap_strtoul(const char *s, char **t, int b) +{ unsigned long n = 0; + register int c; + while (*s > 0 && *s <= 32) + s++; + if (b == 10) + { if (*s == '+') + s++; + while ((c = *s) && c >= '0' && c <= '9') + { if (n >= 429496729 && (n > 429496729 || c >= '6')) + break; + n *= 10; + n += c - '0'; + s++; + } + } + else /* b == 16 */ + { while ((c = *s)) + { if (c >= '0' && c <= '9') + c -= '0'; + else if (c >= 'A' && c <= 'F') + c -= 'A' - 10; + else if (c >= 'a' && c <= 'f') + c -= 'a' - 10; + if (n > 0x0FFFFFFF) + break; + n <<= 4; + n += c; + s++; + } + } + if (t) + *t = (char*)s; + return n; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_array_begin_out(struct soap *soap, const char *tag, int id, const char *type, const char *offset) +{ if (!type || !*type) + return soap_element_begin_out(soap, tag, id, NULL); + if (soap_element(soap, tag, id, "SOAP-ENC:Array")) + return soap->error; + if (soap->version == 2) + { const char *s; + s = soap_strrchr(type, '['); + if ((size_t)(s - type) < sizeof(soap->tmpbuf)) + { strncpy(soap->tmpbuf, type, s - type); + soap->tmpbuf[s - type] = '\0'; + if (soap_attribute(soap, "SOAP-ENC:itemType", soap->tmpbuf)) + return soap->error; + if (s && (soap_attribute(soap, "SOAP-ENC:arraySize", s + 1))) + return soap->error; + } + } + else + { if (offset && soap_attribute(soap, "SOAP-ENC:offset", offset)) + return soap->error; + if (soap_attribute(soap, "SOAP-ENC:arrayType", type)) + return soap->error; + } +#ifndef WITH_LEAN + if ((soap->mode & SOAP_XML_CANONICAL)) + { const char *s = strchr(type, ':'); + if (s) + soap_utilize_ns(soap, type, s - type); + } +#endif + return soap_element_start_end_out(soap, NULL); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_element_start_end_out(struct soap *soap, const char *tag) +{ register struct soap_attribute *tp; +#ifndef WITH_LEAN + if (soap->mode & SOAP_XML_CANONICAL) + { struct soap_nlist *np; + for (tp = soap->attributes; tp; tp = tp->next) + { if (tp->visible && tp->name) + { const char *s = strchr(tp->name, ':'); + if (s) + soap_utilize_ns(soap, tp->name, s - tp->name); + } + } + for (np = soap->nlist; np; np = np->next) + { if (np->index == 1 && np->ns) + { sprintf(soap->tmpbuf, "xmlns:%s", np->id); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Enabling utilized binding (level=%u) %s='%s'\n", np->level, soap->tmpbuf, np->ns)); + soap_set_attr(soap, soap->tmpbuf, np->ns); + np->index = 2; + } + } + } +#endif +#ifdef WITH_DOM + if ((soap->mode & SOAP_XML_DOM) && soap->dom) + { register struct soap_dom_attribute **att; + att = &soap->dom->atts; + for (tp = soap->attributes; tp; tp = tp->next) + { if (tp->visible) + { *att = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute)); + if (!*att) + return soap->error; + (*att)->next = NULL; + (*att)->nstr = NULL; + (*att)->name = soap_strdup(soap, tp->name); + (*att)->data = soap_strdup(soap, tp->value); + (*att)->wide = NULL; + (*att)->soap = soap; + att = &(*att)->next; + tp->visible = 0; + } + } + return SOAP_OK; + } +#endif + for (tp = soap->attributes; tp; tp = tp->next) + { if (tp->visible) + { +#ifdef WITH_XMLNS + const char *s = strchr(tp->name, ':'); + if (s) + { size_t n = s - tp->name; + if (soap->nlist && !strncmp(soap->nlist->id, tp->name, n) && !soap->nlist->id[n]) + s++; + else + s = tp->name; + if (soap_send(soap, " ") || soap_send(soap, s)) + return soap->error; + } + else +#endif + if (soap_send(soap, " ") || soap_send(soap, tp->name)) + return soap->error; + if (tp->visible == 2 && tp->value) + if (soap_send_raw(soap, "=\"", 2) + || soap_string_out(soap, tp->value, 1) + || soap_send_raw(soap, "\"", 1)) + return soap->error; + tp->visible = 0; + } + } + if (tag) + { +#ifndef WITH_LEAN + if (soap->mode & SOAP_XML_CANONICAL) + { if (soap_send_raw(soap, ">", 1) + || soap_element_end_out(soap, tag)) + return soap->error; + return SOAP_OK; + } +#endif + soap->level--; /* decrement level just before /> */ + if (soap_send_raw(soap, "/>", 2)) + return soap->error; + return SOAP_OK; + } + return soap_send_raw(soap, ">", 1); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_element_end_out(struct soap *soap, const char *tag) +{ if (*tag == '-') + return SOAP_OK; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element ending tag='%s'\n", tag)); +#ifdef WITH_DOM + if ((soap->mode & SOAP_XML_DOM) && soap->dom) + { if (soap->dom->prnt) + soap->dom = soap->dom->prnt; + return SOAP_OK; + } +#endif +#ifndef WITH_LEAN + if (soap->mode & SOAP_XML_CANONICAL) + soap_pop_ns(soap); + if (soap->mode & SOAP_XML_INDENT) + { if (!soap->body) + { if (soap_send_raw(soap, soap_indent, soap->level < sizeof(soap_indent) ? soap->level : sizeof(soap_indent) - 1)) + return soap->error; + } + soap->body = 0; + } +#endif +#ifdef WITH_XMLNS + { const char *s = strchr(tag, ':'); + if (s && strncmp(tag, "SOAP-ENV", s - tag)) + { soap_pop_ns(soap); + tag = s + 1; + } + } +#endif + if (soap_send_raw(soap, "error; + soap->level--; /* decrement level just before > */ + return soap_send_raw(soap, ">", 1); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_element_ref(struct soap *soap, const char *tag, int id, int href) +{ register int n = 0; + const char *s = "href"; + if (soap->version == 2) + { s = "SOAP-ENC:ref"; + n = 1; + } + sprintf(soap->href, "#_%d", href); + return soap_element_href(soap, tag, id, s, soap->href + n); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_element_href(struct soap *soap, const char *tag, int id, const char *ref, const char *val) +{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element '%s' reference %s='%s'\n", tag, ref, val)); + if (soap_element(soap, tag, id, NULL) + || soap_attribute(soap, ref, val) + || soap_element_start_end_out(soap, tag)) + return soap->error; + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_element_null(struct soap *soap, const char *tag, int id, const char *type) +{ struct soap_attribute *tp; + for (tp = soap->attributes; tp; tp = tp->next) + if (tp->visible) + break; + if (tp || (soap->version == 2 && soap->position > 0) || id > 0 || (soap->mode & SOAP_XML_NIL)) + { if (soap_element(soap, tag, id, type)) + return soap->error; + if (!tp && soap_attribute(soap, "xsi:nil", "true")) + return soap->error; + return soap_element_start_end_out(soap, tag); + } + soap->null = 1; + soap->position = 0; + soap->mustUnderstand = 0; + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_element_id(struct soap *soap, const char *tag, int id, const void *p, const struct soap_array *a, int n, const char *type, int t) +{ if (!p) + { soap_element_null(soap, tag, id, type); + return -1; + } +#ifndef WITH_NOIDREF + if (soap->mode & SOAP_XML_TREE) + return 0; + if (id < 0) + { struct soap_plist *pp; + if (a) + id = soap_array_pointer_lookup(soap, p, a, n, t, &pp); + else + id = soap_pointer_lookup(soap, p, t, &pp); + if (id) + { if (soap_is_embedded(soap, pp)) + { soap_element_ref(soap, tag, 0, id); + return -1; + } + if (soap_is_single(soap, pp)) + return 0; + soap_set_embedded(soap, pp); + } + } + return id; +#else + return 0; +#endif +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_element_result(struct soap *soap, const char *tag) +{ if (soap->version == 2 && soap->encodingStyle) + { if (soap_element(soap, "SOAP-RPC:result", 0, NULL) + || soap_attribute(soap, "xmlns:SOAP-RPC", soap_rpc) + || soap_element_start_end_out(soap, NULL) + || soap_string_out(soap, tag, 0) + || soap_element_end_out(soap, "SOAP-RPC:result")) + return soap->error; + } + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_check_result(struct soap *soap, const char *tag) +{ if (soap->version == 2 && soap->encodingStyle) + { soap_instring(soap, ":result", NULL, NULL, 0, 2, -1, -1); + /* just ignore content for compliance reasons, but should compare tag to element's QName value? */ + } +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_attribute(struct soap *soap, const char *name, const char *value) +{ + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Attribute '%s'='%s'\n", name, value)); +#ifdef WITH_DOM + if ((soap->mode & SOAP_XML_DOM) && !(soap->mode & SOAP_XML_CANONICAL) && soap->dom) + { register struct soap_dom_attribute *a = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute)); + if (!a) + return soap->error; + a->next = soap->dom->atts; + a->nstr = NULL; + a->name = soap_strdup(soap, name); + a->data = soap_strdup(soap, value); + a->wide = NULL; + a->soap = soap; + soap->dom->atts = a; + return SOAP_OK; + } +#endif +#ifndef WITH_LEAN + if (soap->mode & SOAP_XML_CANONICAL) + { /* TODO: consider using this code to handle default namespace bindings + if (!strncmp(name, "xmlns", 5) && (name[5] == ':' || name[5] == '\0')) + { if (name[5] == ':') + soap_push_ns(soap, name + 6, value, 0); + else + soap_push_ns(soap, "", value, 0); + } + */ + if (!strncmp(name, "xmlns:", 6)) + soap_push_ns(soap, name + 6, value, 0); + else if (soap_set_attr(soap, name, value)) + return soap->error; + } + else +#endif + { if (soap_send(soap, " ") || soap_send(soap, name)) + return soap->error; + if (value) + if (soap_send_raw(soap, "=\"", 2) + || soap_string_out(soap, value, 1) + || soap_send_raw(soap, "\"", 1)) + return soap->error; + } + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_element_begin_in(struct soap *soap, const char *tag, int nillable, const char *type) +{ if (!soap_peek_element(soap)) + { if (soap->other) + return soap->error = SOAP_TAG_MISMATCH; + if (tag && *tag == '-') + return SOAP_OK; + if (!(soap->error = soap_match_tag(soap, soap->tag, tag))) + { soap->peeked = 0; + if (type && *soap->type && soap_match_tag(soap, soap->type, type)) + return soap->error = SOAP_TYPE; + if (!nillable && soap->null && (soap->mode & SOAP_XML_STRICT)) + return soap->error = SOAP_NULL; + if (soap->body) + soap->level++; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:SOAP_STR_EOS )); + } + } + else if (soap->error == SOAP_NO_TAG && tag && *tag == '-') + soap->error = SOAP_OK; + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_element_end_in(struct soap *soap, const char *tag) +{ register soap_wchar c; + register char *s; + register int n = 0; + if (tag && *tag == '-') + return SOAP_OK; + if (soap->error == SOAP_NO_TAG) + soap->error = SOAP_OK; +#ifdef WITH_DOM + /* this whitespace or mixed content is not insignificant for DOM */ + if ((soap->mode & SOAP_XML_DOM) && soap->dom) + { if (!soap->peeked && !soap_string_in(soap, 3, -1, -1)) + return soap->error; + if (soap->dom->prnt) + soap->dom = soap->dom->prnt; + } +#endif + if (soap->peeked) + { if (*soap->tag) + n++; + soap->peeked = 0; + } + do + { while (((c = soap_get(soap)) != SOAP_TT)) + { if ((int)c == EOF) + return soap->error = SOAP_EOF; + if (c == SOAP_LT) + n++; + else if (c == '/') + { c = soap_get(soap); + if (c == SOAP_GT) + n--; + else + soap_unget(soap, c); + } + } + } while (n--); + s = soap->tag; + n = sizeof(soap->tag); + while (soap_notblank(c = soap_get(soap))) + { if (--n > 0) + *s++ = (char)c; + } + *s = '\0'; + if ((int)c == EOF) + return soap->error = SOAP_EOF; + while (soap_blank(c)) + c = soap_get(soap); + if (c != SOAP_GT) + return soap->error = SOAP_SYNTAX_ERROR; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:SOAP_STR_EOS)); +#ifndef WITH_LEAN + if (tag && (soap->mode & SOAP_XML_STRICT)) + { soap_pop_namespace(soap); + if (soap_match_tag(soap, soap->tag, tag)) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element tag name does not match\n")); + return soap->error = SOAP_SYNTAX_ERROR; + } + } +#endif + soap->level--; + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +const char * +SOAP_FMAC2 +soap_attr_value(struct soap *soap, const char *name, int flag) +{ register struct soap_attribute *tp; + if (*name == '-') + return SOAP_STR_EOS; + for (tp = soap->attributes; tp; tp = tp->next) + { if (tp->visible && !soap_match_tag(soap, tp->name, name)) + break; + } + if (tp) + { if (flag == 2 && (soap->mode & SOAP_XML_STRICT)) + soap->error = SOAP_PROHIBITED; + else + return tp->value; + } + else if (flag == 1 && (soap->mode & SOAP_XML_STRICT)) + soap->error = SOAP_REQUIRED; + return NULL; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_set_attr(struct soap *soap, const char *name, const char *value) +{ register struct soap_attribute *tp; + if (*name == '-') + return SOAP_OK; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attribute %s='%s'\n", name, value?value:SOAP_STR_EOS)); + for (tp = soap->attributes; tp; tp = tp->next) + { if (!strcmp(tp->name, name)) + break; + } + if (!tp) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Allocate attribute %s\n", name)); + if (!(tp = (struct soap_attribute*)SOAP_MALLOC(soap, sizeof(struct soap_attribute) + strlen(name)))) + return soap->error = SOAP_EOM; + tp->ns = NULL; +#ifndef WITH_LEAN + if (soap->mode & SOAP_XML_CANONICAL) + { struct soap_attribute **tpp = &soap->attributes; + const char *s = strchr(name, ':'); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inserting attribute %s for c14n\n", name)) + if (!strncmp(name, "xmlns", 5)) + { for (; *tpp; tpp = &(*tpp)->next) + if (strncmp((*tpp)->name, "xmlns", 5) || strcmp((*tpp)->name + 5, name + 5) > 0) + break; + } + else if (!s) + { for (; *tpp; tpp = &(*tpp)->next) + if (strncmp((*tpp)->name, "xmlns", 5) && ((*tpp)->ns || strcmp((*tpp)->name, name) > 0)) + break; + } + else + { int k; + for (; *tpp; tpp = &(*tpp)->next) + { if (!strncmp((*tpp)->name, "xmlns:", 6) && !strncmp((*tpp)->name + 6, name, s - name) && !(*tpp)->name[6 + s - name]) + { if (!tp->ns) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Canonicalization: prefix %s=%p (%s)\n", name, (*tpp)->ns, (*tpp)->ns)); + tp->ns = (*tpp)->ns; + } + } + else if (strncmp((*tpp)->name, "xmlns", 5) && (*tpp)->ns && tp->ns && ((k = strcmp((*tpp)->ns, tp->ns)) > 0 || (!k && strcmp((*tpp)->name, name) > 0))) + break; + } + } + tp->next = *tpp; + *tpp = tp; + } + else +#endif + { tp->next = soap->attributes; + soap->attributes = tp; + } + strcpy(tp->name, name); + tp->value = NULL; + } + else if (tp->visible) + { return SOAP_OK; + } + else if (value && tp->value && tp->size <= strlen(value)) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free attribute value of %s (free %p)\n", name, tp->value)); + SOAP_FREE(soap, tp->value); + tp->value = NULL; + tp->ns = NULL; + } + if (value) + { if (!tp->value) + { tp->size = strlen(value) + 1; + if (!(tp->value = (char*)SOAP_MALLOC(soap, tp->size))) + return soap->error = SOAP_EOM; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Allocate attribute value for %s (%p)\n", tp->name, tp->value)); + } + strcpy(tp->value, value); + if (!strncmp(tp->name, "xmlns:", 6)) + tp->ns = tp->value; + tp->visible = 2; +#ifndef WITH_LEAN + if (!strcmp(name, "wsu:Id")) + { soap->part = SOAP_BEGIN_SECURITY; + strncpy(soap->id, value, sizeof(soap->id)); + soap->id[sizeof(soap->id)-1] = '\0'; + } +#endif + } + else + tp->visible = 1; + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_clr_attr(struct soap *soap) +{ register struct soap_attribute *tp; +#ifndef WITH_LEAN + if ((soap->mode & SOAP_XML_CANONICAL)) + { while (soap->attributes) + { tp = soap->attributes->next; + if (soap->attributes->value) + SOAP_FREE(soap, soap->attributes->value); + SOAP_FREE(soap, soap->attributes); + soap->attributes = tp; + } + } + else +#endif + { for (tp = soap->attributes; tp; tp = tp->next) + tp->visible = 0; + } +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +static int +soap_getattrval(struct soap *soap, char *s, size_t n, soap_wchar d) +{ register size_t i; + for (i = 0; i < n; i++) + { register soap_wchar c = soap_get(soap); + switch (c) + { + case SOAP_TT: + *s++ = '<'; + soap_unget(soap, '/'); + break; + case SOAP_LT: + *s++ = '<'; + break; + case SOAP_GT: + if (d == ' ') + { soap_unget(soap, c); + *s = '\0'; + return SOAP_OK; + } + *s++ = '>'; + break; + case SOAP_QT: + if (c == d) + { *s = '\0'; + return SOAP_OK; + } + *s++ = '"'; + break; + case SOAP_AP: + if (c == d) + { *s = '\0'; + return SOAP_OK; + } + *s++ = '\''; + break; + case '\t': + case '\n': + case '\r': + case ' ': + case '/': + if (d == ' ') + { soap_unget(soap, c); + *s = '\0'; + return SOAP_OK; + } + default: + if ((int)c == EOF) + return soap->error = SOAP_EOF; + *s++ = (char)c; + } + } + return soap->error = SOAP_EOM; +} +#endif + +/******************************************************************************/ +#ifdef WITH_FAST +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_store_lab(struct soap *soap, const char *s, size_t n) +{ soap->labidx = 0; + return soap_append_lab(soap, s, n); +} +#endif +#endif + +/******************************************************************************/ +#ifdef WITH_FAST +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_append_lab(struct soap *soap, const char *s, size_t n) +{ if (soap->labidx + n >= soap->lablen) + { register char *t = soap->labbuf; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Enlarging look-aside buffer to append data, old size=%lu", (unsigned long)soap->lablen)); + if (soap->lablen == 0) + soap->lablen = SOAP_LABLEN; + while (soap->labidx + n >= soap->lablen) + soap->lablen <<= 1; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, ", new size=%lu\n", (unsigned long)soap->lablen)); + soap->labbuf = (char*)SOAP_MALLOC(soap, soap->lablen); + if (!soap->labbuf) + { if (t) + SOAP_FREE(soap, t); + return soap->error = SOAP_EOM; + } + if (t) + { memcpy(soap->labbuf, t, soap->labidx); + SOAP_FREE(soap, t); + } + } + if (s) + { memcpy(soap->labbuf + soap->labidx, s, n); + soap->labidx += n; + } + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_peek_element(struct soap *soap) +{ +#ifdef WITH_DOM + register struct soap_dom_attribute **att = NULL; + register char *lead = NULL; +#endif + register struct soap_attribute *tp, *tq = NULL; + const char *t; + register char *s; + register soap_wchar c; + register int i; + if (soap->peeked) + { if (!*soap->tag) + return soap->error = SOAP_NO_TAG; + return SOAP_OK; + } + soap->peeked = 1; + soap->id[0] = '\0'; + soap->href[0] = '\0'; + soap->type[0] = '\0'; + soap->arrayType[0] = '\0'; + soap->arraySize[0] = '\0'; + soap->arrayOffset[0] = '\0'; + soap->other = 0; + soap->root = -1; + soap->position = 0; + soap->null = 0; + soap->mustUnderstand = 0; + c = soap_getutf8(soap); +#ifdef WITH_DOM + /* whitespace leading to start tag is not insignificant for DOM */ + if (soap_blank(c)) + { soap->labidx = 0; + do + { if (soap_append_lab(soap, NULL, 0)) + return SOAP_EOM; + s = soap->labbuf + soap->labidx; + i = soap->lablen - soap->labidx; + soap->labidx = soap->lablen; + while (soap_blank(c) && i--) + { *s++ = c; + c = soap_getutf8(soap); + } + } + while (soap_blank(c)); + *s = '\0'; + lead = soap_strdup(soap, soap->labbuf); + } +#else + while (soap_blank(c)) + c = soap_getutf8(soap); +#endif + if (c != SOAP_LT) + { *soap->tag = '\0'; + if ((int)c == EOF) + return soap->error = SOAP_EOF; + soap_unget(soap, c); +#ifdef WITH_DOM + /* whitespace leading to end tag is not insignificant for DOM */ + if ((soap->mode & SOAP_XML_DOM) && soap->dom) + soap->dom->tail = soap_strdup(soap, lead); +#endif + return soap->error = SOAP_NO_TAG; + } + s = soap->tag; + do c = soap_get1(soap); + while (soap_blank(c)); + i = sizeof(soap->tag); + while (c != '>' && c != '/' && soap_notblank(c) && (int)c != EOF) + { if (--i > 0) + *s++ = (char)c; + c = soap_get1(soap); + } + while (soap_blank(c)) + c = soap_get1(soap); + *s = '\0'; +#ifdef WITH_DOM + if (soap->mode & SOAP_XML_DOM) + { register struct soap_dom_element *elt; + elt = (struct soap_dom_element*)soap_malloc(soap, sizeof(struct soap_dom_element)); + if (!elt) + return soap->error; + elt->next = NULL; + elt->nstr = NULL; + elt->name = soap_strdup(soap, soap->tag); + elt->prnt = soap->dom; + elt->elts = NULL; + elt->atts = NULL; + elt->data = NULL; + elt->wide = NULL; + elt->type = 0; + elt->node = NULL; + elt->head = lead; + elt->tail = NULL; + elt->soap = soap; + if (soap->dom) + { struct soap_dom_element *p = soap->dom->elts; + if (p) + { while (p->next) + p = p->next; + p->next = elt; + } + else + soap->dom->elts = elt; + } + soap->dom = elt; + att = &elt->atts; + } +#endif + soap_pop_namespace(soap); + for (tp = soap->attributes; tp; tp = tp->next) + tp->visible = 0; + while ((int)c != EOF && c != '>' && c != '/') + { s = soap->tmpbuf; + i = sizeof(soap->tmpbuf); + while (c != '=' && c != '>' && c != '/' && soap_notblank(c) && (int)c != EOF) + { if (--i > 0) + *s++ = (char)c; + c = soap_get1(soap); + } + *s = '\0'; + if (i == sizeof(soap->tmpbuf)) + return soap->error = SOAP_SYNTAX_ERROR; +#ifdef WITH_DOM + /* add attribute name to dom */ + if (att) + { *att = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute)); + if (!*att) + return soap->error; + (*att)->next = NULL; + (*att)->nstr = NULL; + (*att)->name = soap_strdup(soap, soap->tmpbuf); + (*att)->data = NULL; + (*att)->wide = NULL; + (*att)->soap = soap; + } +#endif + if (!strncmp(soap->tmpbuf, "xmlns", 5)) + { if (soap->tmpbuf[5] == ':') + t = soap->tmpbuf + 6; + else if (soap->tmpbuf[5]) + t = NULL; + else + t = SOAP_STR_EOS; + } + else + t = NULL; + tq = NULL; + for (tp = soap->attributes; tp; tq = tp, tp = tp->next) + { if (!SOAP_STRCMP(tp->name, soap->tmpbuf)) + break; + } + if (!tp) + { tp = (struct soap_attribute*)SOAP_MALLOC(soap, sizeof(struct soap_attribute) + strlen(soap->tmpbuf)); + if (!tp) + return soap->error = SOAP_EOM; + strcpy(tp->name, soap->tmpbuf); + tp->value = NULL; + tp->size = 0; + /* if attribute name is qualified, append it to the end of the list */ + if (tq && strchr(soap->tmpbuf, ':')) + { tq->next = tp; + tp->next = NULL; + } + else + { tp->next = soap->attributes; + soap->attributes = tp; + } + } + while (soap_blank(c)) + c = soap_get1(soap); + if (c == '=') + { do c = soap_getutf8(soap); + while (soap_blank(c)); + if (c != SOAP_QT && c != SOAP_AP) + { soap_unget(soap, c); + c = ' '; /* blank delimiter */ + } + if (soap_getattrval(soap, tp->value, tp->size, c)) + { +#ifdef WITH_FAST + if (soap->error != SOAP_EOM) + return soap->error; + soap->error = SOAP_OK; + if (soap_store_lab(soap, tp->value, tp->size)) + return soap->error; + if (tp->value) + SOAP_FREE(soap, tp->value); + for (;;) + { if (soap_getattrval(soap, soap->labbuf + soap->labidx, soap->lablen - soap->labidx, c)) + { if (soap->error != SOAP_EOM) + return soap->error; + soap->error = SOAP_OK; + soap->labidx = soap->lablen; + if (soap_append_lab(soap, NULL, 0)) + return soap->error; + } + else + break; + } + if (soap->labidx) + tp->size = soap->lablen; + else + { tp->size = strlen(soap->labbuf) + 1; + if (tp->size < SOAP_LABLEN) + tp->size = SOAP_LABLEN; + } + if (!(tp->value = (char*)SOAP_MALLOC(soap, tp->size))) + return soap->error = SOAP_EOM; + strcpy(tp->value, soap->labbuf); +#else + size_t n; + if (soap->error != SOAP_EOM) + return soap->error; + soap->error = SOAP_OK; + if (soap_new_block(soap) == NULL) + return soap->error; + for (;;) + { if (!(s = (char*)soap_push_block(soap, NULL, SOAP_BLKLEN))) + return soap->error; + if (soap_getattrval(soap, s, SOAP_BLKLEN, c)) + { if (soap->error != SOAP_EOM) + return soap->error; + soap->error = SOAP_OK; + } + else + break; + } + n = tp->size + soap->blist->size; + if (!(s = (char*)SOAP_MALLOC(soap, n))) + return soap->error = SOAP_EOM; + if (tp->value) + { memcpy(s, tp->value, tp->size); + SOAP_FREE(soap, tp->value); + } + soap_save_block(soap, NULL, s + tp->size, 0); + tp->value = s; + tp->size = n; +#endif + } + do c = soap_get1(soap); + while (soap_blank(c)); + tp->visible = 2; /* seen this attribute w/ value */ +#ifdef WITH_DOM + if (att) + (*att)->data = soap_strdup(soap, tp->value); +#endif + } + else + tp->visible = 1; /* seen this attribute w/o value */ +#ifdef WITH_DOM + if (att) + att = &(*att)->next; +#endif + if (t && tp->value) + { if (soap_push_namespace(soap, t, tp->value)) + return soap->error; + } + } +#ifdef WITH_DOM + if (att) + { soap->dom->nstr = soap_current_namespace(soap, soap->tag); + for (att = &soap->dom->atts; *att; att = &(*att)->next) + (*att)->nstr = soap_current_namespace(soap, (*att)->name); + } +#endif + if ((int)c == EOF) + return soap->error = SOAP_EOF; + if (!(soap->body = (c != '/'))) + do c = soap_get1(soap); + while (soap_blank(c)); +#ifdef WITH_DOM + if (soap->mode & SOAP_XML_DOM) + { if (!soap->body && soap->dom->prnt) + soap->dom = soap->dom->prnt; + } +#endif + for (tp = soap->attributes; tp; tp = tp->next) + { if (tp->visible && tp->value) + { +#ifndef WITH_NOIDREF + if (!strcmp(tp->name, "id")) + { if ((soap->version > 0 && !(soap->mode & SOAP_XML_TREE)) + || (soap->mode & SOAP_XML_GRAPH)) + { *soap->id = '#'; + strncpy(soap->id + 1, tp->value, sizeof(soap->id) - 2); + soap->id[sizeof(soap->id)-1] = '\0'; + } + } + else if (!strcmp(tp->name, "href")) + { if (soap->version == 1 + || (soap->mode & SOAP_XML_GRAPH) + || (soap->mode & SOAP_ENC_MTOM) + || (soap->mode & SOAP_ENC_DIME)) + { strncpy(soap->href, tp->value, sizeof(soap->href) - 1); + soap->href[sizeof(soap->href)-1] = '\0'; + } + } + else +#endif + if (!soap_match_tag(soap, tp->name, "xsi:type")) + { strncpy(soap->type, tp->value, sizeof(soap->type) - 1); + soap->type[sizeof(soap->type)-1] = '\0'; + } + else if ((!soap_match_tag(soap, tp->name, "xsi:null") + || !soap_match_tag(soap, tp->name, "xsi:nil")) + && (!strcmp(tp->value, "1") + || !strcmp(tp->value, "true"))) + { soap->null = 1; + } + else if (soap->version == 1) + { if (!soap_match_tag(soap, tp->name, "SOAP-ENC:arrayType")) + { s = soap_strrchr(tp->value, '['); + if (s && (size_t)(s - tp->value) < sizeof(soap->arrayType)) + { strncpy(soap->arrayType, tp->value, s - tp->value); + soap->arrayType[s - tp->value] = '\0'; + strncpy(soap->arraySize, s, sizeof(soap->arraySize) - 1); + } + else + strncpy(soap->arrayType, tp->value, sizeof(soap->arrayType) - 1); + soap->arraySize[sizeof(soap->arrayType)-1] = '\0'; + soap->arrayType[sizeof(soap->arrayType)-1] = '\0'; + } + else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:offset")) + strncpy(soap->arrayOffset, tp->value, sizeof(soap->arrayOffset)); + else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:position")) + soap->position = soap_getposition(tp->value, soap->positions); + else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:root")) + soap->root = ((!strcmp(tp->value, "1") || !strcmp(tp->value, "true"))); + else if (!soap_match_tag(soap, tp->name, "SOAP-ENV:mustUnderstand") + && (!strcmp(tp->value, "1") || !strcmp(tp->value, "true"))) + soap->mustUnderstand = 1; + else if (!soap_match_tag(soap, tp->name, "SOAP-ENV:actor")) + { if ((!soap->actor || strcmp(soap->actor, tp->value)) + && strcmp(tp->value, "http://schemas.xmlsoap.org/soap/actor/next")) + soap->other = 1; + } + } + else if (soap->version == 2) + { +#ifndef WITH_NOIDREF + if (!strcmp(tp->name, "ref") + || !soap_match_tag(soap, tp->name, "SOAP-ENC:ref")) + { *soap->href = '#'; + strncpy(soap->href + 1, tp->value, sizeof(soap->href) - 2); + soap->href[sizeof(soap->href)-1] = '\0'; + } + else +#endif + if (!soap_match_tag(soap, tp->name, "SOAP-ENC:itemType")) + strncpy(soap->arrayType, tp->value, sizeof(soap->arrayType) - 1); + else if (!soap_match_tag(soap, tp->name, "SOAP-ENC:arraySize")) + strncpy(soap->arraySize, tp->value, sizeof(soap->arraySize) - 1); + else if (!soap_match_tag(soap, tp->name, "SOAP-ENV:mustUnderstand") + && (!strcmp(tp->value, "1") || !strcmp(tp->value, "true"))) + soap->mustUnderstand = 1; + else if (!soap_match_tag(soap, tp->name, "SOAP-ENV:role")) + { if ((!soap->actor || strcmp(soap->actor, tp->value)) + && strcmp(tp->value, "http://www.w3.org/2003/05/soap-envelope/role/next")) + soap->other = 1; + } + } + } + } + return soap->error = SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_retry(struct soap *soap) +{ soap->error = SOAP_OK; + soap_revert(soap); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_revert(struct soap *soap) +{ if (!soap->peeked) + { soap->peeked = 1; + if (soap->body) + soap->level--; + } + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Reverting last element (level=%u)\n", soap->level)); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_string_out(struct soap *soap, const char *s, int flag) +{ register const char *t; + register soap_wchar c; + register soap_wchar mask = (soap_wchar)0xFFFFFF80UL; +#ifdef WITH_DOM + if ((soap->mode & SOAP_XML_DOM) && soap->dom) + { soap->dom->data = soap_strdup(soap, s); + return SOAP_OK; + } +#endif + if (soap->mode & SOAP_C_UTFSTRING) + mask = 0; + t = s; + while ((c = *t++)) + { switch (c) + { + case 0x09: + if (flag) + { if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, " ", 5)) + return soap->error; + s = t; + } + break; + case 0x0A: + if (flag || !(soap->mode & SOAP_XML_CANONICAL)) + { if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, " ", 5)) + return soap->error; + s = t; + } + break; + case 0x0D: + if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, " ", 5)) + return soap->error; + s = t; + break; + case '&': + if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, "&", 5)) + return soap->error; + s = t; + break; + case '<': + if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, "<", 4)) + return soap->error; + s = t; + break; + case '>': + if (!flag) + { if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, ">", 4)) + return soap->error; + s = t; + } + break; + case '"': + if (flag) + { if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, """, 6)) + return soap->error; + s = t; + } + break; + default: +#ifndef WITH_LEANER +#ifdef HAVE_MBTOWC + if (soap->mode & SOAP_C_MBSTRING) + { wchar_t wc; + register int m = mbtowc(&wc, t - 1, MB_CUR_MAX); + if (m > 0 && wc != c) + { if (soap_send_raw(soap, s, t - s - 1) || soap_pututf8(soap, wc)) + return soap->error; + s = t += m - 1; + continue; + } + } +#endif +#endif +#ifndef WITH_NOSTRINGTOUTF8 + if ((c & mask) || !(c & 0xFFFFFFE0UL)) + { if (soap_send_raw(soap, s, t - s - 1) || soap_pututf8(soap, (unsigned char)c)) + return soap->error; + s = t; + } +#endif + } + } + return soap_send_raw(soap, s, t - s - 1); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +char * +SOAP_FMAC2 +soap_string_in(struct soap *soap, int flag, long minlen, long maxlen) +{ register char *s; + char *t = NULL; + register size_t i; + register long l = 0; + register int n = 0, f = 0, m = 0; + register soap_wchar c; +#if !defined(WITH_LEANER) && defined(HAVE_WCTOMB) + char buf[MB_LEN_MAX > 8 ? MB_LEN_MAX : 8]; +#else + char buf[8]; +#endif + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Reading string content\n")); + if (soap->peeked) + { if (*soap->tag) + { +#ifndef WITH_LEAN + struct soap_attribute *tp; + t = soap->tmpbuf; + *t = '<'; + t[sizeof(soap->tmpbuf)-1] = '\0'; + strncpy(t + 1, soap->tag, sizeof(soap->tmpbuf) - 2); + t += strlen(t); + for (tp = soap->attributes; tp; tp = tp->next) + { if (tp->visible) + { if (t >= soap->tmpbuf + sizeof(soap->tmpbuf) - 2) + break; + *t++ = ' '; + strcpy(t, tp->name); + t += strlen(t); + if (t >= soap->tmpbuf + sizeof(soap->tmpbuf) - 2) + break; /* too many or large attribute values */ + if (tp->value) + { *t++ = '='; + *t++ = '"'; + strcpy(t, tp->value); + t += strlen(t); + *t++ = '"'; + } + } + } + if (!soap->body) + *t++ = '/'; + *t++ = '>'; + *t = '\0'; + t = soap->tmpbuf; + m = (int)strlen(soap->tmpbuf); +#endif + if (soap->body) + n = 1; + f = 1; + soap->peeked = 0; + } + } +#ifdef WITH_CDATA + if (!flag) + { register int state = 0; +#ifdef WITH_FAST + soap->labidx = 0; /* use look-aside buffer */ +#else + if (soap_new_block(soap) == NULL) + return NULL; +#endif + for (;;) + { +#ifdef WITH_FAST + register size_t k; + if (soap_append_lab(soap, NULL, 0)) /* allocate more space in look-aside buffer if necessary */ + return NULL; + s = soap->labbuf + soap->labidx; /* space to populate */ + k = soap->lablen - soap->labidx; /* number of bytes available */ + soap->labidx = soap->lablen; /* claim this space */ +#else + register size_t k = SOAP_BLKLEN; + if (!(s = (char*)soap_push_block(soap, NULL, k))) + return NULL; +#endif + for (i = 0; i < k; i++) + { if (m > 0) + { *s++ = *t++; /* copy multibyte characters */ + m--; + continue; + } + c = soap_getchar(soap); + if ((int)c == EOF) + goto end; + if (c >= 0x80 && state != 1 && !(soap->mode & SOAP_ENC_LATIN)) + { soap_unget(soap, c); + c = soap_getutf8(soap); + if (soap->mode & SOAP_C_UTFSTRING) + { if ((c & 0x80000000) && c >= -0x7FFFFF80 && c < SOAP_AP) + { c &= 0x7FFFFFFF; + t = buf; + if (c < 0x0800) + *t++ = (char)(0xC0 | ((c >> 6) & 0x1F)); + else + { if (c < 0x010000) + *t++ = (char)(0xE0 | ((c >> 12) & 0x0F)); + else + { if (c < 0x200000) + *t++ = (char)(0xF0 | ((c >> 18) & 0x07)); + else + { if (c < 0x04000000) + *t++ = (char)(0xF8 | ((c >> 24) & 0x03)); + else + { *t++ = (char)(0xFC | ((c >> 30) & 0x01)); + *t++ = (char)(0x80 | ((c >> 24) & 0x3F)); + } + *t++ = (char)(0x80 | ((c >> 18) & 0x3F)); + } + *t++ = (char)(0x80 | ((c >> 12) & 0x3F)); + } + *t++ = (char)(0x80 | ((c >> 6) & 0x3F)); + } + *t++ = (char)(0x80 | (c & 0x3F)); + m = (int)(t - buf) - 1; + t = buf; + *s++ = *t++; + continue; + } + } + } + switch (state) + { case 1: + if (c == ']') + state = 4; + *s++ = c; + continue; + case 2: + if (c == '-') + state = 6; + *s++ = c; + continue; + case 3: + if (c == '?') + state = 8; + *s++ = c; + continue; + /* CDATA */ + case 4: + if (c == ']') + state = 5; + else + state = 1; + *s++ = c; + continue; + case 5: + if (c == '>') + state = 0; + else + state = 1; + *s++ = c; + continue; + /* comment */ + case 6: + if (c == '-') + state = 7; + else + state = 2; + *s++ = c; + continue; + case 7: + if (c == '>') + state = 0; + else + state = 2; + *s++ = c; + continue; + /* PI */ + case 8: + if (c == '>') + state = 0; + else + state = 3; + *s++ = c; + continue; + } + switch (c) + { + case '/': + if (n > 0) + { c = soap_getchar(soap); + if (c == '>') + n--; + soap_unget(soap, c); + } + *s++ = '/'; + break; + case '<': + c = soap_getchar(soap); + if (c == '/') + { if (n == 0) + { c = SOAP_TT; + goto end; + } + n--; + } + else if (c == '!') + { c = soap_getchar(soap); + if (c == '[') + { do c = soap_getchar(soap); + while ((int)c != EOF && c != '['); + if ((int)c == EOF) + goto end; + t = (char*)"![CDATA["; + m = 8; + state = 1; + } + else if (c == '-') + { if ((c = soap_getchar(soap)) == '-') + state = 2; + t = (char*)"!-"; + m = 2; + soap_unget(soap, c); + } + else + { t = (char*)"!"; + m = 1; + soap_unget(soap, c); + } + *s++ = '<'; + break; + } + else if (c == '?') + state = 3; + else + n++; + soap_unget(soap, c); + *s++ = '<'; + break; + case '>': + *s++ = '>'; + break; + case '"': + *s++ = '"'; + break; + default: +#ifndef WITH_LEANER +#ifdef HAVE_WCTOMB + if (soap->mode & SOAP_C_MBSTRING) + { m = wctomb(buf, c & 0x7FFFFFFF); + if (m >= 1 && m <= (int)MB_CUR_MAX) + { t = buf; + *s++ = *t++; + m--; + } + else + { *s++ = SOAP_UNKNOWN_CHAR; + m = 0; + } + } + else +#endif +#endif + *s++ = (char)(c & 0xFF); + } + l++; + if ((soap->mode & SOAP_XML_STRICT) && maxlen >= 0 && l > maxlen) + { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "String too long: maxlen=%ld\n", maxlen)); + soap->error = SOAP_LENGTH; + return NULL; + } + } + } + } +#endif +#ifdef WITH_FAST + soap->labidx = 0; /* use look-aside buffer */ +#else + if (soap_new_block(soap) == NULL) + return NULL; +#endif + for (;;) + { +#ifdef WITH_FAST + register size_t k; + if (soap_append_lab(soap, NULL, 0)) /* allocate more space in look-aside buffer if necessary */ + return NULL; + s = soap->labbuf + soap->labidx; /* space to populate */ + k = soap->lablen - soap->labidx; /* number of bytes available */ + soap->labidx = soap->lablen; /* claim this space */ +#else + register size_t k = SOAP_BLKLEN; + if (!(s = (char*)soap_push_block(soap, NULL, k))) + return NULL; +#endif + for (i = 0; i < k; i++) + { if (m > 0) + { *s++ = *t++; /* copy multibyte characters */ + m--; + continue; + } + if (soap->mode & SOAP_C_UTFSTRING) + { if (((c = soap_get(soap)) & 0x80000000) && c >= -0x7FFFFF80 && c < SOAP_AP) + { c &= 0x7FFFFFFF; + t = buf; + if (c < 0x0800) + *t++ = (char)(0xC0 | ((c >> 6) & 0x1F)); + else + { if (c < 0x010000) + *t++ = (char)(0xE0 | ((c >> 12) & 0x0F)); + else + { if (c < 0x200000) + *t++ = (char)(0xF0 | ((c >> 18) & 0x07)); + else + { if (c < 0x04000000) + *t++ = (char)(0xF8 | ((c >> 24) & 0x03)); + else + { *t++ = (char)(0xFC | ((c >> 30) & 0x01)); + *t++ = (char)(0x80 | ((c >> 24) & 0x3F)); + } + *t++ = (char)(0x80 | ((c >> 18) & 0x3F)); + } + *t++ = (char)(0x80 | ((c >> 12) & 0x3F)); + } + *t++ = (char)(0x80 | ((c >> 6) & 0x3F)); + } + *t++ = (char)(0x80 | (c & 0x3F)); + m = (int)(t - buf) - 1; + t = buf; + *s++ = *t++; + continue; + } + } + else + c = soap_getutf8(soap); + switch (c) + { + case SOAP_TT: + if (n == 0) + goto end; + n--; + *s++ = '<'; + t = (char*)"/"; + m = 1; + break; + case SOAP_LT: + if (f && n == 0) + goto end; + n++; + *s++ = '<'; + break; + case SOAP_GT: + *s++ = '>'; + break; + case SOAP_QT: + *s++ = '"'; + break; + case SOAP_AP: + *s++ = '\''; + break; + case '/': + if (n > 0) + { c = soap_get(soap); + if (c == SOAP_GT) + n--; + soap_unget(soap, c); + } + *s++ = '/'; + break; + case (soap_wchar)('<' | 0x80000000): + if (flag) + *s++ = '<'; + else + { *s++ = '&'; + t = (char*)"lt;"; + m = 3; + } + break; + case (soap_wchar)('>' | 0x80000000): + if (flag) + *s++ = '>'; + else + { *s++ = '&'; + t = (char*)"gt;"; + m = 3; + } + break; + case (soap_wchar)('&' | 0x80000000): + if (flag) + *s++ = '&'; + else + { *s++ = '&'; + t = (char*)"amp;"; + m = 4; + } + break; + case (soap_wchar)('"' | 0x80000000): + if (flag) + *s++ = '"'; + else + { *s++ = '&'; + t = (char*)"quot;"; + m = 5; + } + break; + case (soap_wchar)('\'' | 0x80000000): + if (flag) + *s++ = '\''; + else + { *s++ = '&'; + t = (char*)"apos;"; + m = 5; + } + break; + default: + if ((int)c == EOF) + goto end; +#ifndef WITH_LEANER +#ifdef HAVE_WCTOMB + if (soap->mode & SOAP_C_MBSTRING) + { m = wctomb(buf, c & 0x7FFFFFFF); + if (m >= 1 && m <= (int)MB_CUR_MAX) + { t = buf; + *s++ = *t++; + m--; + } + else + { *s++ = SOAP_UNKNOWN_CHAR; + m = 0; + } + } + else +#endif +#endif + *s++ = (char)(c & 0xFF); + } + l++; + if ((soap->mode & SOAP_XML_STRICT) && maxlen >= 0 && l > maxlen) + { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "String too long: maxlen=%ld\n", maxlen)); + soap->error = SOAP_LENGTH; + return NULL; + } + } + } +end: + soap_unget(soap, c); + *s = '\0'; +#ifdef WITH_FAST + t = soap_strdup(soap, soap->labbuf); +#else + soap_size_block(soap, NULL, i+1); + t = soap_save_block(soap, NULL, 0); +#endif + if ((soap->mode & SOAP_XML_STRICT) && l < minlen) + { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "String too short: %ld chars, minlen=%ld\n", l, minlen)); + soap->error = SOAP_LENGTH; + return NULL; + } +#ifdef WITH_DOM + if ((soap->mode & SOAP_XML_DOM) && soap->dom) + { if (flag == 3) + soap->dom->tail = t; + else + soap->dom->data = t; + } +#endif + if (flag == 2) + if (soap_s2QName(soap, t, &t)) + return NULL; + return t; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_wstring_out(struct soap *soap, const wchar_t *s, int flag) +{ const char *t; + char tmp; + register soap_wchar c; +#ifdef WITH_DOM + if ((soap->mode & SOAP_XML_DOM) && soap->dom) + { wchar_t *r = (wchar_t*)s; + int n = 1; + while (*r++) + n++; + soap->dom->wide = r = (wchar_t*)soap_malloc(soap, n * sizeof(wchar_t)); + while (n--) + *r++ = *s++; + return SOAP_OK; + } +#endif + while ((c = *s++)) + { switch (c) + { + case 0x09: + if (flag) + t = " "; + else + t = "\t"; + break; + case 0x0A: + if (flag || !(soap->mode & SOAP_XML_CANONICAL)) + t = " "; + else + t = "\n"; + break; + case 0x0D: + t = " "; + break; + case '&': + t = "&"; + break; + case '<': + t = "<"; + break; + case '>': + if (flag) + t = ">"; + else + t = ">"; + break; + case '"': + if (flag) + t = """; + else + t = "\""; + break; + default: + if (c >= 0x20 && c < 0x80) + { tmp = (char)c; + if (soap_send_raw(soap, &tmp, 1)) + return soap->error; + } + else if (soap_pututf8(soap, (unsigned long)c)) + return soap->error; + continue; + } + if (soap_send(soap, t)) + return soap->error; + } + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_2 +SOAP_FMAC1 +wchar_t * +SOAP_FMAC2 +soap_wstring_in(struct soap *soap, int flag, long minlen, long maxlen) +{ wchar_t *s; + register int i, n = 0, f = 0; + register long l = 0; + register soap_wchar c; + char *t = NULL; + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Reading wide string content\n")); + if (soap->peeked) + { if (*soap->tag) + { +#ifndef WITH_LEAN + struct soap_attribute *tp; + t = soap->tmpbuf; + *t = '<'; + t[sizeof(soap->tmpbuf)-1] = '\0'; + strncpy(t + 1, soap->tag, sizeof(soap->tmpbuf) - 2); + t += strlen(t); + for (tp = soap->attributes; tp; tp = tp->next) + { if (tp->visible) + { if (t >= soap->tmpbuf + sizeof(soap->tmpbuf) - 2) + break; + *t++ = ' '; + strcpy(t, tp->name); + t += strlen(t); + if (t >= soap->tmpbuf + sizeof(soap->tmpbuf) - 2) + break; + if (tp->value) + { *t++ = '='; + *t++ = '"'; + strcpy(t, tp->value); + t += strlen(t); + *t++ = '"'; + } + } + } + if (!soap->body) + *t++ = '/'; + *t++ = '>'; + *t = '\0'; + t = soap->tmpbuf; +#endif + if (soap->body) + n = 1; + f = 1; + soap->peeked = 0; + } + } + if (soap_new_block(soap) == NULL) + return NULL; + for (;;) + { if (!(s = (wchar_t*)soap_push_block(soap, NULL, sizeof(wchar_t)*SOAP_BLKLEN))) + return NULL; + for (i = 0; i < SOAP_BLKLEN; i++) + { if (t) + { *s++ = (wchar_t)*t++; + if (!*t) + t = NULL; + continue; + } + c = soap_getutf8(soap); + switch (c) + { + case SOAP_TT: + if (n == 0) + goto end; + n--; + *s++ = '<'; + soap_unget(soap, '/'); + break; + case SOAP_LT: + if (f && n == 0) + goto end; + n++; + *s++ = '<'; + break; + case SOAP_GT: + *s++ = '>'; + break; + case SOAP_QT: + *s++ = '"'; + break; + case SOAP_AP: + *s++ = '\''; + break; + case '/': + if (n > 0) + { c = soap_getutf8(soap); + if (c == SOAP_GT) + n--; + soap_unget(soap, c); + } + *s++ = '/'; + break; + case '<': + if (flag) + *s++ = (soap_wchar)'<'; + else + { *s++ = (soap_wchar)'&'; + t = (char*)"lt;"; + } + break; + case '>': + if (flag) + *s++ = (soap_wchar)'>'; + else + { *s++ = (soap_wchar)'&'; + t = (char*)"gt;"; + } + break; + case '"': + if (flag) + *s++ = (soap_wchar)'"'; + else + { *s++ = (soap_wchar)'&'; + t = (char*)"quot;"; + } + break; + default: + if ((int)c == EOF) + goto end; + *s++ = (wchar_t)c & 0x7FFFFFFF; + } + l++; + if ((soap->mode & SOAP_XML_STRICT) && maxlen >= 0 && l > maxlen) + { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "String too long: maxlen=%ld\n", maxlen)); + soap->error = SOAP_LENGTH; + return NULL; + } + } + } +end: + soap_unget(soap, c); + *s = '\0'; + soap_size_block(soap, NULL, sizeof(wchar_t) * (i + 1)); + if ((soap->mode & SOAP_XML_STRICT) && l < minlen) + { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "String too short: %ld chars, minlen=%ld\n", l, minlen)); + soap->error = SOAP_LENGTH; + return NULL; + } + s = (wchar_t*)soap_save_block(soap, NULL, NULL, 0); +#ifdef WITH_DOM + if ((soap->mode & SOAP_XML_DOM) && soap->dom) + soap->dom->wide = s; +#endif + return s; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_int2s(struct soap *soap, int n) +{ return soap_long2s(soap, (long)n); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outint(struct soap *soap, const char *tag, int id, const int *p, const char *type, int n) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, p, n), type) + || soap_string_out(soap, soap_long2s(soap, (long)*p), 0)) + return soap->error; + return soap_element_end_out(soap, tag); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2int(struct soap *soap, const char *s, int *p) +{ if (s) + { char *r; +#ifndef WITH_NOIO +#ifndef WITH_LEAN + soap_reset_errno; +#endif +#endif + *p = (int)soap_strtol(s, &r, 10); + if ((s == r && (soap->mode & SOAP_XML_STRICT)) || *r +#ifndef WITH_NOIO +#ifndef WITH_LEAN + || soap_errno == SOAP_ERANGE +#endif +#endif + ) + soap->error = SOAP_TYPE; + } + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int * +SOAP_FMAC2 +soap_inint(struct soap *soap, const char *tag, int *p, const char *type, int t) +{ if (soap_element_begin_in(soap, tag, 0, NULL)) + return NULL; +#ifndef WITH_LEAN + if (*soap->type + && soap_match_tag(soap, soap->type, type) + && soap_match_tag(soap, soap->type, ":int") + && soap_match_tag(soap, soap->type, ":short") + && soap_match_tag(soap, soap->type, ":byte")) + { soap->error = SOAP_TYPE; + soap_revert(soap); + return NULL; + } +#endif + p = (int*)soap_id_enter(soap, soap->id, p, t, sizeof(int), 0, NULL, NULL, NULL); + if (*soap->href) + p = (int*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(int), 0, NULL); + else if (p) + { if (soap_s2int(soap, soap_value(soap), p)) + return NULL; + } + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_long2s(struct soap *soap, long n) +{ sprintf(soap->tmpbuf, "%ld", n); + return soap->tmpbuf; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outlong(struct soap *soap, const char *tag, int id, const long *p, const char *type, int n) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, p, n), type) + || soap_string_out(soap, soap_long2s(soap, *p), 0)) + return soap->error; + return soap_element_end_out(soap, tag); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2long(struct soap *soap, const char *s, long *p) +{ if (s) + { char *r; +#ifndef WITH_NOIO +#ifndef WITH_LEAN + soap_reset_errno; +#endif +#endif + *p = soap_strtol(s, &r, 10); + if ((s == r && (soap->mode & SOAP_XML_STRICT)) || *r +#ifndef WITH_NOIO +#ifndef WITH_LEAN + || soap_errno == SOAP_ERANGE +#endif +#endif + ) + soap->error = SOAP_TYPE; + } + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +long * +SOAP_FMAC2 +soap_inlong(struct soap *soap, const char *tag, long *p, const char *type, int t) +{ if (soap_element_begin_in(soap, tag, 0, NULL)) + return NULL; +#ifndef WITH_LEAN + if (*soap->type + && soap_match_tag(soap, soap->type, type) + && soap_match_tag(soap, soap->type, ":int") + && soap_match_tag(soap, soap->type, ":short") + && soap_match_tag(soap, soap->type, ":byte")) + { soap->error = SOAP_TYPE; + soap_revert(soap); + return NULL; + } +#endif + p = (long*)soap_id_enter(soap, soap->id, p, t, sizeof(long), 0, NULL, NULL, NULL); + if (*soap->href) + p = (long*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(long), 0, NULL); + else if (p) + { if (soap_s2long(soap, soap_value(soap), p)) + return NULL; + } + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_LONG642s(struct soap *soap, LONG64 n) +{ sprintf(soap->tmpbuf, SOAP_LONG_FORMAT, n); + return soap->tmpbuf; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outLONG64(struct soap *soap, const char *tag, int id, const LONG64 *p, const char *type, int n) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, p, n), type) + || soap_string_out(soap, soap_LONG642s(soap, *p), 0)) + return soap->error; + return soap_element_end_out(soap, tag); +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2LONG64(struct soap *soap, const char *s, LONG64 *p) +{ if (s) + { +#ifdef HAVE_STRTOLL + char *r; +#ifndef WITH_NOIO +#ifndef WITH_LEAN + soap_reset_errno; +#endif +#endif + *p = strtoll(s, &r, 10); + if ((s == r && (soap->mode & SOAP_XML_STRICT)) || *r +#ifndef WITH_NOIO +#ifndef WITH_LEAN + || soap_errno == SOAP_ERANGE +#endif +#endif + ) +#else +# ifdef HAVE_SSCANF + if (sscanf(s, SOAP_LONG_FORMAT, p) != 1) +# endif +#endif + soap->error = SOAP_TYPE; + } + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +LONG64 * +SOAP_FMAC2 +soap_inLONG64(struct soap *soap, const char *tag, LONG64 *p, const char *type, int t) +{ if (soap_element_begin_in(soap, tag, 0, NULL)) + return NULL; +#ifndef WITH_LEAN + if (*soap->type + && soap_match_tag(soap, soap->type, type) + && soap_match_tag(soap, soap->type, ":integer") + && soap_match_tag(soap, soap->type, ":positiveInteger") + && soap_match_tag(soap, soap->type, ":negativeInteger") + && soap_match_tag(soap, soap->type, ":nonPositiveInteger") + && soap_match_tag(soap, soap->type, ":nonNegativeInteger") + && soap_match_tag(soap, soap->type, ":long") + && soap_match_tag(soap, soap->type, ":int") + && soap_match_tag(soap, soap->type, ":short") + && soap_match_tag(soap, soap->type, ":byte")) + { soap->error = SOAP_TYPE; + soap_revert(soap); + return NULL; + } +#endif + p = (LONG64*)soap_id_enter(soap, soap->id, p, t, sizeof(LONG64), 0, NULL, NULL, NULL); + if (*soap->href) + p = (LONG64*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(LONG64), 0, NULL); + else if (p) + { if (soap_s2LONG64(soap, soap_value(soap), p)) + return NULL; + } + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_byte2s(struct soap *soap, char n) +{ return soap_long2s(soap, (long)n); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outbyte(struct soap *soap, const char *tag, int id, const char *p, const char *type, int n) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, p, n), type) + || soap_string_out(soap, soap_long2s(soap, (long)*p), 0)) + return soap->error; + return soap_element_end_out(soap, tag); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2byte(struct soap *soap, const char *s, char *p) +{ if (s) + { long n; + char *r; + n = soap_strtol(s, &r, 10); + if (s == r || *r || n < -128 || n > 127) + soap->error = SOAP_TYPE; + *p = (char)n; + } + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +char * +SOAP_FMAC2 +soap_inbyte(struct soap *soap, const char *tag, char *p, const char *type, int t) +{ if (soap_element_begin_in(soap, tag, 0, NULL)) + return NULL; +#ifndef WITH_LEAN + if (*soap->type + && soap_match_tag(soap, soap->type, type) + && soap_match_tag(soap, soap->type, ":byte")) + { soap->error = SOAP_TYPE; + soap_revert(soap); + return NULL; + } +#endif + p = (char*)soap_id_enter(soap, soap->id, p, t, sizeof(char), 0, NULL, NULL, NULL); + if (*soap->href) + p = (char*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(char), 0, NULL); + else if (p) + { if (soap_s2byte(soap, soap_value(soap), p)) + return NULL; + } + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_short2s(struct soap *soap, short n) +{ return soap_long2s(soap, (long)n); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outshort(struct soap *soap, const char *tag, int id, const short *p, const char *type, int n) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, p, n), type) + || soap_string_out(soap, soap_long2s(soap, (long)*p), 0)) + return soap->error; + return soap_element_end_out(soap, tag); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2short(struct soap *soap, const char *s, short *p) +{ if (s) + { long n; + char *r; + n = soap_strtol(s, &r, 10); + if (s == r || *r || n < -32768 || n > 32767) + soap->error = SOAP_TYPE; + *p = (short)n; + } + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +short * +SOAP_FMAC2 +soap_inshort(struct soap *soap, const char *tag, short *p, const char *type, int t) +{ if (soap_element_begin_in(soap, tag, 0, NULL)) + return NULL; +#ifndef WITH_LEAN + if (*soap->type + && soap_match_tag(soap, soap->type, type) + && soap_match_tag(soap, soap->type, ":short") + && soap_match_tag(soap, soap->type, ":byte")) + { soap->error = SOAP_TYPE; + soap_revert(soap); + return NULL; + } +#endif + p = (short*)soap_id_enter(soap, soap->id, p, t, sizeof(short), 0, NULL, NULL, NULL); + if (*soap->href) + p = (short*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(short), 0, NULL); + else if (p) + { if (soap_s2short(soap, soap_value(soap), p)) + return NULL; + } + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_float2s(struct soap *soap, float n) +{ char *s; +/* if (soap_isnan((double)n)) + return "NaN";*/ + if (soap_ispinff(n)) + return "INF"; + if (soap_isninff(n)) + return "-INF"; + s = soap->tmpbuf; +#if defined(HAVE_SPRINTF_L) + sprintf_l(s, soap->c_locale, soap->float_format, n); +#else + sprintf(s, soap->float_format, n); + s = strchr(s, ','); /* convert decimal comma to DP */ + if (s) + *s = '.'; +#endif + return soap->tmpbuf; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outfloat(struct soap *soap, const char *tag, int id, const float *p, const char *type, int n) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, p, n), type) + || soap_string_out(soap, soap_float2s(soap, *p), 0)) + return soap->error; + return soap_element_end_out(soap, tag); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2float(struct soap *soap, const char *s, float *p) +{ if (s) + { if (!*s) + return soap->error = SOAP_TYPE; + if (!soap_tag_cmp(s, "INF")) + *p = FLT_PINFTY; + else if (!soap_tag_cmp(s, "+INF")) + *p = FLT_PINFTY; + else if (!soap_tag_cmp(s, "-INF")) + *p = FLT_NINFTY; + else if (!soap_tag_cmp(s, "NaN")) + *p = FLT_NAN; + else + { +/* On some systems strtof requires -std=c99 or does not even link: so we try to use strtod first */ +#if defined(HAVE_STRTOD_L) + char *r; + *p = (float)strtod_l(s, &r, soap->c_locale); + if (*r) +#elif defined(HAVE_STRTOD) + char *r; + *p = (float)strtod(s, &r); + if (*r) +#elif defined(HAVE_STRTOF_L) + char *r; + *p = strtof_l((char*)s, &r, soap->c_locale); + if (*r) +#elif defined(HAVE_STRTOF) + char *r; + *p = strtof((char*)s, &r); + if (*r) +#endif + { +#if defined(HAVE_SSCANF_L) && !defined(HAVE_STRTOF_L) && !defined(HAVE_STRTOD_L) + if (sscanf_l(s, soap->c_locale, "%g", p) != 1) + soap->error = SOAP_TYPE; +#elif defined(HAVE_SSCANF) + if (sscanf(s, "%g", p) != 1) + soap->error = SOAP_TYPE; +#else + soap->error = SOAP_TYPE; +#endif + } + } + } + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +static int soap_isnumeric(struct soap *soap, const char *type) +{ if (soap_match_tag(soap, soap->type, type) + && soap_match_tag(soap, soap->type, ":float") + && soap_match_tag(soap, soap->type, ":double") + && soap_match_tag(soap, soap->type, ":decimal") + && soap_match_tag(soap, soap->type, ":integer") + && soap_match_tag(soap, soap->type, ":positiveInteger") + && soap_match_tag(soap, soap->type, ":negativeInteger") + && soap_match_tag(soap, soap->type, ":nonPositiveInteger") + && soap_match_tag(soap, soap->type, ":nonNegativeInteger") + && soap_match_tag(soap, soap->type, ":long") + && soap_match_tag(soap, soap->type, ":int") + && soap_match_tag(soap, soap->type, ":short") + && soap_match_tag(soap, soap->type, ":byte") + && soap_match_tag(soap, soap->type, ":unsignedLong") + && soap_match_tag(soap, soap->type, ":unsignedInt") + && soap_match_tag(soap, soap->type, ":unsignedShort") + && soap_match_tag(soap, soap->type, ":unsignedByte")) + { soap->error = SOAP_TYPE; + soap_revert(soap); + return SOAP_ERR; + } + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +float * +SOAP_FMAC2 +soap_infloat(struct soap *soap, const char *tag, float *p, const char *type, int t) +{ if (soap_element_begin_in(soap, tag, 0, NULL)) + return NULL; +#ifndef WITH_LEAN + if (*soap->type != '\0' && soap_isnumeric(soap, type)) + return NULL; +#endif + p = (float*)soap_id_enter(soap, soap->id, p, t, sizeof(float), 0, NULL, NULL, NULL); + if (*soap->href) + p = (float*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(float), 0, NULL); + else if (p) + { if (soap_s2float(soap, soap_value(soap), p)) + return NULL; + } + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_double2s(struct soap *soap, double n) +{ char *s; +/* if (soap_isnan(n)) + return "NaN";*/ + if (soap_ispinfd(n)) + return "INF"; + if (soap_isninfd(n)) + return "-INF"; + s = soap->tmpbuf; +#if defined(HAVE_SPRINTF_L) + sprintf_l(s, soap->c_locale, soap->double_format, n); +#else + sprintf(s, soap->double_format, n); + s = strchr(s, ','); /* convert decimal comma to DP */ + if (s) + *s = '.'; +#endif + return soap->tmpbuf; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outdouble(struct soap *soap, const char *tag, int id, const double *p, const char *type, int n) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, p, n), type) + || soap_string_out(soap, soap_double2s(soap, *p), 0)) + return soap->error; + return soap_element_end_out(soap, tag); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2double(struct soap *soap, const char *s, double *p) +{ if (s) + { if (!*s) + return soap->error = SOAP_TYPE; + if (!soap_tag_cmp(s, "INF")) + *p = DBL_PINFTY; + else if (!soap_tag_cmp(s, "+INF")) + *p = DBL_PINFTY; + else if (!soap_tag_cmp(s, "-INF")) + *p = DBL_NINFTY; + else if (!soap_tag_cmp(s, "NaN")) + *p = DBL_NAN; + else + { +#if defined(HAVE_STRTOD_L) + char *r; + *p = strtod_l(s, &r, soap->c_locale); + if (*r) +#elif defined(HAVE_STRTOD) + char *r; + *p = strtod(s, &r); + if (*r) +#endif + { +#if defined(HAVE_SSCANF_L) && !defined(HAVE_STRTOF_L) && !defined(HAVE_STRTOD_L) + if (sscanf_l(s, soap->c_locale, "%lg", p) != 1) + soap->error = SOAP_TYPE; +#elif defined(HAVE_SSCANF) + if (sscanf(s, "%lg", p) != 1) + soap->error = SOAP_TYPE; +#else + soap->error = SOAP_TYPE; +#endif + } + } + } + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +double * +SOAP_FMAC2 +soap_indouble(struct soap *soap, const char *tag, double *p, const char *type, int t) +{ if (soap_element_begin_in(soap, tag, 0, NULL)) + return NULL; +#ifndef WITH_LEAN + if (*soap->type != '\0' && soap_isnumeric(soap, type)) + return NULL; +#endif + p = (double*)soap_id_enter(soap, soap->id, p, t, sizeof(double), 0, NULL, NULL, NULL); + if (*soap->href) + p = (double*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(double), 0, NULL); + else if (p) + { if (soap_s2double(soap, soap_value(soap), p)) + return NULL; + } + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_unsignedByte2s(struct soap *soap, unsigned char n) +{ return soap_unsignedLong2s(soap, (unsigned long)n); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outunsignedByte(struct soap *soap, const char *tag, int id, const unsigned char *p, const char *type, int n) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, p, n), type) + || soap_string_out(soap, soap_unsignedLong2s(soap, (unsigned long)*p), 0)) + return soap->error; + return soap_element_end_out(soap, tag); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2unsignedByte(struct soap *soap, const char *s, unsigned char *p) +{ if (s) + { unsigned long n; + char *r; + n = soap_strtoul(s, &r, 10); + if (s == r || *r || n > 255) + soap->error = SOAP_TYPE; + *p = (unsigned char)n; + } + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +unsigned char * +SOAP_FMAC2 +soap_inunsignedByte(struct soap *soap, const char *tag, unsigned char *p, const char *type, int t) +{ if (soap_element_begin_in(soap, tag, 0, NULL)) + return NULL; +#ifndef WITH_LEAN + if (*soap->type + && soap_match_tag(soap, soap->type, type) + && soap_match_tag(soap, soap->type, ":unsignedByte")) + { soap->error = SOAP_TYPE; + soap_revert(soap); + return NULL; + } +#endif + p = (unsigned char*)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned char), 0, NULL, NULL, NULL); + if (*soap->href) + p = (unsigned char*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(unsigned char), 0, NULL); + else if (p) + { if (soap_s2unsignedByte(soap, soap_value(soap), p)) + return NULL; + } + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_unsignedShort2s(struct soap *soap, unsigned short n) +{ return soap_unsignedLong2s(soap, (unsigned long)n); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outunsignedShort(struct soap *soap, const char *tag, int id, const unsigned short *p, const char *type, int n) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, p, n), type) + || soap_string_out(soap, soap_unsignedLong2s(soap, (unsigned long)*p), 0)) + return soap->error; + return soap_element_end_out(soap, tag); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2unsignedShort(struct soap *soap, const char *s, unsigned short *p) +{ if (s) + { unsigned long n; + char *r; + n = soap_strtoul(s, &r, 10); + if (s == r || *r || n > 65535) + soap->error = SOAP_TYPE; + *p = (unsigned short)n; + } + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +unsigned short * +SOAP_FMAC2 +soap_inunsignedShort(struct soap *soap, const char *tag, unsigned short *p, const char *type, int t) +{ if (soap_element_begin_in(soap, tag, 0, NULL)) + return NULL; +#ifndef WITH_LEAN + if (*soap->type + && soap_match_tag(soap, soap->type, type) + && soap_match_tag(soap, soap->type, ":unsignedShort") + && soap_match_tag(soap, soap->type, ":unsignedByte")) + { soap->error = SOAP_TYPE; + soap_revert(soap); + return NULL; + } +#endif + p = (unsigned short*)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned short), 0, NULL, NULL, NULL); + if (*soap->href) + p = (unsigned short*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(unsigned short), 0, NULL); + else if (p) + { if (soap_s2unsignedShort(soap, soap_value(soap), p)) + return NULL; + } + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_unsignedInt2s(struct soap *soap, unsigned int n) +{ return soap_unsignedLong2s(soap, (unsigned long)n); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outunsignedInt(struct soap *soap, const char *tag, int id, const unsigned int *p, const char *type, int n) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, p, n), type) + || soap_string_out(soap, soap_unsignedLong2s(soap, (unsigned long)*p), 0)) + return soap->error; + return soap_element_end_out(soap, tag); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2unsignedInt(struct soap *soap, const char *s, unsigned int *p) +{ if (s) + { char *r; +#ifndef WITH_NOIO +#ifndef WITH_LEAN + soap_reset_errno; +#endif +#endif + *p = (unsigned int)soap_strtoul(s, &r, 10); + if ((s == r && (soap->mode & SOAP_XML_STRICT)) || *r +#ifndef WITH_NOIO +#ifndef WITH_LEAN + || soap_errno == SOAP_ERANGE +#endif +#endif + ) + soap->error = SOAP_TYPE; + } + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +unsigned int * +SOAP_FMAC2 +soap_inunsignedInt(struct soap *soap, const char *tag, unsigned int *p, const char *type, int t) +{ if (soap_element_begin_in(soap, tag, 0, NULL)) + return NULL; +#ifndef WITH_LEAN + if (*soap->type + && soap_match_tag(soap, soap->type, type) + && soap_match_tag(soap, soap->type, ":unsignedInt") + && soap_match_tag(soap, soap->type, ":unsignedShort") + && soap_match_tag(soap, soap->type, ":unsignedByte")) + { soap->error = SOAP_TYPE; + soap_revert(soap); + return NULL; + } +#endif + p = (unsigned int*)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned int), 0, NULL, NULL, NULL); + if (*soap->href) + p = (unsigned int*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(unsigned int), 0, NULL); + else if (p) + { if (soap_s2unsignedInt(soap, soap_value(soap), p)) + return NULL; + } + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_unsignedLong2s(struct soap *soap, unsigned long n) +{ sprintf(soap->tmpbuf, "%lu", n); + return soap->tmpbuf; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outunsignedLong(struct soap *soap, const char *tag, int id, const unsigned long *p, const char *type, int n) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, p, n), type) + || soap_string_out(soap, soap_unsignedLong2s(soap, *p), 0)) + return soap->error; + return soap_element_end_out(soap, tag); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2unsignedLong(struct soap *soap, const char *s, unsigned long *p) +{ if (s) + { char *r; +#ifndef WITH_NOIO +#ifndef WITH_LEAN + soap_reset_errno; +#endif +#endif + *p = soap_strtoul(s, &r, 10); + if ((s == r && (soap->mode & SOAP_XML_STRICT)) || *r +#ifndef WITH_NOIO +#ifndef WITH_LEAN + || soap_errno == SOAP_ERANGE +#endif +#endif + ) + soap->error = SOAP_TYPE; + } + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +unsigned long * +SOAP_FMAC2 +soap_inunsignedLong(struct soap *soap, const char *tag, unsigned long *p, const char *type, int t) +{ if (soap_element_begin_in(soap, tag, 0, NULL)) + return NULL; +#ifndef WITH_LEAN + if (*soap->type + && soap_match_tag(soap, soap->type, type) + && soap_match_tag(soap, soap->type, ":unsignedInt") + && soap_match_tag(soap, soap->type, ":unsignedShort") + && soap_match_tag(soap, soap->type, ":unsignedByte")) + { soap->error = SOAP_TYPE; + soap_revert(soap); + return NULL; + } +#endif + p = (unsigned long*)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned long), 0, NULL, NULL, NULL); + if (*soap->href) + p = (unsigned long*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(unsigned long), 0, NULL); + else if (p) + { if (soap_s2unsignedLong(soap, soap_value(soap), p)) + return NULL; + } + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_ULONG642s(struct soap *soap, ULONG64 n) +{ sprintf(soap->tmpbuf, SOAP_ULONG_FORMAT, n); + return soap->tmpbuf; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outULONG64(struct soap *soap, const char *tag, int id, const ULONG64 *p, const char *type, int n) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, p, n), type) + || soap_string_out(soap, soap_ULONG642s(soap, *p), 0)) + return soap->error; + return soap_element_end_out(soap, tag); +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2ULONG64(struct soap *soap, const char *s, ULONG64 *p) +{ if (s) + { +#ifdef HAVE_STRTOULL + char *r; +#ifndef WITH_NOIO +#ifndef WITH_LEAN + soap_reset_errno; +#endif +#endif + *p = strtoull(s, &r, 10); + if ((s == r && (soap->mode & SOAP_XML_STRICT)) || *r +#ifndef WITH_NOIO +#ifndef WITH_LEAN + || soap_errno == SOAP_ERANGE +#endif +#endif + ) +#else +#ifdef HAVE_SSCANF + if (sscanf(s, SOAP_ULONG_FORMAT, p) != 1) +#endif +#endif + soap->error = SOAP_TYPE; + } + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +ULONG64 * +SOAP_FMAC2 +soap_inULONG64(struct soap *soap, const char *tag, ULONG64 *p, const char *type, int t) +{ if (soap_element_begin_in(soap, tag, 0, NULL)) + return NULL; + if (*soap->type + && soap_match_tag(soap, soap->type, type) + && soap_match_tag(soap, soap->type, ":positiveInteger") + && soap_match_tag(soap, soap->type, ":nonNegativeInteger") + && soap_match_tag(soap, soap->type, ":unsignedLong") + && soap_match_tag(soap, soap->type, ":unsignedInt") + && soap_match_tag(soap, soap->type, ":unsignedShort") + && soap_match_tag(soap, soap->type, ":unsignedByte")) + { soap->error = SOAP_TYPE; + soap_revert(soap); + return NULL; + } + p = (ULONG64*)soap_id_enter(soap, soap->id, p, t, sizeof(ULONG64), 0, NULL, NULL, NULL); + if (*soap->href) + p = (ULONG64*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(ULONG64), 0, NULL); + else if (p) + { if (soap_s2ULONG64(soap, soap_value(soap), p)) + return NULL; + } + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2string(struct soap *soap, const char *s, char **t) +{ if (s) + { if (!(*t = soap_strdup(soap, s))) + return soap->error = SOAP_EOM; + if (!(soap->mode & (SOAP_ENC_LATIN | SOAP_C_UTFSTRING))) + { /* TODO: consider truncating UTF8 to ASCII for regular XML attribute strings? */ + } + } + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2QName(struct soap *soap, const char *s, char **t) +{ if (s) + { soap->labidx = 0; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Normalized namespace(s) of QNames '%s'", s)); + /* convert (by prefix normalize prefix) all QNames in s */ + for (;;) + { size_t n; + struct soap_nlist *np; + register const char *p; + /* skip blanks */ + while (*s && soap_blank(*s)) + s++; + if (!*s) + break; + /* find next QName */ + n = 1; + while (s[n] && !soap_blank(s[n])) + n++; + np = soap->nlist; + /* if there is no namespace stack, or prefix is "xml" then copy string */ + if (!np || !strncmp(s, "xml:", 4)) + { soap_append_lab(soap, s, n); + } + else /* we normalize the QName by replacing its prefix */ + { p = strchr(s, ':'); + if (p) + { size_t k = p - s; + while (np && (strncmp(np->id, s, k) || np->id[k])) + np = np->next; + p++; + } + else + { while (np && *np->id) + np = np->next; + p = s; + } + /* replace prefix */ + if (np) + { if (np->index >= 0 && soap->local_namespaces) + { const char *q = soap->local_namespaces[np->index].id; + if (q) + soap_append_lab(soap, q, strlen(q)); + } + else if (np->ns) + { soap_append_lab(soap, "\"", 1); + soap_append_lab(soap, np->ns, strlen(np->ns)); + soap_append_lab(soap, "\"", 1); + } + else + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "\nNamespace prefix of '%s' not defined (index=%d, URI=%s)\n", s, np->index, np->ns?np->ns:SOAP_STR_EOS)); + return soap->error = SOAP_NAMESPACE; + } + } + else /* no namespace: assume default "" namespace */ + { soap_append_lab(soap, "\"\"", 2); + } + soap_append_lab(soap, ":", 1); + soap_append_lab(soap, p, n - (p-s)); + } + /* advance to next and add spacing */ + s += n; + if (*s) + soap_append_lab(soap, " ", 1); + } + soap_append_lab(soap, SOAP_STR_EOS, 1); + *t = soap_strdup(soap, soap->labbuf); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, " into '%s'\n", *t)); + } + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_QName2s(struct soap *soap, const char *s) +{ const char *t = NULL; + if (s) + { soap->labidx = 0; + for (;;) + { size_t n; + /* skip blanks */ + while (*s && soap_blank(*s)) + s++; + if (!*s) + break; + /* find next QName */ + n = 1; + while (s[n] && !soap_blank(s[n])) + n++; + /* normal prefix: pass string as is */ + if (*s != '"') + { soap_append_lab(soap, s, n); +#ifndef WITH_LEAN + if ((soap->mode & SOAP_XML_CANONICAL)) + { const char *r = strchr(s, ':'); + if (r) + soap_utilize_ns(soap, s, r - s); + } +#endif + } + else /* URL-based string prefix */ + { const char *q; + s++; + q = strchr(s, '"'); + if (q) + { struct Namespace *p = soap->local_namespaces; + if (p) + { for (; p->id; p++) + { if (p->ns) + if (!soap_tag_cmp(s, p->ns)) + break; + if (p->in) + if (!soap_tag_cmp(s, p->in)) + break; + } + } + /* URL is in the namespace table? */ + if (p && p->id) + { soap_append_lab(soap, p->id, strlen(p->id)); + } + else /* not in namespace table: create xmlns binding */ + { char *r = soap_strdup(soap, s); + r[q-s] = '\0'; + sprintf(soap->tmpbuf, "xmlns:_%d", soap->idnum++); + soap_set_attr(soap, soap->tmpbuf, r); + soap_append_lab(soap, soap->tmpbuf + 6, strlen(soap->tmpbuf + 6)); + } + soap_append_lab(soap, q + 1, n - (q-s) - 1); + } + } + /* advance to next and add spacing */ + s += n; + if (*s) + soap_append_lab(soap, " ", 1); + } + soap_append_lab(soap, SOAP_STR_EOS, 1); + t = soap_strdup(soap, soap->labbuf); + } + return t; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2wchar(struct soap *soap, const char *s, wchar_t **t) +{ if (s) + { wchar_t *r; + *t = r = (wchar_t*)soap_malloc(soap, sizeof(wchar_t) * (strlen(s) + 1)); + if (!r) + return soap->error; + if (soap->mode & SOAP_ENC_LATIN) + { while (*s) + *r++ = (wchar_t)*s++; + } + else + { /* Convert UTF8 to wchar */ + while (*s) + { register soap_wchar c, c1, c2, c3, c4; + c = (unsigned char)*s++; + if (c < 0x80) + *r++ = (wchar_t)c; + else + { c1 = (soap_wchar)*s++ & 0x3F; + if (c < 0xE0) + *r++ = (wchar_t)(((soap_wchar)(c & 0x1F) << 6) | c1); + else + { c2 = (soap_wchar)*s++ & 0x3F; + if (c < 0xF0) + *r++ = (wchar_t)(((soap_wchar)(c & 0x0F) << 12) | (c1 << 6) | c2); + else + { c3 = (soap_wchar)*s++ & 0x3F; + if (c < 0xF8) + *r++ = (wchar_t)(((soap_wchar)(c & 0x07) << 18) | (c1 << 12) | (c2 << 6) | c3); + else + { c4 = (soap_wchar)*s++ & 0x3F; + if (c < 0xFC) + *r++ = (wchar_t)(((soap_wchar)(c & 0x03) << 24) | (c1 << 18) | (c2 << 12) | (c3 << 6) | c4); + else + *r++ = (wchar_t)(((soap_wchar)(c & 0x01) << 30) | (c1 << 24) | (c2 << 18) | (c3 << 12) | (c4 << 6) | (soap_wchar)(*s++ & 0x3F)); + } + } + } + } + } + } + *r = L'\0'; + } + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_wchar2s(struct soap *soap, const wchar_t *s) +{ register soap_wchar c; + register char *r, *t; + const wchar_t *q = s; + size_t n = 0; + while ((c = *q++)) + { if (c > 0 && c < 0x80) + n++; + else + n += 6; + } + r = t = (char*)soap_malloc(soap, n + 1); + if (r) + { /* Convert wchar to UTF8 */ + while ((c = *s++)) + { if (c > 0 && c < 0x80) + *t++ = (char)c; + else + { if (c < 0x0800) + *t++ = (char)(0xC0 | ((c >> 6) & 0x1F)); + else + { if (c < 0x010000) + *t++ = (char)(0xE0 | ((c >> 12) & 0x0F)); + else + { if (c < 0x200000) + *t++ = (char)(0xF0 | ((c >> 18) & 0x07)); + else + { if (c < 0x04000000) + *t++ = (char)(0xF8 | ((c >> 24) & 0x03)); + else + { *t++ = (char)(0xFC | ((c >> 30) & 0x01)); + *t++ = (char)(0x80 | ((c >> 24) & 0x3F)); + } + *t++ = (char)(0x80 | ((c >> 18) & 0x3F)); + } + *t++ = (char)(0x80 | ((c >> 12) & 0x3F)); + } + *t++ = (char)(0x80 | ((c >> 6) & 0x3F)); + } + *t++ = (char)(0x80 | (c & 0x3F)); + } + } + *t = '\0'; + } + return r; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outstring(struct soap *soap, const char *tag, int id, char *const*p, const char *type, int n) +{ id = soap_element_id(soap, tag, id, *p, NULL, 0, type, n); + if (id < 0) + return soap->error; + if (!**p && (soap->mode & SOAP_C_NILSTRING)) + return soap_element_null(soap, tag, id, type); + if (soap_element_begin_out(soap, tag, id, type) + || soap_string_out(soap, *p, 0) + || soap_element_end_out(soap, tag)) + return soap->error; + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +char ** +SOAP_FMAC2 +soap_instring(struct soap *soap, const char *tag, char **p, const char *type, int t, int flag, long minlen, long maxlen) +{ if (soap_element_begin_in(soap, tag, 1, NULL)) + { if (!tag || *tag != '-' || soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + } + if (!p) + { if (!(p = (char**)soap_malloc(soap, sizeof(char*)))) + return NULL; + } + if (soap->null) + *p = NULL; + else if (soap->body) + { *p = soap_string_in(soap, flag, minlen, maxlen); + if (!*p || !(char*)soap_id_enter(soap, soap->id, *p, t, sizeof(char*), 0, NULL, NULL, NULL)) + return NULL; + if (!**p && tag && *tag == '-') + { soap->error = SOAP_NO_TAG; + return NULL; + } + } + else if (tag && *tag == '-') + { soap->error = SOAP_NO_TAG; + return NULL; + } + else + *p = soap_strdup(soap, SOAP_STR_EOS); + if (*soap->href) + p = (char**)soap_id_lookup(soap, soap->href, (void**)p, t, sizeof(char**), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outwstring(struct soap *soap, const char *tag, int id, wchar_t *const*p, const char *type, int n) +{ id = soap_element_id(soap, tag, id, *p, NULL, 0, type, n); + if (id < 0) + return soap->error; + if (!**p && (soap->mode & SOAP_C_NILSTRING)) + return soap_element_null(soap, tag, id, type); + if (soap_element_begin_out(soap, tag, id, type) + || soap_wstring_out(soap, *p, 0) + || soap_element_end_out(soap, tag)) + return soap->error; + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_2 +SOAP_FMAC1 +wchar_t ** +SOAP_FMAC2 +soap_inwstring(struct soap *soap, const char *tag, wchar_t **p, const char *type, int t, long minlen, long maxlen) +{ if (soap_element_begin_in(soap, tag, 1, NULL)) + { if (!tag || *tag != '-' || soap->error != SOAP_NO_TAG) + return NULL; + soap->error = SOAP_OK; + } + if (!p) + { if (!(p = (wchar_t**)soap_malloc(soap, sizeof(wchar_t*)))) + return NULL; + } + if (soap->body) + { *p = soap_wstring_in(soap, 1, minlen, maxlen); + if (!*p || !(wchar_t*)soap_id_enter(soap, soap->id, *p, t, sizeof(wchar_t*), 0, NULL, NULL, NULL)) + return NULL; + if (!**p && tag && *tag == '-') + { soap->error = SOAP_NO_TAG; + return NULL; + } + } + else if (tag && *tag == '-') + { soap->error = SOAP_NO_TAG; + return NULL; + } + else if (soap->null) + *p = NULL; + else + *p = soap_wstrdup(soap, (wchar_t*)SOAP_STR_EOS); + if (*soap->href) + p = (wchar_t**)soap_id_lookup(soap, soap->href, (void**)p, t, sizeof(wchar_t**), 0); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +time_t +SOAP_FMAC2 +soap_timegm(struct tm *T) +{ +#if defined(HAVE_TIMEGM) + return timegm(T); +#else + time_t t, g, z; + struct tm tm; + t = mktime(T); + if (t == (time_t)-1) + return (time_t)-1; +#ifdef HAVE_GMTIME_R + gmtime_r(&t, &tm); +#else + tm = *gmtime(&t); +#endif + tm.tm_isdst = 0; + g = mktime(&tm); + if (g == (time_t)-1) + return (time_t)-1; + z = g - t; + return t - z; +#endif +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_dateTime2s(struct soap *soap, time_t n) +{ struct tm T, *pT = &T; +#if defined(HAVE_GMTIME_R) + if (gmtime_r(&n, pT)) + strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%SZ", pT); +#elif defined(HAVE_GMTIME) + if ((pT = gmtime(&n))) + strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%SZ", pT); +#elif defined(HAVE_GETTIMEOFDAY) + struct timezone tz; + memset((void*)&tz, 0, sizeof(tz)); +#if defined(HAVE_LOCALTIME_R) + if (localtime_r(&n, pT)) + { struct timeval tv; + gettimeofday(&tv, &tz); + strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); + sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -tz.tz_minuteswest/60+(pT->tm_isdst!=0), abs(tz.tz_minuteswest)%60); + } +#else + if ((pT = localtime(&n))) + { struct timeval tv; + gettimeofday(&tv, &tz); + strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); + sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -tz.tz_minuteswest/60+(pT->tm_isdst!=0), abs(tz.tz_minuteswest)%60); + } +#endif +#elif defined(HAVE_FTIME) + struct timeb t; + memset((void*)&t, 0, sizeof(t)); +#if defined(HAVE_LOCALTIME_R) + if (localtime_r(&n, pT)) + { +#ifdef __BORLANDC__ + ::ftime(&t); +#else + ftime(&t); +#endif + strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); + sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.timezone/60+(pT->tm_isdst!=0), abs(t.timezone)%60); + } +#else + if ((pT = localtime(&n))) + { +#ifdef __BORLANDC__ + ::ftime(&t); +#else + ftime(&t); +#endif + strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); + sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.timezone/60+(pT->tm_isdst!=0), abs(t.timezone)%60); + } +#endif +#elif defined(HAVE_LOCALTIME_R) + if (localtime_r(&n, pT)) + strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); +#else + if ((pT = localtime(&n))) + strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); +#endif + else + strcpy(soap->tmpbuf, "1969-12-31T23:59:59Z"); + return soap->tmpbuf; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outdateTime(struct soap *soap, const char *tag, int id, const time_t *p, const char *type, int n) +{ if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, p, n), type) + || soap_string_out(soap, soap_dateTime2s(soap, *p), 0)) + return soap->error; + return soap_element_end_out(soap, tag); +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_s2dateTime(struct soap *soap, const char *s, time_t *p) +{ if (s) + { char zone[32]; + struct tm T; + const char *t; + *zone = '\0'; + memset((void*)&T, 0, sizeof(T)); + if (strchr(s, '-')) + t = "%d-%d-%dT%d:%d:%d%31s"; + else if (strchr(s, ':')) + t = "%4d%2d%2dT%d:%d:%d%31s"; + else /* parse non-XSD-standard alternative ISO 8601 format */ + t = "%4d%2d%2dT%2d%2d%2d%31s"; + if (sscanf(s, t, &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, zone) < 6) + return soap->error = SOAP_TYPE; + if (T.tm_year == 1) + T.tm_year = 70; + else + T.tm_year -= 1900; + T.tm_mon--; + if (*zone == '.') + { for (s = zone + 1; *s; s++) + if (*s < '0' || *s > '9') + break; + } + else + s = zone; + if (*s) + { +#ifndef WITH_NOZONE + if (*s == '+' || *s == '-') + { int h = 0, m = 0; + if (s[3] == ':') + { /* +hh:mm */ + sscanf(s, "%d:%d", &h, &m); + if (h < 0) + m = -m; + } + else /* +hhmm */ + { m = (int)atol(s); + h = m / 100; + m = m % 100; + } + T.tm_min -= m; + T.tm_hour -= h; + /* put hour and min in range */ + T.tm_hour += T.tm_min / 60; + T.tm_min %= 60; + if (T.tm_min < 0) + T.tm_min += 60; + T.tm_mday += T.tm_hour / 24; + T.tm_hour %= 24; + if (T.tm_hour < 0) + T.tm_hour += 24; + /* note: day of the month may be out of range, timegm() handles it */ + } +#endif + *p = soap_timegm(&T); + } + else + *p = mktime(&T); + } + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +time_t * +SOAP_FMAC2 +soap_indateTime(struct soap *soap, const char *tag, time_t *p, const char *type, int t) +{ if (soap_element_begin_in(soap, tag, 0, NULL)) + return NULL; + if (*soap->type + && soap_match_tag(soap, soap->type, type) + && soap_match_tag(soap, soap->type, ":dateTime")) + { soap->error = SOAP_TYPE; + soap_revert(soap); + return NULL; + } + p = (time_t*)soap_id_enter(soap, soap->id, p, t, sizeof(time_t), 0, NULL, NULL, NULL); + if (*soap->href) + p = (time_t*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(time_t), 0, NULL); + else if (p) + { if (soap_s2dateTime(soap, soap_value(soap), p)) + return NULL; + } + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outliteral(struct soap *soap, const char *tag, char *const*p, const char *type) +{ int i; + const char *t = NULL; + if (tag && *tag != '-') + { if (soap->local_namespaces && (t = strchr(tag, ':'))) + { strncpy(soap->tmpbuf, tag, t-tag); + soap->tmpbuf[t-tag] = '\0'; + for (i = 0; soap->local_namespaces[i].id; i++) + if (!strcmp(soap->tmpbuf, soap->local_namespaces[i].id)) + break; + t++; + if (soap_element(soap, t, 0, type) + || soap_attribute(soap, "xmlns", soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS) + || soap_element_start_end_out(soap, NULL)) + return soap->error; + } + else + { t = tag; + if (soap_element_begin_out(soap, t, 0, type)) + return soap->error; + } + } + if (p && *p) + { if (soap_send(soap, *p)) + return soap->error; + } + if (t) + return soap_element_end_out(soap, t); + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +char ** +SOAP_FMAC2 +soap_inliteral(struct soap *soap, const char *tag, char **p) +{ if (soap_element_begin_in(soap, tag, 1, NULL)) + { if (soap->error != SOAP_NO_TAG || soap_unget(soap, soap_get(soap)) == SOAP_TT) + return NULL; + soap->error = SOAP_OK; + } + if (!p) + { if (!(p = (char**)soap_malloc(soap, sizeof(char*)))) + return NULL; + } + if (soap->body || (tag && *tag == '-')) + { *p = soap_string_in(soap, 0, -1, -1); + if (!*p) + return NULL; + if (!**p && tag && *tag == '-') + { soap->error = SOAP_NO_TAG; + return NULL; + } + } + else if (soap->null) + *p = NULL; + else + *p = soap_strdup(soap, SOAP_STR_EOS); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_outwliteral(struct soap *soap, const char *tag, wchar_t *const*p, const char *type) +{ int i; + const char *t = NULL; + if (tag && *tag != '-') + { if (soap->local_namespaces && (t = strchr(tag, ':'))) + { strncpy(soap->tmpbuf, tag, t-tag); + soap->tmpbuf[t-tag] = '\0'; + for (i = 0; soap->local_namespaces[i].id; i++) + if (!strcmp(soap->tmpbuf, soap->local_namespaces[i].id)) + break; + t++; + if (soap_element(soap, t, 0, type) + || soap_attribute(soap, "xmlns", soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS) + || soap_element_start_end_out(soap, NULL)) + return soap->error; + } + else + { t = tag; + if (soap_element_begin_out(soap, t, 0, type)) + return soap->error; + } + if (soap_send(soap, soap->tmpbuf)) + return soap->error; + } + if (p) + { wchar_t c; + const wchar_t *s = *p; + while ((c = *s++)) + { if (soap_pututf8(soap, (unsigned long)c)) + return soap->error; + } + } + if (t) + return soap_element_end_out(soap, t); + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_2 +SOAP_FMAC1 +wchar_t ** +SOAP_FMAC2 +soap_inwliteral(struct soap *soap, const char *tag, wchar_t **p) +{ if (soap_element_begin_in(soap, tag, 1, NULL)) + { if (soap->error != SOAP_NO_TAG || soap_unget(soap, soap_get(soap)) == SOAP_TT) + return NULL; + soap->error = SOAP_OK; + } + if (!p) + { if (!(p = (wchar_t**)soap_malloc(soap, sizeof(wchar_t*)))) + return NULL; + } + if (soap->body) + { *p = soap_wstring_in(soap, 0, -1, -1); + if (!*p) + return NULL; + if (!**p && tag && *tag == '-') + { soap->error = SOAP_NO_TAG; + return NULL; + } + } + else if (tag && *tag == '-') + { soap->error = SOAP_NO_TAG; + return NULL; + } + else if (soap->null) + *p = NULL; + else + *p = soap_wstrdup(soap, (wchar_t*)SOAP_STR_EOS); + if (soap->body && soap_element_end_in(soap, tag)) + return NULL; + return p; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +const char * +SOAP_FMAC2 +soap_value(struct soap *soap) +{ register size_t i; + register soap_wchar c = 0; + register char *s = soap->tmpbuf; + if (!soap->body) + return SOAP_STR_EOS; + do c = soap_get(soap); + while (soap_blank(c)); + for (i = 0; i < sizeof(soap->tmpbuf) - 1; i++) + { if (c == SOAP_TT || (int)c == EOF) + break; + *s++ = (char)c; + c = soap_get(soap); + } + for (s--; i > 0; i--, s--) + { if (!soap_blank(*s)) + break; + } + s[1] = '\0'; + if ((int)c == EOF || c == SOAP_TT) + soap_unget(soap, c); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element content value='%s'\n", soap->tmpbuf)); +#ifdef WITH_DOM + if ((soap->mode & SOAP_XML_DOM) && soap->dom) + soap->dom->data = soap_strdup(soap, soap->tmpbuf); +#endif + return soap->tmpbuf; /* return non-null pointer */ +} +#endif + +/******************************************************************************/ +#if !defined(WITH_LEANER) || !defined(WITH_NOHTTP) +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_getline(struct soap *soap, char *s, int len) +{ int i = len; + soap_wchar c = 0; + for (;;) + { while (--i > 0) + { c = soap_getchar(soap); + if (c == '\r' || c == '\n') + break; + if ((int)c == EOF) + return soap->error = SOAP_EOF; + *s++ = (char)c; + } + if (c != '\n') + c = soap_getchar(soap); /* got \r or something else, now get \n */ + if (c == '\n') + { *s = '\0'; + if (i+1 == len) /* empty line: end of HTTP/MIME header */ + break; + c = soap_get0(soap); + if (c != ' ' && c != '\t') /* HTTP line continuation? */ + break; + } + else if ((int)c == EOF) + return soap->error = SOAP_EOF; + } + if (i < 0) + return soap->error = SOAP_HDR; + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +static size_t +soap_count_attachments(struct soap *soap) +{ +#ifndef WITH_LEANER + register struct soap_multipart *content; + register size_t count = soap->count; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Calculating the message size with attachments, current count=%lu\n", (unsigned long)count)); + if ((soap->mode & SOAP_ENC_DIME) && !(soap->mode & SOAP_ENC_MTOM)) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Calculating the size of DIME attachments\n")); + for (content = soap->dime.first; content; content = content->next) + { count += 12 + ((content->size+3)&(~3)); + if (content->id) + count += ((strlen(content->id)+3)&(~3)); + if (content->type) + count += ((strlen(content->type)+3)&(~3)); + if (content->options) + count += ((((unsigned char)content->options[2] << 8) | ((unsigned char)content->options[3]))+7)&(~3); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Size of DIME attachment content is %lu bytes\n", (unsigned long)content->size)); + } + } + if ((soap->mode & SOAP_ENC_MIME) && soap->mime.boundary) + { register size_t n = strlen(soap->mime.boundary); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Calculating the size of MIME attachments\n")); + for (content = soap->mime.first; content; content = content->next) + { register const char *s; + /* count \r\n--boundary\r\n */ + count += 6 + n; + /* count Content-Type: ...\r\n */ + if (content->type) + count += 16 + strlen(content->type); + /* count Content-Transfer-Encoding: ...\r\n */ + s = soap_code_str(mime_codes, content->encoding); + if (s) + count += 29 + strlen(s); + /* count Content-ID: ...\r\n */ + if (content->id) + count += 14 + strlen(content->id); + /* count Content-Location: ...\r\n */ + if (content->location) + count += 20 + strlen(content->location); + /* count Content-Description: ...\r\n */ + if (content->description) + count += 23 + strlen(content->description); + /* count \r\n...content */ + count += 2 + content->size; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Size of MIME attachment content is %lu bytes\n", (unsigned long)content->size)); + } + /* count \r\n--boundary-- */ + count += 6 + n; + } + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "New count is %lu bytes\n", (unsigned long)count)); + return count; +#else + return soap->count; +#endif +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +static int +soap_putdimefield(struct soap *soap, const char *s, size_t n) +{ if (soap_send_raw(soap, s, n)) + return soap->error; + return soap_send_raw(soap, SOAP_STR_PADDING, -(long)n&3); +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +char * +SOAP_FMAC2 +soap_dime_option(struct soap *soap, unsigned short optype, const char *option) +{ size_t n; + char *s = NULL; + if (option) + { n = strlen(option); + s = (char*)soap_malloc(soap, n + 5); + if (s) + { s[0] = (char)(optype >> 8); + s[1] = (char)(optype & 0xFF); + s[2] = (char)(n >> 8); + s[3] = (char)(n & 0xFF); + strcpy(s + 4, option); + } + } + return s; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_putdimehdr(struct soap *soap) +{ unsigned char tmp[12]; + size_t optlen = 0, idlen = 0, typelen = 0; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Put DIME header id='%s'\n", soap->dime.id?soap->dime.id:SOAP_STR_EOS)); + if (soap->dime.options) + optlen = (((unsigned char)soap->dime.options[2] << 8) | ((unsigned char)soap->dime.options[3])) + 4; + if (soap->dime.id) + { idlen = strlen(soap->dime.id); + if (idlen > 0x0000FFFF) + idlen = 0x0000FFFF; + } + if (soap->dime.type) + { typelen = strlen(soap->dime.type); + if (typelen > 0x0000FFFF) + typelen = 0x0000FFFF; + } + tmp[0] = SOAP_DIME_VERSION | (soap->dime.flags & 0x7); + tmp[1] = soap->dime.flags & 0xF0; + tmp[2] = (char)(optlen >> 8); + tmp[3] = (char)(optlen & 0xFF); + tmp[4] = (char)(idlen >> 8); + tmp[5] = (char)(idlen & 0xFF); + tmp[6] = (char)(typelen >> 8); + tmp[7] = (char)(typelen & 0xFF); + tmp[8] = (char)(soap->dime.size >> 24); + tmp[9] = (char)((soap->dime.size >> 16) & 0xFF); + tmp[10] = (char)((soap->dime.size >> 8) & 0xFF); + tmp[11] = (char)(soap->dime.size & 0xFF); + if (soap_send_raw(soap, (char*)tmp, 12) + || soap_putdimefield(soap, soap->dime.options, optlen) + || soap_putdimefield(soap, soap->dime.id, idlen) + || soap_putdimefield(soap, soap->dime.type, typelen)) + return soap->error; + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_putdime(struct soap *soap) +{ struct soap_multipart *content; + if (!(soap->mode & SOAP_ENC_DIME)) + return SOAP_OK; + for (content = soap->dime.first; content; content = content->next) + { void *handle; + soap->dime.size = content->size; + soap->dime.id = content->id; + soap->dime.type = content->type; + soap->dime.options = content->options; + soap->dime.flags = SOAP_DIME_VERSION | SOAP_DIME_MEDIA; + if (soap->fdimereadopen && ((handle = soap->fdimereadopen(soap, (void*)content->ptr, content->id, content->type, content->options)) || soap->error)) + { size_t size = content->size; + if (!handle) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimereadopen failed\n")); + return soap->error; + } + if (!size && ((soap->mode & SOAP_ENC_XML) || (soap->mode & SOAP_IO) == SOAP_IO_CHUNK || (soap->mode & SOAP_IO) == SOAP_IO_STORE)) + { size_t chunksize = sizeof(soap->tmpbuf); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Chunked streaming DIME\n")); + do + { size = soap->fdimeread(soap, handle, soap->tmpbuf, chunksize); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimeread returned %lu bytes\n", (unsigned long)size)); + if (size < chunksize) + { soap->dime.flags &= ~SOAP_DIME_CF; + if (!content->next) + soap->dime.flags |= SOAP_DIME_ME; + } + else + soap->dime.flags |= SOAP_DIME_CF; + soap->dime.size = size; + if (soap_putdimehdr(soap) + || soap_putdimefield(soap, soap->tmpbuf, size)) + break; + if (soap->dime.id) + { soap->dime.flags &= ~(SOAP_DIME_MB | SOAP_DIME_MEDIA); + soap->dime.id = NULL; + soap->dime.type = NULL; + soap->dime.options = NULL; + } + } while (size >= chunksize); + } + else + { if (!content->next) + soap->dime.flags |= SOAP_DIME_ME; + if (soap_putdimehdr(soap)) + return soap->error; + do + { size_t bufsize; + if (size < sizeof(soap->tmpbuf)) + bufsize = size; + else + bufsize = sizeof(soap->tmpbuf); + if (!(bufsize = soap->fdimeread(soap, handle, soap->tmpbuf, bufsize))) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimeread failed: insufficient data (%lu bytes remaining from %lu bytes)\n", (unsigned long)size, (unsigned long)content->size)); + soap->error = SOAP_EOF; + break; + } + if (soap_send_raw(soap, soap->tmpbuf, bufsize)) + break; + size -= bufsize; + } while (size); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimereadclose\n")); + soap_send_raw(soap, SOAP_STR_PADDING, -(long)soap->dime.size&3); + } + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimereadclose\n")); + if (soap->fdimereadclose) + soap->fdimereadclose(soap, handle); + } + else + { if (!content->next) + soap->dime.flags |= SOAP_DIME_ME; + if (soap_putdimehdr(soap) + || soap_putdimefield(soap, (char*)content->ptr, content->size)) + return soap->error; + } + } + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +static char * +soap_getdimefield(struct soap *soap, size_t n) +{ register soap_wchar c; + register size_t i; + register char *s; + register char *p = NULL; + if (n) + { p = (char*)soap_malloc(soap, n + 1); + if (p) + { s = p; + for (i = n; i > 0; i--) + { if ((int)(c = soap_get1(soap)) == EOF) + { soap->error = SOAP_EOF; + return NULL; + } + *s++ = (char)c; + } + *s = '\0'; + if ((soap->error = soap_move(soap, -(long)n&3))) + return NULL; + } + else + soap->error = SOAP_EOM; + } + return p; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_getdimehdr(struct soap *soap) +{ register soap_wchar c; + register char *s; + register int i; + unsigned char tmp[12]; + size_t optlen, idlen, typelen; + if (!(soap->mode & SOAP_ENC_DIME)) + return soap->error = SOAP_DIME_END; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Get DIME header\n")); + if (soap->dime.buflen || soap->dime.chunksize) + { if (soap_move(soap, (long)(soap->dime.size - soap_tell(soap)))) + return soap->error = SOAP_EOF; + soap_unget(soap, soap_getchar(soap)); /* skip padding and get hdr */ + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "... From chunked\n")); + return SOAP_OK; + } + s = (char*)tmp; + for (i = 12; i > 0; i--) + { if ((int)(c = soap_getchar(soap)) == EOF) + return soap->error = SOAP_EOF; + *s++ = (char)c; + } + if ((tmp[0] & 0xF8) != SOAP_DIME_VERSION) + return soap->error = SOAP_DIME_MISMATCH; + soap->dime.flags = (tmp[0] & 0x7) | (tmp[1] & 0xF0); + optlen = (tmp[2] << 8) | tmp[3]; + idlen = (tmp[4] << 8) | tmp[5]; + typelen = (tmp[6] << 8) | tmp[7]; + soap->dime.size = (tmp[8] << 24) | (tmp[9] << 16) | (tmp[10] << 8) | tmp[11]; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "DIME size=%lu flags=0x%X\n", (unsigned long)soap->dime.size, soap->dime.flags)); + if (!(soap->dime.options = soap_getdimefield(soap, optlen)) && soap->error) + return soap->error; + if (!(soap->dime.id = soap_getdimefield(soap, idlen)) && soap->error) + return soap->error; + if (!(soap->dime.type = soap_getdimefield(soap, typelen)) && soap->error) + return soap->error; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "DIME id=%s, type=%s, options=%s\n", soap->dime.id?soap->dime.id:SOAP_STR_EOS, soap->dime.type?soap->dime.type:"", soap->dime.options?soap->dime.options+4:SOAP_STR_EOS)); + if (soap->dime.flags & SOAP_DIME_ME) + soap->mode &= ~SOAP_ENC_DIME; + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_getdime(struct soap *soap) +{ while (soap->dime.flags & SOAP_DIME_CF) + { if (soap_getdimehdr(soap)) + return soap->error; + if (soap_move(soap, (long)soap->dime.size)) + return soap->error = SOAP_EOF; + } + if (soap_move(soap, (long)(((soap->dime.size+3)&(~3))-soap_tell(soap)))) + return soap->error = SOAP_EOF; + for (;;) + { register struct soap_multipart *content; + if (soap_getdimehdr(soap)) + break; + if (soap->fdimewriteopen && ((soap->dime.ptr = (char*)soap->fdimewriteopen(soap, soap->dime.id, soap->dime.type, soap->dime.options)) || soap->error)) + { const char *id, *type, *options; + size_t size, n; + if (!soap->dime.ptr) + return soap->error; + id = soap->dime.id; + type = soap->dime.type; + options = soap->dime.options; + for (;;) + { size = soap->dime.size; + for (;;) + { n = soap->buflen - soap->bufidx; + if (size < n) + n = size; + if ((soap->error = soap->fdimewrite(soap, (void*)soap->dime.ptr, soap->buf + soap->bufidx, n))) + break; + size -= n; + if (!size) + { soap->bufidx += n; + break; + } + if (soap_recv(soap)) + { soap->error = SOAP_EOF; + goto end; + } + } + if (soap_move(soap, -(long)soap->dime.size&3)) + { soap->error = SOAP_EOF; + break; + } + if (!(soap->dime.flags & SOAP_DIME_CF)) + break; + if (soap_getdimehdr(soap)) + break; + } +end: + if (soap->fdimewriteclose) + soap->fdimewriteclose(soap, (void*)soap->dime.ptr); + soap->dime.size = 0; + soap->dime.id = id; + soap->dime.type = type; + soap->dime.options = options; + } + else if (soap->dime.flags & SOAP_DIME_CF) + { const char *id, *type, *options; + id = soap->dime.id; + type = soap->dime.type; + options = soap->dime.options; + if (soap_new_block(soap) == NULL) + return SOAP_EOM; + for (;;) + { register soap_wchar c; + register size_t i; + register char *s; + s = (char*)soap_push_block(soap, NULL, soap->dime.size); + if (!s) + return soap->error = SOAP_EOM; + for (i = soap->dime.size; i > 0; i--) + { if ((int)(c = soap_get1(soap)) == EOF) + return soap->error = SOAP_EOF; + *s++ = (char)c; + } + if (soap_move(soap, -(long)soap->dime.size&3)) + return soap->error = SOAP_EOF; + if (!(soap->dime.flags & SOAP_DIME_CF)) + break; + if (soap_getdimehdr(soap)) + return soap->error; + } + soap->dime.size = soap->blist->size++; /* allocate one more for '\0' */ + if (!(soap->dime.ptr = soap_save_block(soap, NULL, NULL, 0))) + return soap->error; + soap->dime.ptr[soap->dime.size] = '\0'; /* force 0-terminated */ + soap->dime.id = id; + soap->dime.type = type; + soap->dime.options = options; + } + else + soap->dime.ptr = soap_getdimefield(soap, soap->dime.size); + content = soap_new_multipart(soap, &soap->dime.first, &soap->dime.last, soap->dime.ptr, soap->dime.size); + if (!content) + return soap->error = SOAP_EOM; + content->id = soap->dime.id; + content->type = soap->dime.type; + content->options = soap->dime.options; + if (soap->error) + return soap->error; + soap_resolve_attachment(soap, content); + } + if (soap->error != SOAP_DIME_END) + return soap->error; + return soap->error = SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_getmimehdr(struct soap *soap) +{ struct soap_multipart *content; + do + { if (soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf))) + return soap->error; + } + while (!*soap->msgbuf); + if (soap->msgbuf[0] == '-' && soap->msgbuf[1] == '-') + { char *s = soap->msgbuf + strlen(soap->msgbuf) - 1; + /* remove white space */ + while (soap_blank(*s)) + s--; + s[1] = '\0'; + if (soap->mime.boundary) + { if (strcmp(soap->msgbuf + 2, soap->mime.boundary)) + return soap->error = SOAP_MIME_ERROR; + } + else + soap->mime.boundary = soap_strdup(soap, soap->msgbuf + 2); + if (soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf))) + return soap->error; + } + if (soap_set_mime_attachment(soap, NULL, 0, SOAP_MIME_NONE, NULL, NULL, NULL, NULL)) + return soap->error = SOAP_EOM; + content = soap->mime.last; + for (;;) + { register char *key = soap->msgbuf; + register char *val; + if (!*key) + break; + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "MIME header: %s\n", key)); + val = strchr(soap->msgbuf, ':'); + if (val) + { *val = '\0'; + do val++; + while (*val && *val <= 32); + if (!soap_tag_cmp(key, "Content-ID")) + content->id = soap_strdup(soap, val); + else if (!soap_tag_cmp(key, "Content-Location")) + content->location = soap_strdup(soap, val); + else if (!soap_tag_cmp(key, "Content-Disposition")) + content->id = soap_strdup(soap, soap_get_header_attribute(soap, val, "name")); + else if (!soap_tag_cmp(key, "Content-Type")) + content->type = soap_strdup(soap, val); + else if (!soap_tag_cmp(key, "Content-Description")) + content->description = soap_strdup(soap, val); + else if (!soap_tag_cmp(key, "Content-Transfer-Encoding")) + content->encoding = (enum soap_mime_encoding)soap_code_int(mime_codes, val, (long)SOAP_MIME_NONE); + } + if (soap_getline(soap, key, sizeof(soap->msgbuf))) + return soap->error; + } + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_getmime(struct soap *soap) +{ while (soap_get_mime_attachment(soap, NULL)) + ; + return soap->error; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_post_check_mime_attachments(struct soap *soap) +{ soap->imode |= SOAP_MIME_POSTCHECK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_check_mime_attachments(struct soap *soap) +{ if (soap->mode & SOAP_MIME_POSTCHECK) + return soap_get_mime_attachment(soap, NULL) != NULL; + return 0; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +struct soap_multipart * +SOAP_FMAC2 +soap_get_mime_attachment(struct soap *soap, void *handle) +{ register soap_wchar c = 0; + register size_t i, m = 0; + register char *s, *t = NULL; + register struct soap_multipart *content; + register short flag = 0; + if (!(soap->mode & SOAP_ENC_MIME)) + return NULL; + content = soap->mime.last; + if (!content) + { if (soap_getmimehdr(soap)) + return NULL; + content = soap->mime.last; + } + else if (content != soap->mime.first) + { if (soap->fmimewriteopen && ((content->ptr = (char*)soap->fmimewriteopen(soap, (void*)handle, content->id, content->type, content->description, content->encoding)) || soap->error)) + { if (!content->ptr) + return NULL; + } + } + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Parsing MIME content id=%s type=%s\n", content->id?content->id:SOAP_STR_EOS, content->type?content->type:SOAP_STR_EOS)); + if (!content->ptr && soap_new_block(soap) == NULL) + { soap->error = SOAP_EOM; + return NULL; + } + for (;;) + { if (content->ptr) + s = soap->tmpbuf; + else if (!(s = (char*)soap_push_block(soap, NULL, sizeof(soap->tmpbuf)))) + { soap->error = SOAP_EOM; + return NULL; + } + for (i = 0; i < sizeof(soap->tmpbuf); i++) + { if (m > 0) + { *s++ = *t++; + m--; + } + else + { if (!flag) + { c = soap_get1(soap); + if ((int)c == EOF) + { soap->error = SOAP_EOF; + return NULL; + } + } + if (flag || c == '\r') + { t = soap->msgbuf; + memset(t, 0, sizeof(soap->msgbuf)); + strcpy(t, "\n--"); + if (soap->mime.boundary) + strncat(t, soap->mime.boundary, sizeof(soap->msgbuf)-4); + do c = soap_getchar(soap); + while (c == *t++); + if ((int)c == EOF) + { soap->error = SOAP_EOF; + return NULL; + } + if (!*--t) + goto end; + *t = (char)c; + flag = (c == '\r'); + m = t - soap->msgbuf + 1 - flag; + t = soap->msgbuf; + c = '\r'; + } + *s++ = (char)c; + } + } + if (content->ptr && soap->fmimewrite) + { if ((soap->error = soap->fmimewrite(soap, (void*)content->ptr, soap->tmpbuf, i))) + break; + } + } +end: + *s = '\0'; /* force 0-terminated */ + if (content->ptr) + { if (!soap->error && soap->fmimewrite) + soap->error = soap->fmimewrite(soap, (void*)content->ptr, soap->tmpbuf, i); + if (soap->fmimewriteclose) + soap->fmimewriteclose(soap, (void*)content->ptr); + if (soap->error) + return NULL; + } + else + { content->size = soap_size_block(soap, NULL, i+1)-1; + content->ptr = soap_save_block(soap, NULL, NULL, 0); + } + soap_resolve_attachment(soap, content); + if (c == '-' && soap_getchar(soap) == '-') + { soap->mode &= ~SOAP_ENC_MIME; + if ((soap->mode & SOAP_MIME_POSTCHECK) && soap_end_recv(soap)) + return NULL; + } + else + { while (c != '\r' && (int)c != EOF && soap_blank(c)) + c = soap_getchar(soap); + if (c != '\r' || soap_getchar(soap) != '\n') + { soap->error = SOAP_MIME_ERROR; + return NULL; + } + if (soap_getmimehdr(soap)) + return NULL; + } + return content; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_match_cid(struct soap *soap, const char *s, const char *t) +{ register size_t n; + if (!s) + return 1; + if (!strcmp(s, t)) + return 0; + if (!strncmp(s, "cid:", 4)) + s += 4; + n = strlen(t); + if (*t == '<') + { t++; + n -= 2; + } + if (!strncmp(s, t, n) && !s[n]) + return 0; + soap_decode(soap->tmpbuf, sizeof(soap->tmpbuf), s, SOAP_STR_EOS); + if (!strncmp(soap->tmpbuf, t, n) && !soap->tmpbuf[n]) + return 0; + return 1; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +static void +soap_resolve_attachment(struct soap *soap, struct soap_multipart *content) +{ if (content->id) + { register struct soap_xlist **xp = &soap->xlist; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolving attachment data for id=%s\n", content->id)); + while (*xp) + { register struct soap_xlist *xq = *xp; + if (!soap_match_cid(soap, xq->id, content->id)) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Found matching attachment %s for content id=%s\n", xq->id, content->id)); + *xp = xq->next; + *xq->ptr = (unsigned char*)content->ptr; + *xq->size = (int)content->size; + *xq->type = (char*)content->type; + if (content->options) + *xq->options = (char*)content->options; + else + *xq->options = (char*)content->description; + SOAP_FREE(soap, xq); + } + else + xp = &(*xp)->next; + } + } +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_putmimehdr(struct soap *soap, struct soap_multipart *content) +{ const char *s; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "MIME attachment type=%s\n", content->type?content->type:SOAP_STR_EOS)); + if (soap_send3(soap, "\r\n--", soap->mime.boundary, "\r\n")) + return soap->error; + if (content->type && soap_send3(soap, "Content-Type: ", content->type, "\r\n")) + return soap->error; + s = soap_code_str(mime_codes, content->encoding); + if (s && soap_send3(soap, "Content-Transfer-Encoding: ", s, "\r\n")) + return soap->error; + if (content->id && soap_send3(soap, "Content-ID: ", content->id, "\r\n")) + return soap->error; + if (content->location && soap_send3(soap, "Content-Location: ", content->location, "\r\n")) + return soap->error; + if (content->description && soap_send3(soap, "Content-Description: ", content->description, "\r\n")) + return soap->error; + return soap_send_raw(soap, "\r\n", 2); +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_putmime(struct soap *soap) +{ struct soap_multipart *content; + if (!(soap->mode & SOAP_ENC_MIME) || !soap->mime.boundary) + return SOAP_OK; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Sending MIME attachments\n")); + for (content = soap->mime.first; content; content = content->next) + { void *handle; + if (soap->fmimereadopen && ((handle = soap->fmimereadopen(soap, (void*)content->ptr, content->id, content->type, content->description)) || soap->error)) + { size_t size = content->size; + if (!handle) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fmimereadopen failed\n")); + return soap->error; + } + if (soap_putmimehdr(soap, content)) + return soap->error; + if (!size) + { if ((soap->mode & SOAP_ENC_XML) || (soap->mode & SOAP_IO) == SOAP_IO_CHUNK || (soap->mode & SOAP_IO) == SOAP_IO_STORE) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Chunked streaming MIME\n")); + do + { size = soap->fmimeread(soap, handle, soap->tmpbuf, sizeof(soap->tmpbuf)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fmimeread returned %lu bytes\n", (unsigned long)size)); + if (soap_send_raw(soap, soap->tmpbuf, size)) + break; + } while (size); + } + else + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error: cannot chunk streaming MIME (no HTTP chunking)\n")); + } + } + else + { do + { size_t bufsize; + if (size < sizeof(soap->tmpbuf)) + bufsize = size; + else + bufsize = sizeof(soap->tmpbuf); + if (!(bufsize = soap->fmimeread(soap, handle, soap->tmpbuf, bufsize))) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fmimeread failed: insufficient data (%lu bytes remaining from %lu bytes)\n", (unsigned long)size, (unsigned long)content->size)); + soap->error = SOAP_EOF; + break; + } + if (soap_send_raw(soap, soap->tmpbuf, bufsize)) + break; + size -= bufsize; + } while (size); + } + if (soap->fmimereadclose) + soap->fmimereadclose(soap, handle); + } + else + { if (soap_putmimehdr(soap, content) + || soap_send_raw(soap, content->ptr, content->size)) + return soap->error; + } + } + return soap_send3(soap, "\r\n--", soap->mime.boundary, "--"); +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_set_dime(struct soap *soap) +{ soap->omode |= SOAP_ENC_DIME; + soap->dime.first = NULL; + soap->dime.last = NULL; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_set_mime(struct soap *soap, const char *boundary, const char *start) +{ soap->omode |= SOAP_ENC_MIME; + soap->mime.first = NULL; + soap->mime.last = NULL; + soap->mime.boundary = soap_strdup(soap, boundary); + soap->mime.start = soap_strdup(soap, start); +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_clr_dime(struct soap *soap) +{ soap->omode &= ~SOAP_ENC_DIME; + soap->dime.first = NULL; + soap->dime.last = NULL; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_clr_mime(struct soap *soap) +{ soap->omode &= ~SOAP_ENC_MIME; + soap->mime.first = NULL; + soap->mime.last = NULL; + soap->mime.boundary = NULL; + soap->mime.start = NULL; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +static struct soap_multipart* +soap_new_multipart(struct soap *soap, struct soap_multipart **first, struct soap_multipart **last, char *ptr, size_t size) +{ struct soap_multipart *content; + content = (struct soap_multipart*)soap_malloc(soap, sizeof(struct soap_multipart)); + if (content) + { content->next = NULL; + content->ptr = ptr; + content->size = size; + content->id = NULL; + content->type = NULL; + content->options = NULL; + content->encoding = SOAP_MIME_NONE; + content->location = NULL; + content->description = NULL; + if (!*first) + *first = content; + if (*last) + (*last)->next = content; + *last = content; + } + return content; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_set_dime_attachment(struct soap *soap, char *ptr, size_t size, const char *type, const char *id, unsigned short optype, const char *option) +{ struct soap_multipart *content = soap_new_multipart(soap, &soap->dime.first, &soap->dime.last, ptr, size); + if (!content) + return SOAP_EOM; + content->id = soap_strdup(soap, id); + content->type = soap_strdup(soap, type); + content->options = soap_dime_option(soap, optype, option); + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_set_mime_attachment(struct soap *soap, char *ptr, size_t size, enum soap_mime_encoding encoding, const char *type, const char *id, const char *location, const char *description) +{ struct soap_multipart *content = soap_new_multipart(soap, &soap->mime.first, &soap->mime.last, ptr, size); + if (!content) + return SOAP_EOM; + content->id = soap_strdup(soap, id); + content->type = soap_strdup(soap, type); + content->encoding = encoding; + content->location = soap_strdup(soap, location); + content->description = soap_strdup(soap, description); + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +SOAP_FMAC1 +struct soap_multipart* +SOAP_FMAC2 +soap_next_multipart(struct soap_multipart *content) +{ if (content) + return content->next; + return NULL; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +static void +soap_select_mime_boundary(struct soap *soap) +{ while (!soap->mime.boundary || soap_valid_mime_boundary(soap)) + { register char *s = soap->mime.boundary; + register size_t n = 0; + if (s) + n = strlen(s); + if (n < 16) + { n = 64; + s = soap->mime.boundary = (char*)soap_malloc(soap, n + 1); + if (!s) + return; + } + strcpy(s, "=="); + s += 2; + n -= 4; + while (n) + { *s++ = soap_base64o[soap_random & 0x3F]; + n--; + } + strcpy(s, "=="); + } + if (!soap->mime.start) + soap->mime.start = ""; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEANER +#ifndef PALM_1 +static int +soap_valid_mime_boundary(struct soap *soap) +{ register struct soap_multipart *content; + register size_t k; + if (soap->fmimeread) + return SOAP_OK; + k = strlen(soap->mime.boundary); + for (content = soap->mime.first; content; content = content->next) + { if (content->ptr && content->size >= k) + { register const char *p = (const char*)content->ptr; + register size_t i; + for (i = 0; i < content->size - k; i++, p++) + { if (!strncmp(p, soap->mime.boundary, k)) + return SOAP_ERR; + } + } + } + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************\ + * + * HTTP cookie handling + * +\******************************************************************************/ + +#ifdef WITH_COOKIES +/******************************************************************************/ +SOAP_FMAC1 +size_t +SOAP_FMAC2 +soap_encode_cookie(const char *s, char *t, size_t len) +{ register int c; + register size_t n = len; + while ((c = *s++) && --n > 0) + { if (c > ' ' && c < 128 && !strchr("()<>@,;:\\\"/[]?={}", c)) + *t++ = c; + else if (n > 2) + { *t++ = '%'; + *t++ = (c >> 4) + (c > 159 ? '7' : '0'); + c &= 0xF; + *t++ = c + (c > 9 ? '7' : '0'); + n -= 2; + } + else + break; + } + *t = '\0'; + return len - n; +} + +/******************************************************************************/ +SOAP_FMAC1 +struct soap_cookie* +SOAP_FMAC2 +soap_cookie(struct soap *soap, const char *name, const char *domain, const char *path) +{ struct soap_cookie *p; + size_t n; + if (!domain) + domain = soap->cookie_domain; + if (!path) + path = soap->cookie_path; + if (!path) + path = SOAP_STR_EOS; + else if (*path == '/') + path++; + n = strlen(path); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Search cookie %s domain=%s path=%s\n", name, domain?domain:"(null)", path?path:"(null)")); + for (p = soap->cookies; p; p = p->next) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie in database: %s=%s domain=%s path=%s env=%hd\n", p->name, p->value?p->value:"(null)", p->domain?p->domain:"(null)", p->path?p->path:"(null)", p->env)); + if (!strcmp(p->name, name) + && p->domain + && p->path + && !strcmp(p->domain, domain) + && !strncmp(p->path, path, n)) + break; + } + return p; +} + +/******************************************************************************/ +SOAP_FMAC1 +struct soap_cookie* +SOAP_FMAC2 +soap_set_cookie(struct soap *soap, const char *name, const char *value, const char *domain, const char *path) +{ struct soap_cookie **p, *q; + int n; + if (!domain) + domain = soap->cookie_domain; + if (!path) + path = soap->cookie_path; + if (!path) + path = SOAP_STR_EOS; + else if (*path == '/') + path++; + q = soap_cookie(soap, name, domain, path); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set %scookie: %s=%s domain=%s path=%s\n", q ? SOAP_STR_EOS : "new ", name, value?value:"(null)", domain?domain:"(null)", path?path:"(null)")); + if (!q) + { if ((q = (struct soap_cookie*)SOAP_MALLOC(soap, sizeof(struct soap_cookie)))) + { if ((q->name = (char*)SOAP_MALLOC(soap, strlen(name)+1))) + strcpy(q->name, name); + q->value = NULL; + q->domain = NULL; + q->path = NULL; + q->expire = 0; + q->maxage = -1; + q->version = 1; + q->secure = 0; + q->modified = 0; + for (p = &soap->cookies, n = soap->cookie_max; *p && n; p = &(*p)->next, n--) + if (!strcmp((*p)->name, name) && (*p)->path && path && strcmp((*p)->path, path) < 0) + break; + if (n) + { q->next = *p; + *p = q; + } + else + { SOAP_FREE(soap, q->name); + SOAP_FREE(soap, q); + q = NULL; + } + } + } + else + q->modified = 1; + if (q) + { if (q->value) + { SOAP_FREE(soap, q->value); + q->value = NULL; + } + if (q->domain) + { SOAP_FREE(soap, q->domain); + q->domain = NULL; + } + if (q->path) + { SOAP_FREE(soap, q->path); + q->path = NULL; + } + if (value && *value && (q->value = (char*)SOAP_MALLOC(soap, strlen(value)+1))) + strcpy(q->value, value); + if (domain && (q->domain = (char*)SOAP_MALLOC(soap, strlen(domain)+1))) + strcpy(q->domain, domain); + if (path && (q->path = (char*)SOAP_MALLOC(soap, strlen(path)+1))) + strcpy(q->path, path); + q->session = 1; + q->env = 0; + } + return q; +} + +/******************************************************************************/ +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_clr_cookie(struct soap *soap, const char *name, const char *domain, const char *path) +{ struct soap_cookie **p, *q; + if (!domain) + domain = soap->cookie_domain; + if (!domain) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error in clear cookie %s: cookie domain not set\n", name?name:"(null)")); + return; + } + if (!path) + path = soap->cookie_path; + if (!path) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error in clear cookie %s: cookie path not set\n", name?name:"(null)")); + return; + } + if (*path == '/') + path++; + for (p = &soap->cookies, q = *p; q; q = *p) + { if (!strcmp(q->name, name) && !strcmp(q->domain, domain) && !strncmp(q->path, path, strlen(q->path))) + { if (q->value) + SOAP_FREE(soap, q->value); + if (q->domain) + SOAP_FREE(soap, q->domain); + if (q->path) + SOAP_FREE(soap, q->path); + *p = q->next; + SOAP_FREE(soap, q); + } + else + p = &q->next; + } +} + +/******************************************************************************/ +SOAP_FMAC1 +char * +SOAP_FMAC2 +soap_cookie_value(struct soap *soap, const char *name, const char *domain, const char *path) +{ struct soap_cookie *p; + if ((p = soap_cookie(soap, name, domain, path))) + return p->value; + return NULL; +} + +/******************************************************************************/ +SOAP_FMAC1 +char * +SOAP_FMAC2 +soap_env_cookie_value(struct soap *soap, const char *name, const char *domain, const char *path) +{ struct soap_cookie *p; + if ((p = soap_cookie(soap, name, domain, path)) && p->env) + return p->value; + return NULL; +} + +/******************************************************************************/ +SOAP_FMAC1 +time_t +SOAP_FMAC2 +soap_cookie_expire(struct soap *soap, const char *name, const char *domain, const char *path) +{ struct soap_cookie *p; + if ((p = soap_cookie(soap, name, domain, path))) + return p->expire; + return -1; +} + +/******************************************************************************/ +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_set_cookie_expire(struct soap *soap, const char *name, long expire, const char *domain, const char *path) +{ struct soap_cookie *p; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set cookie expiration max-age %ld: %s domain=%s path=%s\n", expire, name, domain?domain:"(null)", path?path:"(null)")); + if ((p = soap_cookie(soap, name, domain, path))) + { p->maxage = expire; + p->modified = 1; + return SOAP_OK; + } + return SOAP_ERR; +} + +/******************************************************************************/ +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_set_cookie_session(struct soap *soap, const char *name, const char *domain, const char *path) +{ struct soap_cookie *p; + if ((p = soap_cookie(soap, name, domain, path))) + { p->session = 1; + p->modified = 1; + return SOAP_OK; + } + return SOAP_ERR; +} + +/******************************************************************************/ +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_clr_cookie_session(struct soap *soap, const char *name, const char *domain, const char *path) +{ struct soap_cookie *p; + if ((p = soap_cookie(soap, name, domain, path))) + { p->session = 0; + p->modified = 1; + return SOAP_OK; + } + return SOAP_ERR; +} + +/******************************************************************************/ +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_putsetcookies(struct soap *soap) +{ struct soap_cookie *p; + char *s, tmp[4096]; + const char *t; + for (p = soap->cookies; p; p = p->next) + { + if (p->modified +#ifdef WITH_OPENSSL + || (!p->env && !soap->ssl == !p->secure) +#endif + ) + { s = tmp; + if (p->name) + s += soap_encode_cookie(p->name, s, tmp-s+4064); + if (p->value && *p->value) + { *s++ = '='; + s += soap_encode_cookie(p->value, s, tmp-s+4064); + } + if (p->domain && (int)strlen(p->domain) < tmp-s+4064) + { strcpy(s, ";Domain="); + strcat(s, p->domain); + } + else if (soap->cookie_domain && (int)strlen(soap->cookie_domain) < tmp-s+4064) + { strcpy(s, ";Domain="); + strcat(s, soap->cookie_domain); + } + strcat(s, ";Path=/"); + s += strlen(s); + if (p->path) + t = p->path; + else + t = soap->cookie_path; + if (t) + { if (*t == '/') + t++; + if ((int)strlen(t) < tmp-s+4064) + { if (strchr(t, '%')) /* already URL encoded? */ + { strcpy(s, t); + s += strlen(s); + } + else + s += soap_encode_cookie(t, s, tmp-s+4064); + } + } + if (p->version > 0 && s-tmp < 4060) + { sprintf(s, ";Version=%u", p->version); + s += strlen(s); + } + if (p->maxage >= 0 && s-tmp < 4060) + { sprintf(s, ";Max-Age=%ld", p->maxage); + s += strlen(s); + } + if (s-tmp < 4073 + && (p->secure +#ifdef WITH_OPENSSL + || soap->ssl +#endif + )) + strcpy(s, ";Secure"); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set-Cookie: %s\n", tmp)); + if ((soap->error = soap->fposthdr(soap, "Set-Cookie", tmp))) + return soap->error; + } + } + return SOAP_OK; +} + +/******************************************************************************/ +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_putcookies(struct soap *soap, const char *domain, const char *path, int secure) +{ struct soap_cookie **p, *q; + unsigned int version = 0; + time_t now = time(NULL); + char *s, tmp[4096]; + p = &soap->cookies; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Sending cookies for domain=%s path=%s\n", domain, path)); + if (*path == '/') + path++; + while ((q = *p)) + { if (q->expire && now > q->expire) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie %s expired\n", q->name)); + SOAP_FREE(soap, q->name); + if (q->value) + SOAP_FREE(soap, q->value); + if (q->domain) + SOAP_FREE(soap, q->domain); + if (q->path) + SOAP_FREE(soap, q->path); + *p = q->next; + SOAP_FREE(soap, q); + } + else + { int flag; + char *t = q->domain; + size_t n = 0; + if (!t) + flag = 1; + else + { const char *r = strchr(t, ':'); + if (r) + n = r - t; + else + n = strlen(t); + flag = !strncmp(t, domain, n); + } + /* domain-level cookies, cannot compile when WITH_NOIO set */ +#ifndef WITH_NOIO + if (!flag) + { struct hostent *hostent = gethostbyname((char*)domain); + if (hostent) + { const char *r = strchr(hostent->h_name, '.'); + if (!r) + r = hostent->h_name; + flag = !strncmp(t, r, n); + } + } +#endif + if (flag + && (!q->path || !strncmp(q->path, path, strlen(q->path))) + && (!q->secure || secure)) + { s = tmp; + if (q->version != version) + { sprintf(s, "$Version=%u;", q->version); + version = q->version; + } + if (q->name) + s += soap_encode_cookie(q->name, s, tmp-s+4080); + if (q->value && *q->value) + { *s++ = '='; + s += soap_encode_cookie(q->value, s, tmp-s+4080); + } + if (q->path && *q->path && (int)strlen(q->path) < tmp-s+4080) + { sprintf(s, ";$Path=\"/%s\"", (*q->path == '/' ? q->path + 1 : q->path)); + s += strlen(s); + } + if (q->domain && (int)strlen(q->domain) < tmp-s+4080) + sprintf(s, ";$Domain=\"%s\"", q->domain); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie: %s\n", tmp)); + if ((soap->error = soap->fposthdr(soap, "Cookie", tmp))) + return soap->error; + } + p = &q->next; + } + } + return SOAP_OK; +} + +/******************************************************************************/ +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_getcookies(struct soap *soap, const char *val) +{ struct soap_cookie *p = NULL, *q; + const char *s; + char *t, tmp[4096]; /* cookie size is up to 4096 bytes [RFC2109] */ + char *domain = NULL; + char *path = NULL; + unsigned int version = 0; + time_t now = time(NULL); + if (!val) + return; + s = val; + while (*s) + { s = soap_decode_key(tmp, sizeof(tmp), s); + if (!soap_tag_cmp(tmp, "$Version")) + { if ((s = soap_decode_val(tmp, sizeof(tmp), s))) + { if (p) + p->version = (int)atol(tmp); + else + version = (int)atol(tmp); + } + } + else if (!soap_tag_cmp(tmp, "$Path")) + { s = soap_decode_val(tmp, sizeof(tmp), s); + if (*tmp) + { if ((t = (char*)SOAP_MALLOC(soap, strlen(tmp)+1))) + strcpy(t, tmp); + } + else + t = NULL; + if (p) + { if (p->path) + SOAP_FREE(soap, p->path); + p->path = t; + } + else + { if (path) + SOAP_FREE(soap, path); + path = t; + } + } + else if (!soap_tag_cmp(tmp, "$Domain")) + { s = soap_decode_val(tmp, sizeof(tmp), s); + if (*tmp) + { if ((t = (char*)SOAP_MALLOC(soap, strlen(tmp)+1))) + strcpy(t, tmp); + } + else + t = NULL; + if (p) + { if (p->domain) + SOAP_FREE(soap, p->domain); + p->domain = t; + } + else + { if (domain) + SOAP_FREE(soap, domain); + domain = t; + } + } + else if (p && !soap_tag_cmp(tmp, "Path")) + { if (p->path) + SOAP_FREE(soap, p->path); + s = soap_decode_val(tmp, sizeof(tmp), s); + if (*tmp) + { if ((p->path = (char*)SOAP_MALLOC(soap, strlen(tmp)+1))) + strcpy(p->path, tmp); + } + else + p->path = NULL; + } + else if (p && !soap_tag_cmp(tmp, "Domain")) + { if (p->domain) + SOAP_FREE(soap, p->domain); + s = soap_decode_val(tmp, sizeof(tmp), s); + if (*tmp) + { if ((p->domain = (char*)SOAP_MALLOC(soap, strlen(tmp)+1))) + strcpy(p->domain, tmp); + } + else + p->domain = NULL; + } + else if (p && !soap_tag_cmp(tmp, "Version")) + { s = soap_decode_val(tmp, sizeof(tmp), s); + p->version = (unsigned int)atol(tmp); + } + else if (p && !soap_tag_cmp(tmp, "Max-Age")) + { s = soap_decode_val(tmp, sizeof(tmp), s); + p->expire = now + atol(tmp); + } + else if (p && !soap_tag_cmp(tmp, "Expires")) + { struct tm T; + char a[3]; + static const char mns[] = "anebarprayunulugepctovec"; + s = soap_decode_val(tmp, sizeof(tmp), s); + if (strlen(tmp) > 20) + { memset((void*)&T, 0, sizeof(T)); + a[0] = tmp[4]; + a[1] = tmp[5]; + a[2] = '\0'; + T.tm_mday = (int)atol(a); + a[0] = tmp[8]; + a[1] = tmp[9]; + T.tm_mon = (int)(strstr(mns, a) - mns) / 2; + a[0] = tmp[11]; + a[1] = tmp[12]; + T.tm_year = 100 + (int)atol(a); + a[0] = tmp[13]; + a[1] = tmp[14]; + T.tm_hour = (int)atol(a); + a[0] = tmp[16]; + a[1] = tmp[17]; + T.tm_min = (int)atol(a); + a[0] = tmp[19]; + a[1] = tmp[20]; + T.tm_sec = (int)atol(a); + p->expire = soap_timegm(&T); + } + } + else if (p && !soap_tag_cmp(tmp, "Secure")) + p->secure = 1; + else + { if (p) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got environment cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value?p->value:"(null)", p->domain?p->domain:"(null)", p->path?p->path:"(null)", p->expire, p->secure)); + if ((q = soap_set_cookie(soap, p->name, p->value, p->domain, p->path))) + { q->version = p->version; + q->expire = p->expire; + q->secure = p->secure; + q->env = 1; + } + if (p->name) + SOAP_FREE(soap, p->name); + if (p->value) + SOAP_FREE(soap, p->value); + if (p->domain) + SOAP_FREE(soap, p->domain); + if (p->path) + SOAP_FREE(soap, p->path); + SOAP_FREE(soap, p); + } + if ((p = (struct soap_cookie*)SOAP_MALLOC(soap, sizeof(struct soap_cookie)))) + { p->name = (char*)SOAP_MALLOC(soap, strlen(tmp)+1); + strcpy(p->name, tmp); + s = soap_decode_val(tmp, sizeof(tmp), s); + if (*tmp) + { p->value = (char*)SOAP_MALLOC(soap, strlen(tmp)+1); + strcpy(p->value, tmp); + } + else + p->value = NULL; + if (domain) + p->domain = domain; + else if (*soap->host) + { p->domain = (char*)SOAP_MALLOC(soap, strlen(soap->host)+1); + strcpy(p->domain, soap->host); + } + else + p->domain = NULL; + if (path) + p->path = path; + else if (soap->path && *soap->path) + { p->path = (char*)SOAP_MALLOC(soap, strlen(soap->path)+1); + strcpy(p->path, soap->path); + } + else + { p->path = (char*)SOAP_MALLOC(soap, 2); + strcpy(p->path, "/"); + } + p->expire = 0; + p->secure = 0; + p->version = version; + } + } + } + if (p) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got environment cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value?p->value:"(null)", p->domain?p->domain:"(null)", p->path?p->path:"(null)", p->expire, p->secure)); + if ((q = soap_set_cookie(soap, p->name, p->value, p->domain, p->path))) + { q->version = p->version; + q->expire = p->expire; + q->secure = p->secure; + q->env = 1; + } + if (p->name) + SOAP_FREE(soap, p->name); + if (p->value) + SOAP_FREE(soap, p->value); + if (p->domain) + SOAP_FREE(soap, p->domain); + if (p->path) + SOAP_FREE(soap, p->path); + SOAP_FREE(soap, p); + } + if (domain) + SOAP_FREE(soap, domain); + if (path) + SOAP_FREE(soap, path); +} + +/******************************************************************************/ +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_getenv_cookies(struct soap *soap) +{ struct soap_cookie *p; + const char *s; + char key[4096], val[4096]; /* cookie size is up to 4096 bytes [RFC2109] */ + if (!(s = getenv("HTTP_COOKIE"))) + return SOAP_ERR; + do + { s = soap_decode_key(key, sizeof(key), s); + s = soap_decode_val(val, sizeof(val), s); + p = soap_set_cookie(soap, key, val, NULL, NULL); + if (p) + p->env = 1; + } while (*s); + return SOAP_OK; +} + +/******************************************************************************/ +SOAP_FMAC1 +struct soap_cookie* +SOAP_FMAC2 +soap_copy_cookies(struct soap *copy, const struct soap *soap) +{ struct soap_cookie *p, **q, *r; + q = &r; + for (p = soap->cookies; p; p = p->next) + { if (!(*q = (struct soap_cookie*)SOAP_MALLOC(copy, sizeof(struct soap_cookie)))) + return r; + **q = *p; + if (p->name) + { if (((*q)->name = (char*)SOAP_MALLOC(copy, strlen(p->name)+1))) + strcpy((*q)->name, p->name); + } + if (p->value) + { if (((*q)->value = (char*)SOAP_MALLOC(copy, strlen(p->value)+1))) + strcpy((*q)->value, p->value); + } + if (p->domain) + { if (((*q)->domain = (char*)SOAP_MALLOC(copy, strlen(p->domain)+1))) + strcpy((*q)->domain, p->domain); + } + if (p->path) + { if (((*q)->path = (char*)SOAP_MALLOC(copy, strlen(p->path)+1))) + strcpy((*q)->path, p->path); + } + q = &(*q)->next; + } + *q = NULL; + return r; +} + +/******************************************************************************/ +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_free_cookies(struct soap *soap) +{ struct soap_cookie *p; + for (p = soap->cookies; p; p = soap->cookies) + { soap->cookies = p->next; + SOAP_FREE(soap, p->name); + if (p->value) + SOAP_FREE(soap, p->value); + if (p->domain) + SOAP_FREE(soap, p->domain); + if (p->path) + SOAP_FREE(soap, p->path); + SOAP_FREE(soap, p); + } +} + +/******************************************************************************/ +#endif /* WITH_COOKIES */ + +/******************************************************************************/ +#ifdef WITH_GZIP +#ifndef PALM_1 +static int +soap_getgziphdr(struct soap *soap) +{ int i; + soap_wchar c = 0, f = 0; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Get gzip header\n")); + for (i = 0; i < 9; i++) + { if ((int)(c = soap_get1(soap) == EOF)) + return soap->error = SOAP_EOF; + if (i == 2) + f = c; + } + if (f & 0x04) /* FEXTRA */ + { for (i = soap_get1(soap) | (soap_get1(soap) << 8); i; i--) + { if ((int)soap_get1(soap) == EOF) + return soap->error = SOAP_EOF; + } + } + if (f & 0x08) /* FNAME */ + { do + c = soap_get1(soap); + while (c && (int)c != EOF); + } + if ((int)c != EOF && (f & 0x10)) /* FCOMMENT */ + { do + c = soap_get1(soap); + while (c && (int)c != EOF); + } + if ((int)c != EOF && (f & 0x01)) /* FHCRC */ + { if ((int)(c = soap_get1(soap)) != EOF) + c = soap_get1(soap); + } + if ((int)c == EOF) + return soap->error = SOAP_EOF; + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_begin_recv(struct soap *soap) +{ soap_wchar c; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing for input\n")); + soap->error = SOAP_OK; + soap_free_temp(soap); + soap_set_local_namespaces(soap); + soap->version = 0; /* don't assume we're parsing SOAP content by default */ +#ifndef WITH_NOIDREF + soap_free_iht(soap); +#endif + if ((soap->imode & SOAP_IO) == SOAP_IO_CHUNK) + soap->omode |= SOAP_IO_CHUNK; + soap->imode &= ~(SOAP_IO | SOAP_ENC_MIME); + soap->mode = soap->imode; + if (!soap->keep_alive) + { soap->buflen = 0; + soap->bufidx = 0; + } + if (!(soap->mode & SOAP_IO_KEEPALIVE)) + soap->keep_alive = 0; + soap->ahead = 0; + soap->peeked = 0; + soap->level = 0; + soap->part = SOAP_BEGIN; + soap->alloced = 0; + soap->count = 0; + soap->length = 0; + soap->cdata = 0; + *soap->endpoint = '\0'; + soap->action = NULL; + soap->header = NULL; + soap->fault = NULL; + soap->status = 0; +#ifndef WITH_LEANER + soap->dom = NULL; + soap->dime.chunksize = 0; + soap->dime.buflen = 0; + soap->dime.list = NULL; + soap->dime.first = NULL; + soap->dime.last = NULL; + soap->mime.list = NULL; + soap->mime.first = NULL; + soap->mime.last = NULL; + soap->mime.boundary = NULL; + soap->mime.start = NULL; +#endif +#ifdef WIN32 +#ifndef UNDER_CE +#ifndef WITH_FASTCGI + if (!soap_valid_socket(soap->socket)) + _setmode(soap->recvfd, _O_BINARY); +#endif +#endif +#endif +#ifdef WITH_ZLIB + soap->mode &= ~SOAP_ENC_ZLIB; + soap->zlib_in = SOAP_ZLIB_NONE; + soap->zlib_out = SOAP_ZLIB_NONE; + soap->d_stream->next_in = Z_NULL; + soap->d_stream->avail_in = 0; + soap->d_stream->next_out = (Byte*)soap->buf; + soap->d_stream->avail_out = SOAP_BUFLEN; + soap->z_ratio_in = 1.0; +#endif +#ifdef WITH_OPENSSL + if (soap->ssl) + ERR_clear_error(); +#endif +#ifndef WITH_LEANER + if (soap->fprepareinit) + soap->fprepareinit(soap); +#endif + c = soap_getchar(soap); +#ifdef WITH_GZIP + if (c == 0x1F) + { if (soap_getgziphdr(soap)) + return soap->error; + if (inflateInit2(soap->d_stream, -MAX_WBITS) != Z_OK) + return soap->error = SOAP_ZLIB_ERROR; + soap->zlib_state = SOAP_ZLIB_INFLATE; + soap->mode |= SOAP_ENC_ZLIB; + soap->zlib_in = SOAP_ZLIB_GZIP; + soap->z_crc = crc32(0L, NULL, 0); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip initialized\n")); + if (!soap->z_buf) + soap->z_buf = (char*)SOAP_MALLOC(soap, SOAP_BUFLEN); + memcpy(soap->z_buf, soap->buf, SOAP_BUFLEN); + /* should not chunk over plain transport, so why bother to check? */ + /* if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) */ + /* soap->z_buflen = soap->bufidx; */ + /* else */ + soap->d_stream->next_in = (Byte*)(soap->z_buf + soap->bufidx); + soap->d_stream->avail_in = soap->buflen - soap->bufidx; + soap->z_buflen = soap->buflen; + soap->buflen = soap->bufidx; + c = soap_getchar(soap); + } +#endif +#ifndef WITH_LEANER + if (c == '-' && soap_get0(soap) == '-') + soap->mode |= SOAP_ENC_MIME; + else if ((c & 0xFFFC) == (SOAP_DIME_VERSION | SOAP_DIME_MB) && (soap_get0(soap) & 0xFFF0) == 0x20) + soap->mode |= SOAP_ENC_DIME; + else +#endif + { while (soap_blank(c)) + c = soap_getchar(soap); + } + if ((int)c == EOF) + return soap->error = SOAP_EOF; + soap_unget(soap, c); +#ifndef WITH_NOHTTP + /* if not XML or (start of)BOM or MIME/DIME/ZLIB, assume HTTP header */ + if (c != '<' && c != 0xEF && !(soap->mode & (SOAP_ENC_MIME | SOAP_ENC_DIME | SOAP_ENC_ZLIB))) + { soap_mode m = soap->imode; + soap->mode &= ~SOAP_IO; + soap->error = soap->fparse(soap); + if (soap->error == 401) /* KMD ADDED: avoid close socket when receive 401 and Connection != Close*/ + { + return soap->error; + } + if (soap->error && soap->error < SOAP_STOP) + { soap->keep_alive = 0; /* force close later */ + return soap->error; + } + if (soap->error == SOAP_STOP) + return soap->error; + soap->mode = soap->imode; /* if imode is changed, effectuate */ + soap->imode = m; /* restore imode */ +#ifdef WITH_ZLIB + soap->mode &= ~SOAP_ENC_ZLIB; +#endif + if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) + { soap->chunkbuflen = soap->buflen; + soap->buflen = soap->bufidx; + soap->chunksize = 0; + } +#ifndef WITH_LEANER + else if (soap->fpreparerecv && soap->buflen != soap->bufidx) + soap->fpreparerecv(soap, soap->buf + soap->bufidx, soap->buflen - soap->bufidx); +#endif + /* Note: fparse should not use soap_unget to push back last char */ + if (soap_get0(soap) == (int)EOF) + { if (soap->status == 200) + return soap->error = SOAP_NO_DATA; /* HTTP OK: always expect data */ + return soap->error = soap->status; + } +#ifdef WITH_ZLIB + if (soap->zlib_in != SOAP_ZLIB_NONE) + { +#ifdef WITH_GZIP + if (soap->zlib_in != SOAP_ZLIB_DEFLATE) + { c = soap_get1(soap); + if (c == 0x1F) + { if (soap_getgziphdr(soap)) + return soap->error; + if (inflateInit2(soap->d_stream, -MAX_WBITS) != Z_OK) + return soap->error = SOAP_ZLIB_ERROR; + soap->z_crc = crc32(0L, NULL, 0); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip initialized\n")); + } + else + { soap_revget1(soap); + if (inflateInit(soap->d_stream) != Z_OK) + return soap->error = SOAP_ZLIB_ERROR; + soap->zlib_in = SOAP_ZLIB_DEFLATE; + } + } + else +#endif + if (inflateInit(soap->d_stream) != Z_OK) + return soap->error = SOAP_ZLIB_ERROR; + soap->zlib_state = SOAP_ZLIB_INFLATE; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflate initialized\n")); + soap->mode |= SOAP_ENC_ZLIB; + if (!soap->z_buf) + soap->z_buf = (char*)SOAP_MALLOC(soap, SOAP_BUFLEN); + memcpy(soap->z_buf, soap->buf, SOAP_BUFLEN); + soap->d_stream->next_in = (Byte*)(soap->z_buf + soap->bufidx); + soap->d_stream->avail_in = soap->buflen - soap->bufidx; + soap->z_buflen = soap->buflen; + soap->buflen = soap->bufidx; + } +#endif + if (soap->error) + { if (soap->error == SOAP_FORM && soap->fform) + { soap->error = soap->fform(soap); + if (soap->error == SOAP_OK) + soap->error = SOAP_STOP; /* prevents further processing */ + } + return soap->error; + } + } +#endif +#ifndef WITH_LEANER + if (soap->mode & SOAP_ENC_MIME) + { if (soap_getmimehdr(soap)) + return soap->error; + if (soap->mime.start) + { do + { if (!soap->mime.last->id) + break; + if (!soap_match_cid(soap, soap->mime.start, soap->mime.last->id)) + break; + } while (soap_get_mime_attachment(soap, NULL)); + } + if (soap_get_header_attribute(soap, soap->mime.first->type, "application/dime")) + soap->mode |= SOAP_ENC_DIME; + } + if (soap->mode & SOAP_ENC_DIME) + { if (soap_getdimehdr(soap)) + return soap->error; + if (soap->dime.flags & SOAP_DIME_CF) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Chunked DIME SOAP message\n")); + soap->dime.chunksize = soap->dime.size; + if (soap->buflen - soap->bufidx >= soap->dime.chunksize) + { soap->dime.buflen = soap->buflen; + soap->buflen = soap->bufidx + soap->dime.chunksize; + } + else + soap->dime.chunksize -= soap->buflen - soap->bufidx; + } + soap->count = soap->buflen - soap->bufidx; + } +#endif + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef WITH_NOHTTP +#ifndef PALM_1 +static int +http_parse(struct soap *soap) +{ char header[SOAP_HDRLEN], *s; + unsigned short httpcmd = 0, status = 0, k = 0; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Waiting for HTTP request/response...\n")); + *soap->endpoint = '\0'; + soap->length = 0; + soap->userid = NULL; + soap->passwd = NULL; + soap->action = NULL; + soap->authrealm = NULL; + soap->proxy_from = NULL; + soap->http_content = NULL; + soap->status = 0; + do + { if (soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf))) + { if (soap->error == SOAP_EOF) + return SOAP_EOF; + return soap->error = 414; + } + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "HTTP status: %s\n", soap->msgbuf)); + for (;;) + { if (soap_getline(soap, header, SOAP_HDRLEN)) + { if (soap->error == SOAP_EOF) + { soap->error = SOAP_OK; + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "EOF in HTTP header, continue anyway\n")); + break; + } + return soap->error; + } + if (!*header) + break; + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "HTTP header: %s\n", header)); + s = strchr(header, ':'); + if (s) + { char *t; + *s = '\0'; + do s++; + while (*s && *s <= 32); + if (*s == '"') + s++; + t = s + strlen(s) - 1; + while (t > s && *t <= 32) + t--; + if (t >= s && *t == '"') + t--; + t[1] = '\0'; + if ((soap->error = soap->fparsehdr(soap, header, s))) + { if (soap->error < SOAP_STOP) + return soap->error; + status = soap->error; + soap->error = SOAP_OK; + } + } + } + if ((s = strchr(soap->msgbuf, ' '))) + { k = (unsigned short)soap_strtoul(s, &s, 10); + if (!soap_blank(*s)) + k = 0; + } + else + k = 0; + } while (k == 100); + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Finished HTTP header parsing, status = %d\n", k)); + s = strstr(soap->msgbuf, "HTTP/"); + if (s && s[7] != '1') + { if (soap->keep_alive == 1) + soap->keep_alive = 0; + if (k == 0 && (soap->omode & SOAP_IO) == SOAP_IO_CHUNK) /* k == 0 for HTTP request */ + { soap->imode |= SOAP_IO_CHUNK; + soap->omode = (soap->omode & ~SOAP_IO) | SOAP_IO_STORE; + } + } + if (soap->keep_alive < 0) + soap->keep_alive = 1; + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Keep alive connection = %d\n", soap->keep_alive)); + if (k == 0) + { size_t l = 0; + if (s) + { if (!strncmp(soap->msgbuf, "POST ", l = 5)) + httpcmd = 1; + else if (!strncmp(soap->msgbuf, "GET ", l = 4)) + httpcmd = 2; + else if (!strncmp(soap->msgbuf, "PUT ", l = 4)) + httpcmd = 3; + else if (!strncmp(soap->msgbuf, "DELETE ", l = 7)) + httpcmd = 4; + else if (!strncmp(soap->msgbuf, "HEAD ", l = 5)) + httpcmd = 5; + } + if (s && httpcmd) + { size_t m = strlen(soap->endpoint); + size_t n = m + (s - soap->msgbuf) - l - 1; + if (m > n) + m = n; + if (n >= sizeof(soap->endpoint)) + n = sizeof(soap->endpoint) - 1; + strncpy(soap->path, soap->msgbuf + l, n - m); + soap->path[n - m] = '\0'; + strcat(soap->endpoint, soap->path); + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Target endpoint='%s'\n", soap->endpoint)); + if (httpcmd > 1) + { switch (httpcmd) + { case 2: soap->error = soap->fget(soap); break; + case 3: soap->error = soap->fput(soap); break; + case 4: soap->error = soap->fdel(soap); break; + case 5: soap->error = soap->fhead(soap); break; + default: soap->error = SOAP_HTTP_METHOD; break; + } + if (soap->error == SOAP_OK) + soap->error = SOAP_STOP; /* prevents further processing */ + return soap->error; + } + if (status) + return soap->error = status; + } + else if (status) + return soap->error = status; + else if (s) + return soap->error = 405; + } + soap->status = k; + /* Status OK (HTTP 200) */ + if (k == 0 || k == 200) + return SOAP_OK; + /* Status 201 (Created), 202 (Accepted), ... and HTTP 400 and 500 errors + require normal return to try parsing SOAP/XML body. + Otherwise, try to parse HTTP body. + */ + if(k==401 && soap->keep_alive!=0) /* KMD ADDED: avoid close socket when receive 401 and Connection != Close*/ + return soap->error = k; + if (soap->length > 0 || (soap->imode & SOAP_IO) == SOAP_IO_CHUNK) + { if (((k > 200 && k <= 299) || k == 400 || k == 500)) + return SOAP_OK; + /* force close afterwards in soap_closesock() */ + soap->keep_alive = 0; + /* read HTTP body for error details */ + s = soap_get_http_body(soap); + if (s) + return soap_set_receiver_error(soap, soap->msgbuf, s, k); + } + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "HTTP error %d\n", k)); + return soap_set_receiver_error(soap, "HTTP Error", soap->msgbuf, k); +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOHTTP +#ifndef PALM_1 +static int +http_parse_header(struct soap *soap, const char *key, const char *val) +{ if (!soap_tag_cmp(key, "Host")) + { +#ifdef WITH_OPENSSL + if (soap->imode & SOAP_ENC_SSL) + strcpy(soap->endpoint, "https://"); + else +#endif + strcpy(soap->endpoint, "http://"); + strncat(soap->endpoint, val, sizeof(soap->endpoint) - 8); + soap->endpoint[sizeof(soap->endpoint) - 1] = '\0'; + } +#ifndef WITH_LEANER + else if (!soap_tag_cmp(key, "Content-Type")) + { const char *action; + soap->http_content = soap_strdup(soap, val); + if (soap_get_header_attribute(soap, val, "application/dime")) + soap->imode |= SOAP_ENC_DIME; + else if (soap_get_header_attribute(soap, val, "multipart/related") + || soap_get_header_attribute(soap, val, "multipart/form-data")) + { soap->mime.boundary = soap_strdup(soap, soap_get_header_attribute(soap, val, "boundary")); + soap->mime.start = soap_strdup(soap, soap_get_header_attribute(soap, val, "start")); + soap->imode |= SOAP_ENC_MIME; + } + action = soap_get_header_attribute(soap, val, "action"); + if (action) + { if (*action == '"') + { soap->action = soap_strdup(soap, action + 1); + soap->action[strlen(soap->action) - 1] = '\0'; + } + else + soap->action = soap_strdup(soap, action); + } + } +#endif + else if (!soap_tag_cmp(key, "Content-Length")) + { soap->length = soap_strtoul(val, NULL, 10); + } + else if (!soap_tag_cmp(key, "Content-Encoding")) + { if (!soap_tag_cmp(val, "deflate")) +#ifdef WITH_ZLIB + soap->zlib_in = SOAP_ZLIB_DEFLATE; +#else + return SOAP_ZLIB_ERROR; +#endif + else if (!soap_tag_cmp(val, "gzip")) +#ifdef WITH_GZIP + soap->zlib_in = SOAP_ZLIB_GZIP; +#else + return SOAP_ZLIB_ERROR; +#endif + } +#ifdef WITH_ZLIB + else if (!soap_tag_cmp(key, "Accept-Encoding")) + { +#ifdef WITH_GZIP + if (strchr(val, '*') || soap_get_header_attribute(soap, val, "gzip")) + soap->zlib_out = SOAP_ZLIB_GZIP; + else +#endif + if (strchr(val, '*') || soap_get_header_attribute(soap, val, "deflate")) + soap->zlib_out = SOAP_ZLIB_DEFLATE; + else + soap->zlib_out = SOAP_ZLIB_NONE; + } +#endif + else if (!soap_tag_cmp(key, "Transfer-Encoding")) + { soap->imode &= ~SOAP_IO; + if (!soap_tag_cmp(val, "chunked")) + soap->imode |= SOAP_IO_CHUNK; + } + else if (!soap_tag_cmp(key, "Connection")) + { if (!soap_tag_cmp(val, "keep-alive")) + soap->keep_alive = -soap->keep_alive; + else if (!soap_tag_cmp(val, "close")) + soap->keep_alive = 0; + } +#ifndef WITH_LEAN + else if (!soap_tag_cmp(key, "Authorization")) + { if (!soap_tag_cmp(val, "Basic *")) + { int n; + char *s; + soap_base642s(soap, val + 6, soap->tmpbuf, sizeof(soap->tmpbuf) - 1, &n); + soap->tmpbuf[n] = '\0'; + if ((s = strchr(soap->tmpbuf, ':'))) + { *s = '\0'; + soap->userid = soap_strdup(soap, soap->tmpbuf); + soap->passwd = soap_strdup(soap, s + 1); + } + } + } + else if (!soap_tag_cmp(key, "WWW-Authenticate")) + { soap->authrealm = soap_strdup(soap, soap_get_header_attribute(soap, val + 6, "realm")); + } + else if (!soap_tag_cmp(key, "Expect")) + { if (!soap_tag_cmp(val, "100-continue")) + { if ((soap->error = soap->fposthdr(soap, "HTTP/1.1 100 Continue", NULL)) + || (soap->error = soap->fposthdr(soap, NULL, NULL))) + return soap->error; + } + } +#endif + else if (!soap_tag_cmp(key, "SOAPAction")) + { if (*val == '"') + { soap->action = soap_strdup(soap, val + 1); + soap->action[strlen(soap->action) - 1] = '\0'; + } + else + soap->action = soap_strdup(soap, val); + } + else if (!soap_tag_cmp(key, "Location")) + { strncpy(soap->endpoint, val, sizeof(soap->endpoint)); + soap->endpoint[sizeof(soap->endpoint) - 1] = '\0'; + } + else if (!soap_tag_cmp(key, "X-Forwarded-For")) + { soap->proxy_from = soap_strdup(soap, val); + } +#ifdef WITH_COOKIES + else if (!soap_tag_cmp(key, "Cookie") + || !soap_tag_cmp(key, "Cookie2") + || !soap_tag_cmp(key, "Set-Cookie") + || !soap_tag_cmp(key, "Set-Cookie2")) + { soap_getcookies(soap, val); + } +#endif + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#if !defined(WITH_NOHTTP) || !defined(WITH_LEANER) +#ifndef PALM_1 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_get_header_attribute(struct soap *soap, const char *line, const char *key) +{ register const char *s = line; + if (s) + { while (*s) + { register short flag; + s = soap_decode_key(soap->tmpbuf, sizeof(soap->tmpbuf), s); + flag = soap_tag_cmp(soap->tmpbuf, key); + s = soap_decode_val(soap->tmpbuf, sizeof(soap->tmpbuf), s); + if (!flag) + return soap->tmpbuf; + } + } + return NULL; +} +#endif +#endif + +/******************************************************************************/ +#if !defined(WITH_NOHTTP) || !defined(WITH_LEANER) +#ifndef PALM_1 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_decode_key(char *buf, size_t len, const char *val) +{ return soap_decode(buf, len, val, "=,;"); +} +#endif +#endif + +/******************************************************************************/ +#if !defined(WITH_NOHTTP) || !defined(WITH_LEANER) +#ifndef PALM_1 +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_decode_val(char *buf, size_t len, const char *val) +{ if (*val != '=') + { *buf = '\0'; + return val; + } + return soap_decode(buf, len, val + 1, ",;"); +} +#endif +#endif + +/******************************************************************************/ +#if !defined(WITH_NOHTTP) || !defined(WITH_LEANER) +#ifndef PALM_1 +static const char* +soap_decode(char *buf, size_t len, const char *val, const char *sep) +{ const char *s; + char *t = buf; + for (s = val; *s; s++) + if (*s != ' ' && *s != '\t' && !strchr(sep, *s)) + break; + if (*s == '"') + { s++; + while (*s && *s != '"' && --len) + *t++ = *s++; + } + else + { while (*s && !soap_blank(*s) && !strchr(sep, *s) && --len) + { if (*s == '%') + { *t++ = ((s[1] >= 'A' ? (s[1] & 0x7) + 9 : s[1] - '0') << 4) + + (s[2] >= 'A' ? (s[2] & 0x7) + 9 : s[2] - '0'); + s += 3; + } + else + *t++ = *s++; + } + } + *t = '\0'; + while (*s && !strchr(sep, *s)) + s++; + return s; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_envelope_begin_out(struct soap *soap) +{ +#ifndef WITH_LEANER + size_t n = 0; + if ((soap->mode & SOAP_ENC_MIME) && soap->mime.boundary && soap->mime.start && strlen(soap->mime.boundary) + strlen(soap->mime.start) < sizeof(soap->tmpbuf) - 80 ) + { const char *s; + if ((soap->mode & SOAP_ENC_DIME) && !(soap->mode & SOAP_ENC_MTOM)) + s = "application/dime"; + else if (soap->version == 2) + { if (soap->mode & SOAP_ENC_MTOM) + s = "application/xop+xml; charset=utf-8; type=\"application/soap+xml\""; + else + s = "application/soap+xml; charset=utf-8"; + } + else if (soap->mode & SOAP_ENC_MTOM) + s = "application/xop+xml; text/xml; charset=utf-8"; + else + s = "text/xml; charset=utf-8"; + sprintf(soap->tmpbuf, "--%s\r\nContent-Type: %s\r\nContent-Transfer-Encoding: binary\r\nContent-ID: %s\r\n\r\n", soap->mime.boundary, s, soap->mime.start); + n = strlen(soap->tmpbuf); + if (soap_send_raw(soap, soap->tmpbuf, n)) + return soap->error; + } + if (soap->mode & SOAP_IO_LENGTH) + soap->dime.size = soap->count; /* DIME in MIME correction */ + if (!(soap->mode & SOAP_IO_LENGTH) && (soap->mode & SOAP_ENC_DIME)) + { if (soap_putdimehdr(soap)) + return soap->error; + } +#endif + soap->part = SOAP_IN_ENVELOPE; + return soap_element_begin_out(soap, "SOAP-ENV:Envelope", 0, NULL); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_envelope_end_out(struct soap *soap) +{ if (soap_element_end_out(soap, "SOAP-ENV:Envelope")) + return soap->error; +#ifndef WITH_LEANER + if ((soap->mode & SOAP_IO_LENGTH) && (soap->mode & SOAP_ENC_DIME) && !(soap->mode & SOAP_ENC_MTOM)) + { soap->dime.size = soap->count - soap->dime.size; /* DIME in MIME correction */ + sprintf(soap->id, soap->dime_id_format, 0); + soap->dime.id = soap->id; + if (soap->local_namespaces) + { if (soap->local_namespaces[0].out) + soap->dime.type = (char*)soap->local_namespaces[0].out; + else + soap->dime.type = (char*)soap->local_namespaces[0].ns; + } + soap->dime.options = NULL; + soap->dime.flags = SOAP_DIME_MB | SOAP_DIME_ABSURI; + if (!soap->dime.first) + soap->dime.flags |= SOAP_DIME_ME; + soap->count += 12 + ((strlen(soap->dime.id)+3)&(~3)) + (soap->dime.type ? ((strlen(soap->dime.type)+3)&(~3)) : 0); + } + if ((soap->mode & SOAP_ENC_DIME) && !(soap->mode & SOAP_ENC_MTOM)) + return soap_send_raw(soap, SOAP_STR_PADDING, -(long)soap->dime.size&3); +#endif + soap->part = SOAP_END_ENVELOPE; + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +static char* +soap_get_http_body(struct soap *soap) +{ +#ifndef WITH_LEAN + register size_t l = 0, n = 0; + register char *s; + /* get HTML body of HTTP error content */ + if (!(soap->mode & SOAP_ENC_ZLIB) && (soap->mode & SOAP_IO) != SOAP_IO_CHUNK) + { n = soap->length; + if (!n) + return NULL; + } +#ifdef WITH_FAST + soap->labidx = 0; /* use look-aside buffer */ +#else + if (soap_new_block(soap) == NULL) + return NULL; +#endif + for (;;) + { +#ifdef WITH_FAST + register size_t i, k; + if (soap_append_lab(soap, NULL, 0)) /* allocate more space in look-aside buffer if necessary */ + return NULL; + s = soap->labbuf + soap->labidx; /* space to populate */ + k = soap->lablen - soap->labidx; /* number of bytes available */ + soap->labidx = soap->lablen; /* claim this space */ +#else + register size_t i, k = SOAP_BLKLEN; + if (!(s = (char*)soap_push_block(soap, NULL, k))) + return NULL; +#endif + for (i = 0; i < k; i++) + { register soap_wchar c = soap_getchar(soap); + if ((int)c == EOF) + goto end; + *s++ = (char)(c & 0xFF); + l++; + if (n > 0 && l >= n) + goto end; + } + } +end: + *s = '\0'; +#ifdef WITH_FAST + s = soap_strdup(soap, soap->labbuf); +#else + soap_size_block(soap, NULL, i+1); + s = soap_save_block(soap, NULL, 0); +#endif + return s; +#else + return NULL; +#endif +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_envelope_begin_in(struct soap *soap) +{ register struct Namespace *p; + soap->part = SOAP_IN_ENVELOPE; + if (soap_element_begin_in(soap, "SOAP-ENV:Envelope", 0, NULL)) + { if (soap->error == SOAP_TAG_MISMATCH + && !soap_element_begin_in(soap, "Envelope", 0, NULL)) + soap->error = SOAP_VERSIONMISMATCH; + else if (soap->status) + soap->error = soap->status; + return soap->error; + } + p = soap->local_namespaces; + if (p) + { const char *ns = p[0].out; + if (!ns) + ns = p[0].ns; + if (!strcmp(ns, soap_env1)) + { soap->version = 1; /* make sure we use SOAP 1.1 */ + if (p[1].out) + SOAP_FREE(soap, p[1].out); + if ((p[1].out = (char*)SOAP_MALLOC(soap, sizeof(soap_enc1)))) + strcpy(p[1].out, soap_enc1); + } + else if (!strcmp(ns, soap_env2)) + { soap->version = 2; /* make sure we use SOAP 1.2 */ + if (p[1].out) + SOAP_FREE(soap, p[1].out); + if ((p[1].out = (char*)SOAP_MALLOC(soap, sizeof(soap_enc2)))) + strcpy(p[1].out, soap_enc2); + } + } + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_envelope_end_in(struct soap *soap) +{ soap->part = SOAP_END_ENVELOPE; + return soap_element_end_in(soap, "SOAP-ENV:Envelope"); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_body_begin_out(struct soap *soap) +{ soap->part = SOAP_IN_BODY; + if (soap->version == 1) + soap->encoding = 1; +#ifndef WITH_LEAN + if ((soap->mode & SOAP_XML_SEC) && soap_set_attr(soap, "wsu:Id", "Body")) + return soap->error; +#endif + if (soap_element(soap, "SOAP-ENV:Body", 0, NULL)) + return soap->error; + return soap_element_start_end_out(soap, NULL); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_body_end_out(struct soap *soap) +{ if (soap_element_end_out(soap, "SOAP-ENV:Body")) + return soap->error; + soap->part = SOAP_END_BODY; + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_body_begin_in(struct soap *soap) +{ soap->part = SOAP_IN_BODY; + if (soap_element_begin_in(soap, "SOAP-ENV:Body", 0, NULL)) + return soap->error; + if (!soap->body) + soap->part = SOAP_NO_BODY; + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_body_end_in(struct soap *soap) +{ if (soap->part == SOAP_NO_BODY) + return SOAP_OK; + soap->part = SOAP_END_BODY; + return soap_element_end_in(soap, "SOAP-ENV:Body"); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_recv_header(struct soap *soap) +{ if (soap_getheader(soap) && soap->error == SOAP_TAG_MISMATCH) + soap->error = SOAP_OK; + else if (soap->error == SOAP_OK && soap->fheader) + soap->error = soap->fheader(soap); + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_set_endpoint(struct soap *soap, const char *endpoint) +{ register const char *s; + register size_t i, n; + soap->endpoint[0] = '\0'; + soap->host[0] = '\0'; + soap->path[0] = '/'; + soap->path[1] = '\0'; + soap->port = 80; + if (!endpoint || !*endpoint) + return; +#ifdef WITH_OPENSSL + if (!soap_tag_cmp(endpoint, "https:*")) + soap->port = 443; +#endif + strncpy(soap->endpoint, endpoint, sizeof(soap->endpoint) - 1); + soap->endpoint[sizeof(soap->endpoint) - 1] = '\0'; + s = strchr(endpoint, ':'); + if (s && s[1] == '/' && s[2] == '/') + s += 3; + else + s = endpoint; + n = strlen(s); + if (n >= sizeof(soap->host)) + n = sizeof(soap->host) - 1; +#ifdef WITH_IPV6 + if (s[0] == '[') + { s++; + for (i = 0; i < n; i++) + { if (s[i] == ']') + { s++; + --n; + break; + } + soap->host[i] = s[i]; + } + } + else + { for (i = 0; i < n; i++) + { soap->host[i] = s[i]; + if (s[i] == '/' || s[i] == ':') + break; + } + } +#else + for (i = 0; i < n; i++) + { soap->host[i] = s[i]; + if (s[i] == '/' || s[i] == ':') + break; + } +#endif + soap->host[i] = '\0'; + if (s[i] == ':') + { soap->port = (int)atol(s + i + 1); + for (i++; i < n; i++) + if (s[i] == '/') + break; + } + if (i < n && s[i]) + { strncpy(soap->path, s + i, sizeof(soap->path)); + soap->path[sizeof(soap->path) - 1] = '\0'; + } +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_connect(struct soap *soap, const char *endpoint, const char *action) +{ return soap_connect_command(soap, SOAP_POST, endpoint, action); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_connect_command(struct soap *soap, int http_command, const char *endpoints, const char *action) +{ char *endpoint; + const char *s; + if (endpoints && (s = strchr(endpoints, ' '))) + { endpoint = (char*)SOAP_MALLOC(soap, strlen(endpoints) + 1); + for (;;) + { strncpy(endpoint, endpoints, s - endpoints); + endpoint[s - endpoints] = '\0'; + if (soap_try_connect_command(soap, http_command, endpoint, action) != SOAP_TCP_ERROR) + break; + if (!*s) + break; + soap->error = SOAP_OK; + while (*s == ' ') + s++; + endpoints = s; + s = strchr(endpoints, ' '); + if (!s) + s = endpoints + strlen(endpoints); + } + SOAP_FREE(soap, endpoint); + } + else + soap_try_connect_command(soap, http_command, endpoints, action); + return soap->error; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +static int +soap_try_connect_command(struct soap *soap, int http_command, const char *endpoint, const char *action) +{ char host[sizeof(soap->host)]; + int port; + size_t count; + soap->error = SOAP_OK; + strcpy(host, soap->host); /* save previous host name: if != then reconnect */ + port = soap->port; /* save previous port to compare */ + soap->status = http_command; + soap_set_endpoint(soap, endpoint); +#ifndef WITH_LEANER + if (soap->fconnect) + { if ((soap->error = soap->fconnect(soap, endpoint, soap->host, soap->port))) + return soap->error; + } + else +#endif + if (soap->fopen && *soap->host) + { if (!soap->keep_alive || !soap_valid_socket(soap->socket) || strcmp(soap->host, host) || soap->port != port || !soap->fpoll || soap->fpoll(soap)) + { soap->keep_alive = 0; /* to force close */ + soap->omode &= ~SOAP_IO_UDP; /* to force close */ + soap_closesock(soap); + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Connect/reconnect to host='%s' path='%s' port=%d\n", soap->host, soap->path, soap->port)); +#ifndef WITH_LEAN + if (!strncmp(endpoint, "soap.udp:", 9)) + soap->omode |= SOAP_IO_UDP; +#endif + soap->socket = soap->fopen(soap, endpoint, soap->host, soap->port); + if (soap->error) + return soap->error; + soap->keep_alive = ((soap->omode & SOAP_IO_KEEPALIVE) != 0); + } + } + count = soap_count_attachments(soap); + if (soap_begin_send(soap)) + return soap->error; + if (http_command != SOAP_POST) + { soap->mode &= ~SOAP_IO; + soap->mode |= SOAP_IO_BUFFER; + } +#ifndef WITH_NOHTTP + soap->action = soap_strdup(soap, action); + if ((soap->mode & SOAP_IO) != SOAP_IO_STORE && !(soap->mode & SOAP_ENC_XML) && endpoint) + { unsigned int k = soap->mode; + soap->mode &= ~(SOAP_IO | SOAP_ENC_ZLIB); + if ((k & SOAP_IO) != SOAP_IO_FLUSH) + soap->mode |= SOAP_IO_BUFFER; + if ((soap->error = soap->fpost(soap, endpoint, soap->host, soap->port, soap->path, action, count))) + return soap->error; +#ifndef WITH_LEANER + if ((k & SOAP_IO) == SOAP_IO_CHUNK) + { if (soap_flush(soap)) + return soap->error; + } +#endif + soap->mode = k; + } + if (http_command != SOAP_POST) + return soap_end_send(soap); +#endif + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +char* +SOAP_FMAC2 +soap_s2base64(struct soap *soap, const unsigned char *s, char *t, int n) +{ register int i; + register unsigned long m; + register char *p; + if (!t) + t = (char*)soap_malloc(soap, (n + 2) / 3 * 4 + 1); + if (!t) + return NULL; + p = t; + t[0] = '\0'; + if (!s) + return p; + for (; n > 2; n -= 3, s += 3) + { m = s[0]; + m = (m << 8) | s[1]; + m = (m << 8) | s[2]; + for (i = 4; i > 0; m >>= 6) + t[--i] = soap_base64o[m & 0x3F]; + t += 4; + } + t[0] = '\0'; + if (n > 0) + { m = 0; + for (i = 0; i < n; i++) + m = (m << 8) | *s++; + for (; i < 3; i++) + m <<= 8; + for (i++; i > 0; m >>= 6) + t[--i] = soap_base64o[m & 0x3F]; + for (i = 3; i > n; i--) + t[i] = '='; + t[4] = '\0'; + } + return p; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_base642s(struct soap *soap, const char *s, char *t, size_t l, int *n) +{ register int i, j, c; + register unsigned long m; + register const char *p; + if (!s || !*s) + { if (n) + *n = 0; + if (soap->error) + return NULL; + return SOAP_NON_NULL; + } + if (!t) + { l = (strlen(s) + 3) / 4 * 3; + t = (char*)soap_malloc(soap, l); + } + if (!t) + return NULL; + p = t; + if (n) + *n = 0; + for (;;) + { for (i = 0; i < SOAP_BLKLEN; i++) + { m = 0; + j = 0; + while (j < 4) + { c = *s++; + if (c == '=' || !c) + { i *= 3; + switch (j) + { case 2: + *t++ = (char)((m >> 4) & 0xFF); + i++; + break; + case 3: + *t++ = (char)((m >> 10) & 0xFF); + *t++ = (char)((m >> 2) & 0xFF); + i += 2; + } + if (n) + *n += i; + return p; + } + c -= '+'; + if (c >= 0 && c <= 79) + { int b = soap_base64i[c]; + if (b >= 64) + { soap->error = SOAP_TYPE; + return NULL; + } + m = (m << 6) + b; + j++; + } + else if (!soap_blank(c + '+')) + { soap->error = SOAP_TYPE; + return NULL; + } + } + *t++ = (char)((m >> 16) & 0xFF); + *t++ = (char)((m >> 8) & 0xFF); + *t++ = (char)(m & 0xFF); + if (l < 3) + { if (n) + *n += i; + return p; + } + l -= 3; + } + if (n) + *n += 3 * SOAP_BLKLEN; + } +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +char* +SOAP_FMAC2 +soap_s2hex(struct soap *soap, const unsigned char *s, char *t, int n) +{ register char *p; + if (!t) + t = (char*)soap_malloc(soap, 2 * n + 1); + if (!t) + return NULL; + p = t; + t[0] = '\0'; + if (s) + { for (; n > 0; n--) + { register int m = *s++; + *t++ = (char)((m >> 4) + (m > 159 ? 'a' - 10 : '0')); + m &= 0x0F; + *t++ = (char)(m + (m > 9 ? 'a' - 10 : '0')); + } + } + *t++ = '\0'; + return p; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +SOAP_FMAC1 +const char* +SOAP_FMAC2 +soap_hex2s(struct soap *soap, const char *s, char *t, size_t l, int *n) +{ register const char *p; + if (!s || !*s) + { if (n) + *n = 0; + if (soap->error) + return NULL; + return SOAP_NON_NULL; + } + if (!t) + { l = strlen(s) / 2; + t = (char*)soap_malloc(soap, l); + } + if (!t) + return NULL; + p = t; + while (l) + { register int d1, d2; + d1 = *s++; + if (!d1) + break; + d2 = *s++; + if (!d2) + break; + *t++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0'); + l--; + } + if (n) + *n = (int)(t - p); + return p; +} +#endif + +/******************************************************************************/ +#ifndef WITH_NOHTTP +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_puthttphdr(struct soap *soap, int status, size_t count) +{ if (soap->status != SOAP_GET) + { register const char *s = "text/xml; charset=utf-8"; + register int err = SOAP_OK; +#ifndef WITH_LEANER + register const char *r = NULL; +#endif + if (status == SOAP_FILE && soap->http_content) + s = soap->http_content; + else if (status == SOAP_HTML) + s = "text/html; charset=utf-8"; + else if (count || ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK)) + { if (soap->version == 2) + s = "application/soap+xml; charset=utf-8"; + } +#ifndef WITH_LEANER + if (soap->mode & (SOAP_ENC_DIME | SOAP_ENC_MTOM)) + { if (soap->mode & SOAP_ENC_MTOM) + { r = s; + s = "application/xop+xml; charset=utf-8"; + } + else + s = "application/dime"; + } + if ((soap->mode & SOAP_ENC_MIME) && soap->mime.boundary && strlen(soap->mime.boundary) + strlen(soap->mime.start ? soap->mime.start : SOAP_STR_EOS) < sizeof(soap->tmpbuf) - 80) + { register const char *t = strchr(s, ';'); + sprintf(soap->tmpbuf, "multipart/related; boundary=\"%s\"; type=\"", soap->mime.boundary); + if (t) + { strncat(soap->tmpbuf, s, t - s); + soap->tmpbuf[sizeof(soap->tmpbuf)-1] = '\0'; + } + else + strcat(soap->tmpbuf, s); + if (soap->mime.start) + { strcat(soap->tmpbuf, "\"; start=\""); + strcat(soap->tmpbuf, soap->mime.start); + } + strcat(soap->tmpbuf, "\""); + if (r) + { strcat(soap->tmpbuf, "; start-info=\""); + strcat(soap->tmpbuf, r); + strcat(soap->tmpbuf, "\""); + } + s = soap->tmpbuf; + } +#endif + if (s && (err = soap->fposthdr(soap, "Content-Type", s))) + return err; +#ifdef WITH_ZLIB + if ((soap->omode & SOAP_ENC_ZLIB)) + { +#ifdef WITH_GZIP + err = soap->fposthdr(soap, "Content-Encoding", soap->zlib_out == SOAP_ZLIB_DEFLATE ? "deflate" : "gzip"); +#else + err = soap->fposthdr(soap, "Content-Encoding", "deflate"); +#endif + if (err) + return err; + } +#endif +#ifndef WITH_LEANER + if ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK) + err = soap->fposthdr(soap, "Transfer-Encoding", "chunked"); + else +#endif + if (s) + { sprintf(soap->tmpbuf, "%lu", (unsigned long)count); + err = soap->fposthdr(soap, "Content-Length", soap->tmpbuf); + } + if (err) + return err; + } + return soap->fposthdr(soap, "Connection", soap->keep_alive ? "keep-alive" : "close"); +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOHTTP +#ifndef PALM_1 +static int +http_get(struct soap *soap) +{ return SOAP_GET_METHOD; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOHTTP +#ifndef PALM_1 +static int +http_put(struct soap *soap) +{ return SOAP_PUT_METHOD; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOHTTP +#ifndef PALM_1 +static int +http_del(struct soap *soap) +{ return SOAP_DEL_METHOD; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOHTTP +#ifndef PALM_1 +static int +http_head(struct soap *soap) +{ return SOAP_HEAD_METHOD; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOHTTP +#ifndef PALM_1 +static int +http_post(struct soap *soap, const char *endpoint, const char *host, int port, const char *path, const char *action, size_t count) +{ register const char *s; + register int err; + if (soap->status == SOAP_GET) + s = "GET"; + else + s = "POST"; +#ifdef PALM + if (!endpoint || (soap_tag_cmp(endpoint, "http:*") && soap_tag_cmp(endpoint, "https:*") && strncmp(endpoint, "httpg:", 6)) && strncmp(endpoint, "_beam:", 6) && strncmp(endpoint, "_local:", 7) && strncmp(endpoint, "_btobex:", 8)) +#else + if (!endpoint || (soap_tag_cmp(endpoint, "http:*") && soap_tag_cmp(endpoint, "https:*") && strncmp(endpoint, "httpg:", 6))) +#endif + return SOAP_OK; + if (strlen(endpoint) + strlen(soap->http_version) > sizeof(soap->tmpbuf) - 80) + return soap->error = SOAP_EOM; + if (soap->proxy_host && soap_tag_cmp(endpoint, "https:*")) + sprintf(soap->tmpbuf, "%s %s HTTP/%s", s, endpoint, soap->http_version); + else + sprintf(soap->tmpbuf, "%s /%s HTTP/%s", s, (*path == '/' ? path + 1 : path), soap->http_version); + if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL))) + return err; +#ifdef WITH_OPENSSL + if ((soap->ssl && soap->port != 443) || (!soap->ssl && soap->port != 80)) + sprintf(soap->tmpbuf, "%s:%d", host, port); + else + strcpy(soap->tmpbuf, host); +#else + if (port != 80) + sprintf(soap->tmpbuf, "%s:%d", host, port); + else + strcpy(soap->tmpbuf, host); +#endif + if ((err = soap->fposthdr(soap, "Host", soap->tmpbuf)) + || (err = soap->fposthdr(soap, "User-Agent", "INTENO CWMP")) + || (err = soap_puthttphdr(soap, SOAP_OK, count))) + return err; +#ifdef WITH_ZLIB +#ifdef WITH_GZIP + if ((err = soap->fposthdr(soap, "Accept-Encoding", "gzip, deflate"))) +#else + if ((err = soap->fposthdr(soap, "Accept-Encoding", "deflate"))) +#endif + return err; +#endif +#ifndef WITH_LEAN + if (soap->userid && soap->passwd && strlen(soap->userid) + strlen(soap->passwd) < 761) + { sprintf(soap->tmpbuf + 262, "%s:%s", soap->userid, soap->passwd); + strcpy(soap->tmpbuf, "Basic "); + soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262)); + if ((err = soap->fposthdr(soap, "Authorization", soap->tmpbuf))) + return err; + } + if (soap->proxy_userid && soap->proxy_passwd && strlen(soap->proxy_userid) + strlen(soap->proxy_passwd) < 761) + { sprintf(soap->tmpbuf + 262, "%s:%s", soap->proxy_userid, soap->proxy_passwd); + strcpy(soap->tmpbuf, "Basic "); + soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262)); + if ((err = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf))) + return err; + } +#endif +#ifdef WITH_COOKIES +#ifdef WITH_OPENSSL + if (soap_putcookies(soap, host, path, soap->ssl != NULL)) + return soap->error; +#else + if (soap_putcookies(soap, host, path, 0)) + return soap->error; +#endif +#endif + if (soap->status != SOAP_GET && (soap->version == 1 || (action && *action))) + { sprintf(soap->tmpbuf, "\"%s\"", action && strlen(action) < sizeof(soap->tmpbuf) - 3 ? action : SOAP_STR_EOS); + if ((err = soap->fposthdr(soap, "SOAPAction", soap->tmpbuf))) + return err; + } + return soap->fposthdr(soap, NULL, NULL); +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOHTTP +#ifndef PALM_1 +static int +http_send_header(struct soap *soap, const char *s) +{ register const char *t; + do + { t = strchr(s, '\n'); /* disallow \n in HTTP headers */ + if (!t) + t = s + strlen(s); + if (soap_send_raw(soap, s, t - s)) + return soap->error; + s = t + 1; + } while (*t); + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOHTTP +#ifndef PALM_1 +static int +http_post_header(struct soap *soap, const char *key, const char *val) +{ if (key) + { if (http_send_header(soap, key)) + return soap->error; + if (val && (soap_send_raw(soap, ": ", 2) || http_send_header(soap, val))) + return soap->error; + } + return soap_send_raw(soap, "\r\n", 2); +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOHTTP +#ifndef PALM_1 +static int +http_response(struct soap *soap, int status, size_t count) +{ register int err; +#ifdef WMW_RPM_IO + if (soap->rpmreqid) + httpOutputEnable(soap->rpmreqid); +#endif + if (strlen(soap->http_version) > 4) + return soap->error = SOAP_EOM; + if (!status || status == SOAP_HTML || status == SOAP_FILE) + { const char *s; +#if 0 /* KMD Modification*/ + if (count || ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK)) +#endif + s = "200 OK"; +#if 0 /* KMD Modification*/ + else + s = "202 ACCEPTED"; +#endif + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Status = %s\n", s)); +#ifdef WMW_RPM_IO + if (soap->rpmreqid || soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* RPM behaves as if standalone */ +#else + if (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* standalone application */ +#endif + { sprintf(soap->tmpbuf, "HTTP/%s %s", soap->http_version, s); + if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL))) + return err; + } + else if ((err = soap->fposthdr(soap, "Status", s))) + return err; + } + else if (status >= 200 && status < 600) + { sprintf(soap->tmpbuf, "HTTP/%s %d %s", soap->http_version, status, http_error(soap, status)); + if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL))) + return err; +#ifndef WITH_LEAN + if (status == 401) + { sprintf(soap->tmpbuf, "Basic realm=\"%s\"", (soap->authrealm && strlen(soap->authrealm) < sizeof(soap->tmpbuf) - 14) ? soap->authrealm : "gSOAP Web Service"); + if ((err = soap->fposthdr(soap, "WWW-Authenticate", soap->tmpbuf))) + return err; + } + else if ((status >= 301 && status <= 303) || status == 307) + { if ((err = soap->fposthdr(soap, "Location", soap->endpoint))) + return err; + } +#endif + } + else + { const char *s = *soap_faultcode(soap); + if (soap->version == 2 && (!s || !strcmp(s, "SOAP-ENV:Sender"))) + s = "400 Bad Request"; + else + s = "500 Internal Server Error"; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error %s (status=%d)\n", s, status)); +#ifdef WMW_RPM_IO + if (soap->rpmreqid || soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* RPM behaves as if standalone */ +#else + if (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* standalone application */ +#endif + { sprintf(soap->tmpbuf, "HTTP/%s %s", soap->http_version, s); + if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL))) + return err; + } + else if ((err = soap->fposthdr(soap, "Status", s))) /* CGI */ + return err; + } + if ((err = soap->fposthdr(soap, "Server", "INTENO CWMP")) + || (err = soap_puthttphdr(soap, status, count))) + return err; +#ifdef WITH_COOKIES + if (soap_putsetcookies(soap)) + return soap->error; +#endif + return soap->fposthdr(soap, NULL, NULL); +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_response(struct soap *soap, int status) +{ register size_t count; + if (!(soap->omode & (SOAP_ENC_XML | SOAP_IO_STORE /* this tests for chunking too */)) + && (status == SOAP_HTML || status == SOAP_FILE)) + soap->omode = (soap->omode & ~SOAP_IO) | SOAP_IO_STORE; + soap->status = status; + count = soap_count_attachments(soap); + if (soap_begin_send(soap)) + return soap->error; +#ifndef WITH_NOHTTP + if ((soap->mode & SOAP_IO) != SOAP_IO_STORE && !(soap->mode & SOAP_ENC_XML)) + { register int n = soap->mode; + soap->mode &= ~(SOAP_IO | SOAP_ENC_ZLIB); + if ((n & SOAP_IO) != SOAP_IO_FLUSH) + soap->mode |= SOAP_IO_BUFFER; + if ((soap->error = soap->fresponse(soap, status, count))) + return soap->error; +#ifndef WITH_LEANER + if ((n & SOAP_IO) == SOAP_IO_CHUNK) + { if (soap_flush(soap)) + return soap->error; + } +#endif + soap->mode = n; + } +#endif + return SOAP_OK; +} +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +static const char* +soap_set_validation_fault(struct soap *soap, const char *s, const char *t) +{ if (*soap->tag) + sprintf(soap->msgbuf, "Validation constraint violation: %s%s in element <%s>", s, t?t:SOAP_STR_EOS, soap->tag); + else + sprintf(soap->msgbuf, "Validation constraint violation: %s%s", s, t?t:SOAP_STR_EOS); + return soap->msgbuf; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_set_fault(struct soap *soap) +{ const char **c = soap_faultcode(soap); + const char **s = soap_faultstring(soap); + if (soap->fseterror) + soap->fseterror(soap, c, s); + if (!*c) + { if (soap->version == 2) + *c = "SOAP-ENV:Sender"; + else + *c = "SOAP-ENV:Client"; + } + if (*s) + return; + switch (soap->error) + { +#ifndef WITH_LEAN + case SOAP_CLI_FAULT: + *s = "Client fault"; + break; + case SOAP_SVR_FAULT: + *s = "Server fault"; + break; + case SOAP_TAG_MISMATCH: + *s = soap_set_validation_fault(soap, "tag name or namespace mismatch", NULL); + break; + case SOAP_TYPE: + *s = soap_set_validation_fault(soap, "data type mismatch ", soap->type); + break; + case SOAP_SYNTAX_ERROR: + *s = "Well-formedness violation"; + break; + case SOAP_NO_TAG: + *s = "No XML element tag"; + break; + case SOAP_MUSTUNDERSTAND: + *c = "SOAP-ENV:MustUnderstand"; + sprintf(soap->msgbuf, "The data in element '%s' must be understood but cannot be handled", soap->tag); + *s = soap->msgbuf; + break; + case SOAP_VERSIONMISMATCH: + *c = "SOAP-ENV:VersionMismatch"; + *s = "Invalid SOAP message or SOAP version mismatch"; + break; + case SOAP_DATAENCODINGUNKNOWN: + *c = "SOAP-ENV:DataEncodingUnknown"; + *s = "Unsupported SOAP data encoding"; + break; + case SOAP_NAMESPACE: + *s = soap_set_validation_fault(soap, "namespace error", NULL); + break; + case SOAP_USER_ERROR: + *s = "User error"; + break; + case SOAP_FATAL_ERROR: + *s = "Fatal error"; + break; + case SOAP_NO_METHOD: + sprintf(soap->msgbuf, "Method '%s' not implemented: method name or namespace not recognized", soap->tag); + *s = soap->msgbuf; + break; + case SOAP_NO_DATA: + *s = "Data required for operation"; + break; + case SOAP_GET_METHOD: + *s = "HTTP GET method not implemented"; + break; + case SOAP_PUT_METHOD: + *s = "HTTP PUT method not implemented"; + break; + case SOAP_HEAD_METHOD: + *s = "HTTP HEAD method not implemented"; + break; + case SOAP_HTTP_METHOD: + *s = "HTTP method not implemented"; + break; + case SOAP_EOM: + *s = "Out of memory"; + break; + case SOAP_MOE: + *s = "Memory overflow or memory corruption error"; + break; + case SOAP_HDR: + *s = "Header line too long"; + break; + case SOAP_IOB: + *s = "Array index out of bounds"; + break; + case SOAP_NULL: + *s = soap_set_validation_fault(soap, "nil not allowed", NULL); + break; + case SOAP_DUPLICATE_ID: + *s = soap_set_validation_fault(soap, "multiple definitions of id ", soap->id); + if (soap->version == 2) + *soap_faultsubcode(soap) = "SOAP-ENC:DuplicateID"; + break; + case SOAP_MISSING_ID: + *s = soap_set_validation_fault(soap, "missing id for ref ", soap->id); + if (soap->version == 2) + *soap_faultsubcode(soap) = "SOAP-ENC:MissingID"; + break; + case SOAP_HREF: + *s = soap_set_validation_fault(soap, "incompatible object type ref/id pair ", soap->id); + break; + case SOAP_FAULT: + break; +#ifndef WITH_NOIO + case SOAP_UDP_ERROR: + *s = "Message too large for UDP packet"; + break; + case SOAP_TCP_ERROR: + *s = tcp_error(soap); + break; +#endif + case SOAP_HTTP_ERROR: + *s = "An HTTP processing error occurred"; + break; + case SOAP_SSL_ERROR: +#ifdef WITH_OPENSSL + *s = "SSL error"; +#else + *s = "OpenSSL not installed: recompile with -DWITH_OPENSSL"; +#endif + break; + case SOAP_PLUGIN_ERROR: + *s = "Plugin registry error"; + break; + case SOAP_DIME_ERROR: + *s = "DIME format error"; + break; + case SOAP_DIME_HREF: + *s = "DIME href to missing attachment"; + break; + case SOAP_DIME_MISMATCH: + *s = "DIME version/transmission error"; + break; + case SOAP_DIME_END: + *s = "End of DIME error"; + break; + case SOAP_MIME_ERROR: + *s = "MIME format error"; + break; + case SOAP_MIME_HREF: + *s = "MIME href to missing attachment"; + break; + case SOAP_MIME_END: + *s = "End of MIME error"; + break; + case SOAP_ZLIB_ERROR: +#ifdef WITH_ZLIB + sprintf(soap->msgbuf, "Zlib/gzip error: '%s'", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS); + *s = soap->msgbuf; +#else + *s = "Zlib/gzip not installed for (de)compression: recompile with -DWITH_GZIP"; +#endif + break; + case SOAP_REQUIRED: + *s = soap_set_validation_fault(soap, "missing required attribute", NULL); + break; + case SOAP_PROHIBITED: + *s = soap_set_validation_fault(soap, "prohibited attribute present", NULL); + break; + case SOAP_OCCURS: + *s = soap_set_validation_fault(soap, "occurrence violation", NULL); + break; + case SOAP_LENGTH: + *s = soap_set_validation_fault(soap, "content range or length violation", NULL); + break; + case SOAP_FD_EXCEEDED: + *s = "Maximum number of open connections was reached"; + break; + case SOAP_STOP: + *s = "Stopped: no response sent"; + break; +#endif + case SOAP_EOF: +#ifndef WITH_NOIO + strcpy(soap->msgbuf, soap_strerror(soap)); +#ifndef WITH_LEAN + if (strlen(soap->msgbuf) + 25 < sizeof(soap->msgbuf)) + { memmove(soap->msgbuf + 25, soap->msgbuf, strlen(soap->msgbuf) + 1); + memcpy(soap->msgbuf, "End of file or no input: ", 25); + } +#endif + *s = soap->msgbuf; + break; +#else + *s = "End of file or no input"; + break; +#endif + default: +#ifndef WITH_NOHTTP +#ifndef WITH_LEAN + if (soap->error > 200 && soap->error < 600) + { sprintf(soap->msgbuf, "HTTP Error: %d %s", soap->error, http_error(soap, soap->error)); + *s = soap->msgbuf; + } + else +#endif +#endif + { sprintf(soap->msgbuf, "Error %d", soap->error); + *s = soap->msgbuf; + } + } +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_send_fault(struct soap *soap) +{ register int status = soap->error; + if (status == SOAP_STOP) + return status; + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Sending back fault struct for error code %d\n", soap->error)); + soap->keep_alive = 0; /* to terminate connection */ + soap_set_fault(soap); + if (status != SOAP_EOF || (!soap->recv_timeout && !soap->send_timeout)) + { int r = 1; +#ifndef WITH_NOIO + if (soap->fpoll && soap->fpoll(soap)) + r = 0; +#ifndef WITH_LEAN + else if (soap_valid_socket(soap->socket)) + { struct timeval timeout; + fd_set rfd, sfd; + timeout.tv_sec = 0; + timeout.tv_usec = 0; + FD_ZERO(&rfd); + FD_ZERO(&sfd); + FD_SET(soap->socket, &rfd); + FD_SET(soap->socket, &sfd); + r = select((int)soap->socket + 1, &rfd, &sfd, NULL, &timeout); + if (r > 0) + { if (!FD_ISSET(soap->socket, &sfd) + || (FD_ISSET(soap->socket, &rfd) + && recv(soap->socket, soap->tmpbuf, 1, MSG_PEEK) < 0)) + r = 0; + } + } +#endif +#endif + if (r > 0) + { soap->error = SOAP_OK; + soap_serializeheader(soap); + soap_serializefault(soap); + soap_begin_count(soap); + if (soap->mode & SOAP_IO_LENGTH) + { soap_envelope_begin_out(soap); + soap_putheader(soap); + soap_body_begin_out(soap); + soap_putfault(soap); + soap_body_end_out(soap); + soap_envelope_end_out(soap); + } + soap_end_count(soap); + if (soap_response(soap, status) + || soap_envelope_begin_out(soap) + || soap_putheader(soap) + || soap_body_begin_out(soap) + || soap_putfault(soap) + || soap_body_end_out(soap) + || soap_envelope_end_out(soap)) + return soap_closesock(soap); + soap_end_send(soap); + } + } + soap->error = status; + return soap_closesock(soap); +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_recv_fault(struct soap *soap) +{ register int status = soap->error; + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Receiving SOAP Fault\n")); + soap->error = SOAP_OK; + if (soap_getfault(soap)) + { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Error: soap_get_soapfault() failed. Is this a SOAP message at all?\n")); + *soap_faultcode(soap) = (soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client"); + soap->error = status; + soap_set_fault(soap); + } + else + { register const char *s = *soap_faultcode(soap); + if (!soap_match_tag(soap, s, "SOAP-ENV:Server") || !soap_match_tag(soap, s, "SOAP-ENV:Receiver")) + status = SOAP_SVR_FAULT; + else if (!soap_match_tag(soap, s, "SOAP-ENV:Client") || !soap_match_tag(soap, s, "SOAP-ENV:Sender")) + status = SOAP_CLI_FAULT; + else if (!soap_match_tag(soap, s, "SOAP-ENV:MustUnderstand")) + status = SOAP_MUSTUNDERSTAND; + else if (!soap_match_tag(soap, s, "SOAP-ENV:VersionMismatch")) + status = SOAP_VERSIONMISMATCH; + else + { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Fault code %s\n", s)); + status = SOAP_FAULT; + } + if (soap_body_end_in(soap) + || soap_envelope_end_in(soap) + || soap_end_recv(soap)) + return soap_closesock(soap); + soap->error = status; + } + return soap_closesock(soap); +} +#endif + +/******************************************************************************/ +#ifndef WITH_NOHTTP +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_send_empty_response(struct soap *soap, int httpstatuscode) +{ register soap_mode m = soap->omode; + soap->count = 0; + if ((m & SOAP_IO) == SOAP_IO_CHUNK) + soap->omode = (m & ~SOAP_IO) | SOAP_IO_BUFFER; + if (soap_response(soap, httpstatuscode) || soap_end_send(soap)) + { soap->omode = m; + return soap_closesock(soap); + } + soap->omode = m; + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOHTTP +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_recv_empty_response(struct soap *soap) +{ if (!soap_begin_recv(soap)) + soap_end_recv(soap); + else if (soap->error == SOAP_NO_DATA || soap->error == 202) + soap->error = SOAP_OK; + return soap_closesock(soap); +} +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_NOIO +#ifndef PALM_1 +static const char* +soap_strerror(struct soap *soap) +{ register int err = soap->errnum; + if (err) + { +#ifndef WIN32 + return strerror(err); +#else +#ifndef UNDER_CE + DWORD len; + *soap->msgbuf = '\0'; + len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)soap->msgbuf, (DWORD)sizeof(soap->msgbuf), NULL); +#else + DWORD i, len; + *soap->msgbuf = '\0'; + len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, (LPTSTR)soap->msgbuf, (DWORD)(sizeof(soap->msgbuf)/sizeof(TCHAR)), NULL); + for (i = 0; i <= len; i++) + { if (((TCHAR*)soap->msgbuf)[i] < 0x80) + soap->msgbuf[i] = (char)((TCHAR*)soap->msgbuf)[i]; + else + soap->msgbuf[i] = '?'; + } +#endif + return soap->msgbuf; +#endif + } +#ifndef WITH_LEAN + if (soap->recv_timeout > 0) + { if (soap->send_timeout > 0) + sprintf(soap->msgbuf, "Operation interrupted or timed out after %ds send or %ds receive delay", soap->send_timeout, soap->recv_timeout); + else + sprintf(soap->msgbuf, "Operation interrupted or timed out after %ds receive delay", soap->recv_timeout); + return soap->msgbuf; + } +#endif + return "Operation interrupted or timed out"; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_2 +static int +soap_set_error(struct soap *soap, const char *faultcode, const char *faultsubcodeQName, const char *faultstring, const char *faultdetailXML, int soaperror) +{ *soap_faultcode(soap) = faultcode; + if (faultsubcodeQName) + *soap_faultsubcode(soap) = faultsubcodeQName; + *soap_faultstring(soap) = faultstring; + if (faultdetailXML && *faultdetailXML) + { register const char **s = soap_faultdetail(soap); + if (s) + *s = faultdetailXML; + } + return soap->error = soaperror; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_set_sender_error(struct soap *soap, const char *faultstring, const char *faultdetailXML, int soaperror) +{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", NULL, faultstring, faultdetailXML, soaperror); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_set_receiver_error(struct soap *soap, const char *faultstring, const char *faultdetailXML, int soaperror) +{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", NULL, faultstring, faultdetailXML, soaperror); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +static int +soap_copy_fault(struct soap *soap, const char *faultcode, const char *faultsubcodeQName, const char *faultstring, const char *faultdetailXML) +{ char *r = NULL, *s = NULL, *t = NULL; + if (faultsubcodeQName) + r = soap_strdup(soap, faultsubcodeQName); + if (faultstring) + s = soap_strdup(soap, faultstring); + if (faultdetailXML) + t = soap_strdup(soap, faultdetailXML); + return soap_set_error(soap, faultcode, r, s, t, SOAP_FAULT); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_sender_fault(struct soap *soap, const char *faultstring, const char *faultdetailXML) +{ return soap_sender_fault_subcode(soap, NULL, faultstring, faultdetailXML); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_sender_fault_subcode(struct soap *soap, const char *faultsubcodeQName, const char *faultstring, const char *faultdetailXML) +{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", faultsubcodeQName, faultstring, faultdetailXML); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_receiver_fault(struct soap *soap, const char *faultstring, const char *faultdetailXML) +{ return soap_receiver_fault_subcode(soap, NULL, faultstring, faultdetailXML); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_receiver_fault_subcode(struct soap *soap, const char *faultsubcodeQName, const char *faultstring, const char *faultdetailXML) +{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", faultsubcodeQName, faultstring, faultdetailXML); +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +#ifndef WITH_NOSTDLIB +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_print_fault(struct soap *soap, FILE *fd) +{ if (soap_check_state(soap)) + fprintf(fd, "Error: soap struct state not initialized\n"); + else if (soap->error) + { const char *c, *v = NULL, *s, **d; + d = soap_faultcode(soap); + if (!*d) + soap_set_fault(soap); + c = *d; + if (soap->version == 2) + v = *soap_faultsubcode(soap); + s = *soap_faultstring(soap); + d = soap_faultdetail(soap); + fprintf(fd, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c, v ? v : "no subcode", s ? s : "[no reason]", d && *d ? *d : "[no detail]"); + } +} +#endif +#endif + +/******************************************************************************/ +#ifdef __cplusplus +#ifndef WITH_LEAN +#ifndef WITH_NOSTDLIB +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_stream_fault(struct soap *soap, std::ostream& os) +{ if (soap_check_state(soap)) + os << "Error: soap struct state not initialized\n"; + else if (soap->error) + { const char *c, *v = NULL, *s, **d; + d = soap_faultcode(soap); + if (!*d) + soap_set_fault(soap); + c = *d; + if (soap->version == 2) + v = *soap_faultsubcode(soap); + s = *soap_faultstring(soap); + d = soap_faultdetail(soap); + os << (soap->version ? "SOAP 1." : "Error ") + << (soap->version ? (int)soap->version : soap->error) + << " fault: " << c + << "[" << (v ? v : "no subcode") << "]" + << std::endl + << "\"" << (s ? s : "[no reason]") << "\"" + << std::endl + << "Detail: " << (d && *d ? *d : "[no detail]") + << std::endl; + } +} +#endif +#endif +#endif + +/******************************************************************************/ +#ifndef WITH_LEAN +#ifndef WITH_NOSTDLIB +SOAP_FMAC1 +char* +SOAP_FMAC2 +soap_sprint_fault(struct soap *soap, char *buf, size_t len) +{ if (soap_check_state(soap)) + strncpy(buf, "Error: soap struct not initialized", len); + else if (soap->error) + { const char *c, *v = NULL, *s, **d; + d = soap_faultcode(soap); + if (!*d) + soap_set_fault(soap); + c = *d; + if (soap->version == 2) + v = *soap_faultsubcode(soap); + s = *soap_faultstring(soap); + d = soap_faultdetail(soap); +#ifdef WIN32 + _snprintf +#else + snprintf +#endif + (buf, len, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c, v ? v : "no subcode", s ? s : "[no reason]", d && *d ? *d : "[no detail]"); + } + return buf; +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +#ifndef WITH_NOSTDLIB +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_print_fault_location(struct soap *soap, FILE *fd) +{ +#ifndef WITH_LEAN + int i, j, c1, c2; + if (soap->error && soap->bufidx <= soap->buflen && soap->buflen > 0 && soap->buflen <= SOAP_BUFLEN) + { i = (int)soap->bufidx - 1; + if (i <= 0) + i = 0; + c1 = soap->buf[i]; + soap->buf[i] = '\0'; + if ((int)soap->buflen >= i + 1024) + j = i + 1023; + else + j = (int)soap->buflen - 1; + c2 = soap->buf[j]; + soap->buf[j] = '\0'; + fprintf(fd, "%s%c\n\n", soap->buf, c1); + if (soap->bufidx < soap->buflen) + fprintf(fd, "%s\n", soap->buf + soap->bufidx); + soap->buf[i] = c1; + soap->buf[j] = c2; + } +#endif +} +#endif +#endif + +/******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_register_plugin_arg(struct soap *soap, int (*fcreate)(struct soap*, struct soap_plugin*, void*), void *arg) +{ register struct soap_plugin *p; + register int r; + if (!(p = (struct soap_plugin*)SOAP_MALLOC(soap, sizeof(struct soap_plugin)))) + return soap->error = SOAP_EOM; + p->id = NULL; + p->data = NULL; + p->fcopy = NULL; + p->fdelete = NULL; + r = fcreate(soap, p, arg); + if (!r && p->fdelete) + { p->next = soap->plugins; + soap->plugins = p; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Registered '%s' plugin\n", p->id)); + return SOAP_OK; + } + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not register plugin '%s': plugin returned error %d (or fdelete callback not set)\n", p->id?p->id:"?", r)); + SOAP_FREE(soap, p); + return r; +} +#endif + +/******************************************************************************/ +#ifndef PALM_1 +static void * +fplugin(struct soap *soap, const char *id) +{ register struct soap_plugin *p; + for (p = soap->plugins; p; p = p->next) + if (p->id == id || !strcmp(p->id, id)) + return p->data; + return NULL; +} +#endif + +/******************************************************************************/ +#ifndef PALM_2 +SOAP_FMAC1 +void * +SOAP_FMAC2 +soap_lookup_plugin(struct soap *soap, const char *id) +{ return soap->fplugin(soap, id); +} +#endif + +/******************************************************************************/ +#ifdef __cplusplus +} +#endif + +/******************************************************************************\ + * + * C++ soap struct methods + * +\******************************************************************************/ + +#ifdef __cplusplus +soap::soap() +{ soap_init(this); +} +#endif + +/******************************************************************************/ +#ifdef __cplusplus +soap::soap(soap_mode m) +{ soap_init1(this, m); +} +#endif + +/******************************************************************************/ +#ifdef __cplusplus +soap::soap(soap_mode im, soap_mode om) +{ soap_init2(this, im, om); +} +#endif + +/******************************************************************************/ +#ifdef __cplusplus +soap::soap(struct soap& soap) +{ soap_copy_context(this, &soap); +} +#endif + +/******************************************************************************/ +#ifdef __cplusplus +soap::~soap() +{ soap_destroy(this); + soap_end(this); + soap_done(this); +} +#endif + +/******************************************************************************/ diff --git a/src/wsdl/cwmp-1-1.wsdl b/src/wsdl/cwmp-1-1.wsdl new file mode 100644 index 0000000..947b41e --- /dev/null +++ b/src/wsdl/cwmp-1-1.wsdl @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Service definition of function GetRPCMethods + + + + + + + + + + + + + + + + + + + + + + Metanoia cwmp service definition + + + + + + diff --git a/src/wsdl/cwmp-1-1.xsd b/src/wsdl/cwmp-1-1.xsd new file mode 100644 index 0000000..fdfe6f5 --- /dev/null +++ b/src/wsdl/cwmp-1-1.xsd @@ -0,0 +1,1664 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CPE fault codes + + + + Method not supported + + + + + Request denied (no reason specified) + + + + + Internal error + + + + + Invalid arguments + + + + + Resources exceeded + + + + + Invalid parameter name + + + + + Invalid parameter type + + + + + Invalid parameter value + + + + + Attempt to set a non-writable parameter + + + + + Notification request rejected + + + + + Download failure + + + + + Upload failure + + + + + File transfer server authentication failure + + + + + Unsupported protocol for file transfer + + + + + Download failure: unable to join multicast group + + + + + Download failure: unable to contact file server + + + + + Download failure: unable to access file + + + + + Download failure: unable to complete download + + + + + Download failure: file corrupted + + + + + Download failure: file authentication failure + + + + + + + + Future expansion fault codes + + + + + + + + + CPE Vendor fault codes + + + + + + + + + ACS fault codes + + + + Method not supported + + + + + Request denied (no reason specified) + + + + + Internal error + + + + + Invalid arguments + + + + + Resources exceeded + + + + + Retry request + + + + + + + + Future expansion fault codes + + + + + + + + + ACS Vendor fault codes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fault information for TransferComplete and AutonomousTransferComplete + + + + + Transfer fault codes + + + + + + + + No fault + + + + + Request denied (no reason specified) + + + + + Internal error + + + + + Download failure + + + + + Upload failure + + + + + File transfer server authentication failure + + + + + Download failure: unable to join multicast group + + + + + Download failure: unable to contact file server + + + + + Download failure: unable to access file + + + + + Download failure: unable to complete download + + + + + Download failure: file corrupted + + + + + Download failure: file authentication failure + + + + + + + + Future expansion fault codes + + + + + + + + + CPE Vendor fault codes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Notification off. The CPE need not inform the ACS of a change to the specified parameter(s) + + + + + Passive notification. Whenever the specified parameter value changes, the CPE MUST include the new value in the ParameterList in the Inform message that is sent the next time a session is established to the ACS + + + + + Active notification. Whenever the specified parameter value changes, the CPE MUST initiate a session to the ACS, and include the new value in the ParameterList in the associated Inform message + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 - Not yet started + + + + + 2 - In progress + + + + + 3 - Completed + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 - Not yet started + + + + + 2 - In progress + + + + + 3 - Completed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Option is disabled and not setup + + + + + Option is enabled and not setup + + + + + Option is disabled and setup + + + + + Option is enabled and setup + + + + + + + + + + + 0 - Disabled + + + + + 1 - Enabled with expiration + + + + + 2 - Enabled without expiration + + + + + + + + + + + + + Non-transferable + + + + + Transferable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GeRPCMethods message - Annex A.3.1.1 + + + + + + + + GeRPCMethodsResponse message - Annex A.3.1.1 + + + + + + + + + + + + + + SetParameterValues message - Annex A.3.2.1 + + + + + + + + + + + + + SetParameterValuesResponse message - Annex A.3.2.1 + + + + + + + + + All Parameter changes have been validated and applied + + + + + All Parameter changes have been validated and committed, but some or all are not yet applied (for example, if a reboot is required before the new values are applied) + + + + + + + + + + + + + GetParameterValues message - Annex A.3.2.2 + + + + + + + + + + + + GetParameterValuesResponse message - Annex A.3.2.2 + + + + + + + + + + + + GetParameterNames message - Annex A.3.2.3 + + + + + + + + + + + + + + + + + + + GetParameterNamesResponse message - Annex A.3.2.3 + + + + + + + + + + + + SetParameterAttributes message - Annex A.3.2.4 + + + + + + + + + + + + SetParameterAttributesResponse message - Annex A.3.2.4 + + + + + + + + GetParameterAttributes message - Annex A.3.2.5 + + + + + + + + + + + + GetParameterAttributesResponse message - Annex A.3.2.5 + + + + + + + + + + + + AddObject message - Annex A.3.2.6 + + + + + + + + + + + + + AddObjectResponse message - Annex A.3.2.6 + + + + + + + + + + + + + + + + The object has been created + + + + + The object creation has been validated and committed, but not yet applied + + + + + + + + + + + + + DeleteObject message - Annex A.3.2.7 + + + + + + + + + + + + + DeleteObjectResponse message - Annex A.3.2.7 + + + + + + + + + The object has been deleted + + + + + The object deletion has been validated and committed, but not yet applied + + + + + + + + + + + + + Download message - Annex A.3.2.8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DownloadResponse message - Annex A.3.2.8 + + + + + + + + + Download has completed and been applied + + + + + Download has not yet been completed and applied + + + + + + + + + + + + + + + Reboot message - Annex A.3.2.9 + + + + + + + + + + + + RebootResponse message - Annex A.3.2.9 + + + + + + + + + + GetQueuedTransfers message - Annex A.4.1.1 + + + + + + + + GetQueuedTransfersResponse message - Annex A.4.1.1 + + + + + + + + + + + + ScheduleInform message - Annex A.4.1.2 + + + + + + + + + + + + + ScheduleInformResponse message - Annex A.4.1.2 + + + + + + + + SetVouchers message - Annex A.4.1.3 + + + + + + + + + + + + SetVouchersResponse message - Annex A.4.1.3 + + + + + + + + GetOptions message - Annex A.4.1.4 + + + + + + + + + + + + + + + + + + GetOptionsResponse message - Annex A.4.1.4 + + + + + + + + + + + + Upload message - Annex A.4.1.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UploadResponse message - Annex A.4.1.5 + + + + + + + + + Upload has been completed + + + + + Upload has not yet completed + + + + + + + + + + + + + + + FactoryReset message - Annex A.4.1.6 + + + + + + + + FactoryResetResponse message - Annex A.4.1.6 + + + + + + + + GetAllQueuedTransfers message - Annex A.4.1.7 + + + + + + + + GetAllQueuedTransfersResponse message - Annex A.4.1.7 + + + + + + + + + + + + + + Inform message - Annex A.3.3.1 + + + + + + + + + + + + + + + + + InformResponse message - Annex A.3.3.1 + + + + + + + + + + + + TransferComplete message - Annex A.3.3.2 + + + + + + + + + + + + + + + TransferCompleteResponse message - Annex A.3.3.2 + + + + + + + + AutonomousTransferComplete message - Annex A.3.3.3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AutonomousTransferCompleteResponse message - Annex A.3.3.3 + + + + + + + + + + Kicked message - Annex A.4.2.1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KickedResponse message - Annex A.4.2.1 + + + + + + + + + + + + + + + + + + RequestDownload message - Annex A.4.2.2 + + + + + + + + + + + + + + + + + + + + + + + RequestDownloadResponse message - Annex A.4.2.2 + + + + +